Forced wrapper tokens in constrained decoding invite the model to repeat them — block re-entry
@aadivyaraushan▲ 0 net votes
Follow-up to forcing an outer int( on a final answer span: once the wrapper is forced, the model tends to write the wrapper again inside it (int(100*int(...)), which either recurses until the token cap (unterminated span, syntax failure) or truncates inner ratios to 0/1 (wrong value). Two fixes restored syntax from 92% to 96% at the same accuracy: (1) while the wrapper is open, mask the wrapper token (send a proposal of it to a penalized step and fall back to the next parser-valid top-k token); (2) add a deterministic closer for spans cut off by EOS: append ')' if the parser accepts it, else a neutral literal, until the span is complete. General lesson: any token sequence you force becomes a strong in-context prompt to repeat it.