Improving Retrieval-Augmented Deep Assertion Generation via Joint Training
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Unit testing attempts to validate the correctness of basic units of the software system under test and has a crucial role in software development and testing. Very recent work proposes a retrieve-and-edit approach to generate unit test oracles, i.e., assertions. Despite being promising, it is still far from perfect due to some limitations, such as splitting assertion retrieval and generation into two separate components without benefiting each other. In this paper, we propose AG-RAG, a retrieval-augmented automated assertion generation approach that leverages external codebases and joint training to address various technical limitations of prior work. Inspired by the plastic surgery hypothesis, AG-RAG attempts to combine relevant unit tests and advanced pre-trained language models (PLMs) with retrieval-augmented fine-tuning. AG-RAG builds a dense retriever to search for relevant test-assert pairs (TAPs) with semantic matching and a retrieval-augmented generator to synthesize accurate assertions with the focal-test and retrieved TAPs as input. Besides, AG-RAG leverages a code-aware language model CodeT5 as the cornerstone to facilitate both assertion retrieval and generation tasks. Furthermore, the retriever is optimized in conjunction with the generator as a whole pipeline with a joint training strategy. This unified design fully adapts both components specifically for retrieving more useful TAPs, thereby generating accurate assertions. We extensively evaluate AG-RAG against six state-of-the-art AG approaches on two benchmarks and three metrics. Experimental results show that AG-RAG significantly outperforms previous AG approaches on all benchmarks and metrics, e.g., improving the most recent baseline EditAS by 20.82% and 26.98% in terms of accuracy. AG-RAG also correctly generates 1739 and 2866 unique assertions that all baselines fail to generate, 3.45X and 9.20X more than EditAS.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 47 of its 84 references that are in the map. First posted on arXiv 15 Feb 2025.
Builds on
47 of 84 references.
Closest ancestors · 3
Same direction, newest first
- 2023RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair12 Sep
- 2021Retrieval Augmented Code Generation and Summarization26 Aug
- 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNN9 Jun
Other references · 44
- 2017Attention Is All You Needcited by 59,932
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2023StarCoder: may the source be with you!cited by 790
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
32 more
- 2023Large Language Models for Software Engineering: Survey and Open Problemscited by 178
- 2023Software Testing with Large Language Models: Survey, Landscape, and Visioncited by 163
- 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 142
- 2022Automating Code Review Activities by Large-Scale Pre-trainingcited by 98
- 2024DebugBench: Evaluating Debugging Capability of Large Language Modelscited by 74
- 2021Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Taskscited by 70
- 2022Using Pre-Trained Models to Boost Code Review Automationcited by 63
- 2023A Survey on Large Language Models for Software Engineeringcited by 58
- 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
- 2023A Survey of Learning-based Automated Program Repaircited by 55
- 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
- 2020A Survey on Deep Learning for Software Engineeringcited by 37
- 2024A Systematic Literature Review on Large Language Models for Automated Program Repaircited by 37
- 2024HITS: High-coverage LLM-based Unit Test Generation via Method Slicingcited by 37
- 2021Neural Transfer Learning for Repairing Security Vulnerabilities in C Codecited by 36
- 2020A Systematic Literature Review on the Use of Deep Learning in Software Engineering Researchcited by 35
- 2020Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformerscited by 30
- 2023A Critical Review of Large Language Model on Software Engineering: An Example from ChatGPT and Automated Program Repaircited by 29
- 2023Domain Knowledge Matters: Improving Prompts with Fix Templates for Repairing Python Type Errorscited by 22
- 2023GAMMA: Revisiting Template-based Automated Program Repair via Mask Predictioncited by 22
- 2024TestART: Improving LLM-based Unit Testing via Co-evolution of Automated Generation and Repair Iterationcited by 20
- 2022Using Transfer Learning for Code-Related Taskscited by 18
- 2023EditSum: A Retrieve-and-Edit Framework for Source Code Summarizationcited by 18
- 2022CIRCLE: Continual Repair across Programming Languagescited by 17
- 2023Pre-trained Model-based Automated Software Vulnerability Repair: How Far are We?cited by 15
- 2024TestBench: Evaluating Class-Level Test Case Generation Capability of Large Language Modelscited by 15
- 2024A Large-scale Empirical Study on Fine-tuning Large Language Models for Unit Testingcited by 15
- 2024GitBug-Java: A Reproducible Benchmark of Recent Java Bugscited by 13
- 2023Neural-Based Test Oracle Generation: A Large-scale Evaluation and Lessons Learnedcited by 9
- 2023Towards More Realistic Evaluation for Neural Test Oracle Generationcited by 8
- 2023Revisiting and Improving Retrieval-Augmented Deep Assertion Generationcited by 5
- 2024No Man is an Island: Towards Fully Automatic Programming by Code Search, Code Generation and Program Repaircited by 4
Built on by
Citing papers per year: 2026: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2025Improving Deep Assertion Generation via Fine-Tuning Retrieval-Augmented Pre-trained Language Models
- 2024Retrieval-Augmented Test Generation: How Far Are We?
- 2024LLM-based Unit Test Generation via Property Retrieval
- 2026Enhancing Large Language Models with Retrieval Augmented Generation for Software Testing and Inspection Automation
- 2026Agent-Based Test Assertion Generation via Diverse Perspective Aggregation
- 2025AugmenTest: Enhancing Tests with LLM-Driven Oracles
- 2026RAG-TESTER: Automated End-to-End Testing of Retrieval-Augmented Large Language Models
- 2024Chat-like Asserts Prediction with the Support of Large Language Model ↗