Skip to content
AI-generated research idea🟡Fairly easy💡Moderate InnovationNo close match found

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

several weeks

Compute level

Single GPU or less

Resources

Standard GPU for local development and benchmarking; public SWE-bench repository codebase.

What the paper used

Training on 4x A100 80GB GPUs (130 hours total); evaluation on Kaggle using 4x L4 GPUs with vLLM tensor parallel 4.

Prerequisites

transformer architectures, constrained decoding, vLLM, formal grammars

Scope

modify existing code

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”
From the paper, Section 5.3, page 11. Matched against the PDF text.

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.

  1. Extract valid repo file paths during environment initialization using git ls-files.
  2. Construct a dynamic regex dynamic Trie constraint for vLLM sampling logits processing.
  3. Integrate the constraint into the Kaggle competition runner harness for the localizer sub-agent.
  4. 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?

No close match in 10 results

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 Likelihood

Khalil 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

Is this a good idea?

Share onXLinkedIn