SAGE:Specification-Aware Grammar Extraction for Automated Test Case Generation with LLMs
Not on the map. Why?
Abstract (arXiv)
Grammar-based test case generation has proven effective for competitive programming problems, but generating valid and general grammars from natural language specifications remains a key challenge, especially under limited supervision. Context-Free Grammars with Counters (CCFGs) have recently been introduced as a formalism to represent such specifications with logical constraints by storing and reusing counter values during derivation. In this work, we explore the use of open-source large language models (LLMs) to induce CCFGs from specifications using a small number of labeled examples and verifiable reward-guided reinforcement learning. Our approach first fine-tunes an open-source LLM to perform specification-to-grammar translation, and further applies Group Relative Policy Optimization (GRPO) to enhance grammar validity and generality. We also examine the effectiveness of iterative feedback for open and closed-source LLMs in correcting syntactic and semantic errors in generated grammars. Experimental results show that our approach SAGE achieves stronger generalization and outperforms 17 open and closed-source LLMs in both grammar quality and test effectiveness, improving over the state-of-the-art by 15.92%p in grammar validity and 12.34%p in test effectiveness. We provide our implementation and dataset at the following anonymous repository:https://anonymous.4open.science/r/SAGE-5714
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 32 of its 44 references that are in the map. First posted on arXiv 4 Jun 2025.
Builds on
32 of 44 references.
References · 32
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2017Proximal Policy Optimization Algorithmscited by 15,215
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,330
- 2023Qwen Technical Reportcited by 3,344
- 2023Mistral 7Bcited by 3,164
- 2022Scaling Instruction-Finetuned Language Modelscited by 3,024
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
- 2024Gemma: Open Models Based on Gemini Research and Technologycited by 916
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
20 more
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
- 2022CodeT: Code Generation with Generated Testscited by 384
- 2025Absolute Zero: Reinforced Self-play Reasoning with Zero Datacited by 344
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 200
- 2023ChatUniTest: A Framework for LLM-Based Test Generationcited by 96
- 2025ACECODER: Acing Coder RL via Automated Test-Case Synthesiscited by 93
- 2024Automated Unit Test Improvement using Large Language Models at Metacited by 75
- 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 64
- 2023Effective Test Generation Using Pre-trained Large Language Models and Mutation Testingcited by 51
- 2024TESTEVAL: Benchmarking Large Language Models for Test Case Generationcited by 40
- 2024Mercury: A Code Efficiency Benchmark for Code Large Language Modelscited by 35
- 2023Learning Deep Semantics for Test Completioncited by 31
- 2024What Makes Large Language Models Reason in (Multi-Turn) Code Generation?cited by 29
- 2025EffiBench-X: A Multi-Language Benchmark for Measuring Efficiency of LLM-Generated Codecited by 27
- 2024RePair: Automated Program Repair with Process-based Feedbackcited by 16
- 2024TestBench: Evaluating Class-Level Test Case Generation Capability of Large Language Modelscited by 15
- 2018Superion: Grammar-Aware Greybox Fuzzingcited by 12
- 2024TestSpark: IntelliJ IDEA's Ultimate Test Generation Companioncited by 9
- 2021Predicting Patch Correctness Based on the Similarity of Failing Test Casescited by 4
- 2025LogiCase: Effective Test Case Generation from Logical Description in Competitive Programmingcited by 4
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Enhancing Automated Unit Test Generation for NLP Libraries Using Large Language Models ↗
- 2026CodeContests-O: Powering LLMs via Feedback-Driven Iterative Test Case Generation
- 2026Learning and Enforcing Context-Sensitive Control for LLMs
- 2025Rethinking Verification for LLM Code Generation: From Generation to Testing
- 2025Can LLMs Generate Reliable Test Case Generators? A Study on Competition-Level Programming Problems
- 2026LLMs taking shortcuts in test generation: A study with SAP HANA and LevelDB
- 2025Challenges in Testing Large Language Model Based Software: A Faceted Taxonomy
- 2024Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generation