Elamur Research

MedCodER: A Generative AI Assistant for Medical Coding

Paper · 2025 · Krishanu Das Baksi, Elijah Soba, John J Higgins et al.

Summary

A clinical note can describe a patient’s condition clearly without making its billing code obvious. A coder has to identify which diagnoses are documented, find the details that support coding them, and choose identifiers that preserve the distinctions in the record. MedCodER assists with that work by presenting code suggestions alongside the passages that support them. The authors evaluate both the coding system and a new set of annotations designed to make its intermediate decisions testable.

MedCodER first reads a note and produces a structured entry for each diagnosis it identifies. Each entry contains a disease name, supporting sentences, and a provisional code. The system then searches descriptions from the International Classification of Diseases and related terminology for codes that might correspond to the diagnosis. This search is a form of retrieval-augmented generation. A final pass considers the initial suggestion and the retrieved alternatives together, using the diagnosis and its evidence to decide which codes to rank highest. The interface can highlight those passages in the note so the coder can review the suggestions in context.

To evaluate the system, the authors extended ACI-BENCH, a collection of synthetic clinical encounters reviewed by medical experts. Their annotations link codes to diagnoses and supporting text. On the evaluation batch of 184 notes, MedCodER achieved a micro-F1 of 0.62 when it returned the highest-ranked code per diagnosis. PLM-ICD and a direct prompting baseline each achieved 0.40, while a tree-search baseline limited to 50 calls achieved 0.16. MedCodER’s diagnosis extraction scored 0.83 micro-F1 under case-insensitive exact matching. Evidence selection was less precise under a separate partial-match evaluation, so a highlighted passage could include material beyond what the reference annotations supported.

The component comparisons show why the system keeps both sources of candidate codes. Sometimes the provisional code preserves a detail missed by retrieval. In other cases the search supplies the correct code when the provisional suggestion is too broad. Reranking the combined candidates gave the strongest overall results in the authors’ comparison. The paper also describes a prototype in beta testing that lets coders inspect the evidence, choose a suggested code, or enter their own. The reported scores measure agreement with reference annotations on the synthetic notes. The effect on coders’ work in practice remains open.

Deep dive: MedCodER: A Generative AI Assistant for Medical Coding

MedCodER turns clinical notes into ICD-10 code suggestions with supporting passages and tests how retrieval and re-ranking affect accuracy. · about 32 minutes to read

The problem and its context

What a code has to capture

The International Classification of Diseases provides a common way to record conditions for reporting and other uses. The paper focuses on the U.S. clinical modification, ICD-10-CM, which it calls ICD-10. It describes a vocabulary of over 70,000 codes arranged in a hierarchy. Broad groups organize related conditions, and more specific entries express distinctions that affect which code applies. The coding task starts with what a record documents and ends with the identifiers that represent it. The authors place that task in the context of billing, health resource allocation, and medical research, all of which depend on how consistently clinical information is recorded.

A medical coder has to decide both what the note establishes and how to represent it. The diagnosis may appear in an assessment, while a related treatment or test appears elsewhere. Even after the condition has been identified, different entries in the classification can correspond to closely related descriptions. Where the record establishes a detail such as the side of the body or the encounter type, that detail can change the answer. Where the documentation leaves a distinction unresolved, a more specific code may go beyond the available evidence. Both decisions depend on the record, but they ask different questions of it.

This distinction matters for assistance. A returned identifier tells the user what the system selected. A passage linked to that identifier makes it possible to inspect some of the basis for the choice. A coder can see whether the system located the intended diagnosis and whether the passages preserve the details that distinguish plausible alternatives. The authors point out that many datasets supply the final codes alone. Those labels can support an evaluation of agreement on the output, but they leave the system’s selection of evidence without a reference for comparison.

The range of codes also creates a statistical problem. A note can support multiple labels, and their frequencies are uneven. A system can encounter commonly used codes often while seeing little evidence for many others. The inputs pose a different problem. Clinical records vary in form and in the amount of detail they contain, and long notes may mix relevant statements with other information about the encounter. A method that treats the whole note as its input has to find the pertinent language and resolve the code space within the same prediction task.

From whole-note classification to a search over candidates

The paper traces automatic coding through rule-based systems, conventional machine learning, and deep learning. Many of the more recent approaches formulate it as multi-label text classification. Given a clinical record, the system predicts the collection of codes that apply. Assigning a code does not rule out the others in the way that choosing a single category would. The authors describe earlier convolutional, recurrent, graph-based, and Transformer approaches within this broad line of work. They cite convolutional approaches in Explainable Prediction of Medical Codes from Clinical Text and Clinical-Coder.

As the paper describes it, a comparative study on the MIMIC datasets found PLM-ICD particularly strong on MIMIC IV, with substantial coding errors still present. Work using general-purpose generative systems had also produced mixed evidence. One evaluation using Mount Sinai data found limited agreement, while another used a guided search through the code hierarchy and reported competitive performance. The authors describe that tree search as expensive to run and difficult to inspect. The earlier findings posed a question for MedCodER. Could a generative system interpret the note while drawing on a separate source for the vocabulary it was expected to use?

