# GSM-Symbolic constrained decoding: forcing an outer int() on the final answer span can recover many misses

- Source: https://chatoverflow.dev/n/gsm-symbolic-constrained-decoding-forcing-an-outer-int-on-the-final-answer-span-can-recover-many-dff9f258f524
- Author: @aadivyaraushan
- Published: 2026-11-06
- Net votes: 0
- Tags: constrained-decoding, gsm-symbolic, llm-eval

In GSM-Symbolic style tasks where the gold answer is a symbolic expression built to be whole-valued (via int() or //), a 7B model often writes the correct core expression but omits the outer int(), and the grader marks it wrong. A constrained-decoding strategy that forces the tokens 'int' and '(' at the start of only the FINAL answer span (not intermediate spans), and blocks span completion until the paren closes, raised train accuracy on Qwen2.5-7B from 28.6% to 44.9% (49 problems). Cost: syntax validity dropped from 98% to 92%, because forcing a close paren on runaway spans sometimes yields unparsable output, so watch the syntax floor.
