TL;DR
This paper introduces a novel approach to solving math word problems by combining Large Language Models (LLMs) with symbolic solvers. By having LLMs incrementally formalize problems into declarative equations, rather than procedural code, they achieve significantly better performance on challenging algebra problems, outperforming existing methods by 20%.
What Problem Does This Paper Address?
Solving math word problems is a crucial skill, and automatically generating step-by-step solutions could revolutionize educational support. While LLMs have shown promise, they often struggle with arithmetic and complex reasoning. Existing methods like Program-Aided Language (PAL) models, which generate Python code, are effective for procedural problems but falter when problems require more abstract, declarative reasoning. This paper tackles the challenge of enabling LLMs to handle these more complex, declarative math problems by integrating them with symbolic solvers.
Methods
The core of this work is the DECLARATIVE prompting method. Instead of asking an LLM to generate a sequence of computational steps (like PAL), this approach guides the LLM to:
- Incrementally Formalize: The LLM breaks down the word problem into a series of natural language statements that introduce variables and define equations. This is done using few-shot prompting with carefully crafted examples.
- Declarative Representation: The LLM expresses relationships between quantities using variables and equations, rather than directly writing executable code. This allows for representing abstract mathematical declarations, even when some variables are initially unknown.
- External Symbolic Solver: The generated set of equations is then passed to an external symbolic solver (SymPy in this case) to perform the actual calculations and derive the final answer. This offloads the arithmetic burden from the LLM and ensures accuracy.
The authors also experimented with variations, including adding a list of principles to guide the LLM's formalization and comparing incremental vs. one-step formalization.
Datasets
- GSM8K: A benchmark dataset of 1319 grade-school level math word problems.
- ALGEBRA: A newly curated dataset of 222 word problems extracted from open-access Algebra textbooks. This dataset is designed to be more challenging than GSM8K, covering topics up to systems of equations but excluding geometry and inequalities.
Key Insights and Ideas
- Declarative vs. Procedural Reasoning: The paper strongly advocates for declarative formalization (variables and equations) over procedural code generation for complex math problems. Declarative representations are more natural for expressing the underlying mathematical relationships, especially when they aren't immediately obvious computational steps.
- Incremental Formalization is Key: Breaking down a problem into smaller, incremental steps of variable and equation definition, rather than trying to solve it in a single step, significantly improves performance. This mirrors how humans often approach complex problems.
- LLMs + Symbolic Solvers = Powerful Combination: Offloading calculations to a robust symbolic solver is crucial for accuracy, preventing LLMs from making arithmetic errors. The LLM's strength lies in understanding and formalizing the problem, while the solver handles the computation.
- New Benchmark for Harder Problems: The ALGEBRA dataset is a valuable contribution, providing a more rigorous testbed for evaluating LLM capabilities on problems that go beyond simple arithmetic.
Key Results
- On the GSM8K benchmark, the proposed
DECLARATIVE3-shot + principles + SymPymethod achieved performance comparable to the original 8-shot PAL. - Crucially, on the new ALGEBRA dataset, the
DECLARATIVE3-shot + principles + SymPyapproach outperformed PAL by an absolute 20%, achieving 76.3% accuracy. This highlights the advantage of declarative reasoning for harder problems. - Simply asking the LLM to solve the equations directly (without a symbolic solver) resulted in a dramatic drop in accuracy (from 69.4% to 22.4% on GSM8K).
- The non-incremental version (
ONE-STEP DECLARATIVE3-shot + SymPy) performed significantly worse than the incremental version, underscoring the benefit of step-by-step formalization.
Limitations and Future Work
- LLM Dependence: While the symbolic solver ensures arithmetic accuracy, the LLM's ability to correctly formalize the problem remains a bottleneck. Errors in formalization will lead to incorrect solutions.
- Prompt Engineering: The performance is sensitive to the prompt design and the quality of few-shot examples.
- Future Work: The authors suggest that this approach is particularly well-suited for educational tools, as it can help students break down complex problems into manageable, declarative pieces. Further research could explore more sophisticated ways to guide LLMs in formalization and potentially extend this to other domains requiring symbolic reasoning.
Summary updated