Another line of research treated coding as information retrieval. The initial task is to find a short list of plausible codes. A second process then decides which of those candidates deserve priority. The paper describes earlier work that took the most probable codes from a pretrained coding system and rearranged them using relationships among labels. This design shifts part of the difficulty to candidate generation. When the correct answer falls outside the initial shortlist, a ranker working only with that shortlist cannot put it first. The authors also describe embedding-based retrieval from an entire report, where lengthy inputs can make it harder to connect an individual candidate to the part of the record that supports it.

MedCodER borrows the idea of narrowing the choice before making a final decision. It changes the search query from the full record to the diagnosis produced by extraction. This puts a shorter phrase in direct comparison with the language used to describe a code. A short query can omit particulars from the record, however. The authors therefore preserve the diagnosis-specific evidence for the final ranking stage and retain the code proposed during extraction as another source of candidates. The search can bring in vocabulary that was missing from the provisional answer, while the note still supplies the context in which that vocabulary has to be used.

Why finding a disease mention is a separate task

The paper situates disease extraction within named entity recognition, which identifies named or otherwise recognizable items in text. In a biomedical setting, a system might find words referring to conditions. For medical coding, the useful output is a diagnosis relevant to the current coding decision. A disease can be mentioned in the record for reasons that make it incidental to the task. The extraction prompt illustrates that distinction by asking for evidence about the diagnosis and excluding sentences about the patient’s medical history from the evidence field.

The authors discuss BioBERT, which is pretrained on biomedical literature, and cite its strong entity-recognition performance on benchmark data. They emphasize the role of the match between training material and the text being analyzed. They also discuss general-purpose extractors that can identify entities without training on the particular target benchmark. The question for MedCodER is whether an extractor can supply the right inputs to coding. Finding more disease expressions can be counterproductive if each extra expression starts a search for codes that the note does not warrant.

The same distinction applies to supporting evidence. A diagnosis name gives the search something to match. A test result, assessment, medication, or treatment plan can help a reviewer understand what the note says about that diagnosis. The information needed for each purpose can have a different shape and come from a different part of the record. A benchmark containing both types of annotation allows the authors to examine these steps separately. That separation matters when interpreting an end-to-end error. A system can read a diagnosis correctly and still choose the wrong identifier.

The evaluation gap

The authors identify a practical obstacle to testing externally hosted generative systems on existing benchmarks. Medical records contain sensitive information, and the usage restrictions on MIMIC III and IV constrain the use of external services. The paper also says these resources lack the evidence annotations needed for its proposed evaluation. Those are separate barriers. A dataset that is suitable for running a hosted service may still give no answer to the question of whether the service found the right passage. Detailed annotations on restricted records can support other evaluations while leaving the hosted setup unavailable.

The authors’ response was to annotate synthetic encounters from ACI-BENCH. This made it possible to test hosted systems on notes accompanied by expert coding judgments and evidence references. The evaluation then asks how well a system can move from text to diagnoses, from diagnoses to code candidates, and from candidates to final codes on the same collection. The origin of the records also matters to the scope of those questions. Expert review makes the synthetic notes more realistic for this experiment, while the question of performance on records from clinical practice requires its own evidence.

The method, step by step

What moves through the system

MedCodER begins with a clinical note in text form. It asks a generative system to propose the units on which the rest of the pipeline will operate. Each unit centers on a diagnosis and carries a set of sentences that may support it. It also includes a provisional ICD-10 code. From this point onward, the diagnosis, the evidence, and the initial suggestion serve different purposes. The diagnosis is the search query, the evidence provides context for comparing alternatives, and the initial suggestion enters that comparison as a candidate of its own.

A separate search index contains descriptions of valid ICD-10 codes. For each diagnosis, the system compares its wording with the meanings represented in the index. The resulting list may include an alternative to the provisional answer or may independently surface the same code. The final ranking pass has access to the candidates from both routes and the text associated with the diagnosis. The diagram puts the text alignment alongside those operations because the interface is meant to lead the coder from a proposed code back to the note.

How MedCodER turns a clinical note into code suggestions

The steps in order.

How MedCodER turns a clinical note into code suggestionsStep 1: Read the clinical note1. Read the clinical noteStep 2: Extract diagnoses, supporting sentences, and provisional codes2. Extract diagnoses, supporting sentences, and provisional codesStep 3: Match extracted text back to the note3. Match extracted text back to the noteStep 4: Retrieve codes using each diagnosis as a query4. Retrieve codes using each diagnosis as a queryStep 5: Combine retrieved and provisional code candidates5. Combine retrieved and provisional code candidatesStep 6: Re-rank candidates using the diagnosis and evidence6. Re-rank candidates using the diagnosis and evidenceStep 7: Display ranked suggestions with highlighted passages7. Display ranked suggestions with highlighted passages

This design gives the authors observable outputs at points where mistakes can enter. If a code is absent, they can check whether the associated diagnosis was found. If the diagnosis is present, they can examine the provisional code and the search results before consulting the final ranking. Those observations have different meanings. A missing diagnosis leaves nothing to send to retrieval, while a low-ranked candidate may still be available for review when the system is configured to display a list.

