DoM: Math Problems to Computation Graphs
A PyTorch transformer that generates structured math programs, with correct and incorrect decodes to inspect.
Problem
Math word problems require translating language into operations. A model can produce either a malformed program or a valid program that solves the wrong problem; those failures need separate evaluation.
Approach
Trained a decoder-only sequence-to-sequence transformer on MathQA and restricted decoding choices to valid graph structure. Compared generated computation graphs with reference programs.
What I built
Co-developed the tokenizer, data loader, model, training loop, and constrained decoding in PyTorch. Analyzed successful decodes alongside over-generation and missing-operation errors.
Result
The coauthored course report records 77.45% exact graph match, 84.78% 2-gram BLEU, and 2.72 average graph edit distance. Structural constraints do not guarantee the mathematical answer is correct.
Inspect the remaining errors
The constrained decoder can produce a valid graph with extra operations or omit steps the problem requires. Showing an incorrect decode beside a success separates structural validity from semantic accuracy.