Towards a Deterministic Math Solver for Clinical Language Models
Felipe Ocampo Osorio, Sebastián Andrés Cajas Ordoñez, Maximin Lange, Rafi Al Attrach, Sahil Kapadia, Zakaria Laouabdia Sellami, Angelo Antonio Talio, Leo Anthony Celi
MIT Critical Data · UNC Chapel Hill · University of Pavia · Humanitas University
Published September 9, 2026 · on the feed September 14, 2026 · ▲ 2 · arXiv 2609.10728
The abstract
Large language models are unreliable at arithmetic, which is a problem for clinical calculators where a single numerical error changes the recommendation. The standard response is to hardcode each calculator as a validated function, one at a time. We test an alternative: the model does not calculate. Instead, it writes case-specific Python that a restricted local executor runs as a deterministic solver, and the model's task reduces to deciding how to use it. We evaluate this Program-Solve interface on MedCalc-Bench Verified (1,100 cases, 55 calculators) against direct model arithmetic and a hand-written 22-calculator library, using Qwen2.5-7B and Qwen2.5-32B-AWQ, after auditing the benchmark's formulas against current clinical guidelines and flagging 16 of 55 with version, use or coefficient concerns. With formulas and gold variables supplied and both routes reading the whole note, handing off to the solver is not a reliable advantage at 7B (75.31% against 72.02%, a paired +3.29 points with a 95% calculator-cluster interval of [-3.49, 10.38]) but is one at 32B (90.53% against 83.47%, +7.05 [0.47, 14.60], clear of zero). The hand-written library is exact on its 440 supported cases but abstains elsewhere (40.0% overall). Adding an executor thus helps some open-weight models more than others even under matched formula, variable and note access, and is not a substitute for verified formulas or reliable variable extraction either way.
The Brief
2:38A short podcast summary of the paper. Written and voiced by AI.
Transcript
Towards a Deterministic Math Solver for Clinical Language Models. By Felipe Ocampo Osorio and seven others, from MIT Critical Data, the University of North Carolina at Chapel Hill, and two other institutions. Published on the ninth of September. Its code repository is worked out: about one hundred and forty source files, with a readme.
Large language models are unreliable at arithmetic, and in a clinical calculator a single numerical error changes the recommendation. The standard response is to hardcode each calculator as a validated function, one at a time. This study tests an alternative in which the model does not calculate at all. It writes case-specific Python, a restricted local executor runs that code as a deterministic solver, and the model's task reduces to deciding how to use it. The claim that emerges is conditional. Handing the arithmetic to an executor helps some open-weight models more than others, even when access to formulas, variables and the note is matched.
This Program-Solve interface was evaluated on MedCalc-Bench Verified, which has one thousand one hundred cases across fifty-five calculators. It was compared with direct model arithmetic and with a hand-written library covering twenty-two calculators, using Qwen2.5-7B and Qwen2.5-32B-AWQ. First, though, the authors audited the benchmark's formulas against current clinical guidelines, and flagged sixteen of the fifty-five for concerns about version, use or coefficients.
With formulas and gold variables supplied, and both routes reading the whole note, the solver is not a reliable advantage for the seven billion model. It scores seventy-five point three one percent against seventy-two point zero two. The paired gain is three point two nine points, and its ninety-five percent calculator-cluster interval runs from minus three point four nine up to ten point three eight, so it includes zero.
At thirty-two billion the advantage holds. The solver scores ninety point five three percent against eighty-three point four seven, a gain of seven point zero five points, with an interval from zero point four seven to fourteen point six, clear of zero. The hand-written library, meanwhile, is exact on the four hundred and forty cases it supports, but abstains everywhere else, which leaves it at forty percent overall.
These results come from matched access to formulas, variables and the note, on one verified benchmark, with two Qwen models. And whichever route is taken, an executor is not a substitute for verified formulas, or for reliable extraction of variables from the note.
Taking the arithmetic away from the model moves the risk rather than removing it. What remains is whether the model sets the problem up correctly, and whether the formula it sets up is the right one to begin with, which is why the audit of the benchmark's own formulas sits beside the results.
Paper Quest · 7 chapters · about 39 min
Play this paper
Learn it by doing: make the calls the authors made, guess the result before you see it, and defend it in a viva graded on your own words. Chapter 1 is right here.
Chapter 1 🧩 · The problem
One slipped digit, one wrong recommendation. Here is the wall.
You build a tool that reads a clinical note and computes a clinical calculator score. Your language model slips on arithmetic often enough, and a single numerical error changes the recommendation.
The road ahead
- 1 · The problem ~6 min Language models slip on arithmetic, and in a clinical calculator one wrong number changes the advice, while hand-written calculators leave every uncovered case unanswered.
- 2 · What came before ~3 min
- 3 · The key idea ~8 min The model stops calculating: it writes a short case-specific Python program, and a restricted local executor runs it to produce the answer.
- 4 · Choose your own research ~3 min
- 5 · Build the method ~8 min Give the model the formula and gold variables with the note, have it write case-specific Python, then run that program in a restricted local executor.
- 6 · The experiment ~6 min You’ll guess: With formulas and gold variables supplied and the whole note read, did handing arithmetic to the solver give a reliable advantage for Qwen2.5-7B and Qwen2.5-32B-AWQ?
- 7 · The viva ~5 min Three questions from the examiners, answered in your own words. Win it for the paper’s trophy.
Free, with Google or an email address. Your stars and progress are kept.