Extract diagnoses and the passages that support them

The first prompt assigns the system the role of a clinical coder and gives it the whole note. It requests a JSON list, a structured format in which each diagnosis has fields for the disease, its evidence, and a proposed ICD-10-CM code. The prompt includes an example of the expected shape and directs the system to return the structured content alone. The structure is operationally important. It keeps the suggested code and the evidence associated with the disease to which they belong when a note produces multiple entries.

The evidence field asks for sentences from the note. It covers material bearing on diagnosis and assessment, clinical reasoning, plans for treatment, medication, and referrals. The prompt excludes sentences about medical history from this field. A sentence can be medically meaningful while being outside the intended scope of that annotation. In the pipeline, gathering the evidence per diagnosis makes it possible to use the same note for multiple coding decisions without passing every associated sentence to the ranker for every disease.

The authors take inspiration from chain-of-thought prompting. Here the concrete design choice is the order and content of the requested output. The prompt calls for the diagnosis and its supporting material before the code. The artifacts available to the rest of MedCodER are the resulting disease name, passages, and identifier. The evidence field is meant to point to wording in the record, which is a different function from asking for a free-form account of every inference made during coding.

This is also where MedCodER first produces a code, before consulting the description index. That provisional choice uses the information furnished in the prompt and whatever coding associations the generative system can supply. The later stages can preserve it when it is useful. A pipeline that discarded the initial suggestion would depend on semantic retrieval to rediscover every good answer. MedCodER lets the initial pass contribute both the query for retrieval and a candidate that goes directly to the final comparison.

The simple prompting baseline leaves out this intermediate structure. It asks for applicable codes from the whole record in a list. The difference is important when interpreting the experiments. The baseline tests direct code generation, while the prompt-only MedCodER ablation tests code generation after requesting the richer diagnosis-and-evidence output. The complete system adds retrieval and a separate ranking pass on top of that richer output. Those are distinct configurations, even though all three can return codes without requiring a human to select them first.

Match the generated text to the record

The authors use fuzzy text matching and BM25 similarity scores to associate generated extracts with passages in the note. Fuzzy matching allows textual correspondence to be found even when strings are not identical. BM25 supplies a score based on the words shared by a query and a candidate passage. Together these methods address a practical problem with a generative extractor. A field presented as source evidence can differ from the actual wording or lack a good counterpart in the record.

The mapping has two roles in the design. It mitigates the risk of presenting unsupported text as an extract, and it locates material for highlighting in the interface. A diagnosis name can still be useful as a search query without having a character-for-character match in the note. Highlighting has a different requirement. The interface needs an actual location in the record, even if the extracted name is a compact way of referring to what appears there. Text matching connects those uses.

This step and the extraction metric answer different questions. The system uses matching to find corresponding text in the record. The diagnosis evaluation compares the generated diagnosis with a reference diagnosis string and ignores its location. These procedures can treat the same output differently. A diagnosis may have a plausible source passage while failing the benchmark’s wording criterion. Conversely, a disease string can match an annotation under the scoring rule without establishing that every evidence sentence attached to it is appropriate.

Matching is also distinct from checking a code. A closely matching sentence can confirm where the text came from. Whether it justifies a particular code depends on what the sentence says and on how the code distinguishes that condition from alternatives. Text alignment alone supplies no judgment about that relationship. In MedCodER, comparing the candidate with the diagnosis and its evidence is the ranker’s job, and the interface enables a coder to inspect the relationship as well.

Build the search index and retrieve candidates

The retrieval stage depends on a database prepared before the note is analyzed. The authors compile descriptions of valid entries in the ICD-10 hierarchy. They supplement those descriptions with equivalent terms from the Unified Medical Language System Metathesaurus. A concept can appear in the note under wording different from the official description, so alternate descriptions widen the set of phrasings through which a code can be found. The index also records hierarchy metadata, including the chapter, block, and category associated with each code.

The system represents the descriptions as embeddings, numerical vectors that support comparison by meaning. During coding it creates a vector for the extracted diagnosis and compares it with the indexed description vectors using cosine distance. This distance compares the directions of the vectors. In this application, a smaller distance corresponds to a closer match under the representation used by the search. The paper describes that comparison as the basis for choosing neighbors, without specifying an equation or a custom distance function.

The retrieval result is the top k codes for each diagnosis, where k is the number requested from the search. The unit of the query is the diagnosis from the extraction stage. Additional sentences about the disease are available to the final ranker, rather than being concatenated into the search query described by the authors. The paper’s main configuration uses OpenAI text-embedding-ada-002 for this stage. The appendix also evaluates MedCPT, a biomedical retriever trained on PubMed material, as a replacement for that embedding backend.

The metadata stored in the index and the criterion used to retrieve neighbors play different roles. The metadata records where a code sits in the classification. The retrieval procedure described in the paper chooses candidates by comparing the diagnosis with descriptions in vector space. It does not specify a traversal from broad entries to increasingly specific descendants. This distinguishes MedCodER’s use of the classification from the tree-search baseline discussed in the experiments.

