Ontology-Compiled 2D Clinical State Fields with Bidirectional Diffusion Encoders for Zero-Training Cross-Ontology Medical Coding

Zeqiang WangarXiv 2026

It’s late, you’ve had a long day, and the last thing you want to think about is the labyrinthine world of medical billing. But imagine for a moment the sheer chaos of a modern hospital’s data. Every year, national health authorities update their diagnostic codes. One day you’re using ICD-9; the next, it’s ICD-10. Then there are regional variations, different languages, and complex reimbursement rules (DRGs).

Traditionally, if you wanted an AI to help with "medical coding"—the process of turning a doctor's narrative note into standardized codes—you had to retrain the entire model every time the rules changed. It was slow, expensive, and required thousands of manually labeled examples.

This paper introduces a way to break that cycle. It’s called Ontology-Compiled 2D Clinical State Fields (OCSF), and it treats medical coding not as a static classification task, but as a dynamic mathematical "compilation."

TL;DR

OCSF decouples the act of "reading" a medical document from the act of "assigning" specific codes. By mapping clinical notes into a universal 2D "state matrix," a single model trained only on English records can instantly switch to coding in Spanish, Greek, or Chinese—or adapt to entirely new billing systems—in seconds, without ever needing to be retrained.

What Problem Does This Paper Address?

The core issue is entanglement. Current AI models have "fixed heads"—they are hard-wired to recognize a specific set of codes. If the hospital switches from ICD-9 to ICD-10, the model becomes obsolete.

Furthermore, medical notes are messy. A single discharge summary might mention thirteen different conditions across various organ systems. Standard AI often tries to squash this complexity into a single one-dimensional vector (a list of numbers). When you do that, distinct findings—like a heart condition and a lung infection—can "cancel each other out" or get blurred together, leading to errors.

Methods

The authors propose a two-part solution:

  1. The Universal Reader (2D State Fields): Instead of a 1D vector, the model routes clinical evidence into a 2D state matrix. Think of this as a grid where different "channels" represent different medical specialties (e.g., cardiology, neurology). This prevents "comorbidity superposition"—it keeps the heart findings from interfering with the kidney findings. They use a bidirectional diffusion encoder, which allows the model to look at the entire document at once, rather than reading it strictly from start to finish.
  2. The Instant Compiler: When a new set of codes (an ontology) is introduced, the system doesn't retrain. Instead, it "compiles" the text descriptions of those new codes into a mathematical operator (a Tikhonov deconvolution operator) on a standard CPU. This happens in seconds. This operator is designed to suppress "cross-talk" between very similar "sibling" codes, ensuring that the model picks the most precise one.
The OCSF Architecture: From raw text to a 2D state matrix, then compiled into specific codes.

Datasets

The model was trained exclusively on English discharge summaries from the MIMIC-IV dataset using ICD-9 codes.

To prove it could handle "zero-training" transfer, it was then evaluated on five entirely unseen benchmarks:

  • MIMIC-IV ICD-10: 26,085 English codes.
  • MS-DRG: English billing groups.
  • CodiEsp: 185,458 Spanish codes.
  • ElCardioCC: Greek cardiology notes.
  • CHIP-CDN: 37,645 Chinese clinical terms.

Key Insights and Ideas

  • Decoupling is Freedom: By separating the "reading" of the patient's state from the "indexing" of the codes, the model becomes a general-purpose clinical observer.
  • Spatial Separation Matters: Using 512 distinct semantic channels (the 2D grid) allows the model to maintain high precision even when a patient has many overlapping conditions.
  • Algebraic Transfer: The "aha moment" is that you don't need a GPU or a week of training to learn a new language. If you have the codebook, you can use linear algebra to "project" the model's understanding onto that new language instantly.

Key Results

The results are quite startling for a "zero-training" approach:

  • In-Domain Superiority: Even on the ICD-9 codes it was trained on, OCSF (63.15% Micro-F1) outperformed traditional models that were specifically built for those codes.
  • Massive Scale: It successfully transferred to the Spanish CodiEsp dataset, which contains over 185,000 codes, compiling the entire system in under 10 seconds on a basic CPU.
  • Cross-Lingual Success: It maintained high accuracy in Greek and Chinese without ever seeing a single training note in those languages.
Table 2: In-domain coding and zero-training cross-ontology transfer across six clinical ontologies. ICD-9 (N = 32,804; Edin 6,150 frequent codes), patient-disjoint ICD-10 (N = 13,783; 26,085 codes split into 16,146 CM diagnoses and 9,939 PCS procedures), patient-disjoint MS-DRG (N = 11,869), and Spanish CodiEsp (N = 250) are evaluated on locked held-out test splits; Greek ElCardioCC (N = 2,500) and Chinese CHIP-CDN (N = 2,000) are evaluated on their full public cohorts. All thresholds τA, channel anchors, and λ = 0.15 are fixed solely on source ICD-9 validation. Values are percentages (full precision/ranking metrics and development-to-test consistency in Supple- mentary Tables S1–S2).

Limitations and Future Work

While the diagnostic transfer is impressive, procedural codes (how a surgery was performed) remain a challenge. The authors note that ICD-10-PCS codes are highly specific about anatomical approaches and devices—details that weren't always captured in the older ICD-9 training data.

Additionally, some billing groups (MS-DRG) depend on non-text factors like a patient’s age or sex. The authors suggest that the next logical step is fusing these structured electronic health record (EHR) fields directly into the mathematical operators to create an even more robust "all-in-one" hospital coding engine.

Summary updated

Abstract

Healthcare systems continually revise clinical taxonomies, update reimbursement schedules, and harmonize cross-border registries. Existing automated coding models bind clinical text understanding to fixed vocabulary-specific heads, requiring manual relabeling and retraining whenever code sets change. We introduce Ontology-Compiled 2D Clinical State Fields (OCSF), a vocabulary-free framework that decouples clinical document reading from target ontology indexing so one trained encoder can switch across arbitrary medical vocabularies in seconds without target training. A single-pass bidirectional diffusion-pretrained encoder and vocabulary-free decoder map each clinical note into a fixed-dimension two-dimensional state matrix with zero code-specific parameters. Any target ontology is compiled offline on CPU from public text descriptions into a scale-invariant Tikhonov deconvolution operator that suppresses sibling-code interference while preserving source decision thresholds. Trained solely on English MIMIC-IV ICD-9 discharge summaries and evaluated without target tuning across 58,706 held-out test notes and five unseen ontologies spanning English ICD-10, MS-DRG, Spanish, Greek, and Chinese (115-185,458 codes), OCSF reaches 63.15% Micro-F1 on in-domain ICD-9 (outperforming a matched closed-vocabulary classifier and eliminating late-epoch tail overfitting) and transfers directly to 26,085 English ICD-10 codes (29.23% recall at gold cardinality), MS-DRG groups, and multilingual terminologies, compiling up to 185,458 codes in under 10 seconds on CPU with sub-millisecond GPU readout.
BibTeX
@misc{wang2026ontology,
  author = {Zeqiang Wang},
  title = {{Ontology-Compiled 2D Clinical State Fields with Bidirectional Diffusion Encoders for Zero-Training Cross-Ontology Medical Coding}},
  year = {2026},
  eprint = {2611.30218},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.30218},
}
Figure