mlsanityData to 7 Oct 2026

SynCode: LLM Generation with Grammar Augmentation

arXiv 2403.01632 ↗First posted 3 Mar 2024cs.LG cs.FL cs.PLcited by 66

Not on the map. Why?

Abstract (arXiv)

LLMs are widely used in complex AI applications. These applications underscore the need for LLM outputs to adhere to a specific format, for their integration with other components in the systems. Typically the format rules e.g., for data serialization formats such as JSON, YAML, or Code in Programming Language are expressed as context-free grammar (CFG). Due to the hallucinations and unreliability of LLMs, instructing LLMs to adhere to specified syntax becomes an increasingly important challenge. We present SynCode, a novel framework for efficient and general syntactical decoding with LLMs, to address this challenge. SynCode ensures soundness and completeness with respect to the CFG of a formal language, effectively retaining valid tokens while filtering out invalid ones. SynCode uses an offline-constructed, efficient lookup table, the DFA mask store, derived from the DFA of the language's grammar for efficient generation. SynCode seamlessly integrates with any language defined by CFG, as evidenced by experiments focusing on generating JSON, Python, and Go outputs. Our experiments evaluating the effectiveness of SynCode for JSON generation demonstrate that SynCode eliminates all syntax errors and significantly outperforms state-of-the-art baselines. Furthermore, our results underscore how SynCode significantly reduces 96.07% of syntax errors in generated Python and Go code, showcasing its substantial impact on enhancing syntactical precision in LLM generation. Our code is available at https://github.com/uiuc-focal-lab/syncode

Key facts. Cited by 66 papers in the map (data through 7 Oct 2026). Builds on 29 of its 51 references that are in the map. First posted on arXiv 3 Mar 2024.

Builds on

29 of 51 references.

References · 29

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  3. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  4. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  5. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  6. 2021Program Synthesis with Large Language Modelscited by 3,509
  7. 2022Fast Inference from Transformers via Speculative Decodingcited by 1,615
  8. 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
  9. 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,116
  10. 2023Accelerating Large Language Model Decoding with Speculative Samplingcited by 975
  11. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  12. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
17 more
  1. 2018Meta-Learning for Semi-Supervised Few-Shot Classificationcited by 456
  2. 2023LeanDojo: Theorem Proving with Retrieval-Augmented Language Modelscited by 414
  3. 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 402
  4. 2023Logic-LM: Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoningcited by 379
  5. 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 286
  6. 2022Autoformalization with Large Language Modelscited by 252
  7. 2022Neural Networks and the Chomsky Hierarchycited by 214
  8. 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 186
  9. 2023LINC: A Neurosymbolic Approach for Logical Reasoning by Combining Language Models with First-Order Logic Proverscited by 161
  10. 2022Multi-lingual Evaluation of Code Generation Modelscited by 158
  11. 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generationcited by 99
  12. 2023Copiloting the Copilots: Fusing Large Language Models with Completion Engines for Automated Program Repaircited by 55
  13. 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
  14. 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languagescited by 47
  15. 2023Guiding Language Models of Code with Global Context using Monitorscited by 20
  16. 2023Pushdown Layers: Encoding Recursive Structure in Transformer Language Modelscited by 18
  17. 2024Constrained Decoding for Fill-in-the-Middle Code Language Models via Efficient Left and Right Quotienting of Context-Sensitive Grammarscited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 5; 2025: 18; 2026: 43.

66 papers.

Sort:

By area:

  1. 2025CRANE: Reasoning with constrained LLM generationcited by 38
  2. 2024CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Rerankingcited by 37
  3. 2025Type-Constrained Code Generation with Language Modelscited by 32
  4. 2025ProofBridge: Auto-Formalization of Natural Language Proofs in Lean via Joint Embeddingscited by 16
  5. 2025CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesiscited by 15
  6. 2025DINGO: Constrained Inference for Diffusion LLMscited by 15
  7. 2025Constrained Decoding of Diffusion LLMs with Context-Free Grammarscited by 13
  8. 2025Pre3: Enabling Deterministic Pushdown Automata for Faster Structured LLM Generationcited by 11
  9. 2025On the Query Complexity of Verifier-Assisted Language Generationcited by 10
  10. 2025Towards Formal Verification of LLM-Generated Code from Natural Language Promptscited by 8
  11. 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposalscited by 8
  12. 2024Is The Watermarking Of LLM-Generated Code Robust?cited by 7