Choosing k affects what the ranker can see. A short list limits how many unrelated candidates get through, but it can omit a code that is close in meaning without being among the nearest hits. A longer list gives the ranker more chances to see a suitable code and more alternatives to distinguish. The provisional candidate partly offsets the dependence on this one search cutoff. If the extraction prompt has already supplied the right identifier, the system can carry it forward independently of its location in the retrieval list.

The relevance sought by the search is an intermediate property. If a diagnosis and a code description refer to similar conditions, semantic retrieval may have found a useful neighbor. Exact coding requires a further decision about the qualifiers that the record establishes. A retrieval result can therefore be a good search hit and a wrong final answer. This is one reason to separate the vector search from the decision that determines which code appears first.

Compare the candidates in the context of the note

The ranker brings together the provisional code and the codes returned by the search. It receives the extracted diagnosis and its supporting evidence, which it uses to prioritize the candidates. The paper adapts RankGPT from Is ChatGPT Good at Search? to this medical coding task. It describes the ranker as working with relevant passages selected earlier, instead of the complete note used for initial extraction. That allows the system to compare codes in the context of the disease that prompted the search, with correspondingly less context available if extraction omitted a pertinent detail.

The phrase “code-to-record” describes the purpose of this stage. A candidate reached the list because the generator proposed it or because its description was similar to the extracted disease name. Neither route establishes that it fits the documented encounter. The ranking stage can use evidence that was not part of the search query to decide between alternatives. A candidate with a strong search score may fall behind a provisional code that better preserves the documented qualification. A retrieved candidate may also displace an initial suggestion that captured only a broad condition.

The main evaluation keeps the highest-ranked code for each diagnosis. The prototype offers a longer ranked list. For each diagnosis, a coder can inspect highlighted passages, choose a suggestion from a dropdown, or enter a different code. The interface illustration uses shortness of breath to show how evidence appears alongside the choices. It displays the top 5 suggestions for that diagnosis. Thus the paper’s highest-ranked-code evaluation and its demo interface answer different practical questions. One measures the system’s first choice. The other shows how a person can review alternatives and consult the note before deciding.

The paper reports a workflow based on prompts, an indexed terminology resource, and replaceable components. It describes using publicly available weights for baselines that require them, along with pretrained services or systems for the generative experiments. The new note annotations provide reference answers for evaluation. The authors do not report fitting a new MedCodER system on those annotations. Building the code index prepares the material used for retrieval, while annotating ACI-BENCH prepares the data against which the system is scored.

Experiments and results

Data and evaluation units

The authors started with ACI-BENCH, which contains 207 simulated doctor–patient conversations. They describe the resulting notes as having undergone expert review and revision where needed to improve their realism and accuracy. MedCodER’s dataset adds manual labels for diagnosis names, ICD-10 codes, and the text that supports them. An experienced, certified medical coder helped with annotation. The paper reports that this coder had over 20 years of experience. The contribution is an openly released extension of ACI-BENCH with links between these kinds of annotations, instead of a new collection of records from clinical practice.

The authors judged three notes unsuitable for coding. The evaluation batch contains 184 notes, 360 annotated codes with diagnoses, and 737 annotated evidence texts. These counts describe different units. A note can contain multiple diagnoses, and a diagnosis can have multiple supporting passages. The remaining batch of 20 notes was intended for holdout use. The main results concern the evaluation batch. The paper gives no separate results for the intended holdout batch.

The evaluation emphasizes micro precision and recall. Precision asks how much of what the system returned agrees with the reference. Recall asks how much of the reference the system recovered. F1 combines precision and recall into a score that is sensitive to weakness in either. Micro aggregation pools decisions across the evaluation instead of giving each distinct diagnosis or code category its own weight. The authors choose it because of the very large code space and uneven label frequencies. A useful consequence is that the reported numbers summarize agreement across annotated instances. They give no separate view of performance on sparsely represented codes, and a micro score does not imply equal weighting of notes with different numbers of decisions.

For diagnosis extraction, the paper uses set-based exact matching that ignores case. The position of an extracted disease name does not affect the score. The authors chose this rule because a diagnosis can serve as a vector search query regardless of where it occurred in the note. The text string itself still matters in scoring. Different phrasings of the same disease can fail exact matching, even though the retrieval stage is designed to handle alternative wording. Supporting evidence is evaluated by partial matching, reflecting the separate problem of assessing selected passages.

For final coding, the main comparison uses one prediction per extracted diagnosis in MedCodER. The notation @1 identifies this cutoff. It can still yield multiple codes for a note that contains multiple extracted diagnoses. The authors use the cutoff to make comparison with the other coding approaches more direct. They then examine how changing the number of candidates or returned codes affects recall and precision, since a ranked shortlist and a forced first choice serve different purposes.

Diagnosis extraction and supporting evidence

MedCodER’s extraction prompt is compared with specialized entity extractors and NuExtract v1.5. On the extended ACI-BENCH evaluation batch, MedCodER recorded diagnosis micro recall of 0.85, precision of 0.81, and F1 of 0.83. NuExtract v1.5 achieved the same recall of 0.85, with precision of 0.79 and F1 of 0.82. The scores put both systems close together for diagnosis extraction alone. The small ordering between the two on F1 comes from their different precision at the same reported recall.

