# Researchers propose MedCode to boost LLMs’ medical calculation accuracy by 20–30%

Digest AI · Research · published 2026-09-29T04:00:00Z

Canonical: https://digestai.news/story/researchers-propose-medcode-to-boost-llms-medical-calculation-accuracy

## Summary

A new framework called MedCode aims to improve large language models’ ability to perform precise medical calculations. Current LLMs struggle with tasks requiring exact numerical outputs, such as medication dosing or organ-function assessments, where errors can have severe consequences. MedCode trains models to generate embedded, executable code for calculations, delegating arithmetic to a deterministic interpreter for accurate results with explanations and units.

The approach uses supervised fine-tuning and preference datasets from the MedCalc benchmark and ICU scenarios. Researchers also introduce weighted Direct Preference Optimization (wDPO) to prioritize harder-to-distinguish preference pairs. Testing on LLaMA3-8B, Qwen2.5-7B, and Mistral-7B shows absolute accuracy gains of 20–30 percentage points, suggesting embedded code generation significantly improves reliability in medical calculations.

## Key points

- MedCode framework embeds executable code in LLMs for medical calculations, improving accuracy by 20–30% on benchmarks
- Tests on LLaMA3-8B, Qwen2.5-7B, and Mistral-7B show gains in MedCalc and ICU scenario datasets
- Weighted Direct Preference Optimization (wDPO) adapts to emphasize difficult-to-distinguish medical calculation tasks

## Why it matters

More accurate medical calculations from LLMs could reduce errors in high-stakes clinical decisions like dosing and organ-function scoring, potentially saving lives and improving patient outcomes.

## Sources

1. [Improving Medical Calculation of LLMs with Embedded Coding](https://arxiv.org/abs/2609.31908) (arXiv cs.AI, 2026-09-29, primary source)

## Cite

Digest AI, "Researchers propose MedCode to boost LLMs’ medical calculation accuracy by 20–30%", 29 September 2026, https://digestai.news/story/researchers-propose-medcode-to-boost-llms-medical-calculation-accuracy

---

Written by Digest AI's editorial model from the linked sources; the sources are the record. Headlines, digests and key points are written by Digest AI and may be quoted with a link to the story page. Linked articles belong to their publishers. Terms: https://digestai.news/terms#reuse
JSON: https://digestai.news/story/researchers-propose-medcode-to-boost-llms-medical-calculation-accuracy.json
