Design and implementation of an intelligent ICD coding system using large language model
This paper presents an intelligent ICD coding system that integrates the Qwen3.6-35B-A3B large language model with a multi-agent collaborative framework and Retrieval-Augmented Generation (RAG) to automate precise, interpretable, and human-like diagnostic and procedural coding in ophthalmology, achieving high accuracy in both code assignment and principal diagnosis/procedure identification.
Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Every time a patient leaves a hospital, a specialized professional translates the story of their illness into a universal language of numbers and letters. This system, known as the International Classification of Diseases, or ICD, acts as the global standard for health records. It turns complex medical notes about a broken bone or a heart condition into standardized codes that insurance companies, researchers, and hospitals use to track health trends and determine payment. For decades, this translation has been done by hand. Human coders read through pages of handwritten notes, lab results, and surgeon reports, searching for the exact code that matches the patient's condition. It is a tedious, high-stakes job where a single mistake can lead to financial loss or skewed data. As hospitals generate more data than ever before, the old method of reading every line manually is becoming too slow and prone to error.
Researchers at Daping Hospital in China have built a new kind of assistant to help with this heavy lifting. They created an intelligent system that uses a powerful computer brain, known as a large language model, to read medical records and suggest the correct codes. However, they did not simply ask the computer to guess the answer. Instead, they designed the system to mimic the careful, step-by-step workflow of a human expert. The computer does not just spit out a list of codes; it acts like a team of specialists who check each other's work, look up rules in a digital encyclopedia, and verify that every decision is backed by evidence from the patient's file. This approach aims to make the coding process faster and more accurate while keeping a human in the loop to handle the most difficult cases.
The team tested their system using real medical records from an eye hospital in Chongqing. They gathered data from over 6,000 patients admitted between January and June of 2026, focusing specifically on eye diseases and eye surgeries. From this large group, they selected 1,200 records to study in detail, ensuring that the sample included both common conditions and rare, complex cases. The goal was to see if the computer could match the accuracy of the human coders who had already processed these files. The system was tasked with two main jobs: assigning codes for the patient's diagnosis and assigning codes for the procedures performed, such as cataract surgery or laser treatments.
To understand how the system works, imagine a librarian who must find a specific book in a massive library. Instead of guessing the title, the librarian first reads the request, then checks a card catalog to find the right section, and finally pulls the exact book to confirm the details. The researchers built their system to follow a similar path. First, a central computer reads the entire patient record, which might include admission notes, lab results, and discharge summaries. It breaks this long text into smaller, manageable pieces of information. Then, a team of digital agents takes over. One agent looks for specific medical terms and matches them against a structured database of official codes. Another agent checks the rules to ensure that certain codes cannot be used together or that a specific code requires a companion code. A third agent decides which condition is the main reason for the hospital stay, a critical step that determines how the patient is billed. Finally, a quality control agent reviews the final list, flagging any code that seems uncertain or violates a rule, sending it to a human for a second look.
The results of this test were promising. When the system assigned codes for eye diseases, it matched the human experts' choices with high accuracy. For the most specific level of detail, the system was correct about 92% of the time. It successfully identified the main reason a patient was admitted in more than 90% of the cases. The system performed even better at the broader levels of classification, such as identifying the general category of an eye disease, where it was correct nearly 97% of the time. However, the system found the procedure codes slightly more challenging. While it was still very good, its accuracy for surgical procedures was lower than for diagnoses, with a success rate of about 85% for the most specific codes. This gap suggests that describing exactly how a surgery was performed is harder for a computer to pin down than describing a disease.
One of the most important findings was how the system handled rare conditions. The researchers found that the system was excellent at coding common diseases that appear frequently in the records. However, for very rare codes that appeared only a handful of times, the system struggled more, sometimes missing the correct code or suggesting a wrong one. This is a known challenge in medical coding, as there is less data to learn from for rare events. The system also made a specific type of error: it tended to suggest too many codes rather than too few. In other words, it was more likely to include a code that wasn't strictly necessary than to leave out a necessary one. This is a safer mistake in a medical setting, as it ensures nothing is missed, though it still requires a human to clean up the list.
The researchers emphasized that this system is not designed to replace human coders entirely. Instead, it serves as a powerful assistant that does the heavy lifting of reading and initial sorting. The system is built to be transparent; for every code it suggests, it points to the exact sentence in the medical record that led to that decision. If the system is unsure, it flags the case for a human expert to review. This "human-in-the-loop" design ensures that the final output is reliable. The study showed that by combining the speed of artificial intelligence with the judgment of human experts, hospitals can achieve a level of coding quality that is both efficient and precise. The system successfully translated the complex, messy reality of patient notes into the clean, standardized language needed for modern healthcare, proving that machines can learn to follow the rules of coding just as carefully as the people who wrote them.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.