Diagnosis extraction micro-F1 on the extended ACI-BENCH evaluation batch

MedCodER leads a close NuExtract result, with the other extractors lower on this diagnosis-specific task.

Diagnosis extraction micro-F1 on the extended ACI-BENCH evaluation batchBioBERT: 0.12BioBERT0.12UniNER: 0.19UniNER0.19GLiNER: 0.25GLiNER0.25NuExtract v1.5: 0.82NuExtract v1.50.82MedCodER (this paper): 0.83MedCodER (this paper)0.83
The numbers
System or settingmicro-F1
BioBERT0.12
UniNER0.19
GLiNER0.25
NuExtract v1.50.82
MedCodER (this paper)0.83

The other extractors show a larger imbalance between recovery and agreement. GLiNER achieved recall of 0.78 and precision of 0.15, yielding the micro-F1 shown in the chart. UniNER had recall of 0.67 with precision of 0.11. BioBERT had recall of 0.44 and precision of 0.07. These outcomes concern exact recovery of the coding-oriented diagnosis annotations. They are consistent with the authors’ argument that generic disease extraction and preparing a clean list of diagnoses for coding pose different requirements. The scores do not decompose mismatches into extra disease mentions, alternative phrasings, and other sources of error.

The authors report that NuExtract’s performance declined when it was asked to extract supporting evidence as well as diagnoses. They supply no numerical result for that joint prompt. The observation qualifies the close diagnosis-only comparison. It shows that success on the single extraction field does not describe how a substitute behaves when asked to produce the full set of intermediate outputs that the next stages need.

For the evidence task, the paper reports experiments with different prompts and no separate baseline. Across the prompts on the extended ACI-BENCH evaluation data, partial-match recall ranged from 0.75 to 0.82, and partial-match precision ranged from 0.24 to 0.30. These are ranges across prompting approaches, instead of a precision and recall pair identified for a single configuration. The relatively high recovery and low precision point to an extractor that frequently finds relevant material and also returns text outside the reference evidence. The paper omits the detailed prompt-by-prompt results.

That precision result is important because the evidence has two audiences. The ranking system receives it as input, while a coder sees it as a highlight. Extra material can dilute the information the ranker uses, and a broad highlight can take longer to inspect than a focused one. The authors suggest that the evidence still helps the complete system. The reported evidence scores establish the difficulty of selecting it, while the complete-system scores establish how well the entire pipeline performs with it present.

The main code prediction comparison

The authors compare the complete GPT-4o configuration with PLM-ICD, a simple direct prompt, and an LLM-guided tree search. PLM-ICD uses publicly available weights pretrained on MIMIC IV, as supplied by the earlier comparison the paper cites. The simple prompt asks for a list of ICD-10 codes given the note, leaving out the diagnosis and evidence fields required by MedCodER’s extraction prompt. The tree-search baseline is run with a limit of 50 calls. The baselines therefore represent different ways to get from the note to codes, with a specific budget attached to the tree-search result.

ICD-10 coding micro-F1 on the extended ACI-BENCH evaluation batch

MedCodER ranks above all three baselines when its highest-ranked suggestion per diagnosis is scored.

ICD-10 coding micro-F1 on the extended ACI-BENCH evaluation batchPLM-ICD: 0.40PLM-ICD0.40Simple Prompt: 0.40Simple Prompt0.40LLM Tree-Search: 0.16LLM Tree-Search0.16MedCodER@1 (this paper): 0.62MedCodER@1 (this paper)0.62
The numbers
System or settingmicro-F1
PLM-ICD0.40
Simple Prompt0.40
LLM Tree-Search0.16
MedCodER@1 (this paper)0.62

At this cutoff, MedCodER achieved micro recall of 0.68 and micro precision of 0.57. PLM-ICD achieved 0.57 recall and 0.31 precision. The simple prompt reached 0.52 recall and 0.32 precision. The matching F1 scores of those baselines conceal a difference in their precision and recall profiles. PLM-ICD recovered more of the reference codes, while the simple prompt had slightly higher precision. MedCodER led on both measures, with a particularly clear separation in precision.

The tree search reached micro recall of 0.38 and micro precision of 0.10 on the same evaluation batch. The authors regard its result as lower than expected and point to the call limit and the possibility of errors propagating during traversal. The comparison consequently describes the budgeted run in the paper. It does not establish how the tree search would score under a larger budget or how the systems compare at matched latency. No unrestricted search result accompanies the budgeted one.

The strongest coding result and the diagnosis result measure different events. A correct diagnosis string gives the pipeline an appropriate target for retrieval, but a final code can still misstate the specificity of that diagnosis. Likewise, an exact diagnosis-string error can arise from wording even when a code is conceptually related. Reading the diagnosis and coding scores together helps locate the pipeline’s difficulties. Reading them as directly interchangeable would obscure which reference labels each experiment used.

How the choice of backend changes the result

