Math benchmarks like GSM8K grade only the final answer buried at the end of a long reasoning trace. Extract it robustly.
Implement extract_answer(text) returning the answer as a string, or None:
\boxed{...}, use the contents of the last one.For the chosen text, if it contains a number, return just that number normalised: remove commas, $ and a trailing ., and turn "42.0" into "42". Otherwise return it trimmed. Then implement is_correct(text, gold): compare normalised answers, and numbers numerically within 1e-6.