TL;DR
The authors introduce RAG-Coding, a training-free, multi-agent framework that significantly improves LLM-based medical coding by grounding decisions in a structured Knowledge Graph of the ICD tabular list and distilled guideline summaries. To evaluate performance against modern clinical standards, they also release MDACE-2025, the first public dataset updated for the 2025 ICD-10 guidelines complete with code sequencing and expert justifications.
What Problem Does This Paper Address?
Medical coding—the process of translating messy clinical documentation into standardized alphanumeric codes (like ICD-10)—is the backbone of hospital billing, healthcare statistics, and policy. However, manual coding is notoriously slow, often leading to massive hospital backlogs.
While Large Language Models (LLMs) seem like a natural fit for automating this task, out-of-the-box models struggle. They are prone to hallucinations and fail to adhere to strict, complex coding rules. Furthermore, medical coding standards change annually, meaning an LLM's static internal knowledge quickly becomes obsolete. Existing automated methods and datasets have failed to keep pace, mostly relying on pre-2022 guidelines and omitting critical workflow steps like code sequencing (identifying the primary vs. secondary diagnosis).
Methods
The authors propose RAG-Coding, an agentic, training-free pipeline that breaks down the medical coding task into four sequential steps, each handled by a specialized LLM agent:
- Candidate Generator: Uses dynamic few-shot examples to extract an initial set of relevant ICD codes along with verbatim supporting evidence from the medical note.
- KG-Based Auditor: Validates these candidates against an ICD-10-CM Knowledge Graph (KG). The authors built this KG from the official tabular list to explicitly capture hierarchical (parent-child) and instructional relationships (e.g.,
excludes1,use_additional_code). - Guideline Summariser: Rather than feeding raw, multi-page narrative guidelines into the LLM, this agent navigates the guidelines' table of contents to retrieve and distill only the rules directly applicable to the validated codes into concise bullet points.
- Guideline-Based Auditor: Performs a final audit, cross-referencing the clinical note with the distilled guideline summaries to retain, remove, or replace codes.
Datasets
The paper evaluates its approach on two datasets:
- MDACE: A widely used, professionally re-annotated subset of the MIMIC-III dataset based on pre-2022 guidelines.
- MDACE-2025: A new benchmark introduced in this paper. The authors hired a certified medical coder to re-annotate the MDACE test set under the April 2025 ICD-10-CM/PCS guidelines, adding mandatory code sequencing and expert justification comments for complex decisions.
Key Insights and Ideas
- Structure Trumps Raw Text: Standard Retrieval-Augmented Generation (RAG) often treats medical references as flat text. RAG-Coding demonstrates that encoding the tabular list as a structural KG allows the model to accurately prune conflicting or redundant codes.
- Distillation Prevents Context Overwhelm: Official coding guidelines span over 100 pages. By dynamically navigating the table of contents and distilling rules into code-specific summaries, the framework prevents the LLM from getting lost in irrelevant context.
- LLMs Can't Fix Themselves "Closed-Book": Ablation studies confirmed that asking an LLM to self-correct its coding errors using only its internal parametric knowledge yields virtually zero performance gains. External structural knowledge is absolutely necessary.
Key Results
The authors evaluated RAG-Coding across five LLM backbones (including Deepseek-V3, Qwen3, and GPT-5).
- On the original MDACE dataset: RAG-Coding outperformed the best LLM baseline (CLH) by 3–13% in micro-F1 across all backbones. When compared to PLM-ICD (the supervised, BERT-based state-of-the-art), RAG-Coding achieved a +11% higher recall, showing a clear advantage in identifying rare codes.
- On the new MDACE-2025 dataset: Supervised models like PLM-ICD suffered from "guideline drift" because they were trained on older data. RAG-Coding (backed by GPT-5) easily adapted to the new rules, outperforming PLM-ICD by 8% in both micro- and macro-F1.
Limitations and Future Work
While highly effective, the paper notes a few limitations:
- Ontology Focus: The evaluation focused exclusively on ICD-10-CM (diagnoses). Although the MDACE-2025 dataset contains procedure codes (ICD-10-PCS), evaluating them was omitted due to baseline limitations.
- Language: The framework was only tested on English-language medical notes.
Future Directions: The authors plan to expand the annotation scope of MDACE-2025 and adapt the RAG-Coding framework to other clinical ontologies (like CPT and ICD-10-AM) as well as non-English languages.
Summary updated