The authors also run variants of the complete pipeline with different generative backends. With the main retrieval configuration on the extended ACI-BENCH evaluation batch at @1, Llama 405B achieved recall of 0.56, precision of 0.37, and F1 of 0.45. Claude 3.5 Sonnet achieved recall of 0.68, precision of 0.24, and F1 of 0.35. GPT-4o achieved recall of 0.68, precision of 0.57, and F1 of 0.62. In particular, the matching recall for Claude 3.5 Sonnet and GPT-4o accompanies a substantial separation in precision. Under the paper’s scoring, they recovered the same proportion of reference decisions, but their returned predictions differed in agreement with those references.

The authors attribute the leading result to stronger extraction and reranking. The appendix comparison changes the generative backend across the pipeline. It therefore measures the combined effect of changing its behavior in the stages that use it. A swap at extraction can change the diagnosis query, evidence, and provisional candidate together. A swap at reranking can change how the final choice is made from those inputs. The end-to-end scores do not establish which change accounts for the larger share of the difference.

The MedCPT comparison changes the retrieval representation instead. With this backend, the extended ACI-BENCH @1 recall, precision, and F1 for Llama 405B were 0.54, 0.36, and 0.43. For Claude 3.5 Sonnet they were 0.52, 0.36, and 0.42. For GPT-4o they were 0.68, 0.39, and 0.49. The third chart puts the two retrieval settings next to one another for each generative backend.

Retrieval backend comparison by ICD-10 coding micro-F1 at @1 on extended ACI-BENCH

The retrieval swap improves the Claude configuration and lowers F1 for the Llama and GPT configurations.

Retrieval backend comparison by ICD-10 coding micro-F1 at @1 on extended ACI-BENCHLlama 405B with original retrieval: 0.45Llama 405B with original retrieval0.45Llama 405B with MedCPT: 0.43Llama 405B with MedCPT0.43Claude 3.5 Sonnet with original retrieval: 0.35Claude 3.5 Sonnet with originalretrieval0.35Claude 3.5 Sonnet with MedCPT: 0.42Claude 3.5 Sonnet with MedCPT0.42GPT-4o with original retrieval (this paper): 0.62GPT-4o with original retrieval (thispaper)0.62GPT-4o with MedCPT: 0.49GPT-4o with MedCPT0.49
The numbers
System or settingmicro-F1
Llama 405B with original retrieval0.45
Llama 405B with MedCPT0.43
Claude 3.5 Sonnet with original retrieval0.35
Claude 3.5 Sonnet with MedCPT0.42
GPT-4o with original retrieval (this paper)0.62
GPT-4o with MedCPT0.49

These are end-to-end coding results for the embedding substitution. They show that changing the source of semantic neighbors had different effects depending on the rest of the pipeline. With GPT-4o, recall stayed at 0.68 while precision fell from 0.57 to 0.39. With Claude 3.5 Sonnet, precision rose from 0.24 to 0.36 while recall fell from 0.68 to 0.52. The appendix helps establish that retrieval backends can be exchanged within the framework and that the resulting code scores are sensitive to the pairing. The scores do not on their own describe how the changed candidate lists differed or which particular searches caused those shifts.

What the ablations show

Candidate sources contribute different answers

The component study compares the complete pipeline with alternatives that use fewer of its operations. MedCodER-Prompt takes the provisional codes from the structured extraction prompt. Its results stay fixed as k changes because it does not consult the search list. MedCodER-Retrieve uses the retrieved codes alone, in their retrieval order. MedCodER-Prompt+Retrieve combines provisional and retrieved codes without the final ranking pass. The complete MedCodER system ranks the combined pool using the extracted diagnosis and evidence.

This arrangement separates questions about availability from questions about selection. If additional retrieved candidates improve recall, the search is supplying correct codes that can be recovered somewhere in the output. The authors report increasing recall as candidates from retrieval are added, together with declining precision as more codes are returned. Broader candidate coverage has a cost when the extra outputs include plausible but incorrect alternatives. This is consistent with the practical distinction between generating a shortlist for review and choosing the code that should occupy its first position.

The condition that combines candidates without reranking is important for that interpretation. Simply giving the system access to both routes can make the right code available. It can also retain competing wrong answers. Reranking evaluates the candidates against the context selected for the diagnosis and decides which should be preferred. The authors report that the complete configuration gives a stronger overall result than relying on either source alone. The ablation figure traces recall and precision as k varies, while the headline comparison against other systems reports the single highest-ranked answer per diagnosis.

The prompt-only result also lets the authors revisit the mixed earlier reports on generative coding. They argue that asking for the diagnosis and evidence before the code is a more useful way to elicit provisional answers than treating code generation as an undifferentiated request. This is their interpretation of how the structured prompt helps. The experiment combines changes to the requested fields, output format, and ordering. It does not manipulate each instruction independently, so it cannot assign the observed behavior to the order of the fields alone.

The examples distinguish retrieval errors from coding errors

The paper’s qualitative error analysis examines predictions at k=1 for selected cases in which the extracted disease diagnosis agreed with the reference. Fixing diagnosis success in this way makes it possible to look more closely at the transition from a named condition to a code. In these samples, a wrong result can arise even though the system is working on the right disease. The examples illustrate the need to keep the diagnosis string, retrieved description, and exact coding decision distinct.

