Unit Dependency Graph and its Application to Arithmetic Word Problem Solving

Subhro Roy, Dan Roth

TL;DR

This paper introduces Unit Dependency Graphs (UDGs), a novel way to model the semantic relationships between units in math word problems. By forcing an arithmetic solver to respect these unit-based constraints—such as ensuring you only add quantities with the same units—the authors improved solver accuracy by over 10% and significantly increased robustness to unfamiliar vocabulary.

What Problem Does This Paper Address?

Solving math word problems isn't just about parsing numbers; it’s about understanding the "common sense" of the situation. For example, if a problem mentions "66 flowers" and "10 flowers," a human knows they can be added. But if it mentions "8 flowers per bouquet," we intuitively know that 8 is a rate and will likely be used in multiplication or division.

Existing solvers often treat numbers as abstract entities, missing out on these crucial unit-based cues. This leads to "brittle" systems that fail when they encounter new words or equation structures they haven't seen during training. The authors aim to bridge this gap by explicitly modeling how units (like "flowers," "bouquets," or "miles per hour") interact.

Methods

The core contribution is the Unit Dependency Graph (UDG). In this graph:

  • Vertices represent every quantity mentioned in the problem, plus the question itself. Each vertex is classified as either a RATE (e.g., "flowers per bouquet") or NOT RATE.
  • Edges define the relationships between units. Labels include SAME UNIT (for addition/subtraction), NUM UNIT (Numerator), and DEN UNIT (Denominator).
Figure 1: An arithmetic word problem, its UDG, and a tree representation of the solution (66 −10)/8. Several dependencies exist between the UDG and the final solution of a problem. Here, “66” and “10” are connected via SAME UNIT edge, hence they can be added or subtracted, “8” is connected by DEN UNIT to the question, indicating that some expression will be divided by “8” to get the answer’s unit.

The authors developed a decomposed model to predict these graphs:

  1. Vertex Classifier: A binary classifier that identifies if a quantity represents a rate based on context and rule-based features.
  2. Edge Classifier: A multiclass classifier that predicts the relationship between pairs of quantities.
  3. Joint Inference: The system doesn't just predict the UDG in a vacuum. It uses a constrained inference framework to simultaneously predict the UDG and the mathematical solution tree. It discards any solution that violates unit logic (e.g., trying to add "miles" to "hours").

Datasets

The researchers evaluated their system on a pooled dataset called AllArith (831 problems), combined from several existing benchmarks (Hosseini et al. 2014; Roy and Roth 2015; Koncel-Kedziorski et al. 2015).

To test robustness, they created two specific subsets:

  • AllArithLex: Problems with low lexical overlap (new vocabulary).
  • AllArithTmpl: Problems with low template overlap (new equation structures).

Key Insights and Ideas

  • Units as Structural Priors: Units provide a "grammar" for math. Just as you can't have a sentence without a verb, you can't (usually) add two different units. Modeling this explicitly acts as a powerful filter for incorrect mathematical expressions.
  • Generalized Rates: The paper defines "rate" broadly. It’s not just "miles per hour," but also implicit rates like "3 books per student." Identifying these is the key to knowing when to multiply or divide.
  • Robustness over Accuracy: While accuracy improved, the real win was in robustness. The UDG-augmented system performed significantly better on the low-overlap datasets, suggesting it relies more on logic and less on memorizing patterns in the training data.
  • Decomposed vs. Joint Learning: Interestingly, training separate classifiers for vertices and edges (decomposed) performed better than training one giant joint model. This is likely because the search space for a joint model is too large for the relatively small datasets available in this field.

Key Results

The UDG-augmented system, named UNITDEP, outperformed all existing baselines across all datasets.

Performance of system components for predicting vertex and edge labels.
  • Overall Accuracy: Reached 81.7% on AllArith, compared to 79.4% for the previous state-of-the-art (LCA++).
  • Robustness Gains: On the challenging AllArithLex and AllArithTmpl datasets, UNITDEP provided a 5% absolute improvement over LCA++, proving that unit reasoning helps the system generalize to new types of problems.
  • Error Reduction: The introduction of UDGs reduced the solver's error by over 10%.

Limitations and Future Work

Despite the progress, the authors note two main areas of failure:

  1. Extraneous Quantities: About 50% of errors came from the system failing to realize a number mentioned in the text was irrelevant to the math.
  2. Deep Semantic Understanding: The system still struggles with complex comparison questions (e.g., "How many more pennies does John have?"), which require a deeper grasp of mathematical concepts beyond simple unit matching.

Future work will focus on incorporating more domain knowledge, such as understanding entities, physical transfers, and more complex mathematical concepts.

Summary updated

Abstract

Math word problems provide a natural abstraction to a range of natural language understanding problems that involve reasoning about quantities, such as interpreting election results, news about casualties, and the financial section of a newspaper. Units associated with the quantities often provide information that is essential to support this reasoning. This paper proposes a principled way to capture and reason about units and shows how it can benefit an arithmetic word problem solver. This paper presents the concept of Unit Dependency Graphs (UDGs), which provides a compact representation of the dependencies between units of numbers mentioned in a given problem. Inducing the UDG alleviates the brittleness of the unit extraction system and allows for a natural way to leverage domain knowledge about unit compatibility, for word problem solving. We introduce a decomposed model for inducing UDGs with minimal additional annotations, and use it to augment the expressions used in the arithmetic word problem solver of (Roy and Roth 2015) via a constrained inference framework. We show that introduction of UDGs reduces the error of the solver by over 10 %, surpassing all existing systems for solving arithmetic word problems. In addition, it also makes the system more robust to adaptation to new vocabulary and equation forms .
BibTeX
@inproceedings{roy2017unit,
  author = {Subhro Roy and Dan Roth},
  title = {{Unit Dependency Graph and its Application to Arithmetic Word Problem Solving}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2017},
  url = {https://openreview.net/forum?id=rJ-Gqae_Wr},
}
Figure