Grammar-Based Code Representation: Is It a Worthy Pursuit for LLMs?
Not on the map. Why?
Abstract (arXiv)
Grammar serves as a cornerstone in programming languages and software engineering, providing frameworks to define the syntactic space and program structure. Existing research demonstrates the effectiveness of grammar-based code representations in small-scale models, showing their ability to reduce syntax errors and enhance performance. However, as language models scale to the billion level or beyond, syntax-level errors become rare, making it unclear whether grammar information still provides performance benefits. To explore this, we develop a series of billion-scale GrammarCoder models, incorporating grammar rules in the code generation process. Experiments on HumanEval (+) and MBPP (+) demonstrate a notable improvement in code generation accuracy. Further analysis shows that grammar-based representations enhance LLMs' ability to discern subtle code differences, reducing semantic errors caused by minor variations. These findings suggest that grammar-based code representations remain valuable even in billion-scale models, not only by maintaining syntax correctness but also by improving semantic differentiation.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 25 of its 47 references that are in the map. First posted on arXiv 7 Mar 2025.
Builds on
25 of 47 references.
References · 25
- 2017Attention Is All You Needcited by 60,361
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,224
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2024MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategiescited by 723
- 2024Yi: Open Foundation Models by 01.AIcited by 719
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
13 more
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
- 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 256
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 247
- 2024CodeGemma: Open Code Models Based on Gemmacited by 150
- 2017Abstract Syntax Networks for Code Generation and Semantic Parsingcited by 92
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2024SelfCodeAlign: Self-Alignment for Code Generationcited by 62
- 2019TreeGen: A Tree-Based Transformer Architecture for Code Generationcited by 58
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 41
- 2018A Grammar-Based Structural CNN Decoder for Code Generationcited by 29
- 2024Do Advanced Language Models Eliminate the Need for Prompt Engineering in Software Engineering?cited by 19
- 2024Condor: A Code Discriminator Integrating General Semantics with Code Detailscited by 1
Built on by
Citing papers per year: 2025: 3; 2026: 2.
5 papers.
- 2026Evaluating and Improving Automated Repository-Level Rust Issue Resolution with LLM-based Agentscited by 8
- 2025SLMFix: Leveraging Small Language Models for Domain Specific Language Error Fixing with Reinforcement Learningcited by 2
- 2025EvoSyn: Generalizable Evolutionary Data Synthesis for Verifiable Learningcited by 1
- 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesiscited by 0
- 2026LLMs + Security = Troublecited by 0
- 2026Evaluating and Improving Automated Repository-Level Rust Issue Resolution with LLM-based Agents26 Feb 2026
- 2026LLMs + Security = Trouble9 Feb 2026
- 2025SLMFix: Leveraging Small Language Models for Domain Specific Language Error Fixing with Reinforcement Learning24 Nov 2025
- 2025EvoSyn: Generalizable Evolutionary Data Synthesis for Verifiable Learning20 Oct 2025
- 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesis11 Oct 2025