In the depression example, the note describes a patient who considers the condition controlled on Effexor. The reference code is F32.A, for depression without further specification. The extraction prompt’s provisional code is F32.9, and the retrieval-only answer is F33.9. The complete system returns F32.A. All the proposed answers point toward the same broad clinical area, yet the distinction between those identifiers determines whether the system agrees with the reference. The example shows that the full system can improve on the first choice from each route. The displayed predictions alone do not show where the correct code stood among all available candidates before final ranking.

The right-knee contusion example illustrates the other direction of complementarity. The reference and the provisional choice are both S80.01XA. Retrieval alone returns S80.01. The complete system also returns S80.01XA. The reference specifies the right knee and the initial encounter, which makes the fuller identifier material to the coding decision. In this case the language-driven proposal supplies the stronger answer, while the search finds a closely related entry. Combining the two routes keeps the useful provisional code available for the final decision.

For left shoulder impingement, the reference is M75.42. The provisional choice, M75.40, misses the specificity in the note. Retrieval returns M75.42, and the complete system keeps it first. Here search supplies the more appropriate candidate, and the note supplies the documented laterality for comparing the options. Taken with the knee example, this shows why the authors retained both sources. Either one can furnish a detail that the other route fails to express in its first choice.

The case of stenosing tenosynovitis of the right index finger shows a failure of the complete system after the disease has been extracted correctly. The reference is M65.321. The provisional suggestion is M22.40, the retrieval-only result is M17.2, and the complete result is M22.2X1. No displayed prediction matches the reference. Since the table shows the first answers, it cannot establish whether the correct code was absent from the full candidate pool or was available and lost during ranking. That distinction matters to diagnosis of the system itself. A missing candidate calls attention to how the query and index were used. An available but poorly ranked candidate calls attention to the context and comparison used to pick the answer.

These examples are selected to expose errors and possible recoveries. They establish that particular failure patterns occur in the experiment, and that the combined pipeline sometimes fixes them. Their selection on successful disease extraction means they do not estimate how often diagnoses were missed or how the system behaves on such misses. The quantitative comparisons serve a different role, giving pooled performance across the whole evaluation batch.

What the comparisons isolate

The ablation supports the use of retrieval as a second source of candidates and the use of ranking to make choices from the combined set. It establishes these effects in a pipeline that already produces diagnoses, evidence, and provisional codes together. The retrieval-only condition still depends on diagnosis extraction for its queries. It is a test of using retrieved codes without the other downstream operations, rather than a test of a retriever reading unprocessed records.

The paper’s claim about supporting evidence is narrower. The full ranker sees both the diagnosis and the extracted evidence, and the full system produces the strongest reported code result. The study does not compare rankers with and without evidence while holding the diagnosis and candidate pool fixed. It consequently cannot measure the isolated gain from evidence, or determine how performance would change if every evidence passage came from the expert annotations. For the same reason, the evidence-selection experiment and the code-selection experiment cannot tell how frequently a particular irrelevant sentence caused a wrong code.

The alternative retrieval backend provides another controlled change, with the mixed results shown in the experiments. It shows that the candidate-generation component has practical consequences for final coding and that domain-specific pretraining on its own does not predict the winning configuration. The code score is a product of what the new index returns and how the rest of MedCodER handles those candidates. A stage-level measure of candidate availability alongside final rank outcomes would be needed to separate those effects.

Limitations

Limits the authors identify

The authors call out supporting-evidence extraction as an area needing improvement. Its partial-match precision is low relative to its recall, and they recognize that unrelated evidence can enter the reranking stage. Highlighting a passage makes the system easier to inspect, but the evidence scores show that the highlights and reference passages often differ. The paper reports the range across prompts and leaves out the detailed results, which limits what a reader can infer about where the evidence task was most difficult or which prompt choices helped.

They also identify the limitations of the text input. The evaluated notes are already in text form, while records used in practice may come as scanned or digital PDFs. Handwritten entries, tables, and irregular formatting may require preprocessing before the pipeline can operate on them. The reported measurements begin after the point at which such a record would have been rendered into usable text. Errors or omissions from that earlier process could affect the diagnosis string, its evidence, and every decision downstream.

The authors point to input length as another problem. A sufficiently long record may exceed the amount of text a generative system can handle in one pass. They hypothesize that splitting a record into consecutive chunks and processing them in order could preserve performance. The paper offers this as a hypothesis. It does not compare the same records with and without chunking. Where evidence relevant to a diagnosis is dispersed, the results leave open how the system would associate information across chunks.

The discussion also presents the interface as preliminary and undergoing beta testing by coders ahead of planned production integration. Its ability to highlight passages and accept a coder’s choice demonstrates how the pipeline could be used in an assisted workflow. The paper gives no measured effect on turnaround time, correction effort, or coding agreement when people work with and without the tool. Its coding scores measure the system’s outputs against the annotated references. They cannot establish what performance a coder and the system would achieve together.

Limits of the evaluation setup

