Metraipolis › archive › dc_fae20a196cb3

Improving Medical Calculation of LLMs with Embedded Coding — arXiv:2609.31908

Source
arXiv (en)
Original
https://arxiv.org/abs/2609.31908
License (as archived)
CC0-1.0
Archived
2026-10-07T20:54:59.446Z
SHA-256 of the archived text
b1e0e52f9caaadaaad58841a6cab4b26a6efb019025b3cb37fe8a6c29edb1e76
Stable URL of this page
https://metraipolis.com/documento/dc_fae20a196cb3

How to cite

Improving Medical Calculation of LLMs with Embedded Coding — arXiv:2609.31908 — arXiv (en), https://arxiv.org/abs/2609.31908 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_fae20a196cb3 (Metraipolis archive dc_fae20a196cb3, sha256 b1e0e52f9caaadaaad58841a6cab4b26a6efb019025b3cb37fe8a6c29edb1e76)
BibTeX
@misc{dcfae20a196cb3,
  title = {Improving Medical Calculation of LLMs with Embedded Coding — arXiv:2609.31908},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2609.31908},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_fae20a196cb3; sha256 b1e0e52f9caaadaaad58841a6cab4b26a6efb019025b3cb37fe8a6c29edb1e76},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2609.31908. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

Large Language Models (LLMs) perform well on medical examinations and question-answering benchmarks, but remain unreliable on medical calculation tasks that require exact numerical outputs. These calculations support high-stakes decisions such as medication dosing, organ-function assessment, and prognostic scoring, for which even small errors can have serious clinical consequences. We introduce MedCode, a framework that improves medical calculation by training LLMs to generate embedded executable code. Given a clinical context, the model identifies the relevant calculator, extracts its input variables, and produces a script that delegates arithmetic operations to a deterministic interpreter. Executing the script returns the calculated value together with an explanation and the appropriate unit. We construct supervised fine-tuning (SFT) and preference datasets from the MedCalc benchmark and additionally curate a dataset for calculation tasks in Intensive Care Unit (ICU) scenarios. We further propose weighted Direct Preference Optimization (wDPO), which adaptively emphasizes preference pairs that are difficult for the model to distinguish. Experiments with LLaMA3-8B, Qwen2.5-7B, and Mistral-7B show absolute accuracy gains of 20--30 percentage points, demonstrating the effectiveness of embedded code generation for medical calculation.

Tema degli esploratori: agenti e intelligenza artificiale (retro-catalogo arXiv: annunci del 2026-09-29 in cs.AI).
Categorie arXiv: Artificial Intelligence (cs.AI) ; Computation and Language (cs.CL).
Pagina del lavoro: https://arxiv.org/abs/2609.31908 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-07T20:29:00.677Z dalla pagina https://arxiv.org/catchup/cs.AI/2026-09-29?abs=True (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).