mlsanityData to 14 Oct 2026

Grammar-Based Code Representation: Is It a Worthy Pursuit for LLMs?

arXiv 2503.05507 ↗First posted 7 Mar 2025cs.PL cs.AIcited by 5

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

  1. 2017Attention Is All You Needcited by 60,361
  2. 2024The Llama 3 Herd of Modelscited by 14,715
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2021Program Synthesis with Large Language Modelscited by 3,637
  5. 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,224
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  7. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  8. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  9. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  10. 2024MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategiescited by 723
  11. 2024Yi: Open Foundation Models by 01.AIcited by 719
  12. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
13 more
  1. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
  2. 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
  3. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 256
  4. 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 247
  5. 2024CodeGemma: Open Code Models Based on Gemmacited by 150
  6. 2017Abstract Syntax Networks for Code Generation and Semantic Parsingcited by 92
  7. 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
  8. 2024SelfCodeAlign: Self-Alignment for Code Generationcited by 62
  9. 2019TreeGen: A Tree-Based Transformer Architecture for Code Generationcited by 58
  10. 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 41
  11. 2018A Grammar-Based Structural CNN Decoder for Code Generationcited by 29
  12. 2024Do Advanced Language Models Eliminate the Need for Prompt Engineering in Software Engineering?cited by 19
  13. 2024Condor: A Code Discriminator Integrating General Semantics with Code Detailscited by 1

Built on by

Cited by year (2026 to 14 Oct)

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

5 papers.