Evaluating SageMath-Augmented LLM Agents for Computational and Experimental Mathematics
This paper proposes and evaluates a ReAct-style agentic framework that integrates Large Language Models with SageMath and up-to-date documentation, demonstrating that such CAS-augmented agents significantly improve performance on research-level mathematical problems from the RealMath benchmark while narrowing the gap between open-weight and closed models.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Idea: Giving Math Robots a Calculator
Imagine you have a brilliant but sometimes forgetful student (the AI) who is trying to solve very hard, research-level math problems. This student is great at reading and thinking, but they often make calculation errors or get stuck because they don't have the right tools.
For a long time, researchers have been teaching these AI students how to write formal proofs (like writing a legal contract for a math fact). But this paper asks a different question: What happens if we give the AI a powerful, real-world calculator (called SageMath) and let it run experiments?
The researchers set up a "lab" where the AI can:
- Think about a problem.
- Write a computer code to test a guess.
- Run that code in a safe, isolated sandbox.
- See the result, realize if it was wrong, and try again.
They call this a "ReAct" loop (Reason + Act). It's like a detective who doesn't just guess who the culprit is, but actually goes out, checks the alibis, and comes back with evidence.
The Experiment: 15 Students, 133 Problems
The team tested 15 different "frontier" AI models (the smartest ones available) on 133 real math problems taken from recent research papers. They tested them in two ways:
- The "Brain Only" Mode: The AI had to solve the problem using only its internal knowledge, like a student taking a test without a calculator.
- The "Tool-User" Mode: The AI could use the SageMath calculator and a documentation helper (Context7) to run code and check its work.
The Results: Tools Make Everyone Better (But Some More Than Others)
The findings were clear: Giving the AI a calculator helped every single model solve more problems. On average, the success rate jumped by nearly 10 percentage points.
Here are the key takeaways, explained simply:
1. The "Underdog" Effect
The AI models that were weaker at math to begin with (the "open-weight" models) improved the most. It's like giving a calculator to a student who struggles with arithmetic; their grades skyrocket because the tool fixes their biggest weakness.
- Example: One model, Qwen, went from solving 42% of problems to 70%—a massive jump of nearly 28 points.
- The top-tier models (like GPT-5.5) were already good, so they improved less (from 67% to 75%), but they still ended up being the best overall.
2. The Efficiency Paradox
You might think that using a calculator makes you faster or uses less energy. Not necessarily here.
- Some models used the tool so much they got "stuck in the weeds," running thousands of lines of code and using huge amounts of computing power (tokens) just to get a slightly better answer.
- GPT-5.5 was the most efficient "athlete." It solved the most problems (75.2%) while using the least amount of computing power. It knew exactly when to use the tool and when to stop.
3. The "Two-Mode" Behavior
The researchers noticed a funny pattern in how the AI used the tool. The AI's behavior was bimodal (two distinct modes):
- Mode A (The Experts): Strong models would think for a bit, use the calculator just once or twice to verify their answer, and then finish. They used the tool like a spell-checker.
- Mode B (The Strugglers): Weaker models would use the calculator over and over again, trying to brute-force a solution. They would run out of time or memory, often failing because they were trying to compute their way to an answer instead of thinking first.
4. The "Hallucination" Fix
AI models often make up facts about how to use software (like inventing a function that doesn't exist). The researchers added a "documentation tool" (Context7) to help the AI look up the correct instructions.
- Result: Most models didn't actually use this tool much. The top models already knew the software well. The weaker models tried to use it but often still made mistakes.
A Real-World Example: The Knot Detective
The paper includes a case study where the AI had to solve a problem about "twisted torus knots" (a complex shape in math).
- The Old Way: The AI would have to guess the formula based on memory.
- The New Way: The AI used the calculator to draw small versions of the knot, measure them, and look for a pattern. It noticed that as the knot got bigger, a specific number grew in a predictable way. It used this pattern to guess the final formula.
- The Outcome: The AI didn't just "know" the answer; it discovered it through a mini-experiment, just like a human mathematician would.
The Bottom Line
This paper proves that for complex math, AI shouldn't just be a "thinker"; it needs to be an "experimenter."
When you give an AI access to a reliable computer algebra system (SageMath), it stops guessing and starts verifying. This turns the AI from a confident guesser into a careful researcher. While the best models were already good, this tool helps the weaker ones catch up, narrowing the gap between the "cheap" open-source models and the expensive, closed ones.
The authors conclude that this is a major step toward automated discovery, where AI agents can not only solve known problems but potentially help humans find new mathematical truths by running endless, reliable experiments.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.