← Back to Blog
RAG Systems

Why LLMs Fail at Math and How RAG-Powered Agents Could Bridge the Gap

October 10, 2026
Armor Tech
7 min read
Why LLMs Fail at Math and How RAG-Powered Agents Could Bridge the Gap

OpenAI's recent math proof release exposes critical gaps in LLM mathematical reasoning — formalization errors, missing human understanding, and proprietary black boxes. This article examines those failures and explores how retrieval-augmented generation (RAG) agents might provide verifiable, auditab

The OpenAI Math Release: What Went Wrong

OpenAI's October 2026 release of 719 mathematical proofs exposed the gap between benchmark performance and mathematical rigor. The company consulted the Advisory Group on Mathematics and Artificial Intelligence (AGMAI) — nine prominent researchers hosted by the Institute for Advanced Study — but fell short of the group's guidelines in ways that matter for anyone building AI systems that touch formal reasoning.

The failures are specific and documented: only 10 of 719 manuscripts included chain-of-thought traces. Just 42% of proofs had been formalized in Lean, the proof assistant that compiles mathematical arguments into verifiable code. A Cambridge/King's College paper found at least two discrepancies between natural-language proofs and their Lean translations for a Navier-Stokes-derived problem — silent mistranslations that neither invalidate nor confirm the result, but make trust impossible without human audit. AGMAI's first principle — stop testing advanced problems on proprietary models — was explicitly violated; OpenAI evaluated its closed models on open research problems.

Why LLMs Stumble on Mathematical Reasoning

The structural problem isn't model scale — it's the mismatch between probabilistic token prediction and deductive certainty. LLMs generate plausible-sounding natural-language proofs that may not map to valid formal code. Autoformalization — the step that translates natural language into Lean, Isabelle, or Coq — introduces silent errors because the model has no built-in mechanism to verify its own translation against a trusted mathematical corpus.

Consider what happens during autoformalization: the model produces a natural-language argument, then attempts to express it in a proof assistant. The Cambridge/King's College paper documents how this translation can diverge in subtle ways — a hypothesis stated informally might be formalized with different quantifier scope, or a "clearly" step might hide a non-trivial lemma that doesn't exist in the target library. The model cannot catch these because it doesn't execute the formal code; it only predicts tokens that look like formal code.

Human understanding is absent at the point of release. As Harvard mathematician Melanie Wood told TechCrunch: "there is not human understanding of them at the point of release, and now the work begins." This violates the mathematical community's norms: when humans discover results, they take responsibility through papers, talks, and seminars. AI-generated proofs skip this entirely.

What AGMAI's Standards Reveal About Trustworthy Math AI

AGMAI's guidelines translate into concrete technical requirements for any system claiming mathematical capability:

  • Open, reproducible evaluation: No proprietary model testing on research problems. Benchmarks must be runnable by the community.
  • Correlated artifacts with metadata: Machine-readable links between natural-language steps and formal terms — not just two separate files.
  • Funded human verification: Budget for mathematicians to verify, extend, and teach AI-generated results.
  • Collaborator, not autonomous solver: AI as a research assistant that surfaces prior art and suggests formalization paths, with humans retaining responsibility.

These aren't abstract principles — they're architectural constraints. A system that cannot emit correlated NL-formal pairs with provenance fails the metadata requirement. A system that only works behind an API fails the reproducibility requirement. A system with no human-in-the-loop checkpoints fails the collaborator requirement.

How RAG-Powered Agents Could Address Each Gap

Retrieval-augmented generation (RAG) agents — grounded in curated formal libraries and equipped with verification tooling — offer a conceptual framework for addressing the failures above. This is an architectural hypothesis, not a proven result; the research text does not discuss RAG or agents. But mapping capabilities to gaps clarifies what a trustworthy system would need.

Failure ModeRAG/Agent Response (Conceptual)
Autoformalization mistranslations Retrieve relevant lemmas from Mathlib/Isabelle before generating formal code; ground each step in verified theorems
No self-verification against trusted corpus Verifier agent compiles Lean snippets in sandbox, returns type-check errors, forces regeneration
Missing NL-formal correlation metadata Agentic pipeline logs every NL-formal pair with provenance IDs for audit trails
Human understanding absent at release Human-in-the-loop checkpoints at formalization, verification, and export stages
Proprietary opacity Open-weight models or at minimum evaluable on open benchmarks with reproducible retrieval

The key shift: instead of generating a proof end-to-end and hoping the formalization matches, a RAG agent retrieves from versioned formal libraries before and during generation. Each natural-language claim is backed by a cited lemma. Each formal step is type-checked before the next is emitted. The audit trail emerges from the pipeline structure, not as an afterthought.

Design Patterns for Verifiable Math Agents

