Grammar-Constrained Path Decoding for Two-Agent Code Localizers
Enforce dynamic directory-tree grammar constraints during localizer decoding to eliminate hallucinated non-existent repository file paths.
Time
Compute level
Resources
What the paper used
Prerequisites
Scope
The Gap
In Section 5.3 and Table 4, localizer adapters fine-tuned on GitHub repository trajectories frequently assumed hardcoded file path prefixes like /workspace/src/ (which did not exist in target repositories such as fastapi or rich), resulting in 5 or more 'No such file' errors across 27 to 54 out of 78 development tasks.
“Every two-agent system uses paths under /workspace/src/ that do not exist in 24-43 tasks”
Limitation
The localizer model overfits to path structures from training repositories and hallucinates non-existent directory prefixes during inference rather than dynamically adhering to actual repository file trees.
Proposed Solution
Implement dynamic Trie-based or context-free grammar-constrained decoding within the inference engine (e.g., vLLM format enforcement). Extract valid relative file paths via repository directory tree inspection prior to localizer tool calls and restrict output token sampling strictly to valid repository paths.
Why This Matters
Will eliminate 'No such file' errors completely, saving wasted tool call turns and improving two-agent task resolution rates.
How to Get Started
How to test it: Test whether dynamic file tree constrained decoding reduces 'No file' task failure counts from 27-54 down to zero on the 78 development tasks. Metric: number of 'No file' errors and total solved tasks compared to unconstrained S3r1-soft.
- Extract valid repo file paths during environment initialization using git ls-files.
- Construct a dynamic regex dynamic Trie constraint for vLLM sampling logits processing.
- Integrate the constraint into the Kaggle competition runner harness for the localizer sub-agent.
- Evaluate the S3r1-soft model with constrained path decoding across the 78 Kaggle dev tasks.
Suggested by AI. Adapt it to your setup.
Has This Been Done?
The listed works do not cover grammar-constrained path decoding specifically for two-agent code localizers using directory trees and inference-engine token restrictions. Although papers like Type-Constrained Code Generation with Language Models and Cascaded Neurosymbolic Code Generation discuss constrained decoding, they do not apply Trie-based repository path enforcement for file localizers.
We searched OpenAlex and arXiv for “constrained decoding software engineering agents file path hallucination localizer vLLM” and “Grammar-Constrained Path Decoding for Two-Agent Code Localizers” and an AI compared the idea with the top 10 results. A small search can miss relevant work.
Source Paper
Let the Fixer Decide: Training a Code Localizer from the Fixer's LikelihoodKhalil Hennara, Muhammad Hreden, Zeina Aldallal +2 more · 2026
This paper presents Fixer-Guided Localization (FGL), an expectation-maximization framework for training a code localizer sub-agent based on the likelihood assigned to verified patches by a frozen code fixer. By using weighted supervised fine-tuning instead of expensive reinforcement learning with test execution, FGL optimizes localized context size and utility. While offline signal tests show FGL provides 27.5% smaller context windows with equal patch accuracy, end-to-end evaluations on Gemma 4 E4B demonstrate that overall agent performance is primarily bottlenecked by execution timeouts, repetition loops, and edit quality rather than localization quality alone.
Related Ideas
- Automated Linter for Agent-Code SynchronizationAgent READMEs: An Empirical Study of Context Files for Agentic Coding🟡Fairly easy
- Hermetic Harness-Agent Environment Isolation Against Dependency-Mediated Answer LeakageSage S2.1 Flash Technical Report🟡Fairly easy
- Syntax-Tree-Constrained Surgical Patching for Video Agent Edit LocalityVibeVideoAgent: Closing the Perceptual Loop for Code-Driven Video Generation🟡Fairly easy
- Structure-Aware Retrieval for Coding Agent ContextAgent READMEs: An Empirical Study of Context Files for Agentic Coding🟡Fairly easy
- Grammar-Constrained Command GenerationAutoDev: Automated AI-Driven Development🟡Fairly easy