Instruction-tuning large language models with medical classification data improves ICD coding of German tumor diagnoses
Open Access
- 23 October 2026
- journal article
- research article
- Published by Springer Nature in Scientific Reports
- Vol. 16 (1) , 34059
Abstract
Accurate coding of tumor diagnoses, with the German Modification of the International Classification of Diseases, 10th Revision (ICD-10-GM), and the International Classification of Diseases for Oncology, Third Edition (ICD-O-3), is essential for structured cancer documentation. Large language models (LLMs) offer opportunities for automating such tasks, but locally deployable, open-weight models often lack sufficient domain-specific coding expertise. This study investigates whether instruction-based fine-tuning on public classification resources improves the coding accuracy of open-weight LLMs for German tumor diagnosis texts. Eight models from the Qwen, Llama, and Mistral families (7–70 billion parameters) were fine-tuned on over 500,000 question-answer pairs based on the ICD-10-GM, ICD-O-3, and German procedure classification. The evaluation uses coded diagnoses from the local tumor documentation system as test data. ICD-10-GM accuracy rose from 1.4 to 24 to 41–58%, and partial (three-character codes only) accuracy from 31 to 74 to 73–83%. The accuracy of ICD-O-3 topography coding also improved but started and remained considerably lower. Malformed code outputs dropped to nearly 0% for almost all models. Tumor-diagnosis recognition reached 99%. A data quality analysis showed that incomplete diagnosis descriptions limited achievable test performance. Accuracy correlated positively with model size, but gaps between small and large models narrowed after fine-tuning. The reasoning mode in Qwen3 generally yielded lower performance than fine-tuning and was over 100 times slower. Our findings highlight the potential of leveraging public catalogues to build instruction datasets that improve LLMs in medical documentation tasks. To support reproducibility and further research, we publicly release the complete training dataset and the best-performing fine-tuned model checkpoints.Keywords
Funding Information
- Federal Ministry of Research, Technology and Space (BMFTR) in Germany (01ZZ2106A)
This publication has 20 references indexed in Scilit:
- A study of large language models for patient information extraction: Model architecture, fine-tuning strategy, and multi-task instruction tuningJournal of Biomedical Informatics, 2026
- Information extraction from clinical notes: are we ready to switch to large language models?Journal of the American Medical Informatics Association, 2026
- A multimodal dataset for precision oncology in head and neck cancerNature Communications, 2025
- Exploring the effectiveness of instruction tuning in biomedical language processingArtificial Intelligence in Medicine, 2024
- Assessing Retrieval-Augmented Large Language Model Performance in Emergency Department ICD-10-CM Coding Compared to Human CodersmedRxiv, 2024
- Privacy-preserving large language models for structured medical information retrievalnpj Digital Medicine, 2024
- Large Language Models Are Poor Medical Coders — Benchmarking of Medical Code QueryingNEJM AI, 2024
- Der einheitliche onkologische Basisdatensatz (oBDS)Forum, 2024
- Automatic inference of ICD-10 codes from German ophthalmologic physicians’ letters using natural language processingScientific Reports, 2024
- From Text to Tables: A Local Privacy Preserving Large Language Model for Structured Information Retrieval from Medical DocumentsmedRxiv, 2023