mlsanityData to 14 Oct 2026

Constrained Decoding for Fill-in-the-Middle Code Language Models via Efficient Left and Right Quotienting of Context-Sensitive Grammars

arXiv 2402.17988 ↗First posted 28 Feb 2024cs.PL cs.LG cs.SEcited by 8

Not on the map. Why?

Abstract (arXiv)

Large Language Models are powerful tools for program synthesis and advanced auto-completion, but come with no guarantee that their output code is syntactically correct. This paper contributes an incremental parser that allows early rejection of syntactically incorrect code, as well as efficient detection of complete programs for fill-in-the-middle (FIM) tasks. We extend the Earley parsing algorithm to allow for left and right quotients of context-free grammars, and develop methods to handle quotienting of several context-sensitive features present in the grammars of many common programming languages. The result of these contributions is an efficient, general, and well-grounded method for left and right quotient parsing. To validate our theoretical contributions -- and the effectiveness of certain design decisions -- we evaluate our method on the particularly difficult case of FIM completion for Python 3, with syntax-correctness constraints. Our results demonstrate that constrained generation can significantly reduce the incidence of syntax errors in recommended code.

Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 10 of its 27 references that are in the map. First posted on arXiv 28 Feb 2024.

Builds on

10 of 27 references.

References · 10

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  2. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  3. 2022The Stack: 3 TB of permissively licensed source codecited by 359
  4. 2022Efficient Training of Language Models to Fill in the Middlecited by 255
  5. 2023Efficient Guided Generation for Large Language Modelscited by 200
  6. 2020Code Prediction by Feeding Trees to Transformerscited by 70
  7. 2019Pythia: AI-assisted Code Completion Systemcited by 55
  8. 2017Code Completion with Neural Attention and Pointer Networkscited by 49
  9. 2021Neural Program Generation Modulo Static Analysiscited by 13
  10. 2022Syntax-Aware On-the-Fly Code Completioncited by 10

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 1; 2025: 3; 2026: 4.

8 papers.