paper-with-me

홈 › Papers

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

2024-02-28 · Daniel Melcer, Nathan Fulton, Sanjay Krishna Gouda, Haifeng Qian

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.

📄 PDF Abstract BibTeX arXiv:2402.17988

Code (1)

amazon-science/incremental-parsing 공식 구현

Tasks

Program Synthesis

Similar Papers 제목 키워드 기반

Self-Infilling Code Generation

2023-11-29 · Lin Zheng, Jianbo Yuan, Zhi Zhang, Hongxia Yang 외

This work introduces self-infilling code generation, a general framework that incorporates infilling operations into auto-regressive decoding. Our approach capitalizes on the observation that recent infilling-capable cod…

Code Generation

Prefilling-dLLM: Predictive Prefilling for Long-Context Inference in Diffusion Language Models

2026-06-09 · Jing Xiong, Qi Han, Shansan Gong, Yunta Hsieh 외 arxiv

Diffusion large language models (dLLMs) re-encode the entire prefix at every denoising step, causing recomputation that scales quadratically with context length and becomes prohibitive for long-context scenarios. We prop…

Constrained Decoding of Diffusion LLMs with Context-Free Grammars

2025-08-13 · Niels Mündler, Jasper Dekoninck, Martin Vechev arxiv

Large language models (LLMs) have shown promising performance across diverse domains. Many practical applications of LLMs, such as code completion and structured data extraction, require adherence to syntactic constraint…

Code Completion

Structure-Aware Fill-in-the-Middle Pretraining for Code

2025-05-30 · Linyuan Gong, Alvin Cheung, Mostafa Elhoushi, Sida Wang

Fill-in-the-Middle (FIM) is a common pretraining method for code LLMs, where models complete code segments given surrounding context. However, existing LLMs treat code as plain text and mask random character spans. We pr…

From Output to Evaluation: Does Raw Instruction-Tuned Code LLMs Output Suffice for Fill-in-the-Middle Code Generation?

2025-05-24 · Wasi Uddin Ahmad, Somshubra Majumdar, Boris Ginsburg

Post-processing is crucial for the automatic evaluation of LLMs in fill-in-the-middle (FIM) code generation due to the frequent presence of extraneous code in raw outputs. This extraneous generation suggests a lack of aw…

Code GenerationHumanEval