CAT-LM: Training Language Models on Aligned Code And Tests
Nikitha Rao, Kush Jain, Uri Alon, Claire Le Goues, Vincent J., Hellendoorn

TL;DR
CAT-LM is a large language model trained on aligned code and test data, leveraging a novel pretraining approach and extended context window to generate high-quality, developer-like tests that achieve coverage efficiently.
Contribution
The paper introduces CAT-LM, a GPT-style model trained on aligned code and test data with a new pretraining signal and longer context, improving test generation quality and relevance.
Findings
CAT-LM produces tests with coverage similar to human-written tests.
It outperforms larger models like CodeGen 16B and StarCoder in test validity.
Sampling with filtering enhances test quality and applicability.
Abstract
Testing is an integral part of the software development process. Yet, writing tests is time-consuming and therefore often neglected. Classical test generation tools such as EvoSuite generate behavioral test suites by optimizing for coverage, but tend to produce tests that are hard to understand. Language models trained on code can generate code that is highly similar to that written by humans, but current models are trained to generate each file separately, as is standard practice in natural language processing, and thus fail to consider the code-under-test context when producing a test file. In this work, we propose the Aligned Code And Tests Language Model (CAT-LM), a GPT-style language model with 2.7 Billion parameters, trained on a corpus of Python and Java projects. We utilize a novel pretraining signal that explicitly considers the mapping between code and test files when…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Software System Performance and Reliability
