Zero-Training Cross-Ontology Medical Coding: OCSF Framework Lets Encoders Switch Vocabularies Instantly

OCSF decouples clinical text understanding from vocabulary indexing, so switching vocabularies needs only offline operator compilation, not retraining.
The article introduces OCSF, an RSS study tackling the structural problem in automated medical coding where changing the vocabulary requires retraining. It separates document reading from vocabulary matching: the encoder outputs a code-agnostic fixed-dimension 2D state matrix, while any target ontology is compiled offline on CPU into a scale-invariant Tikhonov deconvolution operator—up to 185,458 codes compile in under 10 seconds with sub-millisecond GPU readout. Trained only on English ICD-9, it achieves 63.15% in-domain Micro-F1 and transfers zero-tuning to ICD-10, MS-DRG, and Spanish, Greek, and Chinese vocabularies, with 29.23% recall on ICD-10. The authors frame this as downgrading vocabulary switching from a training problem to a compilation problem, though absolute metrics remain far from production-ready and real-world long-tail noise needs further validation.
Healthcare systems constantly revise clinical taxonomies, update reimbursement catalogs, and coordinate cross-border registry data, yet existing automated coding models typically bind clinical text understanding to a fixed vocabulary-specific head—meaning any change to the code set requires manual re-annotation and retraining. A cutting-edge study from RSS proposes Ontology-Compiled 2D Clinical State Fields (OCSF), attempting to fundamentally sever this binding.

