Non-Autoregressive Math Word Problem Solver with Unified Tree Structure
Paper · 2023 · Yi Bin, Mengqun Han, Wenhao Shi et al.
Summary
A math word problem can have several correct calculations. To work out how much money someone has after a weekend, you can add the hours worked, multiply by the hourly wage and deduct the expense. You can also work out the earnings for each day separately and combine them with the expense. A solver trained to reproduce a particular expression sees different targets for those approaches. An evaluation that demands the same expression as the answer key can mark one of them wrong. The paper studies how to represent equivalent calculations consistently, how to predict that representation from prose and how to use it to assess an incomplete or partly correct solution.
The authors build on MTree, an earlier expression tree that can give an operation several children and lets those children be rearranged. Standard algebraic transformations put expressions such as the factored and expanded versions of the weekend calculation into a common form. The new solver, MWP-NAS, starts with a representation of the whole problem and works down the tree. When it expands an operation, it predicts its children in parallel. An attention mechanism lets the positions involved in different expansions exchange information, so a branch can take account of the goals being expanded alongside it. The resulting tree specifies an arithmetic calculation that can be evaluated to obtain the final answer.
MWP-NAS has the highest final-answer accuracy among the systems compared on the main Math23K and MAWPS benchmarks. Under the SUMC split settings, it reaches 84.8% on Math23K and 86.7% on MAWPS. Under the Reasoner split settings, it reaches 86.1% and 91.4%, respectively. Removing cross-goal attention lowers final-answer accuracy on both datasets in the SUMC experiments. A separate analysis finds that MWP-NAS stays ahead of the earlier MTree solver across the branch counts examined, with a more pronounced advantage for wider trees.
The authors also introduce two ways to check the calculation itself. MTree accuracy asks whether the predicted and reference expressions become the same unified tree. MTree IoU measures how many root-to-leaf paths they share relative to the paths they contain together, allowing a partly correct tree to receive partial credit. The experiments show cases where tree matching accepts a valid rearrangement that ordinary expression matching rejects, and cases where the right answer comes from a faulty expression. The authors release the implementation and trained checkpoints for MWP-NAS. They also identify cases where automatic conversion to MTree fails, placing a practical limit on both training and evaluation in the unified format.
Deep dive: Non-Autoregressive Math Word Problem Solver with Unified Tree Structure
MWP-NAS solves math word problems by building a shared tree for equivalent calculations and uses that tree to check answers and partial solutions. · about 33 minutes to read
The problem and its context
Turning a story into a calculation
A solver has to decide what each quantity contributes before it can do the arithmetic. In the paper’s weekend example, Dana earns 13 per hour, works 10 hours on Saturday and 3 on Sunday, and spends 40 on Saturday. The hourly rate applies to the hours for both days. The expense reduces the amount she has at the end. The arithmetic symbols follow from those relationships. A system that finds all the relevant numbers can still make a mistake about which ones belong together, what operation links them or which quantity reduces the result.
One way to organize the calculation is to treat earnings and spending as separate parts. Another is to split the calculation by day. The same hourly rate may appear once in the first expression and more than once in the second. The expressions can have different lengths and put multiplication and addition in different parts of their trees. They agree because the rate applies to each part of the total time. This is a stronger relationship than producing the same value for the particular numbers in the story. Distributing multiplication over addition preserves the calculation as a relationship among the quantities.
The paper connects this observation to two distinct problems. The first arises during learning. A training example pairs a word problem with a reference expression. The system is rewarded for reproducing the chosen arrangement, even when several arrangements describe the same calculation. An expression written in a different but equivalent form can make the target harder to learn across examples. The second problem arises during evaluation. An exact comparison can treat the arrangement chosen by the annotator as part of the required answer. A prediction then loses credit for a difference that has no mathematical consequence.
Checking the computed value addresses a different question. A correct value shows that the arithmetic returned the expected answer for the given inputs. The expression gives the evaluator something more specific to inspect, including whether the appropriate quantities contribute and whether their operations reflect the story. A numerical coincidence can hide a defect in that expression. The authors therefore distinguish the final answer, the full calculation and the parts of a calculation that can be recognized even when the full solution fails. Each is a different object of evaluation.
How earlier solvers represented answers
The paper places its work in a progression from hand-built rules and features, through semantic parsing for quantitative reasoning, to neural systems that learn from problem and solution pairs. It names Bobrow’s early work on natural-language problem solving in this history, and cites Shi and colleagues’ work on number word problems as an example of semantic parsing and reasoning. In the authors’ account, the earlier stages ran into limits in how they represented features and understood the language of the problem. Later approaches used learned representations to turn the text into an arithmetic output.
Some neural solvers borrowed the sequence-to-sequence setup from machine translation. They read words and generated the symbols of an expression in sequence. An early system described in the paper used a recurrent encoder and decoder. Other approaches added reinforcement learning, used convolutional components or predicted a template whose operations could be filled in. These variations changed how systems learned or generated the answer. A sequential expression still required the system to reproduce an order of symbols, including choices that arithmetic can leave open.
Binary expression trees made the arithmetic structure explicit. An internal node indicates an operation, and its children supply the operands. Traversing the tree produces an expression in an appropriate order. The paper highlights a goal-driven approach that builds such a tree from the top down. It starts with the problem as a goal and progressively replaces an operation with goals for its operands. Other approaches enriched the problem representation with graphs of quantities and their comparisons before predicting a tree. The paper also describes a bottom-up alternative that combines numbers and subexpressions into a directed acyclic graph, and a deductive approach that learns relations between quantities and repeatedly builds on them.
These approaches gave the operations or the quantities more explicit structure. A binary expression tree nonetheless assigns every operation a left side and a right side. A group of additions needs several nodes, and the grouping can vary depending on how the expression was written. The grouping and order frequently matter to the representation even when both are free to change in the arithmetic. The paper’s target is that remaining variation. Its approach preserves a hierarchy of operations while changing what that hierarchy requires a decoder to commit to.
Work on the problem encoder followed another line of development. The authors discuss using pretrained encoders such as BERT and RoBERTa to obtain contextual representations of a word problem. They also describe MWP-BERT as an effort to learn representations specifically useful for numbers in context. MWP-NAS uses the pretrained encoder approach. Its main architectural change concerns what happens after encoding, when a representation of the story has to become an expression.
The starting point for MWP-NAS
The earlier SUMC-Solver had already introduced MTree for word problems. Its representation reduces variations due to arithmetic rearrangement, and an operation can have several children at the same level. SUMC-Solver reconstructs this tree using codes predicted for its leaves. A code dictionary assembled in advance supplies the available patterns. The authors of MWP-NAS identify two drawbacks. Predicting codes for leaves can separate quantities whose arithmetic roles depend on one another, and a fixed dictionary can leave the system without a code for a pattern encountered at inference.
The new solver keeps MTree and changes the prediction task. It builds the tree by expanding operations and choosing their children, so quantities and intermediate expressions can enter the same prediction process. The challenge is to do this for several children without imposing an arithmetic distinction between the left and right roles of a binary tree. The paper adapts an idea from Non-Autoregressive Neural Machine Translation, where several output positions are predicted in parallel. The authors note that parallel prediction in translation can struggle with multiple valid outputs and repeated tokens. Their use of it is local to groups of tree branches, with communication among the positions that propose those branches.
The representation and the decoder thus address different parts of the problem. MTree determines which differences between expressions disappear during normalization. The decoder determines how well a solver can infer an expression in that format from the story. A shared format also makes a separate evaluation possible. Older solvers can still produce expressions in their own formats, and those expressions can be converted before they are compared with a reference.
The method, step by step
Making equivalent calculations share a tree
The first step concerns the reference expression used in training. The authors apply SymPy to simplify and expand it, obtaining a form that can be organized under MTree’s operations. In the earnings example, expanding a product over the sum of the hours exposes separate contributions for Saturday and Sunday. The expression that already calculates each day’s earnings separately has those contributions in the open. Both can be organized as a sum of the earnings terms and the expense represented as a negative contribution. This is how the representation can reconcile the factored and distributed versions.
Ordinary addition and multiplication already have the property the authors want for siblings. Their operands can be swapped without affecting the result. An operation can also collect a group of terms or factors at the same node. Ordinary subtraction and division require more care because interchanging their operands generally changes the value. MTree replaces those operations with forms whose operands remain interchangeable.
The operator + adds its children, and × multiplies them. The operator ×− takes the negative of the product of its children. The operator +/ takes the reciprocal of their sum. The last two labels describe operations on a whole group. Under ×−, all the operands contribute to a product and the sign applies to that product. Under +/, all contribute to the sum and the reciprocal applies to the sum. The structure records the grouping that still matters. An operation at one node can take the result of a child operation as an operand, even though the order among children at either node is free.
The paper illustrates the meaning of ×− with operands 2 and 3. Its result is the negative of their product. With the same operands, +/ gives the reciprocal of their sum. In both examples, rearranging the operands preserves the result. Negation also makes it possible to express subtraction by summing a positive contribution and a negative contribution. Reciprocals support a corresponding treatment of division through multiplication. For operations outside the main arithmetic vocabulary, the authors follow the earlier MTree procedure. They give repeated multiplication as a way to express a power in the supported operations.
A leaf can carry a number in its original form, with a minus sign, as its reciprocal or as its negative reciprocal. The leaf in the weekend example can carry the expense as −40, so the root sum includes spending in the right direction. A number’s identity and its form are separate decisions. Selecting 40 identifies the quantity to use. Assigning a negative form specifies its contribution to the calculation. A solver can get either decision wrong while getting the other right.
The resulting object is still a tree. Distributing a product can make a quantity appear in several places, as the hourly rate does when the days are handled separately. Each occurrence belongs to its own branch. The normalization therefore does more than sort a list of symbols. It changes how expressions are grouped, which operators can appear and which number occurrences belong to particular subexpressions. The decoder learns to predict that organized result.
Encoding the story and starting at the root
At prediction time, the solver starts with the problem text. The encoder supplies a representation of the whole story and contextual representations for its numerical quantities. The first becomes the goal at the root of the expression tree. The second set gives the decoder candidates to consider wherever a number is needed. Two quantities can refer to different parts of the problem even when both are represented in the same numerical vocabulary. Their surrounding text is available to the decoder through their contextual representations.
From a word problem to an arithmetic answer
The steps in order.
The paper uses a pretrained encoder and adjusts its parameters during training through fine-tuning. The input begins with [CLS] and ends with [SEP]. The encoder output associated with [CLS] represents the whole problem. The formula also returns the representations used for the input numbers.
Eₛ, Eᵥ = PLM([CLS]; S; [SEP])
Here S is the problem text, made up of the words w₁, w₂, …, wₙ, with n indicating the number of words in that notation. The associated collection V contains values v₁, v₂, …, vₘ, and m indicates the number of numerical values. The word and value subscripts index their positions in their respective collections. PLM is the pretrained encoder. [CLS] and [SEP] are its special opening and closing tokens for this input. The semicolons indicate concatenation in input order. Eₛ is the representation from the opening token, and Eᵥ is the collection of contextual representations for the problem’s numbers.
A goal is a vector the decoder uses to propose components of the expression. The root begins with Eₛ, so the first expansion can draw on the full story. When the solver predicts an operator among the children, the goal for that child can guide the next expansion. Selecting a number or constant completes a leaf. Recursion continues through the operator branches until the tree has been filled in. The parallel part of the procedure operates within expansions. A descendant is reached through the decisions that create its ancestors.
The decoder gives each proposed child an explicit identity by comparing its representation with available candidates. Some candidates come from the story. Others, such as the allowed operators, are learned entries shared across problems. The paper gives the candidate representation as a piecewise definition.
E꜀ = ⎧ Eᵥ for a number in the text
⎪ Eₒₚ for an operator
⎨ E꜀ₒₙ for a constant
⎩ Eₙ for Nᵦ
E꜀ denotes the candidate representations, with each row giving the source for one kind of candidate. Eᵥ supplies the encoded quantities from the input. Eₒₚ supplies learned operator embeddings, and E꜀ₒₙ supplies learned constant embeddings. Nᵦ is the end marker for a child list, and Eₙ is its learned embedding. An embedding is a vector encoding an item so the decoder can compare it with the vectors at proposed child positions. Including input-specific numbers in the candidates lets a child point to a quantity from the current problem. Learned constant candidates make a separate source of numeric operands available.
Giving an unordered group prediction positions
A parent in MTree may have several children and any of their permutations is valid. The decoder still needs a way to address each proposed child. For every potential position, it adds a positional embedding to the current goal vector. Each slot therefore begins with information about the same parent and a distinct position signal. The decoder uses the same processing for the slots. The slot identities help organize prediction and supervision, while the resulting siblings remain interchangeable as operands of the parent operation.
The position signals follow the sinusoidal construction from Attention Is All You Need. The paper writes a sine for one coordinate of each pair.
pᵢ,₂ⱼ = sin(i / 10000^(2j/dₖ))
pᵢ,₂ⱼ is the coordinate with index 2j in the vector for position i. The index j selects a coordinate pair, dₖ is the dimension used in the positional scaling, and 10000 is the fixed base. The caret denotes exponentiation, / denotes division and sin is the sine function. The power of 10000 sets the scale at which the signal changes with i.
The other coordinate in the pair uses a cosine with the same scale.
pᵢ,₂ⱼ₊₁ = cos(i / 10000^(2j/dₖ))
pᵢ,₂ⱼ₊₁ is the adjacent coordinate for the same position i and pair index j. The subscript 2j+1 identifies that coordinate. cos is the cosine function, and 10000, dₖ, the exponent and the division have the same roles as in the sine expression. Together the coordinates distinguish positions through signals at different scales.
For the current expansion, E_g denotes the parent goal representation. Adding it element by element to the positional embeddings gives E_p, the collection of position representations before attention. A goal such as “work out a contribution to the root sum” is therefore present in every slot assigned to that parent. The slots can develop different selections because their positional signals differ and because they exchange information before choosing candidates.
The Transformer and attention computation starts with multi-head self-attention. Attention lets each position consult representations at other positions. Multiple heads carry out that comparison using different learned projections. The paper expresses the operation as follows.
Ẽₚ = MHAtt(Eₚ W̃_Q, Eₚ W̃_K, Eₚ W̃_V)
Eₚ contains the fused goal and position representations. The learned matrices W̃_Q, W̃_K and W̃_V project them into queries, keys and values, respectively. A query represents what a position uses to look for information. A key is the representation against which a query is compared. A value carries the information that can be passed on after those comparisons. Adjacent matrix terms indicate matrix multiplication. MHAtt denotes multi-head attention and Ẽₚ contains the updated representations returned for the positions.
Letting different expansions inform each other
The paper’s cross-goal attention concerns which positions can exchange information in that self-attention operation. In the ordinary comparison used by the authors, an expansion’s positions consult positions attached to the same goal. Cross-goal attention also makes information from other goals available. All those positions begin with their own parent information, so a child position can receive evidence about what another branch of the calculation is trying to express.
The weekend example shows why the distinction matters. The root sum has branches for the earnings terms and a leaf for −40. When a multiplication branch is expanded, its prospective children can receive information associated with the other multiplication branch and with the expense. The leaf presents a practical complication. It has no real children to participate in the exchange. The authors attach dummy child positions to such a leaf for attention, giving the other positions a route to information about it. Those dummy positions contribute no targets to the loss and add no operands to the expression.
This mechanism gives the decoder a way to coordinate decisions. For example, multiple branches can be relevant to different parts of the same story, and their positions can exchange information before any position chooses a symbol. There is no requirement that their selected symbols all differ. The weekend calculation legitimately uses the same hourly rate in more than one branch. The architectural change supplies context for telling an intentional reuse from an unnecessary duplication. It leaves each slot with a distribution over candidates.
Cross-goal attention also preserves the distinction between information flow and arithmetic structure. A prospective child can see information about a separate branch while still belonging to its own parent. Attending to the expense when expanding a multiplication does not put the expense inside that product. It changes the evidence available when the decoder decides what does belong there. The original tree links continue to determine how the eventual expression is evaluated.
Comparing positions with operators and numbers
After self-attention, the decoder relates the updated positions to the inventory of possible outputs. The paper calls this inter-attention. The positions act as queries, while the candidate representations are projected into keys and values. The result at a position incorporates information about the candidates that fit its context. This step is useful because the inventory mixes items with different origins. The same position can be compared with a number drawn from the text, a learned operator or the marker that closes the list.
Êₚ = softmax((Ẽₚ (E꜀ Ŵ_K)ᵀ) / √dₖ) (E꜀ Ŵ_V)
Êₚ contains the position representations after inter-attention. Ẽₚ is the self-attention output serving as the queries, and E꜀ is the array of candidate vectors. The learned matrices Ŵ_K and Ŵ_V turn candidates into keys and values. ᵀ transposes the projected keys so the matrix multiplication compares every position with the candidate keys. √dₖ is the square root of the key dimension and scales those comparisons. softmax turns the comparisons for a position into weights over the candidates. Multiplying by the projected values combines candidate information according to those weights.
The decoder then uses a mechanism based on Pointer Networks to choose an actual token for each position. The attention over candidate values gives a contextual vector. The pointer computation scores individual candidates using the position and candidate representations. This produces the explicit decision that becomes an operator, a leaf or an end marker in the tree.
ωᵢⱼ = uᵀ tanh(Wₚ eₚᵢ + Wᵦ e꜀ⱼ)
ωᵢⱼ is the score for choosing candidate j at position i. eₚᵢ is the vector for that position and e꜀ⱼ is the vector for the candidate. Wₚ and Wᵦ are learned matrices that project the two vectors into a common space. The plus sign adds the projected vectors. tanh applies the hyperbolic tangent to the resulting coordinates. u is a learned column vector, and its transpose uᵀ reduces the transformed vector to a single score by taking a dot product.
Pᵢᵗʳ = softmax(ωᵢ)
ωᵢ collects the scores ωᵢⱼ for all candidates j at position i. softmax normalizes those scores into probabilities. Pᵢᵗʳ is the resulting distribution over candidate tokens for that position. Different positions have their own distributions, informed by the contextual exchange that precedes scoring. The decoder can propose all their tokens in parallel during the current expansion.
Aligning predictions and training targets
The training procedure needs to say which child should supervise each position. The tree allows its siblings to be rearranged, but position-by-position supervision needs a target list. The authors establish a provisional order for that purpose. Operators come first, followed by constants and then by quantities from the problem. In the weekend example, the sum has two multiplication children followed by the negative expense. This supplies a consistent way to present the tree to the decoder while retaining permutation freedom in the mathematical representation.
The solver allocates a maximum decoding length of 8 for an expansion. The authors report that more than 99% of the dataset samples have MTree branching below 8. The child targets include Nᵦ at the end of their list. By predicting this marker, the decoder can use a different effective number of branches for each goal within the fixed allocation. During training, the loss ignores positions after the marker. At inference, positions after it are discarded. This gives the solver a fixed array of positions to process in parallel and a variable-size child list to put in the tree.
The use of a fixed allocation also separates branch count from total tree size. A goal with few children can be one part of a tree with many nested operations. Conversely, a wide group can arise at a shallow node. The cap governs the positions available in one expansion. The recursive procedure determines how many expansions are necessary. A predicted operator creates another expansion, while a numeric leaf ends its branch.
A separate multilayer perceptron classifies the form of the selected operand. Its classes correspond to the original number, its negative, its reciprocal and its negative reciprocal. This decision can change the calculation even after the pointer identifies the right quantity. The authors use focal loss for the classifier to address imbalance among the forms. It changes how classification errors contribute to training when some forms are more prevalent or easier to predict. The form loss is combined with the pointer loss, and the components are trained jointly with the encoder. The paper describes the combination without specifying a separate mathematical loss expression.
At the end of decoding, the selected operands and their forms occupy the leaves and the operators specify how to combine them. The tree can be evaluated to give the final answer. It also remains available for structural checking. The evaluator can inspect the whole expression or follow paths to individual number occurrences, including repeated uses of a quantity.
Experiments and results
Datasets and comparison settings
The main experiments use Math23K and MAWPS as evaluation benchmarks. Math23K contains 23,162 arithmetic word problems. The main split uses 21,162 for training, 1000 for validation and 1000 for testing. The authors follow earlier work for these partitions so they can compare against results under the same conditions. Validation is used to select the checkpoint, and the test partition supplies the reported evaluation.
MAWPS starts with 2373 samples. Following the earlier MTree work’s preprocessing leaves 2163 for the experiments. The authors use 5-fold cross-validation because the dataset is smaller. Four folds have 433 samples each and one has 431. The reported results average over the folds. The preprocessing count specifies the population used for the experiment, which matters when comparing systems that may follow different data preparation conventions.
The paper calls its two sets of comparison conditions the SUMC Split and the Reasoner Split. The main experiments and ablations follow the SUMC Split. In the main comparison table, the Reasoner Split entries for Math23K refer to a 5-fold train-test setup. The authors also explain that the prior deductive solver’s main Math23K experiments used a setting that combined training and validation data and averaged runs with different random seeds. On MAWPS, earlier work used different arrangements of the cross-validation folds, and the authors follow both for comparison. Each reported score belongs with its protocol. The change in score across protocols cannot by itself isolate the effect of the solver.
The authors implement MWP-NAS in PyTorch and run the experiments on an NVIDIA RTX A6000 GPU. They fine-tune the pretrained encoder, using RoBERTa-base or BERT-base, and specify BERT-base for MAWPS. The initial global learning rate is 2e −5 on Math23K and 5e −5 on MAWPS. The decomposer uses hidden size 768 in each layer. Training runs for 1000 epochs on Math23K and 2000 epochs on MAWPS, with checkpoints chosen by performance on validation data. The official implementation includes the code and checkpoints for the solver.
Final-answer accuracy on the main benchmarks
The main baseline comparison reports value accuracy, the percentage of problems for which evaluating the predicted expression gives the reference answer. This metric is available across more of the baseline literature than expression accuracy. It also applies directly to solvers whose intermediate representations differ. A tree generated by MWP-NAS can be rendered as several valid expressions. Evaluating its value avoids having to choose a particular rendering for this comparison.
The baselines cover several ways of producing a calculation. Seq2Seq provides a sequential reference point. GTS builds a tree through goal decomposition, and Graph2Tree enriches the input with a graph before tree generation. The comparison also includes pretrained approaches such as BERT-Tree and UniLM, as well as the SAU-Solver. DeductReasoner builds relations between quantities. SUMC-Solver is the closest baseline for the choice of output representation because it also uses MTree. The paper draws on earlier published baseline scores and flags the split conditions for the direct comparisons.
Final-answer accuracy for selected solvers on Math23K under the main comparison settings
MWP-NAS leads the reported comparison and DeductReasoner is its closest baseline.
The numbers
| System or setting | accuracy % |
|---|---|
| Seq2Seq | 58.1 |
| GTS | 75.6 |
| Graph2Tree | 77.4 |
| BERT-Tree | 82.4 |
| SUMC-Solver | 82.5 |
| DeductReasoner (SUMC Split) | 84.3 |
| MWP-NAS (SUMC Split) (this paper) | 84.8 |
On Math23K, the main table puts MWP-NAS at 84.8% final-answer accuracy under the SUMC Split, with DeductReasoner at 84.3% under the same setting. The comparison with SUMC-Solver, which records 82.5% in that table, is informative because it holds the broad representation choice in common. MWP-NAS and SUMC-Solver still differ in how they predict and assemble the tree. Their scores compare the full procedures, so the lead alone cannot identify which change in the decoder accounts for it. The authors propose that attention helps preserve relationships between quantities during construction, in contrast to the challenges of separately predicting leaf codes.
The MAWPS results under the SUMC Split put MWP-NAS at 86.7% value accuracy and DeductReasoner at 86.0%. SUMC-Solver records 82.0% in the main comparison. Graph2Tree reaches 83.7% in the same results table. The two systems closest in design and in performance answer different questions about the new solver. SUMC-Solver is the comparison for building the same kind of output through a different procedure. DeductReasoner shows how close a strong system using relations between quantities can come on the final-answer metric.
Under the Reasoner Split, MWP-NAS reaches 86.1% value accuracy on Math23K and DeductReasoner reaches 85.1%. On MAWPS under that split, the corresponding accuracies are 91.4% and 91.2%. The lead holds across the reported split settings, with close results for DeductReasoner. The authors suggest that the strength of deductive relation construction makes it an interesting direction for work with MTree. Their experiments compare the existing systems separately.
Measuring whole expressions and partly correct ones
For the expression evaluation, the authors reproduce representative solvers on Math23K using their released implementations. They compare predictions in their original forms where expression accuracy is available and also convert them to the unified tree form. This comparison asks whether the score changes when the object being matched is an arithmetic structure with normalized operations and unordered children. It also lets the authors assess a solver whose native output is already MTree with the same structural metric.
Ordinary expression accuracy gives credit for an exact match to the reference expression. MTree accuracy gives credit for an exact match after unification. The full-tree criterion remains strict about the arrangement of operations and operands in the unified format. It accepts arithmetic variants that normalization maps to the same tree. Value accuracy addresses the computed result in either case. The paper uses examples to show how the three criteria can yield different judgments on the same prediction.
MTree IoU gives partial credit. It describes each leaf by the path connecting it to the root, so the leaf’s contribution is considered together with the operations above it. The predicted paths are compared with the reference paths. The score takes the size of the overlap relative to the total collection of paths represented across the two expressions. The authors draw on the intersection-over-union idea used in object detection, citing Faster R-CNN.
MTreeIoU = |Pₚ ∩ P_g| / |Pₚ ∪ P_g|
MTreeIoU is the path overlap score for a problem. Pₚ is the collection of root-to-leaf paths in the prediction, and P_g is the collection in the reference tree. The intersection sign ∩ denotes the shared paths, and the union sign ∪ denotes the paths represented across both collections. The bars | | count their entries, and the slash divides the shared count by the union count. The reported test score averages the per-problem scores.
Although the formula uses set notation, the implementation stores the paths in lists to preserve repeated occurrences. A solver producing one occurrence of a path has only partly matched a reference requiring repeated instances of it. The authors use the repeated hourly rate in the weekend tree to explain why multiplicity matters. This treatment also shows why MTree IoU differs from merely checking whether the prediction contains each distinct number. The relevant comparisons involve the routes through the expression and how often those routes occur.
The weekend example illustrates what partial credit adds. One erroneous expression gives the expense a positive contribution while keeping the calculation of earnings. Another adds Sunday’s hours where it should use the earnings for Sunday. Both can lose credit under a whole-expression criterion. Their errors affect different parts of the tree, and the authors use them to motivate recognizing the portions that are correct. The path metric turns that distinction into a comparison of the structure from the root to each leaf.
Root-to-leaf path overlap on the Math23K test set
MWP-NAS has the highest average path overlap, followed by DeductReasoner.
The numbers
| System or setting | MTree IoU |
|---|---|
| Seq2Seq | 62.99 |
| GTS | 82.77 |
| Graph2Tree | 83.53 |
| SUMC-Solver | 87.26 |
| DeductReasoner | 88.86 |
| MWP-NAS (this paper) | 89.73 |
In this reproduced Math23K comparison, DeductReasoner obtains 76.4% ordinary expression accuracy, 83.6% MTree accuracy and 84.3% value accuracy. Graph2Tree obtains 66.0% ordinary expression accuracy, 76.9% MTree accuracy and 77.4% value accuracy. GTS records 64.4% on ordinary expression accuracy, 75.3% on MTree accuracy and 75.7% on value accuracy. For these systems, unification brings exact expression matching closer to the corresponding value score. The reproduced comparisons give the authors a way to demonstrate the effect of changing the evaluation for predictions produced outside MWP-NAS.
MWP-NAS obtains 83.8% MTree accuracy on Math23K and 84.8% value accuracy in the same comparison. SUMC-Solver obtains 82.4% MTree accuracy and 82.9% value accuracy there. The latter value score belongs to the reproduction for the expression study. The 82.5% figure belongs to the paper’s main baseline comparison. The paper leaves ordinary expression accuracy blank for the MTree solvers. Their unified outputs support multiple equivalent written expressions, which is the reason the authors give for using the tree as the basis of comparison.
Examples produced by DeductReasoner illustrate what changes in the scoring. In a problem about chickens and ducks, the reference adds a unit and a multiplier before multiplying by 36. The prediction multiplies and then adds the original quantity. The reference and prediction express the same relationship by distribution. Ordinary expression accuracy rejects the prediction, while MTree accuracy accepts it. In the fruit-shop example, the displayed reference and prediction deduct the same terms in opposite orders. Their normalized trees match. This example concerns equivalence between the displayed expressions, and the wording of the problem introduces a separate annotation concern.
The authors also inspect cases where a correct value accompanies a failed MTree match. They report six such test samples in the check. They identify three with incorrect reference expressions and two with a wrong predicted expression that happens to yield the expected answer. The check shows both why matching a tree can provide evidence beyond the final value and why the reference tree must itself be trustworthy. The authors give those diagnoses for the cases they describe, leaving the rest of the accounting unspecified.
Results on the supplementary datasets
The appendix adds MathQA and SVAMP. The authors treat these as supplementary comparisons because fewer of the baselines have results available. On MathQA, MWP-NAS reaches 81.2% final-answer accuracy, ahead of DeductReasoner at 80.6% and BERT-Tree at 73.8%. Graph2Tree records 69.5%. The appendix therefore extends the comparison with DeductReasoner beyond the two main benchmarks.
On SVAMP, Graph2Tree reaches 36.5% value accuracy, MWP-NAS reaches 35.5% and DeductReasoner reaches 35.3%. The authors specify BERT-base as the problem encoder for SVAMP. They suggest that Graph2Tree’s quantity graphs may help it handle the problem variants in this benchmark. The appendix reports the ranking and offers that interpretation. It leaves open whether the graph representation itself accounts for the lead, since the comparison is between complete systems.
The supplement also shows why a ranking on one benchmark does not settle the ordering on another. GROUP-ATT is ahead of Graph2Tree on MathQA, where their value accuracies are 70.4% and 69.5%, respectively. On SVAMP the order reverses, with GROUP-ATT at 21.5% and Graph2Tree at 36.5%. The main claim of a lead on Math23K and MAWPS sits alongside this different outcome on SVAMP. The evidence covers the datasets and baseline entries reported in each comparison.
What the ablations show
Sharing information across goals
The direct ablation removes cross-goal attention and evaluates final-answer accuracy under the main SUMC settings. This comparison gives a more focused test than comparing MWP-NAS with SUMC-Solver. Both variants of MWP-NAS generate the same kind of expression. The manipulation concerns whether positions in different goal expansions can exchange information. The consequence is measured at the end of the calculation, after the predicted tree has been evaluated.
Effect of cross-goal attention on Math23K final-answer accuracy under the SUMC Split
Allowing information to pass across goals improves the final-answer score.
The numbers
| System or setting | accuracy % |
|---|---|
| MWP-NAS without cross-goal attention | 84.1 |
| MWP-NAS with cross-goal attention (this paper) | 84.8 |
On MAWPS, value accuracy moves from 86.1% without cross-goal attention to 86.7% with it under the SUMC Split. The effect goes in the same direction on both main datasets. The authors interpret this as evidence that information from other goals helps the decomposition of an individual goal. The result measures the net effect on correct answers. It leaves the proposed intermediate explanation, such as avoiding a duplicated decomposition, without a separate count of how often such errors occurred or were corrected.
This distinction matters because many changes to a tree can alter its value. Information from another branch might influence which source quantity is selected, whether a slot is filled by an operator, or where the decoder chooses to end a list of children. The ablation switches the communication mechanism as a whole. It cannot assign the resulting improvement to one of these particular decisions. It isolates the contribution of cross-goal communication within the tested architecture and settings.
Performance as trees become wider
The authors also organize problems by the branch count of their reference trees. They define the branch count as the largest number of children attached to any node in a tree. In the weekend example, the root sum has three branches, so that is the count for the whole tree. A maximum is useful here because it identifies an expansion that places particular demands on the decoder. It measures width at the busiest operation, while depth or total tree size could describe different structural demands.
The branch-count comparison is between MWP-NAS and SUMC-Solver. The reported plot shows MWP-NAS ahead at every branch count examined, with a more pronounced advantage where wider expansions are needed. Both systems tend to lose value accuracy as branching increases. This pattern supports the authors’ claim that their approach works better than coded leaf prediction on the wider trees in the comparison. It also shows that wider trees remain harder for MWP-NAS itself.
Branch count is a characteristic of the problems in this analysis. The experiment groups different examples by their trees and compares the systems within those groups. The authors associate wider trees with more complicated cases because a single operation may have to organize more operands and subexpressions. The results cannot isolate width from changes in the types of problems found in each group. The plot establishes how accuracy varies across the measured groups. It leaves open how widening a tree while holding other aspects of a problem constant would affect performance.
Changing the representation of number forms
The appendix tests a preliminary refinement called RefMTree. The authors observe that operators already in MTree can express the special number forms if they are allowed to take a single operand. A ×− node over a number gives its negative, and a +/ node over a number gives its reciprocal. A combination of those operators gives a negative reciprocal. In the weekend example, the expense can then appear as a plain 40 at the leaf, with a ×− node between it and the root.
The change moves a decision from a leaf label into the tree’s internal structure. MWP-NAS can drop its number-form classifier, since the required sign or reciprocal is expressed by predicted operations. SUMC-Solver can drop the form component of its codes. In return, the tree can be deeper, and codes or decoding paths have to describe the new intermediate nodes. The authors keep the experimental settings for Math23K and modify each solver to use the refined representation.
With the original tree, MWP-NAS has 84.8% value accuracy, 83.8% MTree accuracy and 89.73 MTree IoU on Math23K. Under RefMTree it has 84.3% value accuracy, 83.4% MTree accuracy and 89.71 MTree IoU. The direction of change is consistent across the three metrics. The path metric stays close to the original result even as the exact-match and final-answer scores fall. The alternative can express the number forms, but changing their position in the representation brings a cost in these experiments.
For SUMC-Solver, the original setup reaches 82.9% value accuracy, 82.4% MTree accuracy and 87.26 MTree IoU on Math23K. With RefMTree the values are 79.8%, 79.5% and 86.99, respectively. The authors propose that the changed structure affects the path codes used by SUMC-Solver. For MWP-NAS, they point to the extra depth that the decoder has to predict. These are interpretations of a result that changes several closely related features together. The experiment compares a form classifier and its original trees with a different representation and its corresponding decoder. It cannot provide an isolated performance estimate for removing the classifier alone.
What individual predictions reveal
The paper shows successful trees in which the generated expression matches the reference and captures a composition involving 5 and 4. It also shows a failure in the operand form. A solver can assign a quantity the wrong sign or reciprocal status even when it has associated the correct number with a branch. That kind of error is directly visible in MTree because the form is attached to the leaf.
The authors suggest that the separate optimization objective for operand type may contribute to such failures. The example identifies a concrete failure mode. The refinement experiment supplies a test of one way to avoid a separate type decision, and its lower scores show that this particular redesign did not improve either solver. The paper gives no aggregate breakdown of how often the form classifier causes an error. Its quantitative evidence here concerns the representation comparison, while the example illustrates a mistake that the aggregate score can conceal.
Limitations
Limits identified by the authors
Automatic unification sometimes fails. The authors use the simplification and expansion functions in SymPy before building an MTree, and report failures in about 0.2 percent of cases, including 2 cases in the test set. They exclude failed conversions from training and retain the original expression as the test reference for those cases. They attribute a decrease of 0.2 percent in reported performance to this issue. Their procedure depends on obtaining a usable normal form, so conversion coverage affects which training examples the solver can use and how consistently its outputs can be assessed.
This practical limit qualifies the claim about a shared tree. The paper demonstrates that the normalization covers useful arithmetic rearrangements, including exchanging terms and distributing a product. It also documents expressions that the automatic procedure fails to transform. Its benchmarks support the usefulness of the chosen operations and conversion procedure for the arithmetic in those experiments. They leave open how widely the same procedure would unify expressions in other settings.
The authors also identify the scope of the encoder experiments. They use BERT and RoBERTa to keep comparisons aligned with earlier solvers. They leave the integration of MTree with larger pretrained language systems for future work. The findings therefore concern the specific encoding and generation setup they evaluate. The paper supplies no experiment showing whether the same normalization, decoder or structural metrics would have the same effect in a substantially different generation system.
Limits visible in the experimental setup
Parallel prediction is shown at the level of child positions. The tree is still built by recursive expansion, and the paper reports no timing experiment that compares end-to-end decoding speed with the baselines. The motivation from parallel translation helps explain the architectural choice. It leaves the practical speed and resource tradeoffs open, including the cost of sharing information across goals and processing dummy positions.
The fixed upper limit of 8 positions is justified by the reported branch distribution. That is an empirical choice about the datasets used. A group requiring more positions than the decoder provides presents a representational boundary for one expansion. The paper’s branch analysis helps explain performance in the observed range. It gives no evidence about increasing the allocation or about arithmetic collections with substantially wider nodes.
The metrics have different sources of error. Value accuracy can award credit to a prediction that arrives at the right answer through a faulty expression. MTree accuracy can penalize a reasonable prediction when the reference expression has an annotation error or when the available normalization does not produce a matching tree. The fruit-shop example illustrates the importance of distinguishing expression equivalence from correctness relative to the prose. The question states a multiplier of 3.6, while both displayed expressions use 3. Their match shows that the two displayed calculations agree under reordering. The match alone cannot establish that either calculation uses the quantity stated in the question.
MTree IoU also uses a specific notion of partial correctness. It compares whole paths from the root to leaves. An error high in the tree can change the paths for several otherwise appropriate quantities, and shared paths can survive in a tree whose final result is wrong. The reported cases motivate the scoring rule, but the paper gives no independent evaluation against human judgments of partial credit. Path overlap is therefore best understood as structural agreement with the reference under the chosen representation. How that translates to an assessment of a person’s reasoning would require another kind of evidence.
Finally, the scores compare benchmark outcomes and support a focused ablation for cross-goal attention. Some baselines come from prior experiments, and the paper takes care to identify comparison splits. The close scores against DeductReasoner are reported as point results. The main comparisons give no uncertainty estimates for deciding how stable the smallest leads are. The appendix broadens the evidence while showing that the ordering can change across tasks. Together these details bound the claim to the recorded protocols and distinguish performance on final values from performance on complete or partial expressions.
What came after
Math-LLaVA cites the paper and addresses mathematical reasoning in a multimodal setting through bootstrapping. Its stated subject broadens the setting from arithmetic word problems presented in text to mathematical tasks involving more than one input modality. MWP-NAS investigates a narrower question about the output of a text-based solver, namely how a calculation can be represented, generated and checked when several equivalent expressions are possible.
The citation establishes a connection between the studies. The specific role of MWP-NAS in Math-LLaVA is undocumented here, including whether the later work adopted unified trees, parallel branch prediction or path-based scoring. The connection can therefore be described at the level of mathematical reasoning research, with the technical question of transferring MTree to a multimodal solver left open.
Cite
Cite as Yi Bin, Mengqun Han, Wenhao Shi, Lei Wang, Yang Yang, See-Kiong Ng and Heng Shen. 2023. Non-Autoregressive Math Word Problem Solver with Unified Tree Structure. Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing.
@inproceedings{bin2023non,
title = {{Non-Autoregressive Math Word Problem Solver with Unified Tree Structure}},
author = {Yi Bin, Mengqun Han, Wenhao Shi, Lei Wang, Yang Yang, See-Kiong Ng and Heng Shen},
booktitle = {Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing},
year = {2023},
doi = {10.18653/v1/2023.emnlp-main.199},
url = {https://doi.org/10.18653/v1/2023.emnlp-main.199}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/bin-2023-non-autoregressive-math-word-problem/