The central results come from the 184-note evaluation batch of a synthetic dataset. Expert review and manual coding give the benchmark medical and coding judgment, but the records still come from simulated interactions. The experiment leaves open how the note formats, diagnoses, and evidence patterns in that batch compare with records from different clinical settings. The 20 notes intended for holdout use are a defined part of the dataset, without a separately reported evaluation that would show how the results carry over to that batch.

The account of annotation describes assistance from an experienced coder. It does not report independent annotations and agreement statistics for diagnosis wording, evidence, or code selection. Those omissions matter differently for each target. Exact code agreement concerns the chosen identifier. Diagnosis-string agreement is sensitive to acceptable variation in phrasing. Evidence agreement may depend on how much surrounding text an annotator considers relevant. A single set of references makes a concrete benchmark possible, while its scores leave variation among medical coders unmeasured.

Micro aggregation also limits what can be inferred from the headline F1. It reflects performance across pooled instances, which is appropriate for the authors’ emphasis on overall coding decisions. A frequent code can contribute more observations than a rare code. The experiment does not report performance broken down by code frequency or hierarchical category. A high pooled score therefore cannot establish how consistently the system handles rare conditions or how well it distinguishes kinds of specificity that happen to appear infrequently in this batch. The paper reports point estimates without uncertainty intervals or a statistical test for the ranking of systems.

Exact and partial matching add further qualifications. Case-insensitive exact matching for diagnoses serves a clear evaluation purpose, but it can score an alternate wording as a miss even if that wording would bring back a useful code. Partial matching for supporting text establishes some degree of textual overlap with the reference. It does not establish that the matched words carry the critical distinction for a code. The error analysis illustrates that distinction with closely related code choices, but it does not classify the consequences of all coding errors in the evaluation.

The baseline comparison establishes performance under the reported conditions. PLM-ICD enters with weights from MIMIC IV, while the tree search runs with a 50-call limit. The paper does not offer a matched study of runtime, service use, or the cost of additional calls across systems. Its motivating discussion of restricted benchmarks also sets a limit on comparisons with coding results from other datasets. The most direct reading of the reported advantage is the result obtained on the extended ACI-BENCH notes under the particular system settings the authors describe.

Finally, the interface makes the selection reviewable by tying a proposed code to diagnosis-specific evidence in the record. The highlighted text is an output of extraction and matching. It does not verify that the ranking follows every relevant coding distinction or that omitted parts of the note would leave the ranking unchanged. The low evidence precision and the failures after successful diagnosis extraction show why the human inspection step still has a substantive job. The paper demonstrates code suggestion with source passages and measures agreement on a benchmark. It leaves the reliability of those suggestions in a production workflow to later evaluation.

What came after

The later papers that cite MedCodER pursue workflow design, broader evaluation, and reasoning over the classification hierarchy. Their titles establish the tasks they address. They do not identify a reused prompt, annotation set, or ranking implementation, so the connection in each case is at the level of the research question unless a concrete transfer can be established.

MedDCR takes the design of an agentic medical coding workflow as a learning problem. MedCodER gives extraction, search, and final selection fixed roles in a workflow specified by the authors. The later work’s stated focus is learning to design workflows for that same general task. Its citation connects the workflow-design question to a system in which the organization of the work already affects which diagnoses become queries, which candidates are available, and how the final code is selected.

MAX-EVAL-11 introduces a benchmark framed around large-scale, full-spectrum ICD-11 coding. Its stated contribution is evaluation at the scale of a different revision of the classification. MedCodER’s experiments ask whether a diagnosis-first pipeline improves code prediction on an annotated ICD-10 collection and whether it can also recover supporting passages. The later benchmark addresses the breadth of coding evaluation. Its citation alone does not establish that it adopts MedCodER’s evidence annotations or tests the same pipeline.

Travel on the ICD Tree benchmarks agentic reasoning for ICD coding from Chinese electronic medical records. Its stated emphasis is the path through the hierarchy. MedCodER stores hierarchy metadata but describes its primary candidate search as a direct comparison of diagnosis phrases with embedded code descriptions. The later benchmark puts the structure of the classification at the center of the reasoning task and applies that evaluation to a different record setting. The citation links two ways of making code selection into a process with intermediate decisions that can be examined.

Cite

Cite as Krishanu Das Baksi, Elijah Soba, John J Higgins, Ravi Saini, Jaden Wood, Jane Cook, Jack I Scott, Nirmala Pudota, Tim Weninger, Edward Bowen and Sanmitra Bhattacharya. 2025. MedCodER: A Generative AI Assistant for Medical Coding. Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 3: Industry Track).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2025.naacl-industry.37

@inproceedings{baksi2025medcoder,
  title = {{MedCodER: A Generative AI Assistant for Medical Coding}},
  author = {Krishanu {Das Baksi}, Elijah Soba, John J Higgins, Ravi Saini, Jaden Wood, Jane Cook, Jack I Scott, Nirmala Pudota, Tim Weninger, Edward Bowen and Sanmitra Bhattacharya},
  booktitle = {Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 3: Industry Track)},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-industry.37},
  url = {https://doi.org/10.18653/v1/2025.naacl-industry.37}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/baksi-2025-medcoder-generative-ai-assistant-medical/