Abstract
Researchers from MIT have introduced MathDSL, a domain-specific language that allows program synthesis models to solve linear equations with higher accuracy and significantly more "conciseness" than state-of-the-art reinforcement learning. By leveraging the DreamCoder framework to learn reusable mathematical abstractions, the system produces human-like solution steps while requiring orders of magnitude less training data than previous methods.
Introduction
While Large Language Models (LLMs) are impressive, they often stumble on symbolic reasoning tasks like algebra, frequently requiring expensive "chain-of-thought" prompting or massive datasets. Existing specialized solvers often rely on Reinforcement Learning (RL). However, RL agents, such as the previous state-of-the-art ConPoLe, tend to produce "unwieldy" solutions, often taking dozens of steps for simple equations and including redundant operations. Furthermore, these RL models typically require millions of training examples. This research introduces MathDSL to make mathematical AI both more data-efficient and more interpretable by treating equation solving as a program synthesis problem.
Methods
The authors shift the problem from "choosing the next move" (RL) to "writing a program that solves the equation" (Program Synthesis).
MathDSL and Abstraction Learning
MathDSL is designed specifically for algebraic manipulation, featuring primitives for tree operations (e.g., rotations), arithmetic operations (e.g., dividing both sides), and index operations for subtree targeting. The system utilizes the DreamCoder framework, employing a "wake-sleep" algorithm. During the "wake" phase, the system attempts to solve equations. During the "sleep" phase, it uses the Stitch algorithm to identify common patterns in successful solutions and compress them into new, higher-level library functions.
Evaluation Metrics and Dataset
To quantify "elegance," the authors developed a "C-Score" based on the size of the equation's Abstract Syntax Tree (AST) at each step, rewarding solutions that simplify the equation quickly. The study utilized 284 unique equation types from the Cognitive Tutor Algebra dataset. 198 templates were used for training, and 86 were held out for testing.
Results
MathDSL + DreamCoder achieved a 90.70% test accuracy, outperforming RL-based models like ConPoLe (83.72%) and Lemma (84.88%).
Solutions generated by MathDSL were, on average, 48.59% more concise than those from ConPoLe. This efficiency is visually evident when comparing the solution paths for a sample equation.
A key finding is the extreme data efficiency of the approach: while RL models often require ~10^6 equations to reach high performance, MathDSL achieved superior results using only 198 equation templates. The design of the DSL itself proved crucial; forcing the model to use more limited action spaces resulted in significant performance drops.
Conclusion and Future Work
MathDSL demonstrates that combining program synthesis with a well-designed domain-specific language can produce more accurate and human-like mathematical solutions than traditional RL. However, the current conciseness metric may occasionally encourage "large jumps" in logic that could be too fast for a student. Future work will focus on refining the metric to balance conciseness with pedagogical clarity and expanding the DSL to more complex domains like calculus.
Summary updated