Problem Background: Change the Vocabulary, Retrain the Model
In medical coding tasks, models must map clinical documents to standard code systems such as ICD and MS-DRG. The traditional approach trains a dedicated output layer for each target vocabulary, which introduces two structural challenges: first, vocabularies are updated frequently and re-annotation is costly; second, coding systems differ enormously across languages and countries, making a single model hard to reuse.
OCSF's core idea is to completely separate "reading the document" from "matching the vocabulary": the encoder is responsible only for understanding clinical text and outputs a code-agnostic, fixed-dimension 2D state matrix, after which an offline-compiled operator handles alignment with any target ontology.
ICD and MS-DRG primer: ICD (International Classification of Diseases) is maintained by the World Health Organization and is the world's most widely used classification system for diseases and health problems. Clinical use today is dominated by ICD-10 and its national revisions, with code sets reaching tens of thousands of entries. MS-DRG (Medicare Severity Diagnosis Related Groups) is the grouping system used by US Medicare for inpatient payment; it does not directly describe diseases but maps combinations of diagnoses, procedures, age, and comorbidities to roughly several hundred payment groups, so its code space is entirely different from ICD. The difference between the two precisely illustrates the ontology heterogeneity problem facing medical coding models: the same medical record yields target labels that differ in number, granularity, and semantic organization across systems—which is exactly why the traditional "one vocabulary, one output layer" approach is hard to reuse.
Technical Breakdown: Vocabulary-Free Encoder + Offline Ontology Compilation
Single-Pass Bidirectional Diffusion Pretrained Encoder
OCSF uses a single-pass bidirectional diffusion pretrained encoder paired with a vocabulary-free decoder to map each clinical record to a fixed-dimension 2D state matrix. The entire process contains no code-specific parameters, so the model itself does not "know" any concrete codes.
Bidirectional diffusion pretraining: Diffusion models generally refer to generative frameworks that progressively add noise to data and then learn to reverse the denoising. Here, "bidirectional" and "single-pass" mean the encoder does not autoregressively generate codes token by token; instead, a single forward computation completes the representation of the entire document, with the noise process acting on both directions of the text simultaneously, enabling the model to learn representations more robust to local wording perturbations. Compared with encoders that decode token by token over code sequences, this design does not anchor the output space to any fixed vocabulary, making it naturally suited as a "code-agnostic" text understanding backbone.
Tikhonov Deconvolution Operator
Any target ontology can be compiled offline on CPU: starting from public textual descriptions, a scale-invariant Tikhonov deconvolution operator is generated. The operator's role is to suppress interference between sibling codes while preserving source decision thresholds. The authors report that up to 185,458 codes can be compiled in under 10 seconds on CPU, with GPU readout reaching sub-millisecond levels.
Tikhonov regularization and deconvolution: Tikhonov regularization is a classic stabilization technique for least-squares problems; by adding a parameter-norm penalty term to the objective function, it prevents the solution from oscillating violently under ill-conditioned conditions. In OCSF, it is used to infer a linear readout operator from the public textual descriptions of codes: treating "text description → state matrix response" as a convolution-like forward process, deconvolution seeks its inverse. The regularization term here suppresses response crosstalk between similar (sibling) codes, while scale invariance ensures the operator does not fail as the number of codes or description length changes. Because compilation relies only on public description text, the entire operator generation can be done fully offline on CPU without any labeled data.
Experimental Results: Cross-Ontology Transfer Under Zero Target Tuning
The model is trained only on English MIMIC-IV ICD-9 discharge summaries, then directly evaluated on 58,706 held-out test records and five unseen ontologies, covering English ICD-10, MS-DRG, Spanish, Greek, and Chinese, with code set sizes ranging from 115 to 185,458.
On in-domain ICD-9, OCSF achieves 63.15% Micro-F1, outperforming a matched closed-vocabulary classifier and eliminating tail overfitting during the post-training stage. More critically, the zero-target-tuning transfer performance: when transferred directly to 26,085 English ICD-10 codes, it achieves 29.23% recall under the gold candidate set, while also transferring to MS-DRG groupings and multilingual terminology systems.
Micro-F1 and gold-candidate-set recall: Micro-F1 computes precision and recall after aggregating predictions across all codes, then takes their harmonic mean; high-frequency codes therefore dominate the score, making it suitable for measuring overall coding throughput quality. It differs from Macro-F1, which averages per code category and better reflects long-tail code performance. "Recall under the gold candidate set" in the paper refers to the proportion of cases where the model hits the correct code when only genuinely existing candidate codes are considered (i.e., given the gold-standard candidate set). This setting excludes the enormous interference of blind retrieval across all 26,085 codes, and is therefore higher than actual recall under an open vocabulary. Understanding the difference between these two metrics is essential to accurately judging the comparability boundary between 63.15% and 29.23%.
Industry Significance and Limitations
The value of this work lies in downgrading "switching vocabularies" from a training problem to a compilation problem. For institutions that need to frequently update coding systems or coordinate cross-border data, the ability to switch ontologies in seconds means no longer needing to prepare annotation data and training pipelines for each new vocabulary.
What warrants a sober view is that the absolute metrics for cross-ontology transfer remain limited—29.23% recall on ICD-10 is still far from directly production-usable coding. Moreover, evaluation is concentrated on held-out test sets; whether the long-tail noise and localized coding habits of real clinical documents will further degrade performance remains to be seen. But as a directional validation of "vocabulary-free medical coding," OCSF offers an engineering path worth watching.
One-line Summary
OCSF decouples clinical text understanding from vocabulary indexing, so switching vocabularies requires only offline operator compilation rather than retraining.
Paragraph Summary
The article introduces OCSF, a study from RSS that addresses the structural challenge in automated medical coding where "a vocabulary change means retraining." It proposes fully separating document reading from vocabulary matching: the encoder outputs a code-agnostic, fixed-dimension 2D state matrix, while any target ontology is compiled offline on CPU into a scale-invariant Tikhonov deconvolution operator—up to 185,458 codes compile in under 10 seconds, with GPU readout at sub-millisecond levels. Trained only on English ICD-9, the model achieves 63.15% in-domain Micro-F1 and transfers zero-tuning to ICD-10, MS-DRG, and Spanish, Greek, and Chinese vocabularies, with 29.23% recall on ICD-10. The authors argue this downgrades "switching vocabularies" from a training problem to a compilation problem, but absolute metrics still fall short of production readiness, and real-world long-tail noise remains to be validated.
Related articles

Michael Nielsen Takes Down His Classic Neural Network Textbook, Sparking Community Discussion
Michael Nielsen's classic free textbook Neural Networks and Deep Learning has been taken offline, sparking discussion on Hacker News about the reasons and impact.

Inside the AI Training Data Market: The Trade-off Between Exclusivity and Discounts
G2i founder Gabe Greenberg reveals the dual-track pricing of the AI training data market: labs pay a premium for exclusive data or accept discounts that allow others to buy it.

SessionGraph: Unifying All Coding Agent Sessions in One Interactive Graph
SessionGraph aggregates coding agent sessions into an interactive graph, helping developers review, debug, and manage AI coding workflows across sessions. This article examines its positioning, value, and open questions.