mlsanityData to 14 Oct 2026

Improving Deep Assertion Generation via Fine-Tuning Retrieval-Augmented Pre-trained Language Models

arXiv 2502.16071 ↗First posted 22 Feb 2025cs.SEcited by 4

On the map: Retrieval-augmented generation → RAG for code

Abstract (arXiv)

Unit testing validates the correctness of the units of the software system under test and serves as the cornerstone in improving software quality and reliability. To reduce manual efforts in writing unit tests, some techniques have been proposed to automatically generate test assertions, with recent integration-based approaches considered state-of-the-art. Despite being promising, such integration-based approaches face several limitations, including reliance on lexical matching for assertion retrieval and a limited training corpus for assertion generation. This paper proposes a novel retrieval-augmented deep assertion generation approach, namely RetriGen, based on a hybrid retriever and a pre-trained language model (PLM)-based generator. Given a focal-test, RetriGen first builds a hybrid assertion retriever to search for the most relevant Test-Assert Pair from external codebases. The retrieval process considers lexical similarity and semantical similarity via a token-based and an embedding-based retriever, respectively. RetriGen then treats assertion generation as a sequence-to-sequence task and designs a PLM-based assertion generator to predict a correct assertion. We conduct extensive experiments to evaluate RetriGen against six state-of-the-art approaches across two large-scale datasets and two metrics. The results demonstrate that RetriGen achieves 57.66% accuracy and 73.24% CodeBLEU, outperforming all baselines with average improvements of 50.66% and 14.14%, respectively.

Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 40 of its 68 references that are in the map. First posted on arXiv 22 Feb 2025.

Builds on

40 of 68 references.

Closest ancestors · 2

Same direction, newest first

  1. 2023RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair12 Sep
  2. 2021Retrieval Augmented Code Generation and Summarization26 Aug

Other references · 38

  1. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  2. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
  3. 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,824
  4. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  5. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  6. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  7. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  8. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
  9. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
  10. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 194
  11. 2023Software Testing with Large Language Models: Survey, Landscape, and Visioncited by 166
  12. 2022Automating Code Review Activities by Large-Scale Pre-trainingcited by 98
26 more
  1. 2023ChatUniTest: A Framework for LLM-Based Test Generationcited by 96
  2. 2024DebugBench: Evaluating Debugging Capability of Large Language Modelscited by 76
  3. 2021Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Taskscited by 70
  4. 2024Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLMcited by 64
  5. 2022Using Pre-Trained Models to Boost Code Review Automationcited by 63
  6. 2023A Survey on Large Language Models for Software Engineeringcited by 59
  7. 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
  8. 2023A Survey of Learning-based Automated Program Repaircited by 55
  9. 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
  10. 2020A Survey on Deep Learning for Software Engineeringcited by 38
  11. 2024HITS: High-coverage LLM-based Unit Test Generation via Method Slicingcited by 38
  12. 2020A Systematic Literature Review on the Use of Deep Learning in Software Engineering Researchcited by 35
  13. 2024On the Evaluation of Large Language Models in Unit Test Generationcited by 34
  14. 2023ChatGPT vs SBST: A Comparative Assessment of Unit Test Suite Generationcited by 32
  15. 2020Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformerscited by 30
  16. 2023A Critical Review of Large Language Model on Software Engineering: An Example from ChatGPT and Automated Program Repaircited by 29
  17. 2023GAMMA: Revisiting Template-based Automated Program Repair via Mask Predictioncited by 23
  18. 2024TestART: Improving LLM-based Unit Testing via Co-evolution of Automated Generation and Repair Iterationcited by 20
  19. 2022Using Transfer Learning for Code-Related Taskscited by 18
  20. 2023EditSum: A Retrieve-and-Edit Framework for Source Code Summarizationcited by 18
  21. 2022CIRCLE: Continual Repair across Programming Languagescited by 17
  22. 2023Pre-trained Model-based Automated Software Vulnerability Repair: How Far are We?cited by 16
  23. 2024GitBug-Java: A Reproducible Benchmark of Recent Java Bugscited by 14
  24. 2023Neural-Based Test Oracle Generation: A Large-scale Evaluation and Lessons Learnedcited by 9
  25. 2023Towards More Realistic Evaluation for Neural Test Oracle Generationcited by 8
  26. 2023Revisiting and Improving Retrieval-Augmented Deep Assertion Generationcited by 5

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 1; 2026: 3.

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Improving Retrieval-Augmented Deep Assertion Generation via Joint Training
  2. 2024LLM-based Unit Test Generation via Property Retrieval
  3. 2024Chat-like Asserts Prediction with the Support of Large Language Model ↗
  4. 2025Learning to Generate Unit Tests for Automated Debugging
  5. 2026Enhancing Automated Unit Test Generation for NLP Libraries Using Large Language Models ↗
  6. 2026Enhancing Large Language Models with Retrieval Augmented Generation for Software Testing and Inspection Automation
  7. 2025AugmenTest: Enhancing Tests with LLM-Driven Oracles
  8. 2025Test Case Generation from Bug Reports via Large Language Models: A Cognitive Layered Evaluation Framework