TL;DR
Researchers have finally peeked under the hood of how Large Language Models (LLMs) perform arithmetic. By applying game-theoretic "interactions" to input words, they discovered that successful models prioritize complex relationships between numbers and operators, while struggling models get distracted by "background" words like "is" or "the."
What Problem Does This Paper Address?
While LLMs have become surprisingly good at math, we still don't really know how they do it. Is the model actually "reasoning," or is it just performing sophisticated pattern matching? Previous attempts to explain this—like looking at specific neuron activations—often lacked a mathematical guarantee that the explanation actually matched the model's internal logic.
The authors address this "interpretability gap" by treating the words in a math problem as players in a cooperative game. In this framework, the final answer is the "payout," and the goal is to determine exactly how much each combination of words (operands, operators, and background text) contributes to that payout.
Methods
The core of this paper is the use of Harsanyi interactions, a concept from cooperative game theory.
- Disentangling the Output: The researchers break down the LLM's output score into a sum of effects from every possible subset of input words. This is mathematically "faithful," meaning the sum of these interactions perfectly reconstructs the model's output.
- Interaction Categorization: They classify these interactions into four types:
- Operand: Interactions between numbers (e.g., {2, 7}).
- Operator: Interactions between math symbols (e.g., {plus, minus}).
- Operand-Operator: The "meat" of the problem (e.g., {2, plus, 7}).
- Background: Everything else (e.g., {"What", "is"}).
- Focality Metric: They introduce a new metric to quantify which of these categories a model "focuses" on at different layers of its neural network.
- Order of Interaction: They distinguish between "low-order" (simple pairs of words) and "high-order" (complex relationships between many words) interactions.
Datasets
The authors used a set of hand-crafted arithmetic problems across two main categories:
- One-operator queries: Simple problems like "What is 5 plus 1?" using 6 different natural language templates.
- Two-operator queries: More complex problems like "What is the product of 3 plus 4 and 2?" using 29 different templates.
- Models Evaluated: They tested seven popular LLMs, including Llama-2-7B, Llemma-7B, MathCoder, and OPT-1.3B.
Key Insights and Ideas
- The "Aha!" Moment for Simple Math: For one-operator problems, the secret sauce is high-order operand-operator interactions. Strong models (like Llemma) show a massive spike in focus on these complex relationships in their later layers.
- Weak Models are Easily Distracted: Models that fail at math (like the base OPT-1.3B) spend most of their "energy" on background interactions. They essentially get stuck on the grammar of the question rather than the math itself.
- Complex Math Requires Different Logic: Solving two-operator problems requires a shift. The model must focus more on operator-only and operand-only interactions, likely to handle the order of operations before combining them.
- Explaining LoRA's "Forgetfulness": When fine-tuning a model for complex math using LoRA (Low-Rank Adaptation), the model's performance on simple math often drops. The researchers showed this happens because the model literally "forgets" how to encode the high-order interactions needed for simple problems while trying to learn the new patterns.
Key Results
- Performance Gap: Most base models are decent at 1-operator math (Llemma-7B hits ~75% accuracy) but abysmal at 2-operator math (dropping to ~15%).
- Fine-tuning Success: By fine-tuning OPT-1.3B, they boosted its 1-operator accuracy from a measly 3.2% to 83.6%.
- Layer-wise Evolution: Visualizations show that in early layers, all models look at background words. In successful models, the "focus" shifts dramatically toward math-heavy interactions as the data moves toward the output layer.
Limitations and Future Work
The biggest hurdle is computational cost. Because the number of possible interactions grows exponentially ($2^n$) with the number of input words, analyzing long, complex word problems is currently too expensive.
The authors suggest three ways forward:
- Informative Variable Selection: Only analyzing the most important words.
- Phrase-level Aggregation: Grouping words into meaningful chunks to reduce the number of "players" in the game.
- Approximation Methods: Using attention weights to prioritize which interactions to calculate.
Ultimately, this work moves us away from "trusting" LLM math and toward "understanding" exactly which logical circuits are firing—or failing—inside the model.
Summary updated