38 more
  1. 2024Automated User Story Generation with Test Case Specification Using Large Language Modelcited by 7
  2. 2026The Hidden Cost of Structured Generation in LLMs: Draft-Conditioned Constrained Decodingcited by 7
  3. 2026Lookahead-then-Verify: Reliable Constrained Decoding for Diffusion LLMs under Context-Free Grammarscited by 6
  4. 2026SEVerA: Verified Synthesis of Self-Evolving Agentscited by 6
  5. 2024Using a Feedback Loop for LLM-based Infrastructure as Code Generationcited by 5
  6. 2025RefineStat: Efficient Exploration for Probabilistic Program Synthesiscited by 5
  7. 2025Multi-Agent Code-Orchestrated Generation for Reliable Infrastructure-as-Codecited by 5
  8. 2026TerraFormer: Automated Infrastructure-as-Code with LLMs Fine-Tuned via Policy-Guided Verifier Feedbackcited by 4
  9. 2026On the Power of (Approximate) Reward Models for Inference-Time Scalingcited by 4
  10. 2025Syntactic Control of Language Models by Posterior Inferencecited by 3
  11. 2025UTF-8 Plumbing: Byte-level Tokenizers Unavoidably Enable LLMs to Generate Ill-formed UTF-8cited by 3
  12. 2026Semantic Layers for Reliable LLM-Powered Data Analytics: A Paired Benchmark of Accuracy and Hallucination Across Three Frontier Modelscited by 3
  13. 2026Constrained Decoding for Diffusion Language Models via Efficient Inference over Finite Automatacited by 3
  14. 2025Opponent Shaping in LLM Agentscited by 2
  15. 2025TokDrift: When LLM Speaks in Subwords but Code Speaks in Grammarcited by 2
  16. 2026Cybersecurity is the True Frontier for Generative AI Success or Failurecited by 2
  17. 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Modelscited by 1
  18. 2026Attention Meets Reachability: Structural Equivalence and Efficiency in Grammar-Constrained LLM Decodingcited by 1
  19. 2026Diagnosing CFG Interpretation in LLMscited by 1
  20. 2026When Correct Isn't Usable: Improving Structured Output Reliability in Small Language Modelscited by 1
  21. 2026TruncProof: A Guardrail for LLM-based JSON Generation under Token-Length Constraintscited by 1
  22. 2026EPIC: Efficient and Parallel Inference under CFG Constraints for Diffusion Language Modelscited by 1
  23. 2026The Alignment Problem in Constrained Code Generationcited by 1
  24. 2024From Words to Workflows: Automating Business Processescited by 0
  25. 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesiscited by 0
  26. 2025Toward Automated and Trustworthy Scientific Analysis and Visualization with LLM-Generated Codecited by 0
  27. 2026Suffix-Constrained Greedy Search Algorithms for Causal Language Modelscited by 0
  28. 2026LTLGuard: Formalizing LTL Specifications with Compact Language Models and Lightweight Symbolic Reasoningcited by 0
  29. 2026LLM-Powered Workflow Optimization for Multidisciplinary Software Development: An Automotive Industry Case Studycited by 0
  30. 2026Amalgam: Hybrid LLM-PGM Synthesis Algorithm for Accuracy and Realismcited by 0
  31. 2026Rethinking Token Prediction: Tree-Structured Diffusion Language Modelcited by 0
  32. 2026An Empirical Analysis of Static Analysis Methods for Detection and Mitigation of Code Library Hallucinationscited by 0
  33. 2026Towards Human Motion World Models via Executable Behaviour Representationscited by 0
  34. 2026Task Abstention for Large Language Models in Code Generationcited by 0
  35. 2026Domain-Adaptable Reinforcement Learning for Code Generation with Dense Rewardscited by 0
  36. 2026Accelerating Constrained Decoding with Token Space Compressioncited by 0
  37. 2026Projectional Decoding: Towards Semantic-Aware LLM Generationcited by 0
  38. 2026Grammar-Constrained Decoding Can Jailbreak LLMs into Generating Malicious Codecited by 0

50 most cited of 66 All 66 (JSON)