ASSERTIFY: Utilizing Large Language Models to Generate Assertions for Production Code
Not on the map. Why?
Abstract (arXiv)
Production assertions are statements embedded in the code to help developers validate their assumptions about the code. They assist developers in debugging, provide valuable documentation, and enhance code comprehension. Current research in this area primarily focuses on assertion generation for unit tests using techniques, such as static analysis and deep learning. While these techniques have shown promise, they fall short when it comes to generating production assertions, which serve a different purpose. This preprint addresses the gap by introducing Assertify, an automated end-to-end tool that leverages Large Language Models (LLMs) and prompt engineering with few-shot learning to generate production assertions. By creating context-rich prompts, the tool emulates the approach developers take when creating production assertions for their code. To evaluate our approach, we compiled a dataset of 2,810 methods by scraping 22 mature Java repositories from GitHub. Our experiments demonstrate the effectiveness of few-shot learning by producing assertions with an average ROUGE-L score of 0.526, indicating reasonably high structural similarity with the assertions written by developers. This research demonstrates the potential of LLMs in automating the generation of production assertions that resemble the original assertions.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 13 of its 40 references that are in the map. First posted on arXiv 25 Nov 2024.
Builds on
13 of 40 references.
References · 13
- 2023A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPTcited by 619
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2021Prompt Programming for Large Language Models: Beyond the Few-Shot Paradigmcited by 606
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 194
- 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
- 2022Large Language Models are Few-shot Testers: Exploring LLM-based General Bug Reproductioncited by 111
- 2023SatLM: Satisfiability-Aided Language Models Using Declarative Promptingcited by 102
- 2022Experiences from Using Code Explanations Generated by Large Language Models in a Web Software Development E-Bookcited by 84
- 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
- 2023Information Retrieval: Recent Advances and Beyondcited by 49
- 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
- 2018Word2Vec applied to Recommendation: Hyperparameters Mattercited by 20
1 more
- 2023Exploring Large Language Models for Code Explanationcited by 6
Built on by
Citing papers per year: 2025: 3; 2026: 1.
4 papers.
- 2026Same Game, Different Story: A Minimal Conservative Strategic Robustness Benchmark for Large Language Model Agentscited by 1
- 2025LLM-Driven Adaptive 6G-Ready Wireless Body Area Networks: Survey and Frameworkcited by 0
- 2025Assertion-Aware Test Code Summarization with Large Language Modelscited by 0
- 2025Vision-Language Models for Infrared Industrial Sensing in Additive Manufacturing Scene Descriptioncited by 0
- 2026Same Game, Different Story: A Minimal Conservative Strategic Robustness Benchmark for Large Language Model Agents22 Jul 2026
- 2025Vision-Language Models for Infrared Industrial Sensing in Additive Manufacturing Scene Description11 Dec 2025
- 2025Assertion-Aware Test Code Summarization with Large Language Models9 Nov 2025
- 2025LLM-Driven Adaptive 6G-Ready Wireless Body Area Networks: Survey and Framework12 Aug 2025