liveBook · Manning

Answer box

As explained in Build a Reasoning Model (From Scratch)

A final answer presented inside boxed notation so it can be extracted more reliably from the response text.

An answer box presents a final mathematical answer inside boxed notation, such as \boxed{14/3}. Standardizing this format makes model responses easier to extract and score automatically. section 3.4

Candidate extraction

Given a response containing \boxed{\dfrac{14}{3}}, extraction returns the inner LaTeX expression; a response such as \boxed{ 14/3. } is then stripped of surrounding spaces and dollar signs.

How Build a Reasoning Model (From Scratch) covers it

How deep it goes
Implements delimiter search, whitespace handling, nested-brace tracking, malformed-input checks, and numeric fallbacks.
Examples
Demonstrates extraction from boxed LaTeX containing a fraction and cleanup of a boxed numeric answer with punctuation.
What it assumes
Assumes basic Python string handling and introduces brace-balanced parsing and regex-based candidate selection.
What you can do after
Build it from scratch with a parser that extracts boxed answers and selects numeric or full-response fallbacks.
How it connects
Connects answer extraction with mathematical reasoning models, model evaluation, MATH-500, LaTeX, and regular expressions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Reasoning Model (From Scratch). The section links point to the parts of the book it draws on.