arXiv:2610.21477cs.AIOct 2026

Manuscript Offprint

arXiv:2610.21477

Tool-Augmented Large Language Models for Reliable Medical Calculation from Patient Notes

Yang Zhong, Ling Luo, Xuanlyu Zhu, Yanhua Wang, Yuanyuan Sun, Jian Wang, Hongfei Lin

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Yang Zhong 1^{1}, Ling Luo 1,∗^{1,*}, Xuanlyu Zhu 1^{1}, Yanhua Wang 2^{2}, Yuanyuan Sun 1^{1}, Jian Wang 1^{1}, Hongfei Lin 1^{1}

1^{1}College of Computer Science and Technology, Dalian University of Technology, Dalian, China

2^{2}Air Force Communications NCO Academy, Dalian, China

∗^{*}To whom correspondence should be addressed: lingluo@dlut.edu.cn

Abstract—Medical calculators translate raw patient observations into clinically actionable values and scores. However, applying these calculators directly to free-form patient notes requires precise variable extraction combined with the exact execution of complex formulas, scoring rules, and output conventions. Relying solely on direct large language model (LLM) prompting is unreliable in this context, as rule recall, parameter extraction, arithmetic reasoning, and formatting become entangled within a single generative step. To address these limitations, we propose a tool-augmented LLM framework for reliable medical calculation from patient notes. The framework retrieves and structures calculator specifications, generates reusable executable tools, and uses a constrained extractor to map each patient note to calculator-ready inputs. The tools then perform deterministic calculation, separating clinical language understanding from rule execution and arithmetic. Evaluated on the MedCalc-Bench dataset, our method achieves 86.73% final-answer accuracy, outperforming the one-shot prompting and supervised fine tuning-only baselines by 24.0 and 17.27 percentage points. Ablation and error analyses show that these performance gains are primarily driven by rule-grounded tool synthesis and schema-constrained extraction, whereas remaining failures are concentrated in clinical-semantic extraction and benchmark-specific output contracts. By grounding calculator logic in executable tools, the proposed approach alleviates arithmetic hallucinations and improves the computational reliability of the final clinical outputs.

Index Terms—Medical Calculation, Large Language models, Tool Augmentation, Parameter Extraction, Patient Notes

I. INTRODUCTION

Medical calculators convert patient observations into clinically meaningful values, risk scores, or treatment-relevant estimates. Clinicians use calculator resources such as MDCalc [1] to estimate renal function, stratify cardiovascular and thromboembolic risk, grade disease severity, estimate gestational age, and support medication dosing. However, performing these calculations manually can be time-consuming and prone to error, particularly in settings with limited clinical capacity. The projected global shortage of health workers further underscores the need for reliable methods that can reduce routine computational burden while preserving transparency and clinical oversight [2]. Automating medical calculations from free-form patient notes aims to provide reliable computational support in settings where clinician time is limited.

This task differs fundamentally from conventional medical question answering. A system must identify every variable required by the target calculator, including numerical measurements, categorical variables, Boolean criteria, dates, time intervals, and units. These variables may be expressed indirectly, distributed across a note, negated, or implied by diagnoses, medications, and clinical history. The system must then apply the appropriate formula, scoring rule, threshold, boundary condition, and output format. A missed risk factor, an incorrectly interpreted time window, or an improperly normalized unit can change the final result. Reliable medical calculation therefore requires both accurate clinical information extraction and deterministic rule execution, together with a trace that makes errors inspectable.

Large language models (LLMs) are promising interfaces for this task because they can interpret unstructured clinical text, follow instructions, generate structured representations, and interact with external tools. Nevertheless, direct prompting remains unreliable for medical calculation [3]. When formula recall, parameter extraction, mathematical arithmetic, and output formatting are entangled within a single generative step, a hallucinated formula or a minor arithmetic error can silently corrupt the final answer without revealing the source of failure. Prior work has sought to address these limitations through retrieval-augmented prompting, supervised or reinforcement learning, program synthesis, and tool-using agents. In particular, tool-augmented systems can improve numerical reliability by delegating arithmetic to validated calculators [4], [5]. However, existing approaches commonly rely on fixed, manually implemented calculator libraries, which limits coverage to calculators already available as tools. In addition, many systems still combine parameter extraction and calculation within the same reasoning loop, making it difficult to distinguish errors in clinical understanding from errors in calculator implementation or output formatting.

Taiyi demonstrates bilingual biomedical multitask adaptation through supervised fine-tuning [6]. A recent survey reviews collaboration between LLMs, symbolic solvers, and verifiers for mathematical problem solving [7].

To address these limitations, we propose a tool-augmented method that separates clinical language understanding from deterministic medical calculation. Our method first retrieves evidence for a target calculator and structures its specification, including required inputs, formulas or scoring rules, boundary conditions, and expected outputs. It then synthesizes a reusable executable calculator tool and validates the tool on examples from the same calculator, using execution feedback to identify and repair implementation errors. At inference time, a schema-constrained extraction model maps each patient note to calculator-ready structured inputs, and the tool performs the final computation deterministically.

Our contributions are as follows.

  • We propose a tool-augmented framework for medical calculation from patient notes that combines rule-grounded retrieval, on-demand executable tool synthesis with validation and repair, schema-constrained parameter extraction, and deterministic tool execution. This decoupled architecture effectively mitigates formula hallucinations and arithmetic errors, and supports tool construction beyond predefined tool libraries.

  • We establish a standardized evaluation on the corrected MedCalc-Bench benchmark using a unified data split and official metrics. We compare prompting baselines, multiple tool-writing systems, and extraction models under the same evaluation setting, avoiding comparisons aggregated across different benchmark versions.

• Experimental results show that the best configuration achieves 86.73% final-answer accuracy and a 97.47% parameter matching rate on 1,100 test cases, outperforming one-shot prompting baselines by 24.0 percentage points. Tool-level evaluation, extraction-model comparisons, category-level analyses, ablations, and case studies further characterize the sources of improvement and remaining errors.

The code for our framework is available online. 1^{1}

References (34)