Small language models fail in two ways when asked to reason over long, messy documents such as clinical notes, financial filings, or court judgments. Irrelevant text pulls their attention away from the facts that matter. And when they are asked to first pull out the relevant facts in a structured form, the smallest ones invent facts that are not there. This proposal tests a simple fix for both problems at once. The model must first fill in a small structured record of evidence, and every value in that record is forced at decoding time to be a verbatim span of the input document. The model then reasons over that record alone. The model can still choose the wrong span, but it cannot write down a fact that does not appear in the source. Once extraction is done, the distractor text is gone.
The opportunity matters because the field holds two conflicting findings. Front-loading structured extraction before reasoning helps mid-size and frontier models but hurts a 1.5B model, because that model hallucinates constraints (Constraint-First Reasoning). Separately, distractor text collapses reasoning even in GPT-4 (UDA). If hallucination is the specific reason structure fails below the scale where multi-step reasoning starts to work, then a hard grounding constraint should push down the model size at which "extract, then reason" becomes useful. That would give 3B–8B models, including domain-specialized ones, a cheap route to robustness under noise.
Core Claim
Grammar-constrained decoding is a technique that masks forbidden tokens at each generation step so the output always parses. It is usually used to guarantee syntax. We use it to guarantee grounding. The claim is that a copy constraint on extracted evidence lowers the smallest model size at which a two-stage extract-then-reason protocol beats direct reasoning under contextual noise, and that unconstrained extraction does not have this effect.
Formally, let $x$ be the input document and $E = (e_1, \dots, e_m)$ the field values of the evidence record. Free text is allowed only in short field-name slots fixed by the schema. The constraint is
$$ e_j \in \mathrm{Sub}(x) \quad \text{for all } j, $$
where $\mathrm{Sub}(x)$ is the set of contiguous substrings of $x$. For a model of size $N$, define its noise tolerance $k^*(N)$ as the largest ratio of distractor tokens to relevant tokens at which its accuracy stays within $\delta$ of its clean-context accuracy. We predict three things. Copy-constrained extraction raises $k^*$ at every scale. Unconstrained extraction raises $k^*$ only above a size floor, consistent with the 1.5B failure in Constraint-First Reasoning. The gap between the two is largest for the smallest models.
Relation to Prior Work
The method borrows from grammar-constrained decoding. Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning introduced input-dependent grammars that restrict outputs to candidate entities. With them, LLaMA-33B's entity disambiguation rose from 54.1% to 80.3%. That work used a 33B model, no intermediate reasoning, and no injected noise. We restrict outputs to spans of the noisy input itself, and we use them as the only input to a later reasoning step.
Flexible and Efficient Grammar-Constrained Decoding (GREATGRAMMA) supplies the machinery for the main engineering risk: a span of $x$ need not tokenize the same way when regenerated. Its token-level lexing transducers handle this subword misalignment. We combine them with a per-input suffix automaton, a compact structure that recognizes every substring of $x$ and is built in time linear in the length of $x$.
The motivation comes from three lines of work. Constraint-First Reasoning shows that extracting constraints into JSON before solving helps 9B-to-frontier models on AIME and CMIMC (+7.2 points for Qwen3.5-9B) but harms 1.5B models. Its extraction step is unconstrained prompting on clean competition problems. We change exactly that variable and move to noisy documents. UDA and AR-BENCH show that extra context actively hurts: FinHybrid drops from 45.9 with retrieval to 0.4 with the full document for GPT-4, and adding full statute text lowers legal error detection. Neither studies small models or structured outputs. Evaluating Structured Output Robustness of Small Language Models for Open Attribute-Value Extraction from Clinical Notes measures only whether JSON parses for 3B–14B models on clinical notes, not whether the extracted content is correct. We measure content correctness.
Some work constrains the design. Evidence that chain-of-thought and self-verification hurt models below the reasoning floor (Po-Heng Chen; Yixuan Weng et al.; Jean-Noël Vittaut et al.) argues against adding free-form reflection stages. Our first stage therefore produces no free-form rationale at all. Decoupling Task-Solving and Output Formatting in LLM Generation (Deco-G) shows that format tracking competes with reasoning. That is why we keep the evidence schema shallow and let the second stage reason in free text.
Domain specialization is the application regime and a test case. Domain models underperform general models on procedural and diagnostic tasks: LawLLM-7B on AR-BENCH, and BioMistral on BioProBench. We ask whether part of that gap is a noise-handling failure that grounding can repair.
Research Program
We will build a decoding library that compiles an evidence schema into a grammar. Each schema has a few typed fields, such as "relevant figure," "statute cited," or "medication and dose." Each value slot is bound to the suffix automaton of the current input. This sits inside a GREATGRAMMA-style masking loop, and we will report per-token overhead against its published 5–32 ms.
The protocol has two stages. In stage one, the model fills the copy-constrained record. In stage two, it receives the question plus the record, without the original document, and answers. An ablation adds the document back into stage two.
All models are run zero-shot and with a light fine-tuning variant that trains only stage one on gold evidence spans. Every model is evaluated across a controlled noise sweep. Noise is injected by padding gold-relevant passages with same-domain distractors at fixed ratios $k$, and also left in its natural form in the benchmarks.
The model ladder covers general models at 1.5B, 3B, 8B, and 14B: Qwen-family models, LLaMA-3.2 3B, LLaMA-3.1 8B, Phi-3.5-mini, and Phi-4. It also includes the domain-specialized LawLLM-7B and BioMistral. We fit $k^*(N)$ for each protocol and look for the predicted crossing.
Baselines
The naive reference point is direct prompting: the model receives the full noisy document and answers in one pass. This is the long-context condition in UDA, where GPT-4 scored 0.4 on FinHybrid.
The strongest structural competitor is unconstrained two-stage extraction, run in the style of Constraint-First Reasoning. It uses the same schema and the same second stage but has no copy constraint. Its reported gain is +7.2 points for Qwen3.5-9B on AIME/CMIMC, which is a different, clean domain. It is the strongest competitor because it is our method minus the one ingredient we claim matters, so it doubles as the key ablation. Beating it means a statistically significant accuracy gain at 1.5B–3B under high noise, with matched behavior at 9B and above.
The strongest pipeline competitor is retrieval filtering: dense-retrieval RAG as in UDA, where GPT-4 with retrieval scored 45.9 on FinHybrid, and ProAgent-style adaptive chunking from BioProBench, which raised protocol QA from 70% to 85%. We give it the same evidence budget in tokens as our extracted record, the same second-stage model, and the same chunk-size tuning budget we use for schema design.
For format-heavy settings we also run Deco-G and runtime grammar-constrained decoding that enforces syntax only. These test whether syntactic validity alone explains any gain.
For EHRCon, no reported result on semantic extraction accuracy was found on Lacuna; only parseability is reported, at 90.3% for 14B models. For AR-BENCH, Qwen3-Max's 92.03% detection and 74.10% correction accuracy serve as the frontier reference. No reported per-setting S2 versus S3 number for small models was found on Lacuna.
Why not just…?
Why not just retrieve better chunks instead? This is the real threat. On UDA, retrieval alone recovers most of the collapse, and human-annotated context chunks improve scores by up to 60%. Our copy constraint is itself a selection mechanism, but the model makes the selection, at span granularity rather than chunk granularity. The token-matched comparison against retrieval settles the question. If retrieval matches us at equal evidence budget, the contribution shrinks to a statement about scale: grounding only matters where retrieval also fails. We will also report the combination of retrieval followed by copy-constrained extraction, which is the likely practical system.
Why not just tell the model to quote its evidence verbatim? Prompted quoting is exactly the unconstrained baseline. Constraint-First Reasoning reports that 1.5B models hallucinate constraints when asked to extract them. We will measure the fraction of extracted values in unconstrained runs that are not substrings of the input. If that fraction is near zero for small models, our mechanism has nothing to fix and the hypothesis fails cleanly.
Why not just fine-tune the small model with SFT or schema RL? Learning to Generate Structured Output with Schema Reinforcement Learning shows that schema reinforcement learning lifts LLaMA-3.2 3B from 28.51% to 72.50% on SchemaBench, but it targets schema validity on clean inputs, not grounding under noise. We include the fine-tuned stage-one variant both with and without the decoding constraint, which tests whether training makes the hard mask redundant.
Why not just use a frontier model? On AR-BENCH, Qwen3-Max reaches only 53.8% correction against 70.1% for humans in the head-to-head, and long-context GPT-4 collapses on FinHybrid. We report frontier numbers as an upper reference, but the question here is whether small, locally deployable models can become usable.
Proposed Experiments
UDA FinHybrid and TatHybrid test numeric reasoning in messy financial documents. UDA's annotated gold chunks let us also score evidence recall.
AR-BENCH gives a natural noise experiment. Setting S3 adds statute text to the S2 input, and the prediction is that copy-constrained extraction closes most of the S3-minus-S2 drop for 3B–8B models and for LawLLM-7B.
EHRCon, with its 4,101 annotated entities, lets us score attribute-value accuracy rather than parseability.
BioProBench protocol QA and error correction test whether BioMistral's deficit shrinks under grounding.
A GSM8K variant with injected distractor paragraphs gives a clean, controllable noise sweep, linking to the scaling results of Specializing Smaller Language Models towards Multi-Step Reasoning.
The metrics are task accuracy, evidence recall and precision against gold spans, the hallucinated-value rate, $k^*(N)$, and per-token latency.
The decisive check is the crossing pattern. Unconstrained extraction should lose to direct prompting at 1.5B–3B and win at 9B and above. Copy-constrained extraction should win at every size, with the largest margin at high noise and small scale. If copy-constrained extraction also loses at 1.5B, then the small-model failure is about choosing which spans matter, not about inventing facts, and the proposal's mechanism is falsified.
A second check concerns domain models. If LawLLM-7B and BioMistral gain more than size-matched general models, part of the specialization plateau reflects noise sensitivity rather than missing reasoning ability.
References
- Constraint-First Reasoning: A Training-Free Protocol for Exploiting Answer-Space Constraints in Mathematical Problem Solving
- UDA: A Benchmark Suite for Retrieval Augmented Generation in Real-World Document Analysis
- Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning
- Flexible and Efficient Grammar-Constrained Decoding
- AR-BENCH: Benchmarking Legal Reasoning with Judgment Error Detection, Classification and Correction
- Evaluating Structured Output Robustness of Small Language Models for Open Attribute-Value Extraction from Clinical Notes
- Measuring Taiwanese Mandarin Language Understanding
- Large Language Models are Better Reasoners with Self-Verification
- Self-AMPLIFY: Improving Small Language Models with Self Post Hoc Explanations
- Decoupling Task-Solving and Output Formatting in LLM Generation
- BioProBench: A Corpus and Benchmark for Biological Protocol Reasoning in Autonomous Science
- Learning to Generate Structured Output with Schema Reinforcement Learning
- Specializing Smaller Language Models towards Multi-Step Reasoning