For architects building or evaluating such systems, four patterns emerge from the failure analysis:

Retrieve-Then-Prove

Before attempting a proof sketch, the agent queries a curated formal library (Mathlib for Lean, AFP for Isabelle, MathComp for Coq) for relevant definitions, lemmas, and tactics. The retrieved context constrains generation — the model cannot invent a lemma that doesn't exist without flagging it as a sorry (Lean's admission of an unproven step). This reduces hallucinated formalization.

Proof-Sketch Validation

A verifier agent runs in a sandbox: it takes the generated Lean/Isabelle snippet, compiles it, and returns type errors or sorry counts. The generator agent receives this feedback and iterates. This is not "chain of thought" in the LLM sense — it's a compilation loop with a real type checker.

Counterexample Search via Symbolic Tools

For conjectures, the agent can invoke symbolic computation (SageMath, Mathematica via API, or custom decision procedures) to search for counterexamples before committing to a proof direction. Negative results prune the search space.

Citation-Backed Generation with CI/CD Integration

Every emitted natural-language step carries a citation to a formal term ID. The full artifact — NL text, formal code, retrieval logs, verification logs — exports as a package that plugs into CI/CD pipelines. Mathematical artifacts are tested like code: on every commit, the formal library compiles; on every release, the NL-formal correlation is validated.

RAG pipeline architecture for STEM workloads implements these patterns with production-grade retrieval, sandboxed verification, and audit logging.

Operationalizing Human-AI Collaboration in Mathematics

The sociotechnical requirement is as important as the technical one. AGMAI emphasizes that mathematical work begins at release — papers, talks, seminars, teaching. A RAG agent that fits this workflow looks different from one that optimizes for benchmark scores:

  • Research assistant mode: The agent surfaces prior art, suggests formalization paths, and drafts proof sketches that a mathematician extends or redirects.
  • Exportable artifacts: Proof outputs render as LaTeX for papers, as Lean/Isabelle source for repositories, as interactive notebooks for teaching — not as opaque model outputs.
  • Audit logs for reproducibility: Journals and conferences increasingly demand computational reproducibility. The agent's provenance trail (retrieval queries, verification results, human checkpoints) becomes part of the submission.
  • Built-in verification budget: Project economics must allocate mathematician time for verification. An agent that produces 1000 proofs with zero human review creates technical debt, not knowledge.

Terence Tao's critique cuts to the core: "Problems are being solved autonomously by AI prompters who have no interest in the broader field itself once their initial target is 'solved', and do not understand the AI output well enough to answer questions on the result, give talks, or otherwise interact with the rest of the field." Any system that enables this pattern fails the collaborator test.

Evaluating Math-Capable RAG Systems: A Checklist for Buyers

Founders and CTOs assessing vendors or building in-house should demand evidence on four dimensions:

  1. Auditable, versioned formal libraries: Does the system retrieve from Mathlib/AFP/MathComp with pinned versions? Can you inspect the retrieval index? If the library updates, does the system re-evaluate?
  2. Machine-readable NL-formal correlations: Can the system emit structured metadata linking each natural-language claim to a formal term ID? Is this queryable, or buried in logs?
  3. Open evaluation: Is the model open-weight, or at minimum evaluable on open benchmarks (MiniF2F, ProofNet, etc.) with reproducible retrieval? Proprietary APIs with undisclosed training data are a structural barrier to trust.
  4. Human verification as first-class workflow: Are checkpoints (formalization review, proof sketch approval, final audit) built into the UI/API, or bolted on as "human review" after generation?

If a vendor cannot demonstrate these, they are selling benchmark performance — not mathematical reasoning that mathematicians can trust.

Custom agentic AI development teams can help implement these evaluation criteria in procurement or internal builds.

Frequently Asked Questions

Can RAG eliminate autoformalization errors entirely?

No. Retrieval grounds generation in verified lemmas, and sandboxed verification catches type errors, but the natural-language-to-formal translation step still requires human judgment for ambiguous or novel concepts. RAG reduces the error surface; it doesn't remove the need for human audit.

Why not just use a larger model with better chain-of-thought?

Chain-of-thought improves natural-language reasoning coherence, but it does not provide formal verification. A model can produce a perfectly coherent natural-language proof that formalizes incorrectly — the Cambridge/King's College paper demonstrates this. Verification requires a type checker, not more tokens.

What's the minimal viable RAG setup for mathematical reasoning?

At minimum: a versioned formal library (Mathlib/AFP), a retriever that returns relevant lemmas with citations, a generator that emits formal code with sorry tracking, a verifier that compiles and returns errors, and a logging layer that correlates NL steps to formal terms. Everything else (counterexample search, CI/CD integration, teaching exports) builds on this core.

Related reading