MedDCR: Learning to Design Agentic Workflows for Medical Coding

Jiyang Zheng, Islam Nassar, Thanh Vu, Xu Zhong, Yang Lin, Tongliang Liu, Long Duong, Yuan-Fang Li

TL;DR

MedDCR is a novel framework that automates the design of complex, multi-agent workflows for medical coding. By treating workflow design as an iterative learning problem—using a "Designer-Coder-Reflector" loop—it discovers high-performing strategies that outperform both traditional deep learning models and manually crafted agentic pipelines.

What Problem Does This Paper Address?

Medical coding—the process of translating clinical notes into standardized ICD (International Classification of Diseases) codes—is a high-stakes bottleneck in healthcare. It isn't a simple classification task; it requires multi-step reasoning, such as extracting clinical entities, consulting hierarchical codebooks, and cross-checking for consistency across different diagnoses.

Current automated systems generally fall into two camps:

  1. Flat Classifiers: Pre-trained language models (PLMs) that treat coding as an extreme multi-label classification problem. These often struggle with the nuanced reasoning required for rare codes or complex guidelines.
  2. Manual Agentic Workflows: Systems where human experts hard-code the steps an LLM agent should take. While more interpretable, these are rigid and often fail to capture the variability of real-world documentation.

The authors identify a "design problem": manually fixing these workflows is difficult and likely misses more effective coordination patterns. MedDCR aims to bridge this gap by learning the optimal workflow automatically.

Methods

MedDCR (Medical Design-Coding-Reflection) is a closed-loop framework consisting of three primary meta-agents and a memory archive:

  • The Designer: Proposes a high-level workflow plan (in JSON format) by combining various tools (e.g., term extraction, index lookup) and reasoning strategies. It draws inspiration from the "Memory Archive" to refine previous successes or explore new ideas.
  • The Coder: Translates the abstract plan into executable Python code. Crucially, it includes a self-fixing loop that catches syntax or execution errors and regenerates the code until it runs successfully.
  • The Reflector: Evaluates the executed workflow on a validation set. It provides both a quantitative score (like F1) and detailed textual feedback (critiques) explaining why a workflow failed (e.g., "missed key mentions" or "redundant outputs").
  • Memory Archive: Stores the history of all explored workflows. It maintains a set of "Elite" (top-performing) and "Recent" designs, allowing the system to balance exploitation of proven strategies with exploration of new ones.

The process is iterative: the system starts with "seed" workflows (like basic Chain-of-Thought) and evolves them over multiple rounds of design, execution, and reflection.

Datasets

The framework was evaluated on two key ICD-10 coding benchmarks:

  • MDACE: A dataset of real-world clinical notes from the MIMIC-III database, featuring expert-verified ICD-10 annotations.
  • ACI-BENCH: A synthetic benchmark of clinical notes paired with ICD-10 codes, designed to test the accuracy and explainability of automated systems.

Key Insights and Ideas

  • Workflow Design as a Learning Problem: The most significant shift here is moving from "coding a solution" to "coding an agent that finds the solution." By automating the architecture of the agents themselves, the system discovers non-obvious strategies, such as "contrastive screening" to prune near-duplicate codes.
  • The Necessity of Textual Feedback: Ablation studies showed that while numerical scores are helpful, the textual critique from the Reflector is vital. Without it, the Designer struggles to diagnose how to improve the workflow, leading to performance plateaus.
  • Plug-and-Play Optimization: MedDCR isn't just for starting from scratch. It can take existing, expert-designed workflows as "seeds" and iteratively improve them, providing a bridge between human expertise and automated search.
  • Self-Fixing Code Generation: By separating the "planning" (Designer) from the "implementation" (Coder), the system ensures that complex reasoning isn't derailed by simple Python syntax errors.

Key Results

  • SOTA Performance: MedDCR-GPT-5 achieved a 6.2% improvement in F1 score on the MDACE dataset and a 7.4% gain on ACI-BENCH compared to the second-best performing baselines (including both PLMs and manual agentic frameworks).
  • Cost-Efficiency: Despite the iterative search process, the authors found the overhead to be modest. A single search loop required fewer than 20k tokens for the "design" phase, with the majority of costs coming from the actual execution of the coding task.
  • Interpretability: Because the output is a structured Python program with clear reasoning steps, the resulting workflows are far more transparent than "black-box" neural classifiers.

Limitations and Future Work

  • Generalist LLM Reliance: The study used general-purpose models (GPT-4o/GPT-5). The authors suggest that using medically fine-tuned foundation models could further improve accuracy and guideline compliance.
  • Search Complexity: While effective, the iterative loop is computationally more expensive than a single-pass inference. Scaling this to massive datasets or real-time environments may require more efficient search strategies.
  • Heuristic Feedback: The Reflector's feedback is currently heuristic. Developing more "rule-grounded" critics that specifically reference official coding manuals could make the reflection process more robust.
  • Multimodal Data: The current framework is text-only. Future iterations could incorporate visual signals (like scanned medical charts) or structured clinical data to provide a more holistic view for the agents.

Summary updated

Abstract

Medical coding converts free-text clinical notes into standardized diagnostic and procedural codes, which are essential for billing, hospital operations, and medical research. Unlike ordinary text classification, it requires multi-step reasoning: extracting diagnostic concepts, applying guideline constraints, mapping to hierarchical codebooks, and ensuring cross-document consistency. Recent advances leverage agentic LLMs, but most rely on rigid, manually crafted workflows that fail to capture the nuance and variability of real-world documentation, leaving open the question of how to systematically learn effective workflows. We present MedDCR, a closed-loop framework that treats workflow design as a learning problem. A Designer proposes workflows, a Coder executes them, and a Reflector evaluates predictions and provides constructive feedback, while a memory archive preserves prior designs for reuse and iterative refinement. On benchmark datasets, MedDCR outperforms state-of-the-art baselines and produces interpretable, adaptable workflows that better reflect real coding practice, improving both the reliability and trustworthiness of automated systems.
BibTeX
@inproceedings{zheng2026meddcr,
  author = {Jiyang Zheng and Islam Nassar and Thanh Vu and Xu Zhong and Yang Lin and Tongliang Liu and Long Duong and Yuan-Fang Li},
  title = {{MedDCR: Learning to Design Agentic Workflows for Medical Coding}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.627},
}
Figure