Abstract
Large Language Models (LLMs) frequently struggle with the multi-step quantitative reasoning required for university-level mathematics. This paper explores a transformative approach: re-framing mathematical questions as program synthesis tasks. By using OpenAI Codex to translate natural language linear algebra problems into executable Python code, researchers achieved 100% accuracy on datasets from MIT and Columbia University. This methodology leverages the logical rigor of programming and the precision of computational libraries like NumPy to bypass the reasoning failures typical of text-only models.
Introduction
While state-of-the-art LLMs excel at linguistic tasks, they often fail at basic mathematical operations and complex word problems. The core challenge lies in the "tree-like recursive memory" required to construct arithmetic expressions—a structure not natively optimized in standard Transformers. This research investigates whether STEM education can be automated by shifting the model's objective from direct answering to code generation.
Methodology: Interactive Program Synthesis
The researchers employed a technique termed Interactive Program Synthesis. This workflow transforms a static question into a dynamic computational task through three primary stages:
- Zero-Shot Prompting: A math question is fed into OpenAI Codex without providing previous examples.
- Execution: The model synthesizes Python code (utilizing NumPy or SymPy), which is then executed to generate a numerical answer or a visualization.
- Human-in-the-Loop Interaction: If the initial output is incomplete—such as a plot missing a specific marker—the user provides a natural language refinement to the prompt.
Datasets and Evaluation
The study evaluated the system using 60 problems randomly selected from two prestigious undergraduate courses:
- MIT 18.06: Problems from Gilbert Strang’s Introduction to Linear Algebra.
- Columbia COMS3251: Problems from the Computational Linear Algebra course.
To ensure the model was not simply recalling training data, the Columbia questions were selected from a course whose materials were not available online at the time of the study.
Key Results
The interactive program synthesis approach achieved a perfect 100% accuracy rate on both the MIT and Columbia datasets. In stark contrast, the text-only GPT-3 model achieved 0% accuracy on the same problems.
A significant finding was the efficiency of the interaction. The authors quantified the human effort by measuring the cosine similarity between the original question and the successful "working" prompt. The results showed that most problems required very little modification, with median similarities of 0.9 for Columbia and 0.8 for MIT.
Discussion and Future Work
The success of Codex suggests that training on code provides a "computational intuition" that enables models to handle complex logic more effectively than text-only training. Furthermore, the model demonstrated the ability to generate new mathematical content, potentially automating the creation of course materials.
Current limitations include the inability to process visual inputs (such as diagrams within a question) and difficulties with formal symbolic proofs. Future research aims to integrate multi-modal capabilities and automate the prompt refinement process using models like T5 to create a fully autonomous mathematical solver.
This work marks a significant milestone in STEM education, suggesting a future where technical grading and content generation are increasingly driven by program synthesis.
Summary updated