mlsanityData to 7 Oct 2026

CAT-LM: Training Language Models on Aligned Code And Tests

arXiv 2310.01602 ↗First posted 2 Oct 2023cs.SE cs.AIcited by 28

Not on the map. Why?

Abstract (arXiv)

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 available. We also drastically increase the maximum sequence length of inputs to 8,192 tokens, 4x more than typical code generation models, to ensure that the code context is available to the model when generating test code. We analyze its usefulness for realistic applications, showing that sampling with filtering (e.g., by compilability, coverage) allows it to efficiently produce tests that achieve coverage similar to ones written by developers while resembling their writing style. By utilizing the code context, CAT-LM generates more valid tests than even much larger language models trained with more data (CodeGen 16B and StarCoder) and substantially outperforms a recent test-specific model (TeCo) at test completion. Overall, our work highlights the importance of incorporating software-specific insights when training language models for code and paves the way to more powerful automated test generation.

Key facts. Cited by 28 papers in the map (data through 7 Oct 2026). Builds on 23 of its 52 references that are in the map. First posted on arXiv 2 Oct 2023.

Builds on

23 of 52 references.

References · 23

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2023GPT-4 Technical Reportcited by 18,132
  3. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  6. 2022Training Compute-Optimal Large Language Modelscited by 2,927
  7. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  8. 2023StarCoder: may the source be with you!cited by 790
  9. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  10. 2018Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidatescited by 632
  11. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
  12. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
11 more
  1. 2022A Systematic Evaluation of Large Language Models of Codecited by 360
  2. 2022Efficient Training of Language Models to Fill in the Middlecited by 248
  3. 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 123
  4. 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
  5. 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 76
  6. 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
  7. 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
  8. 2016A Survey of Symbolic Execution Techniquescited by 36
  9. 2023Learning Deep Semantics for Test Completioncited by 31
  10. 2020ReAssert: Deep Learning for Assert Generationcited by 6
  11. 2021Developer-Centric Test Amplification The Interplay Between Automatic Generation and Human Explorationcited by 2

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 9; 2025: 8; 2026: 11.

28 papers.

Sort:

By area:

  1. 2024Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Testscited by 11
  2. 2025Compute Optimal Scaling of Skills: Knowledge vs Reasoningcited by 11
  3. 2024RepoMasterEval: Evaluating Code Completion via Real-World Repositoriescited by 10
  4. 2024B4: Towards Optimal Assessment of Plausible Code Solutions with Plausible Testscited by 9
  5. 2025LLM Test Generation via Iterative Hybrid Program Analysiscited by 9
  6. 2025Hallucination to Consensus: Multi-Agent LLMs for End-to-End JUnit Test Generationcited by 8
  7. 2026Test vs Mutant: Adversarial LLM Agents for Robust Unit Test Generationcited by 6
  8. 2024UniTSyn: A Large-Scale Dataset Capable of Enhancing the Prowess of Large Language Models for Program Testingcited by 5
  9. 2024Evaluating the Ability of Large Language Models to Generate Verifiable Specifications in VeriFastcited by 5
  10. 2024exLong: Generating Exceptional Behavior Tests with Large Language Modelscited by 4
  11. 2025LlamaRestTest: Effective REST API Testing with Small Language Modelscited by 4
  12. 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesiscited by 4
16 more
  1. 2024FuzzAug: Data Augmentation by Coverage-guided Fuzzing for Neural Test Generationcited by 3
  2. 2024Toward Automated Validation of Language Model Synthesized Test Cases using Semantic Entropycited by 3
  3. 2024Generative transformations and patterns in LLM-native approaches for software verification and falsificationcited by 2
  4. 2025Large Language Models for Software Testing: A Research Roadmapcited by 2
  5. 2025OptiHive: Ensemble Selection for LLM-Based Optimization via Statistical Modelingcited by 1
  6. 2025Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language Modelscited by 1
  7. 2026SPELL: Synthesis of Programmatic Edits using LLMscited by 1
  8. 2026Fuzzing with Agents? Generators Are All You Needcited by 0
  9. 2026Improving MPI Error Detection and Repair with Large Language Models and Bug Referencescited by 0
  10. 2026Program Structure-aware Language Models: Targeted Software Testing beyond Textual Semanticscited by 0
  11. 2026Inferring Code Correctness from Specificationcited by 0
  12. 2026Rethinking Code Performance Benchmarks for LLMscited by 0
  13. 2026Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate with Their Effectiveness? (Replicability Study)cited by 0
  14. 2026Evaluating and Mitigating the Misguidance Effect of Buggy Code in LLM-Generated Unit Testscited by 0
  15. 2026Grounding AI Agents in Contracts: An Empirical Evaluation of Spec-Driven Test Generationcited by 0
  16. 2026Retrofitting Code Using LLMs to Support Exceptional Behaviorcited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024Large Language Models as Test Case Generators: Performance Evaluation and Enhancement
  2. 2025CodeChemist: Test-Time Scaling for Low-Resource Code Generation via Functional Knowledge Transfer
  3. 2026Test-Oriented Programming: rethinking coding for the GenAI era
  4. 2026Enhancing Automated Unit Test Generation for NLP Libraries Using Large Language Models ↗
  5. 2026LLM vs. Human Unit Tests: Fault Detection on Real Python Bugs
  6. 2026CodeEval: A pedagogical approach for targeted evaluation of code-trained Large Language Models
  7. 2024Low-Cost Language Models: Survey and Performance Evaluation on Python Code Generation
  8. 2025TestWeaver: Execution-aware, Feedback-driven Regression Testing Generation with Large Language Models ↗