Import What You Need: Learning When and How to Augment EHR Graphs with External Knowledge

arXiv cs.LG Papers

Summary

This paper introduces ReTA, a reinforcement learning-based framework for dynamically augmenting electronic health record graphs with external knowledge graphs to improve prediction tasks like diagnosis and mortality.

arXiv:2609.01839v1 Announce Type: new Abstract: Longitudinal prediction from electronic health records (EHRs) is limited by the sparsity and irregularity in patient trajectories, and knowledge augmentation with external knowledge graphs (KGs) offers a promising way to alleviate these issues. However, most existing methods perform fixed, context-agnostic topology augmentation by adding the same KG nodes and edges regardless of a patient's evolving state. We propose ReTA, a Reinforcement learning-based dynamic Topology Augmentation framework that casts KG import as a per-visit, budget-aware policy. ReTA first constructs an offline refined pool of KG-grounded templates, then learns a policy to select one augment action per visit from three options: Soft Import, which enriches node features without modifying graph topology, Hard Import, which grafts a compact KG subgraph onto the visit graph to create message-passing shortcuts, and Skip, which leaves the visit unaugmented when the base encoder is already confident. To stabilize learning, ReTA employs a decoupled encoder that processes semantic and structural signals in separate channels and fuses them via adaptive gating. Experiments on MIMIC-III and MIMIC-IV across diagnosis prediction, mortality, and readmission show that ReTA consistently outperforms strong baselines while remaining efficient, transfers across datasets and knowledge graphs, and yields interpretable augmentation patterns. The robust gains under sparse supervision highlight the advantage of ReTA's dynamic decision to import knowledge, boosting accuracy while curbing costs.
Original Article
View Cached Full Text

Cached at: 09/03/26, 06:11 AM

# Learning When and How toAugment EHR Graphs with External Knowledge
Source: [https://arxiv.org/html/2609.01839](https://arxiv.org/html/2609.01839)
## Import What You Need: Learning When and How to Augment EHR Graphs with External Knowledge

Mohsen Nayebi Kerdabadi†Dongjie Wang†Mei Liu‡Zijun Yao†††thanks:Corresponding author\.Affiliation:†Electrical Engineering and Computer Science, University of Kansas, USAAffiliation:\{chenchen, mohsen\.nayebi, wangdongjie, zyao\}@ku\.eduAffiliation:‡Health Outcomes and Biomedical Informatics, University of Florida, USAEmail:[mei\.liu@ufl\.edu](mailto:)

###### Abstract

Longitudinal prediction from electronic health records \(EHRs\) is limited by the sparsity and irregularity in patient trajectories, and knowledge augmentation with external knowledge graphs \(KGs\) offers a promising way to alleviate these issues\. However, most existing methods perform fixed, context\-agnostic topology augmentation by adding the same KG nodes and edges regardless of a patient’s evolving state\. We proposeReTA, aReinforcement learning\-based dynamicTopologyAugmentation framework that casts KG import as a per\-visit, budget\-aware policy\. ReTA first constructs an offline refined pool of KG\-grounded templates, then learns a policy to select one augment action per visit from three options: Soft Import, which enriches node features without modifying graph topology, Hard Import, which grafts a compact KG subgraph onto the visit graph to create message\-passing shortcuts, and Skip, which leaves the visit unaugmented when the base encoder is already confident\. To stabilize learning, ReTA employs a decoupled encoder that processes semantic and structural signals in separate channels and fuses them via adaptive gating\. Experiments on MIMIC\-III and MIMIC\-IV across diagnosis prediction, mortality, and readmission show that ReTA consistently outperforms strong baselines while remaining efficient, transfers across datasets and knowledge graphs, and yields interpretable augmentation patterns\. The robust gains under sparse supervision highlight the advantage of ReTA’s dynamic decision to import knowledge, boosting accuracy while curbing costs\.

## 1Introduction

Massive electronic health records \(EHRs\) have enabled a wide range of healthcare prediction tasks, from mortality risk estimation to disease progression modeling[Choi et al\. \(2016\)](https://arxiv.org/html/2609.01839#bib.bib1);[Ma et al\. \(2017\)](https://arxiv.org/html/2609.01839#bib.bib3);[Choi et al\. \(2017\)](https://arxiv.org/html/2609.01839#bib.bib7);[Luo et al\. \(2020\)](https://arxiv.org/html/2609.01839#bib.bib4)\. However, patient\-level trajectories \(e\.g\., medical codes over visits\) in EHRs are often sparse and irregular[Rasmy et al\. \(2021\)](https://arxiv.org/html/2609.01839#bib.bib2), making it difficult for data\-driven approaches to capture complex clinical patterns such as comorbidities, complication cascades, and organ\-system interactions\. Established knowledge graphs \(KGs\) in healthcare, such as PrimeKG[Chandak et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib34), offer clinically validated concepts and relations that complement raw visit data\. Topology augmentation, which injects KG\-derived structure into EHR visit graphs, has therefore emerged as a promising strategy for learning knowledge\-augmented patient representations[Liu et al\. \(2020\)](https://arxiv.org/html/2609.01839#bib.bib5)\.

Despite their promise, existing KG\-enhanced topology augmentation methods commonly exhibit three limitations\.Static: Augmentation is typically driven by fixed, context\-agnostic rules that expand each EHR code with a predefined KG neighborhood and apply the same expansion across patients and visits\. Such static expansion can over\-retrieve weakly related concepts, dilute patient\-specific signals, and inflate message\-passing cost[Xu et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib10);[Jiang et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib6);[Zhu et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib31)\.Unbudgeted: Most approaches do not enforce a resource budget for KG augmentation\. Without budget control, expensive strategies \(e\.g\., hard structural injection\) can dominate, while lighter alternatives or outright abstention are not systematically leveraged, leading to over\-augmentation that amplifies noise[Liu et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib29);[Zhang et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib28)\.Single\-pass: Augmentation is commonly performed in a single shot for an entire trajectory, rather than making adaptive decisions at each visit\. Injected knowledge may therefore not reflect evolving patient states\. For example, a patient transitioning from chronic diabetes management to acute sepsis needs different relational context at each stage, but single\-pass methods apply the same expansion throughout[Ye et al\. \(2021\)](https://arxiv.org/html/2609.01839#bib.bib11);[Wang et al\. \(2025\)](https://arxiv.org/html/2609.01839#bib.bib32)\.

In this work, we propose ReTA, a dynamic, budgeted, and adaptive framework that performs visit\-level KG augmentation based on each patient’s evolving history\.111Code:[https://github\.com/ChenC2002/ReTA/](https://github.com/ChenC2002/ReTA/)\.ReTA formulates KG injection along patient progressions as a sequential decision problem in three steps\.

Figure 1:Two augmentation modes for visit\-level KG injection\.Soft Importenriches EHR concepts via semantic embeddings without modifying visit graph structure, whileHard Importaugments topology by adding KG\-derived nodes and edges\.Step 1: We construct a quality\-filtered knowledge pool offline\. Each medical concept is distilled via an LLM into a compact template \(a semantic definition paired with a structural cascade\), grounded against PrimeKG, and clustered to remove redundancy\. At each visit, the top\-KKmost relevant templates are retrieved by combining code\-level similarity with trajectory\-level context\.

Step 2: We introduce a budget\-aware augmentation action space \(Figure[1](https://arxiv.org/html/2609.01839#S1.F1)\)\.Soft Importenriches node features without modifying graph topology\.Hard Importgrafts a compact KG subgraph onto the visit graph to create new message\-passing paths\.Skipleaves the visit unaugmented when the base encoder is already confident\. A reinforcement learning policy selects one action per visit, balancing predictive gain against augmentation cost across the patient trajectory\.

Step 3: Because Soft Import and Hard Import produce heterogeneous signals, we decouple encoding into a semantic channel and a structural channel, fused by an adaptive gate that selectively combines complementary evidence\.

We evaluate ReTA on MIMIC\-III[Johnson et al\. \(2016\)](https://arxiv.org/html/2609.01839#bib.bib12)and MIMIC\-IV[Johnson et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib13)across three clinical tasks \(diagnosis prediction, in\-hospital mortality, and 30\-day readmission\)\. ReTA outperforms strong baselines across all evaluated tasks by wide margins at a lower inference cost\. Ablation studies \(§[3\.3](https://arxiv.org/html/2609.01839#S3.SS3)\) disentangle the effects of the knowledge pool and the policy’s decisions, demonstrating that dynamically deciding whether and how to augment each visit outperforms conventional augmentation strategies in both accuracy and latency\. Moreover, the augmentation patterns are interpretable at the visit level, with performance gains widening as supervision becomes sparser\. Finally, the framework demonstrates strong generalizability across clinical coding systems, with cross\-dataset transfer performance outperforming the strongest baseline’s in\-dataset results\.

## 2Methodology

![Refer to caption](https://arxiv.org/html/2609.01839v1/main.png)Figure 2:Overview of ReTA\.\(1\)Each medical concept is distilled into a KG\-grounded template and clustered into a refined pool\.\(2\)The policy selects one action per visit from the retrieved candidates\.\(3\)The encoder processes semantic and structural signals in separate channels before fusing them for prediction\.### 2\.1Problem Setup

##### Prediction task\.

Let𝒞dx\\mathcal\{C\}\_\{\\mathrm\{dx\}\}denote the set of all unique diagnosis codes in ICD\-9/10\. A patient trajectory𝐕=\{V1,…,VT\}\\mathbf\{V\}=\\\{V\_\{1\},\\dots,V\_\{T\}\\\}is a chronological sequence of hospital visits, where each visitVt⊆𝒞dxV\_\{t\}\\subseteq\\mathcal\{C\}\_\{\\mathrm\{dx\}\}records the diagnosis codes observed at timett\. We predict next\-visit diagnoses at the granularity of Clinical Classifications Software \(CCS\) categories, which group fine\-grained ICD codes into clinically meaningful phenotypes and keep the label space consistent across ICD\-9 and ICD\-10 cohorts\. Let𝒜\\mathcal\{A\}denote the CCS label space\. Given historyV1:tV\_\{1:t\}, the model outputs𝐲^t\+1∈\[0,1\]\|𝒜\|\\hat\{\\mathbf\{y\}\}\_\{t\+1\}\\in\[0,1\]^\{\|\\mathcal\{A\}\|\}, a probability vector over CCS categories for visitt\+1t\{\+\}1\. For binary clinical outcomes \(mortality, readmission\), we replace the multi\-label CCS head with a single sigmoid output and train with binary cross\-entropy, keeping all other components identical\.

##### Visit graphs\.

For each visitVtV\_\{t\}we build a graphGt=\(𝒱t,ℰt\)G\_\{t\}=\(\\mathcal\{V\}\_\{t\},\\mathcal\{E\}\_\{t\}\)whose nodes are the observed ICD codes together with their CCS ancestors up tohhhierarchy levels, and whose edges follow the CCS hierarchy among these nodes, treated as undirected for message passing \(Appendix[B\.1](https://arxiv.org/html/2609.01839#A2.SS1)\)\. We augment these visit graphs with knowledge from PrimeKG[Chandak et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib34), a precision\-medicine knowledge graph that integrates over twenty biomedical resources with rich pathophysiological and disease\-complication relations\. The bridging between ICD/CCS and PrimeKG vocabularies is described in §[2\.2\.1](https://arxiv.org/html/2609.01839#S2.SS2.SSS1)\. Figure[2](https://arxiv.org/html/2609.01839#S2.F2)illustrates the full pipeline\.

### 2\.2Knowledge Pool

Per\-visit augmentation is more efficient when it draws from a pre\-built, bounded candidate set than when it expands an open\-ended KG neighborhood on the fly\. We construct a pool of reusable knowledge templates offline, where each template pairs a semantic summary with a compact subgraph\.

#### 2\.2\.1LLM Distillation and KG Grounding

For each ICD code and its mapped CCS category, we prompt an LLM with the concept’s canonical textual description and ask it to return a one\-sentence definition describing the pathology and a clinical cascade listing downstream complications or comorbidities\. We adapt the cascade length to each concept’s neighborhood density in PrimeKG\. Concepts with few verified KG neighbors receive longer cascades \(up to five items\) to compensate for sparse relational context, while concepts with dense neighborhoods receive shorter ones \(as few as one item\)\. For diabetes, which has moderate KG coverage, a typical cascade might list retinopathy, neuropathy, and nephropathy\. No patient\-level context is provided, and each concept is processed independently with fixed decoding parameters \(prompt template in Appendix[B\.2](https://arxiv.org/html/2609.01839#A2.SS2)\)\.

We ground each mention to a standardized biomedical identifier by exact matching against ICD, CCS, and PrimeKG vocabularies, falling back to cosine similarity betweenℓ2\\ell\_\{2\}\-normalized name embeddings above a thresholdτmap\\tau\_\{\\mathrm\{map\}\}[Liu et al\. \(2021\)](https://arxiv.org/html/2609.01839#bib.bib24);[Sung et al\. \(2020\)](https://arxiv.org/html/2609.01839#bib.bib25);[Neumann et al\. \(2019\)](https://arxiv.org/html/2609.01839#bib.bib33)\. This same normalization bridges ICD and CCS concepts to PrimeKG nodes when constructing visit graphs \(§[2\.1](https://arxiv.org/html/2609.01839#S2.SS1)\)\. For each concept, we then retrieve its PrimeKG neighborhood up tokkhops and retain only entities and links verifiable against the KG[Soldaini and Goharian \(2016\)](https://arxiv.org/html/2609.01839#bib.bib26)\. All filtering uses only external resources and fixed code descriptions\. Apart from the diagnosis vocabulary, pool construction touches no patient trajectories, outcomes, splits, or cohort statistics \(thresholds and diagnostics in Appendix[B\.3](https://arxiv.org/html/2609.01839#A2.SS3)and[B\.5](https://arxiv.org/html/2609.01839#A2.SS5)\)\.

#### 2\.2\.2Template Clustering

We compress and de\-duplicate the grounded outputs by clustering\. Each concept text, consisting of its definition concatenated with its cascade, is embedded with ClinicalBERT[Alsentzer et al\. \(2019\)](https://arxiv.org/html/2609.01839#bib.bib17)and grouped via agglomerative clustering under cosine distance with cut thresholdτ\\tau\. For each resulting cluster we compute a centroid, project it into the model embedding space, andℓ2\\ell\_\{2\}\-normalize it to obtain a template vector𝐩k∈ℝd\\mathbf\{p\}\_\{k\}\\in\\mathbb\{R\}^\{d\}\(details in Appendix[B\.4](https://arxiv.org/html/2609.01839#A2.SS4)\)\. The global pool𝒫global=\{𝐩k\}k=1M\\mathcal\{P\}\_\{\\mathrm\{global\}\}=\\\{\\mathbf\{p\}\_\{k\}\\\}\_\{k=1\}^\{M\}containsMMtemplates\. Because cascade lengths vary by concept, templates differ in subgraph size, which the augmentation policy accounts for when selecting actions \(§[2\.3](https://arxiv.org/html/2609.01839#S2.SS3)\)\.

#### 2\.2\.3History\-Aware Retrieval

At each visitVtV\_\{t\}, we retrieve a candidate subpool from𝒫global\\mathcal\{P\}\_\{\\mathrm\{global\}\}using both the current visit and the patient’s accumulated history\. Letsts\_\{t\}denote the patient state defined in §[2\.3](https://arxiv.org/html/2609.01839#S2.SS3), computed from past visit summaries and the current visit’s base embedding before any augmentation\. We score each template by combining a code\-level similarity term with a trajectory\-level term:

Score⁡\(Vt,st,𝐩k\)=\\displaystyle\\mathrm\{Score\}\(V\_\{t\},s\_\{t\},\\mathbf\{p\}\_\{k\}\)=\{\}\(1−α\)​maxci∈Vt⁡cos⁡\(𝐞ci,𝐩k\)\\displaystyle\(1\{\-\}\\alpha\)\\max\_\{c\_\{i\}\\in V\_\{t\}\}\\cos\(\\mathbf\{e\}\_\{c\_\{i\}\},\\mathbf\{p\}\_\{k\}\)\+αcos\(st,𝐩k\),\\displaystyle\+\\;\\alpha\\,\\cos\(s\_\{t\},\\mathbf\{p\}\_\{k\}\),\(1\)where𝐞ci∈ℝd\\mathbf\{e\}\_\{c\_\{i\}\}\\in\\mathbb\{R\}^\{d\}is the learnable embedding of codecic\_\{i\}andα\\alphacontrols the weight of the trajectory signal\. The additive form ensures that a template can be retrieved either because it matches a current diagnosis or because it aligns with the patient’s accumulated clinical context\. We retain the top\-KKtemplates as the candidate subpool𝒫sub\(t\)\\mathcal\{P\}^\{\(t\)\}\_\{\\mathrm\{sub\}\}\.

### 2\.3Augmentation Policy

Augmentation decisions along a trajectory are interdependent, since early actions reshape intermediate representations and constrain what is beneficial at later visits\. We make these decisions visit by visit in chronological order, formulating the process as a sequential decision problem trained with reinforcement learning\. Patient trajectories are short \(median 2–3 visits\), so the policy performs short\-horizon, cost\-aware routing over the retrieved templates rather than long\-horizon planning\.

#### 2\.3\.1State and Actions

The statests\_\{t\}summarizes the patient history up to visittt\. Let𝐯t∈ℝd\\mathbf\{v\}\_\{t\}\\in\\mathbb\{R\}^\{d\}be the encoder’s summary of visitVtV\_\{t\}\(§[2\.4](https://arxiv.org/html/2609.01839#S2.SS4)\) on the base graph before augmentation\. We compress past visits with a GRU[Chung et al\. \(2014\)](https://arxiv.org/html/2609.01839#bib.bib27)to formst=GRU\(𝐯1:t−1\)⊕𝐯ts\_\{t\}=\\mathrm\{GRU\}\(\\mathbf\{v\}\_\{1:t\-1\}\)\\oplus\\mathbf\{v\}\_\{t\}, where⊕\\oplusdenotes concatenation\.

The discrete action space consists ofKKtemplate\-mode pairs plus a single Skip action,𝒪\(t\)=\(𝒫sub\(t\)×\{0,1\}\)∪\{Skip\}\\mathcal\{O\}^\{\(t\)\}=\\big\(\\mathcal\{P\}^\{\(t\)\}\_\{\\mathrm\{sub\}\}\\times\\\{0,1\\\}\\big\)\\cup\\\{\\texttt\{Skip\}\\\}, giving2​K\+12K\{\+\}1actions\. Each augmentation actionat=\(𝐩k,δ\)a\_\{t\}=\(\\mathbf\{p\}\_\{k\},\\delta\)specifies which template to use and how to apply it\. The Skip action leaves the visit unaugmented\. A lightweight MLP policyπθ​\(at∣st\)\\pi\_\{\\theta\}\(a\_\{t\}\\mid s\_\{t\}\)outputs a categorical distribution over these actions\. We allow one action per visit, forcing the policy to weigh whether to augment, which template to import, and whether to apply Soft Import or the costlier Hard Import\.

We also compute a base\-prediction uncertaintyut=1−max⁡\(y^t\+1base\)u\_\{t\}=1\-\\max\(\\hat\{y\}^\{\\mathrm\{base\}\}\_\{t\+1\}\)from the Stage 1 encoder and append it tosts\_\{t\}, so that the policy observes how confident the encoder is before augmentation\. This biases the policy toward Skip when the base representation is already sufficient \(§[3\.4](https://arxiv.org/html/2609.01839#S3.SS4)\)\.

##### Soft Import\.

We map the selected template vector through a shared two\-layer MLPϕ\\phiand broadcast the resulting offset to every code in the visit, scaled by a strength parameterξ\\xi,

𝐗t′=𝐗t\+ξ⁡\(𝟏\|Vt\|⊗ϕ⁡\(𝐩k\)\),\\mathbf\{X\}^\{\\prime\}\_\{t\}=\\mathbf\{X\}\_\{t\}\+\\xi\\big\(\\mathbf\{1\}\_\{\|V\_\{t\}\|\}\\otimes\\phi\(\\mathbf\{p\}\_\{k\}\)\\big\),\(2\)where𝐗t∈ℝ\|Vt\|×d\\mathbf\{X\}\_\{t\}\\in\\mathbb\{R\}^\{\|V\_\{t\}\|\\times d\}collects the node features of the original visit codes\. The offset is uniform because the template provides visit\-level clinical context\. Code\-level differentiation happens in the downstream attention layers\.

##### Hard Import\.

The template’s compact subgraphg𝐩k=\(V𝐩k,E𝐩k\)g\_\{\\mathbf\{p\}\_\{k\}\}=\(V\_\{\\mathbf\{p\}\_\{k\}\},E\_\{\\mathbf\{p\}\_\{k\}\}\)is grafted onto the visit graph to formGt′=\(𝒱t∪V𝐩k,ℰt∪E𝐩k\)G^\{\\prime\}\_\{t\}=\(\\mathcal\{V\}\_\{t\}\\cup V\_\{\\mathbf\{p\}\_\{k\}\},\\,\\mathcal\{E\}\_\{t\}\\cup E\_\{\\mathbf\{p\}\_\{k\}\}\), adding new relational paths for message passing between codes that share no direct edge\. Node features remain at their base values, so any gain from Hard Import is attributable to the added structure rather than to feature enrichment\.

#### 2\.3\.2Reward

To isolate each augmentation’s incremental benefit from the baseline difficulty of each visit, we compare the augmented inputGedit\(t\)G^\{\(t\)\}\_\{\\mathrm\{edit\}\}against its unaugmented counterpartGraw\(t\)G^\{\(t\)\}\_\{\\mathrm\{raw\}\}under the current encoder on the same mini\-batch with dropout disabled:

rt\\displaystyle r\_\{t\}=λ1​\(ℒC​E​\(Graw\(t\)\)−ℒC​E​\(Gedit\(t\)\)\)\\displaystyle=\\lambda\_\{1\}\\Big\(\\mathcal\{L\}\_\{CE\}\\big\(G^\{\(t\)\}\_\{\\mathrm\{raw\}\}\\big\)\-\\mathcal\{L\}\_\{CE\}\\big\(G^\{\(t\)\}\_\{\\mathrm\{edit\}\}\\big\)\\Big\)−λ2𝕀\[δ=1\]\|V𝐩k\|\|𝒱t\|,\\displaystyle\\quad\-\\lambda\_\{2\}\\,\\mathbb\{I\}\[\\delta\{=\}1\]\\,\\frac\{\|V\_\{\\mathbf\{p\}\_\{k\}\}\|\}\{\|\\mathcal\{V\}\_\{t\}\|\},\(3\)whereℒC​E\\mathcal\{L\}\_\{CE\}is the cross\-entropy loss for predictingyt\+1y\_\{t\+1\},λ1\\lambda\_\{1\}weights prediction improvement, andλ2\\lambda\_\{2\}penalizes Hard Import in proportion to the added nodes\. Under Skip, raw and augmented inputs are identical, sort=0r\_\{t\}=0by construction\.

To sharpen credit assignment, we maintain a running utilityr¯k\\bar\{r\}\_\{k\}for each templatekk, updated asr¯k←γr​r¯k\+\(1−γr\)​rt\\bar\{r\}\_\{k\}\\leftarrow\\gamma\_\{r\}\\,\\bar\{r\}\_\{k\}\+\(1\{\-\}\\gamma\_\{r\}\)\\,r\_\{t\}whenever templatekkis selected\. The utilities of allKKcandidates are concatenated withsts\_\{t\}to form the policy input, giving the policy a memory of which templates have been useful in similar contexts\.

We optimize the policy with REINFORCE[Zhang et al\. \(2021\)](https://arxiv.org/html/2609.01839#bib.bib35)using a running\-mean baseline to reduce variance\. With such short trajectories and a lightweight MLP policy, critic\-based methods are unnecessary\.

### 2\.4Decoupled Encoding

Soft Import modifies node features while preserving graph topology\. Hard Import adds nodes and edges while preserving features\. Encoding both in a single channel would conflate these signals, making it difficult for the encoder to attribute gradient updates to the correct source\. We process them in two parallel channels and fuse the outputs with a learned gate\.

#### 2\.4\.1Semantic Channel

This channel captures within\-visit context from node features alone\. We apply multi\-head self\-attention over the original visit codes using their post\-augment features𝐗t′\\mathbf\{X\}^\{\\prime\}\_\{t\}to produce semantic representations\{hisem\}i∈Vt\\\{h^\{\\mathrm\{sem\}\}\_\{i\}\\\}\_\{i\\in V\_\{t\}\}\. Nodes added by Hard Import are excluded so that this channel reflects only observed codes\.

#### 2\.4\.2Structure Channel

This channel runs message passing on the full augmented graphGt′G^\{\\prime\}\_\{t\}, including any nodes and edges added by Hard Import\. A graph\-attention layer[Veličković et al\. \(2018\)](https://arxiv.org/html/2609.01839#bib.bib18)aggregates neighbor information to produce within\-visit structural representationshiintrah^\{\\mathrm\{intra\}\}\_\{i\}for each nodeii\. To incorporate longitudinal context, each node also attends over past visit embeddings\{hG\(t′\)\}t′<t\\\{h^\{\(t^\{\\prime\}\)\}\_\{G\}\\\}\_\{t^\{\\prime\}<t\}via dot\-product attention, yielding an across\-visit summaryhiinterh^\{\\mathrm\{inter\}\}\_\{i\}\. The two signals are combined with a sigmoid gate intohistruct=μi​hiintra\+\(1−μi\)​hiinterh^\{\\mathrm\{struct\}\}\_\{i\}=\\mu\_\{i\}\\,h^\{\\mathrm\{intra\}\}\_\{i\}\+\(1\{\-\}\\mu\_\{i\}\)\\,h^\{\\mathrm\{inter\}\}\_\{i\}, whereμi=σ\(Wfuse\[hiintra∥hiinter\]\+bfuse\)\\mu\_\{i\}=\\sigma\(W\_\{\\mathrm\{fuse\}\}\[h^\{\\mathrm\{intra\}\}\_\{i\}\\\|h^\{\\mathrm\{inter\}\}\_\{i\}\]\+b\_\{\\mathrm\{fuse\}\}\)\.

#### 2\.4\.3Fusion

We fuse the semantic and structural views with a second sigmoid gateβi=σ\(Wgate\[hisem∥histruct\]\+bgate\)\\beta\_\{i\}=\\sigma\(W\_\{\\mathrm\{gate\}\}\[h^\{\\mathrm\{sem\}\}\_\{i\}\\\|h^\{\\mathrm\{struct\}\}\_\{i\}\]\+b\_\{\\mathrm\{gate\}\}\), giving the final node representationzi=βi​hisem\+\(1−βi\)​histructz\_\{i\}=\\beta\_\{i\}\\,h^\{\\mathrm\{sem\}\}\_\{i\}\+\(1\{\-\}\\beta\_\{i\}\)\\,h^\{\\mathrm\{struct\}\}\_\{i\}\. The visit embeddinghG\(t\)=∑i∈Vtzih\_\{G\}^\{\(t\)\}=\\sum\_\{i\\in V\_\{t\}\}z\_\{i\}sums over original visit codes only, so injected nodes contribute through message passing but do not directly enter the prediction\.

### 2\.5Training

Training proceeds in two stages with the combined objectiveℒtotal=ℒtask−η​𝒥RL\\mathcal\{L\}\_\{\\mathrm\{total\}\}=\\mathcal\{L\}\_\{\\mathrm\{task\}\}\-\\eta\\,\\mathcal\{J\}^\{\\mathrm\{RL\}\}, where𝒥RL\\mathcal\{J\}^\{\\mathrm\{RL\}\}is the REINFORCE objective\.

Stage 1 trains the encoder onℒtask\\mathcal\{L\}\_\{\\mathrm\{task\}\}while stochastically applying Soft Import, Hard Import, or Skip, producing a warm\-started encoder that can stably process all three action types\. The encoder snapshot at the end of this stage is frozen and supplies the base predictiony^t\+1base\\hat\{y\}^\{\\mathrm\{base\}\}\_\{t\+1\}used for the uncertainty signalutu\_\{t\}\(§[2\.3](https://arxiv.org/html/2609.01839#S2.SS3)\)\.

Stage 2 optimizes the augmentation policy under the paired reward while continuing to refine the encoder on policy\-augmented visits, so that the encoder and policy co\-adapt\. The full curriculum is given in Algorithm[1](https://arxiv.org/html/2609.01839#alg1), with complexity analysis in Appendix[A\.2](https://arxiv.org/html/2609.01839#A1.SS2)\.

## 3Experiments

Table 1:Diagnosis prediction \(mean±\\pmstd, 5 seeds\)\. Cross\-Dataset rows are labeled train→\\,\\rightarrow\\,test\.†\\dagger= Holm–Bonferronip<0\.05p\{<\}0\.05vs\. best baseline \(underlined\)\.MIMIC\-III \(%\)MIMIC\-IV \(%\)CategoryModelAUPRCMicro\-F1Acc@20AUPRCMicro\-F1Acc@20LLM\-BasedGPT\-4o22\.41±\\pm\.5718\.36±\\pm\.6433\.74±\\pm\.5121\.87±\\pm\.4917\.52±\\pm\.5832\.91±\\pm\.44\+ PrimeKG25\.63±\\pm\.6120\.74±\\pm\.6836\.28±\\pm\.5324\.91±\\pm\.5419\.83±\\pm\.6235\.47±\\pm\.48SequenceModelsTransformer30\.38±\\pm\.3125\.88±\\pm\.4540\.38±\\pm\.2229\.28±\\pm\.2522\.90±\\pm\.1839\.77±\\pm\.21RETAIN28\.26±\\pm\.1222\.70±\\pm\.2138\.25±\\pm\.1528\.15±\\pm\.1022\.14±\\pm\.1437\.60±\\pm\.12OntologyEncodersHAP29\.28±\\pm\.3023\.18±\\pm\.4739\.56±\\pm\.3330\.86±\\pm\.1825\.87±\\pm\.2240\.44±\\pm\.25G\-BERT29\.57±\\pm\.4423\.41±\\pm\.5139\.82±\\pm\.2733\.08±\\pm\.2927\.53±\\pm\.3841\.63±\\pm\.20StructureLearnersGRAM28\.99±\\pm\.2424\.10±\\pm\.3939\.13±\\pm\.4230\.17±\\pm\.2025\.08±\\pm\.2540\.68±\\pm\.28SeqCare30\.71±\\pm\.3825\.94±\\pm\.3340\.52±\\pm\.4131\.26±\\pm\.2227\.38±\\pm\.3041\.93±\\pm\.27KG\-AugmentedGraphCare31\.42±\\pm\.5827\.10±\\pm\.6242\.18±\\pm\.4831\.85±\\pm\.4528\.45±\\pm\.4242\.15±\\pm\.39RAM\-EHR31\.87±\\pm\.3428\.52±\\pm\.4141\.73±\\pm\.2932\.63±\\pm\.2831\.03±\\pm\.3343\.48±\\pm\.24KARE32\.53±\\pm\.3529\.38±\\pm\.4042\.06±\\pm\.3633\.42±\\pm\.3330\.81±\\pm\.3744\.18±\\pm\.29Ours\(ReTA\)UMLS33\.87±\\pm\.4530\.48±\\pm\.4943\.62±\\pm\.3934\.63±\\pm\.3831\.86±\\pm\.4245\.24±\\pm\.36PrimeKG34\.52±\\pm\.43†31\.06±\\pm\.46†44\.15±\\pm\.37†35\.18±\\pm\.36†32\.43±\\pm\.39†45\.87±\\pm\.34†MIMIC\-IV→\\rightarrowMIMIC\-IIIMIMIC\-III→\\rightarrowMIMIC\-IVCross\-DatasetGraphCare28\.64±\\pm\.6724\.53±\\pm\.7437\.82±\\pm\.5225\.93±\\pm\.6122\.87±\\pm\.6835\.41±\\pm\.48RAM\-EHR29\.13±\\pm\.5826\.71±\\pm\.6538\.63±\\pm\.4927\.42±\\pm\.5225\.34±\\pm\.5936\.87±\\pm\.45KARE29\.71±\\pm\.5426\.48±\\pm\.6138\.42±\\pm\.4727\.84±\\pm\.4925\.17±\\pm\.5637\.28±\\pm\.43ReTA33\.08±\\pm\.55†29\.42±\\pm\.59†42\.37±\\pm\.48†32\.41±\\pm\.51†29\.18±\\pm\.56†42\.63±\\pm\.44†

Table 2:In\-hospital mortality and 30\-day readmission \(mean±\\pmstd, 5 seeds\)\.†\\dagger= Holm–Bonferronip<0\.05p\{<\}0\.05vs\. best baseline \(underlined\)\.MIMIC\-III \(%\)MIMIC\-IV \(%\)TaskModelAUROCAUPRCF1AUROCAUPRCF1In\-HospitalMortalityGraphCare86\.52±\\pm\.3949\.17±\\pm\.5143\.84±\\pm\.4687\.14±\\pm\.3350\.28±\\pm\.4544\.67±\\pm\.41RAM\-EHR87\.18±\\pm\.3450\.63±\\pm\.4744\.52±\\pm\.4287\.63±\\pm\.2952\.14±\\pm\.4145\.36±\\pm\.37KARE86\.94±\\pm\.3149\.78±\\pm\.4445\.19±\\pm\.3988\.27±\\pm\.2751\.09±\\pm\.3845\.83±\\pm\.34ReTA89\.67±\\pm\.26†54\.52±\\pm\.36†48\.36±\\pm\.33†90\.43±\\pm\.23†55\.61±\\pm\.31†49\.28±\\pm\.29†30\-DayReadmissionGraphCare67\.83±\\pm\.5239\.26±\\pm\.5935\.17±\\pm\.5469\.38±\\pm\.4641\.47±\\pm\.5336\.28±\\pm\.48RAM\-EHR68\.47±\\pm\.4738\.62±\\pm\.5534\.91±\\pm\.5169\.14±\\pm\.4240\.86±\\pm\.4936\.71±\\pm\.45KARE67\.91±\\pm\.4439\.41±\\pm\.5235\.63±\\pm\.4870\.21±\\pm\.3940\.93±\\pm\.4636\.94±\\pm\.42ReTA72\.14±\\pm\.38†43\.87±\\pm\.46†39\.72±\\pm\.42†73\.56±\\pm\.34†45\.26±\\pm\.41†41\.08±\\pm\.37†

### 3\.1Setup

##### Datasets\.

We evaluate on MIMIC\-III[Johnson et al\. \(2016\)](https://arxiv.org/html/2609.01839#bib.bib12)and MIMIC\-IV[Johnson et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib13)for next\-visit diagnosis prediction \(CCS granularity\), in\-hospital mortality, and 30\-day readmission\. Dataset statistics are in Appendix[A\.1](https://arxiv.org/html/2609.01839#A1.SS1)\.

##### Baselines\.

We compare against 9 methods spanning four categories\. Sequence models include Transformer[Vaswani et al\. \(2017\)](https://arxiv.org/html/2609.01839#bib.bib30)and RETAIN[Choi et al\. \(2016\)](https://arxiv.org/html/2609.01839#bib.bib1)\. Ontology encoders include G\-BERT[Shang et al\. \(2019\)](https://arxiv.org/html/2609.01839#bib.bib9)and HAP[Zhang et al\. \(2020\)](https://arxiv.org/html/2609.01839#bib.bib15)\. Structure learners include GRAM[Choi et al\. \(2017\)](https://arxiv.org/html/2609.01839#bib.bib7)and SeqCare[Xu et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib10)\. KG\-augmented systems include GraphCare[Jiang et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib6), RAM\-EHR[Xu et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib23), and KARE[Jiang et al\. \(2025\)](https://arxiv.org/html/2609.01839#bib.bib22)\. All methods use the same temporal splits and receive the same ICD code inputs, and KG\-augmented methods additionally share the same PrimeKG and ICD\-to\-KG linker\. We also evaluate GPT\-4o[Hurst et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib16)as a direct predictor by serializing visit histories into ICD descriptions and prompting for CCS predictions \(temperature 0\.2, 5 samples per patient\)\. The \+ PrimeKG variant appends each code’s 1\-hop KG neighbors to the prompt\. To test KG generality, ReTAUMLSrebuilds the knowledge pool from UMLS Metathesaurus[Bodenreider \(2004\)](https://arxiv.org/html/2609.01839#bib.bib8)disease\-complication relations using the same vocabulary bridge \(§[2\.2\.1](https://arxiv.org/html/2609.01839#S2.SS2.SSS1)\) and encoder\.

##### Metrics\.

We report AUPRC \(primary\), Micro\-F1, and Acc@20 for diagnosis prediction, and AUROC, AUPRC, and F1 for mortality and readmission\. Full hyperparameters are in Appendix[A\.2](https://arxiv.org/html/2609.01839#A1.SS2)\.

### 3\.2Main Results

##### Diagnosis prediction\.

ReTA outperforms all baselines on every dataset\-metric pair \(Table[1](https://arxiv.org/html/2609.01839#S3.T1)\), with AUPRC gains of \+1\.99 \(MIMIC\-III\) and \+1\.76 \(MIMIC\-IV\) over KARE\. The in\-domain margin is modest but reliable\. It holds under Holm–Bonferroni correction on both datasets, grows to \+4\.72 on the rarest diagnoses \(Figure[5](https://arxiv.org/html/2609.01839#S3.F5)c\), and widens to \+3\.37 and \+4\.57 under cross\-dataset transfer\. Within the baselines, the largest single jump occurs at the KG\-augmented tier where per\-patient retrieval begins, indicating that the bottleneck is not external knowledge itself but how adaptively it is applied\. ReTA pushes this further by making augmentation decisions at the visit level rather than the patient level\. The Stage 1 checkpoint \(warm\-started encoder, no policy\) reaches 33\.26 AUPRC on MIMIC\-III and the full model reaches 34\.52\. Because Stage 1 already exposes the encoder to a fixed stochastic mixture of all three actions, the \+1\.26 difference reflects the full Stage 2 curriculum applied to an action\-exposed checkpoint, not the policy alone\. Matched controls that isolate the policy’s contribution are in §[3\.3](https://arxiv.org/html/2609.01839#S3.SS3)\.

##### LLM and KG generality\.

GPT\-4o scores below all graph\-based methods, including RETAIN\. The failure is structural\. The 283\-category CCS label space requires calibrated multi\-label probability estimates, but next\-token generation over\-predicts frequent diagnoses and misses rare ones, and cannot propagate relational constraints across a visit graph the way message passing does\. Adding PrimeKG context to the prompt narrows the gap by surfacing complication relations but cannot replicate graph\-structured reasoning\. This confirms that ReTA’s use of an LLM is correctly scoped to offline distillation, where clinical paraphrase complements the graph encoder rather than replacing it\. ReTAUMLSachieves 34\.63% AUPRC on MIMIC\-IV, above every baseline but 0\.55 below the PrimeKG variant, with the gap reflecting PrimeKG’s denser pathophysiological links rather than framework coupling to a particular knowledge source\.

##### Generalization\.

Cross\-dataset transfer introduces a genuine shift between ICD\-9 and ICD\-10 coding systems\. Relative to their in\-domain result on the evaluation dataset, baselines lose 8\.6–18\.6% of AUPRC depending on direction, while ReTA loses 4\.2% transferring to MIMIC\-III and 7\.9% transferring to MIMIC\-IV, because PrimeKG provides dataset\-agnostic relational structure and the Skip mechanism avoids importing distribution\-specific noise\. ReTA’s transfer AUPRC on MIMIC\-III \(33\.08\) exceeds KARE’s in\-domain result \(32\.53\)\.

##### Mortality and readmission\.

On the two binary tasks \(Table[2](https://arxiv.org/html/2609.01839#S3.T2)\), ReTA outperforms the strongest baselines by \+2\.5/\+2\.2 AUROC on mortality and \+3\.7/\+3\.4 on readmission\. The readmission margin is wider because re\-hospitalization depends on how chronic conditions interact at discharge, where Hard Import’s relational paths between comorbidity clusters are most valuable, while mortality is more determined by acute severity markers already captured by the base encoder\.

### 3\.3Ablation

Figure 3:Ablation on MIMIC\-IV, reported as AUPRC drop from the full model\.∗Diagnostic bound \(see §[3\.3](https://arxiv.org/html/2609.01839#S3.SS3)\)\. Exact values and MIMIC\-III controls are in Appendix[D](https://arxiv.org/html/2609.01839#A4)\.##### Component ablation\.

Across pipeline stages \(Figure[3](https://arxiv.org/html/2609.01839#S3.F3)and Table[11](https://arxiv.org/html/2609.01839#A4.T11)\), the knowledge pool contributes the largest gains, the policy provides the next tier, and the encoding stage shapes how the two augmentation modes integrate\. The refined pool \(−\-3\.12\) matters most because it determines what knowledge can enter the pipeline, and replacing LLM\-distilled cascades with rule\-based CCS\-hierarchy expansions \(−\-1\.85\) shows the LLM accounts for roughly 60% of that value\. The per\-visit policy \(−\-1\.78\) and dual\-mode import \(−\-1\.41\) are complementary, one deciding whether to augment and the other how, while freezing the encoder during Stage 2 costs little, ruling out reward inflation from encoder specialization \(Appendix[F\.2](https://arxiv.org/html/2609.01839#A6.SS2)and[F\.3](https://arxiv.org/html/2609.01839#A6.SS3)\)\. To isolate the policy from its curriculum, the rate\-matched shuffle holds the checkpoint, updates, budget, and action rates fixed and shuffles only which visits receive each action, still losing 1\.16 and 1\.42 AUPRC \(Table[11](https://arxiv.org/html/2609.01839#A4.T11)\)\. The pool supplies the knowledge, the encoder represents it, and the policy decides when and how it is used\.

##### Selector comparison\.

The Selectors group in Figure[3](https://arxiv.org/html/2609.01839#S3.F3)compares the learned policy against four alternatives under identical pools and encoders \(Table[12](https://arxiv.org/html/2609.01839#A4.T12)\)\. The threshold heuristic cannot select templates or override retrieval rankings, the supervised selector needs exhaustive per\-action oracle labels and still trails, and the greedy oracle consults the true test outcome across all 41 actions per visit, making it a diagnostic bound rather than a deployable method\. The contextual bandit, the closest deployable alternative, trails by 0\.50 at similar latency, so among selectors requiring no oracle labels RL is the most accurate, and we frame its role as short\-horizon, cost\-aware routing\.

##### Pool sources and validation\.

The Pool Sources group in Figure[3](https://arxiv.org/html/2609.01839#S3.F3)rebuilds the pool from single sources under the same retrieval and encoding interface, where training\-set co\-occurrence performs worst and PrimeKG\-only beats GPT\-4o\-only, so the pool’s value does not reduce to LLM\-encoded co\-occurrences\. We therefore describe the pool as LLM\-guided and structurally KG\-supported, since every retained Hard\-Import relation has support from PrimeKG or CCS \(Appendix[B\.3](https://arxiv.org/html/2609.01839#A2.SS3)\)\. A blinded audit of 240 retained templates finds 94\.2% correct definitions and 93\.8% correct relations, with a higher major\-error rate for rare diagnoses \(2\.5% vs\. 0\.8%, Appendix[B\.6](https://arxiv.org/html/2609.01839#A2.SS6)\), and rebuilding the pool with Qwen3\-32B preserves roughly three quarters of retained grounded links while shifting AUPRC by at most 0\.40 \(Appendix[B\.7](https://arxiv.org/html/2609.01839#A2.SS7)\)\.

### 3\.4Analysis

Figure 4:AUPRC vs\. per\-visit latency on MIMIC\-IV \(left\) and per\-patient skip rate by base\-prediction uncertainty quartile \(right\)\.Figure 5:Robustness on MIMIC\-IV under four degradation axes\.##### Latency\.

ReTA achieves 35\.18% AUPRC at 11\.8 ms/visit \(Figure[4](https://arxiv.org/html/2609.01839#S3.F4)a\), occupying the upper\-left region where accuracy is highest and latency lowest among KG\-augmented methods\. GraphCare and KARE achieve lower AUPRC at higher latency \(16\.8 and 15\.1 ms\), because they apply knowledge uniformly rather than selectively\.

##### Skip behavior\.

The policy skips 27% of visits on MIMIC\-III and 31% on MIMIC\-IV, with the skip rate dropping monotonically from 68% in Q1 \(most confident\) to 9% in Q4 \(least confident\), as shown in Figure[4](https://arxiv.org/html/2609.01839#S3.F4)\(b\)\. Skip therefore concentrates on visits that the base encoder already handles well\. Because confident visits are also easier, comparing accuracy on skipped and augmented visits would confound routing with visit difficulty, so we evaluate abstention at the system level\. Retraining Stage 2 without Skip costs 0\.62 AUPRC and adds 1\.0 ms per visit \(Table[12](https://arxiv.org/html/2609.01839#A4.T12)\), so abstention improves accuracy and latency together rather than merely selecting easy visits\. Sensitivity analysis and calibration diagnostics are in Appendices[C](https://arxiv.org/html/2609.01839#A3)and[E\.2](https://arxiv.org/html/2609.01839#A5.SS2)\.

##### Retrieval overrides\.

The policy departs from code\-only Top\-1 retrieval on 53\.4% of MIMIC\-III visits and 59\.2% of MIMIC\-IV visits, overriding the template choice on roughly a third of non\-Skip visits, and forcing Top\-1 selection lowers AUPRC by 0\.49 and 0\.56 \(Table[13](https://arxiv.org/html/2609.01839#A4.T13)\)\. History\-aware routing is therefore systematic rather than isolated, as the case study in §[3\.6](https://arxiv.org/html/2609.01839#S3.SS6)illustrates\.

### 3\.5Robustness

##### Training data and input completeness\.

Under progressive subsampling \(Figure[5](https://arxiv.org/html/2609.01839#S3.F5)a\), ReTA’s margin over KARE grows from 1\.76 at full data to 4\.53 at 10%, consistent with the knowledge pool providing structured priors that compensate for sparse co\-occurrence statistics\. Under random diagnosis masking \(panel b\), ReTA retains 87% of full\-input AUPRC at 60% masking versus 78% for KARE, because Hard Import can partially recover lost connectivity by grafting short message\-passing paths\.

##### Label frequency and knowledge quality\.

The gain over KARE increases monotonically with label scarcity \(panel c\), from \+1\.54 on the most frequent diagnoses \(\>\>500 occurrences\) to \+4\.72 on the rarest bin \(<<5\)\. Under mixed corruption of retrieved templates \(panel d\), ReTA loses 0\.87 AUPRC at 30% corruption compared to 1\.71 for KARE, because Skip and template utility together enable the policy to route around corrupted templates\. Per\-stratum numbers are in Appendix[E\.1](https://arxiv.org/html/2609.01839#A5.SS1)\.

##### Richer structured inputs\.

Giving both methods prior medication and procedure codes under the same cutoff, ReTA reaches 36\.29 AUPRC against 34\.61 for KARE at lower latency \(12\.9 vs\. 16\.3 ms, Table[14](https://arxiv.org/html/2609.01839#A4.T14)\), and Hard Import falls from 34% to 25% of actions, consistent with richer inputs supplying connectivity that structural grafting would otherwise provide\. Our evaluation covers structured codes, and clinical notes remain future work\.

### 3\.6Case Study

Figure 6:Per\-visit augmentation decisions \(a–c\) and cohort\-level action distribution \(d\)\. Panel \(b\) shows the fusion gateβ\\betawith the semantic and structural shares normalized to sum to one\.Figure 7:Hard Import topology for the case study\. Cascade nodes create short message\-passing paths betweenV1V\_\{1\}andV5V\_\{5\}\.Figure[6](https://arxiv.org/html/2609.01839#S3.F6)traces how the policy adapts as a patient’s clinical state evolves across five visits\. Soft Import is applied atV1V\_\{1\}–V2V\_\{2\}\(routine chronic visits\),V3V\_\{3\}is skipped where the base prediction is already confident \(u3=0\.14u\_\{3\}\{=\}0\.14\), and Hard Import activates atV4V\_\{4\}–V5V\_\{5\}as the state shifts acutely\. The augmentation intensity in panel \(a\) reflects this progression, and the fusion gate \(panel b\) shifts from semantic\-dominant \(β=0\.76\\beta\{=\}0\.76atV1V\_\{1\}\) to structure\-dominant \(β=0\.33\\beta\{=\}0\.33atV5V\_\{5\}\), with the sharpest transition at the chronic\-to\-acute boundary\. Panel \(c\) shows that code\-level retrieval ranks chronic templates highest, but the policy overrides this and selects the Sepsis template, because the history\-aware statests\_\{t\}encodes a trajectory\-level shift that code matching cannot detect\. Figure[7](https://arxiv.org/html/2609.01839#S3.F7)shows the resulting graft, where cascade nodes create short message\-passing paths fromV1V\_\{1\}’s chronic context toV5V\_\{5\}that would otherwise require traversing distant shared ancestors in the CCS hierarchy\. At the cohort level \(panel d\), head diagnoses \(\>\>200 occurrences\) trigger Skip most often \(38%\), while tail diagnoses \(<<20\) trigger Hard most often \(47%\), linking policy behavior to the long\-tail robustness in §[3\.5](https://arxiv.org/html/2609.01839#S3.SS5)\. Population\-level frequency analysis is in Appendix[F\.1](https://arxiv.org/html/2609.01839#A6.SS1)\.

## 4Related Work

##### EHR prediction\.

Longitudinal EHR prediction has evolved from recurrent models[Choi et al\. \(2016\)](https://arxiv.org/html/2609.01839#bib.bib1)to Transformer\-style architectures[Luo et al\. \(2020\)](https://arxiv.org/html/2609.01839#bib.bib4);[Rasmy et al\. \(2021\)](https://arxiv.org/html/2609.01839#bib.bib2), but purely data\-driven models degrade under sparsity, motivating external knowledge as complementary priors\.

##### KG augmentation\.

Topology\-oriented methods expand visit graphs with external structure\. GRAM[Choi et al\. \(2017\)](https://arxiv.org/html/2609.01839#bib.bib7)and G\-BERT[Shang et al\. \(2019\)](https://arxiv.org/html/2609.01839#bib.bib9)follow fixed ontology hierarchies regardless of patient context, and SeqCare[Xu et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib10)induces edges from corpus\-level co\-occurrence rather than individual trajectories\. Semantics\-oriented methods such as GraphCare[Jiang et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib6), KARE[Jiang et al\. \(2025\)](https://arxiv.org/html/2609.01839#bib.bib22), and RAM\-EHR[Xu et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib23)retrieve or generate patient\-specific knowledge artifacts, enriching features but leaving topology unchanged\. Neither family offers per\-visit control over whether, what, and how to augment\.

##### Selective augmentation\.

RL\-based KG reasoning[Das et al\. \(2018\)](https://arxiv.org/html/2609.01839#bib.bib21);[Xiong et al\. \(2017\)](https://arxiv.org/html/2609.01839#bib.bib20)learns paths over a fixed, pre\-existing graph rather than deciding how to augment a patient\-specific one\. Learnable prompts[Liao et al\. \(2025\)](https://arxiv.org/html/2609.01839#bib.bib14)inject soft tokens into the feature space without modifying topology or offering abstention\. ReTA coordinates topology augmentation, semantic augmentation, and abstention under a per\-visit budget, selecting from a quality\-filtered template pool based on each patient’s evolving state\.

## 5Conclusion

ReTA treats knowledge augmentation in longitudinal EHR prediction as a budgeted, per\-visit decision, selecting Soft Import, Hard Import, or Skip from a quality\-filtered knowledge pool based on each patient’s evolving clinical state\. Experiments on MIMIC\-III and MIMIC\-IV show consistent gains across diagnosis prediction, mortality, and readmission, with the advantage growing under sparse supervision and persisting under cross\-dataset transfer and KG replacement \(UMLS\)\. Future work could extend the framework to multi\-modal EHR inputs and uncertainty\-aware retrieval\.

## Limitations

ReTA relies on external KGs \(PrimeKG, UMLS\), which may be incomplete for some clinical domains, and on LLM\-generated cascades that can produce plausible but incorrect complications for rare diseases, where the audit finds a higher major\-error rate \(2\.5% vs\. 0\.8%, Appendix[B\.6](https://arxiv.org/html/2609.01839#A2.SS6)\)\. Grounding establishes structural support rather than clinical correctness, and because GPT\-4o’s pretraining corpus is undisclosed, indirect overlap with MIMIC\-derived literature cannot be ruled out\. The skip mechanism assumes base\-encoder confidence is a reliable proxy for augmentation need, which fails when the encoder is confidently wrong \(Appendix[F\.4](https://arxiv.org/html/2609.01839#A6.SS4)\)\. Finally, our evaluation covers structured codes and does not incorporate clinical notes\.

## Ethics Statement

All experiments use MIMIC\-III and MIMIC\-IV under the PhysioNet Credentialed Health Data License\. The datasets contain de\-identified patient records, and no re\-identification was attempted\. ReTA is a research prototype not intended for clinical deployment without extensive validation, regulatory review, and integration with clinical oversight\. Model performance may vary across patient subgroups defined by age, sex, race, or insurance status, and no fairness audit was conducted in this work\. LLM\-generated knowledge templates are filtered by ontology grounding and assessed by a blinded clinical audit \(Appendix[B\.6](https://arxiv.org/html/2609.01839#A2.SS6)\), but residual errors may propagate into predictions for underrepresented conditions, and the audit’s higher error rate on rare diagnoses quantifies this risk\.

## Acknowledgments

This work was supported by the National Science Foundation under Grant No\. OIA\-2531881\. We also thank the anonymous reviewers for their valuable suggestions and feedback\.

## References

- Agency for Healthcare Research and Quality \(2017\)Agency for Healthcare Research and QualityClinical classifications software \(CCS\) for ICD\-9\-CM\.Note:Healthcare Cost and Utilization Project \(HCUP\)Accessed: 2025\-01\-01External Links:[Link](https://www.hcup-us.ahrq.gov/toolssoftware/ccs/ccs.jsp)Cited by:[§A\.1](https://arxiv.org/html/2609.01839#A1.SS1.SSS0.Px3.p1.1),[§A\.1](https://arxiv.org/html/2609.01839#A1.SS1.SSS0.Px5.p1.1)\.
- Agency for Healthcare Research and Quality \(2019\)Agency for Healthcare Research and QualityBeta clinical classifications software \(CCS\) for ICD\-10\-CM diagnoses\.Note:Healthcare Cost and Utilization Project \(HCUP\)Version 2019\.1, 283 single\-level categories aligned with the ICD\-9\-CM CCS\. Archived alongside the CCSR release\. Accessed: 2025\-01\-01External Links:[Link](https://hcup-us.ahrq.gov/toolssoftware/ccsr/dxccsr.jsp)Cited by:[§A\.1](https://arxiv.org/html/2609.01839#A1.SS1.SSS0.Px5.p1.1)\.
- Alsentzeret al\.\(2019\)E\. Alsentzer, J\. Murphy, W\. Boag, W\. Weng, D\. Jindi, T\. Naumann, and M\. McDermottPublicly available clinical BERT embeddings\.InProceedings of the 2nd Clinical Natural Language Processing Workshop,pp\. 72–78\.Cited by:[§B\.3](https://arxiv.org/html/2609.01839#A2.SS3.p1.1),[§2\.2\.2](https://arxiv.org/html/2609.01839#S2.SS2.SSS2.p1.1)\.
- Bodenreider \(2004\)O\. BodenreiderThe unified medical language system \(UMLS\): integrating biomedical terminology\.Nucleic Acids Research32\(suppl\_1\),pp\. D267–D270\.Cited by:[§B\.5](https://arxiv.org/html/2609.01839#A2.SS5.p3.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1)\.
- Chandaket al\.\(2023\)P\. Chandak, K\. Huang, and M\. ZitnikBuilding a knowledge graph to enable precision medicine\.Scientific Data10\(1\),pp\. 67\.Cited by:[§B\.3](https://arxiv.org/html/2609.01839#A2.SS3.p1.1),[§1](https://arxiv.org/html/2609.01839#S1.p1.1),[§2\.1](https://arxiv.org/html/2609.01839#S2.SS1.SSS0.Px2.p1.1)\.
- Choiet al\.\(2017\)E\. Choi, M\. T\. Bahadori, L\. Song, W\. F\. Stewart, and J\. SunGRAM: graph\-based attention model for healthcare representation learning\.InProceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining,pp\. 787–795\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p1.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px2.p1.1)\.
- Choiet al\.\(2016\)E\. Choi, M\. T\. Bahadori, J\. Sun, J\. Kulas, A\. Schuetz, and W\. StewartRETAIN: an interpretable predictive model for healthcare using reverse time attention mechanism\.Advances in Neural Information Processing Systems29\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p1.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px1.p1.1)\.
- Chunget al\.\(2014\)J\. Chung, C\. Gulcehre, K\. Cho, and Y\. BengioEmpirical evaluation of gated recurrent neural networks on sequence modeling\.arXiv preprint arXiv:1412\.3555\.Cited by:[§2\.3\.1](https://arxiv.org/html/2609.01839#S2.SS3.SSS1.p1.1)\.
- Daset al\.\(2018\)R\. Das, S\. Dhuliawala, M\. Zaheer, L\. Vilnis, I\. Durugkar, A\. Krishnamurthy, A\. Smola, and A\. McCallumGo for a walk and arrive at the answer: reasoning over paths in knowledge bases using reinforcement learning\.InInternational Conference on Learning Representations,Cited by:[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px3.p1.1)\.
- Hurstet al\.\(2024\)A\. Hurst, A\. Lerer, A\. P\. Goucher, A\. Perelman, A\. Ramesh, A\. Clark, A\. Ostrow, A\. Welihinda, A\. Hayes, A\. Radford,et al\.GPT\-4o system card\.arXiv preprint arXiv:2410\.21276\.Cited by:[§B\.2](https://arxiv.org/html/2609.01839#A2.SS2.p1.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1)\.
- Jianget al\.\(2024\)P\. Jiang, C\. Xiao, A\. Cross, and J\. SunGraphCare: enhancing healthcare predictions with personalized knowledge graphs\.InThe Twelfth International Conference on Learning Representations,Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p2.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px2.p1.1)\.
- Jianget al\.\(2025\)P\. Jiang, C\. Xiao, M\. Jiang, P\. Bhatia, T\. Kass\-Hout, J\. Sun, and J\. HanReasoning\-enhanced healthcare predictions with knowledge graph community retrieval\.InThe Thirteenth International Conference on Learning Representations,Cited by:[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px2.p1.1)\.
- Johnsonet al\.\(2023\)A\. E\. Johnson, L\. Bulgarelli, L\. Shen, A\. Gayles, A\. Shammout, S\. Horng, T\. J\. Pollard, S\. Hao, B\. Moody, B\. Gow,et al\.MIMIC\-IV, a freely accessible electronic health record dataset\.Scientific Data10\(1\),pp\. 1\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p7.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px1.p1.1)\.
- Johnsonet al\.\(2016\)A\. E\. Johnson, T\. J\. Pollard, L\. Shen, L\. H\. Lehman, M\. Feng, M\. Ghassemi, B\. Moody, P\. Szolovits, L\. A\. Celi, and R\. G\. MarkMIMIC\-III, a freely accessible critical care database\.Scientific Data3\(1\),pp\. 160035\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p7.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px1.p1.1)\.
- Liaoet al\.\(2025\)W\. Liao, Y\. Zhu, Z\. Zhang, Y\. Wang, Z\. Wang, X\. Chu, Y\. Wang, and L\. MaLearnable prompt as pseudo\-imputation: rethinking the necessity of traditional EHR data imputation in downstream clinical prediction\.InProceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining V\.1,pp\. 765–776\.Cited by:[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px3.p1.1)\.
- Liuet al\.\(2021\)F\. Liu, E\. Shareghi, Z\. Meng, M\. Basaldella, and N\. CollierSelf\-alignment pretraining for biomedical entity representations\.InProceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies,pp\. 4228–4238\.Cited by:[§2\.2\.1](https://arxiv.org/html/2609.01839#S2.SS2.SSS1.p2.1)\.
- Liuet al\.\(2020\)W\. Liu, P\. Zhou, Z\. Zhao, Z\. Wang, Q\. Ju, H\. Deng, and P\. WangK\-bert: enabling language representation with knowledge graph\.InProceedings of the AAAI conference on artificial intelligence,Vol\.34,pp\. 2901–2908\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p1.1)\.
- Liuet al\.\(2024\)Z\. Liu, C\. Wang, and C\. WuGraph contrastive learning with reinforcement augmentation\.InProceedings of the Thirty\-Third International Joint Conference on Artificial Intelligence, IJCAI\-24,pp\. 2225–2233\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p2.1)\.
- Luoet al\.\(2020\)J\. Luo, M\. Ye, C\. Xiao, and F\. MaHiTANet: hierarchical time\-aware attention networks for risk prediction on electronic health records\.InProceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining,pp\. 647–656\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px1.p1.1)\.
- Maet al\.\(2017\)F\. Ma, R\. Chitta, J\. Zhou, Q\. You, T\. Sun, and J\. GaoDipole: diagnosis prediction in healthcare via attention\-based bidirectional recurrent neural networks\.InProceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining,pp\. 1903–1911\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p1.1)\.
- Neumannet al\.\(2019\)M\. Neumann, D\. King, I\. Beltagy, and W\. AmmarScispaCy: fast and robust models for biomedical natural language processing\.InProceedings of the 18th BioNLP Workshop and Shared Task,pp\. 319–327\.Cited by:[§2\.2\.1](https://arxiv.org/html/2609.01839#S2.SS2.SSS1.p2.1)\.
- Rasmyet al\.\(2021\)L\. Rasmy, Y\. Xiang, Z\. Xie, C\. Tao, and D\. ZhiMed\-BERT: pretrained contextualized embeddings on large\-scale structured electronic health records for disease prediction\.npj Digital Medicine4\(1\),pp\. 86\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px1.p1.1)\.
- Shanget al\.\(2019\)J\. Shang, T\. Ma, C\. Xiao, and J\. SunPre\-training of graph augmented transformers for medication recommendation\.InProceedings of the Twenty\-Eighth International Joint Conference on Artificial Intelligence, IJCAI\-19,pp\. 5953–5959\.Cited by:[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px2.p1.1)\.
- Soldaini and Goharian \(2016\)L\. Soldaini and N\. GoharianQuickUMLS: a fast, unsupervised approach for medical concept extraction\.InMedical Information Retrieval \(MedIR\) Workshop, SIGIR,pp\. 1–4\.Cited by:[§2\.2\.1](https://arxiv.org/html/2609.01839#S2.SS2.SSS1.p2.1)\.
- Sunget al\.\(2020\)M\. Sung, H\. Jeon, J\. Lee, and J\. KangBiomedical entity representations with synonym marginalization\.InProceedings of the 58th Annual Meeting of the Association for Computational Linguistics,pp\. 3641–3650\.Cited by:[§2\.2\.1](https://arxiv.org/html/2609.01839#S2.SS2.SSS1.p2.1)\.
- Vaswaniet al\.\(2017\)A\. Vaswani, N\. Shazeer, N\. Parmar, J\. Uszkoreit, L\. Jones, A\. N\. Gomez, Ł\. Kaiser, and I\. PolosukhinAttention is all you need\.Advances in Neural Information Processing Systems30\.Cited by:[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1)\.
- Veličkovićet al\.\(2018\)P\. Veličković, G\. Cucurull, A\. Casanova, A\. Romero, P\. Liò, and Y\. BengioGraph attention networks\.InInternational Conference on Learning Representations,Cited by:[§2\.4\.2](https://arxiv.org/html/2609.01839#S2.SS4.SSS2.p1.1)\.
- Wanget al\.\(2025\)Z\. Wang, Y\. Zhu, H\. Zhao, X\. Zheng, D\. Sui, T\. Wang, W\. Tang, Y\. Wang, E\. Harrison, C\. Pan,et al\.ColaCare: enhancing electronic health record modeling through large language model\-driven multi\-agent collaboration\.InProceedings of the ACM on Web Conference 2025,pp\. 2250–2261\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p2.1)\.
- Xionget al\.\(2017\)W\. Xiong, T\. Hoang, and W\. Y\. WangDeepPath: a reinforcement learning method for knowledge graph reasoning\.InProceedings of the 2017 Conference on Empirical Methods in Natural Language Processing,pp\. 564–573\.Cited by:[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px3.p1.1)\.
- Xuet al\.\(2024\)R\. Xu, W\. Shi, Y\. Yu, Y\. Zhuang, B\. Jin, M\. D\. Wang, J\. C\. Ho, and C\. YangRAM\-EHR: retrieval augmentation meets clinical predictions on electronic health records\.InProceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 2: Short Papers\),pp\. 754–765\.Cited by:[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px2.p1.1)\.
- Xuet al\.\(2023\)Y\. Xu, X\. Chu, K\. Yang, Z\. Wang, P\. Zou, H\. Ding, J\. Zhao, Y\. Wang, and B\. XieSeqCare: sequential training with external medical knowledge graph for diagnosis prediction in healthcare data\.InProceedings of the ACM Web Conference 2023,pp\. 2819–2830\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p2.1),[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1),[§4](https://arxiv.org/html/2609.01839#S4.SS0.SSS0.Px2.p1.1)\.
- Yeet al\.\(2021\)M\. Ye, S\. Cui, Y\. Wang, J\. Luo, C\. Xiao, and F\. MaMedPath: augmenting health risk prediction via medical knowledge paths\.InProceedings of the Web Conference 2021,pp\. 1397–1409\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p2.1)\.
- Zhanget al\.\(2021\)J\. Zhang, J\. Kim, B\. O’Donoghue, and S\. BoydSample efficient reinforcement learning with reinforce\.InProceedings of the AAAI conference on artificial intelligence,Vol\.35,pp\. 10887–10895\.Cited by:[§A\.2](https://arxiv.org/html/2609.01839#A1.SS2.SSS0.Px2.p1.1),[§2\.3\.2](https://arxiv.org/html/2609.01839#S2.SS3.SSS2.p3.1)\.
- Zhanget al\.\(2020\)M\. Zhang, C\. R\. King, M\. Avidan, and Y\. ChenHierarchical attention propagation for healthcare representation learning\.InProceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining,pp\. 249–256\.Cited by:[§3\.1](https://arxiv.org/html/2609.01839#S3.SS1.SSS0.Px2.p1.1)\.
- Zhanget al\.\(2024\)Q\. Zhang, L\. Xia, X\. Cai, S\. Yiu, C\. Huang, and C\. S\. JensenGraph augmentation for recommendation\.In2024 IEEE 40th International Conference on Data Engineering \(ICDE\),pp\. 557–569\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p2.1)\.
- Zhuet al\.\(2024\)Y\. Zhu, C\. Ren, Z\. Wang, X\. Zheng, S\. Xie, J\. Feng, X\. Zhu, Z\. Li, L\. Ma, and C\. PanEMERGE: enhancing multimodal electronic health records predictive modeling with retrieval\-augmented generation\.InProceedings of the 33rd ACM International Conference on Information and Knowledge Management,pp\. 3549–3559\.Cited by:[§1](https://arxiv.org/html/2609.01839#S1.p2.1)\.

## Appendix Contents

[A](https://arxiv.org/html/2609.01839#A1)Reproducibility Details[A](https://arxiv.org/html/2609.01839#A1)

[A\.1](https://arxiv.org/html/2609.01839#A1.SS1)Dataset and Preprocessing\.[A\.1](https://arxiv.org/html/2609.01839#A1.SS1)

[A\.2](https://arxiv.org/html/2609.01839#A1.SS2)Implementation and Hyperparameters\.[A\.2](https://arxiv.org/html/2609.01839#A1.SS2)

[B](https://arxiv.org/html/2609.01839#A2)Knowledge Pool Construction[B](https://arxiv.org/html/2609.01839#A2)

[B\.1](https://arxiv.org/html/2609.01839#A2.SS1)CCS Hierarchy and Hard Import\.[B\.1](https://arxiv.org/html/2609.01839#A2.SS1)

[B\.2](https://arxiv.org/html/2609.01839#A2.SS2)LLM Distillation\.[B\.2](https://arxiv.org/html/2609.01839#A2.SS2)

[B\.3](https://arxiv.org/html/2609.01839#A2.SS3)Grounding and Filtering\.[B\.3](https://arxiv.org/html/2609.01839#A2.SS3)

[B\.4](https://arxiv.org/html/2609.01839#A2.SS4)Template Construction\.[B\.4](https://arxiv.org/html/2609.01839#A2.SS4)

[B\.5](https://arxiv.org/html/2609.01839#A2.SS5)Pool Diagnostics\.[B\.5](https://arxiv.org/html/2609.01839#A2.SS5)

[B\.6](https://arxiv.org/html/2609.01839#A2.SS6)Clinical Audit\.[B\.6](https://arxiv.org/html/2609.01839#A2.SS6)

[B\.7](https://arxiv.org/html/2609.01839#A2.SS7)Generator Dependence\.[B\.7](https://arxiv.org/html/2609.01839#A2.SS7)

[C](https://arxiv.org/html/2609.01839#A3)Sensitivity[C](https://arxiv.org/html/2609.01839#A3)

[D](https://arxiv.org/html/2609.01839#A4)Extended Ablation Results[D](https://arxiv.org/html/2609.01839#A4)

[E](https://arxiv.org/html/2609.01839#A5)Additional Results[E](https://arxiv.org/html/2609.01839#A5)

[E\.1](https://arxiv.org/html/2609.01839#A5.SS1)Label\-Frequency Stratification\.[E\.1](https://arxiv.org/html/2609.01839#A5.SS1)

[E\.2](https://arxiv.org/html/2609.01839#A5.SS2)Calibration\.[E\.2](https://arxiv.org/html/2609.01839#A5.SS2)

[F](https://arxiv.org/html/2609.01839#A6)Mechanism Analysis[F](https://arxiv.org/html/2609.01839#A6)

[F\.1](https://arxiv.org/html/2609.01839#A6.SS1)Policy Behavior\.[F\.1](https://arxiv.org/html/2609.01839#A6.SS1)

[F\.2](https://arxiv.org/html/2609.01839#A6.SS2)Training Stability\.[F\.2](https://arxiv.org/html/2609.01839#A6.SS2)

[F\.3](https://arxiv.org/html/2609.01839#A6.SS3)Paired Reward Ablation\.[F\.3](https://arxiv.org/html/2609.01839#A6.SS3)

[F\.4](https://arxiv.org/html/2609.01839#A6.SS4)Qualitative Analysis\.[F\.4](https://arxiv.org/html/2609.01839#A6.SS4)

## Appendix AReproducibility Details

### A\.1Dataset and Preprocessing

Table 3:Dataset statistics after preprocessing\.MetricMIMIC\-IIIMIMIC\-IV\# Patients \(eligible\)7,02394,402\# Visits \(records\)18,457250,949\# Transitions \(samples\)11,434156,547Avg\. visits / patient2\.632\.66Visits/pat\. \(P25/P50/P75\)2/2/32/2/3Visits/pat\. \(P90/Max\)5/226/28\# Unique ICD codes\|𝒞d​x\|\|\\mathcal\{C\}\_\{dx\}\|4,1378,507Avg\. diagnoses / visit13\.0821\.62Avg\. CCS labels / visit4\.916\.27Label space\|𝒜\|\|\\mathcal\{A\}\|≈283\\approx 283##### Cohort construction\.

We evaluate on MIMIC\-III \(ICD\-9\) and MIMIC\-IV \(ICD\-10\), with statistics in Table[3](https://arxiv.org/html/2609.01839#A1.T3)\(P25, P50, P75 denote percentiles\)\. MIMIC\-IV spans the ICD\-9 to ICD\-10 transition, so we retain only admissions coded in ICD\-10\. We retain patients with at least two visits after 24\-hour aggregation\. Each visit groups events within a 24\-hour window, and the diagnosis codes within a visit are treated as a set with duplicates removed\. For a patient trajectory withTiT\_\{i\}visits, we construct\(Ti−1\)\(T\_\{i\}\-1\)samples for next\-visit prediction\.

##### Splits\.

All methods share the same temporal splits\. Admissions discharged in the earliest 70% of the time range form the training set, the next 10% form validation, and the final 20% form the test set\. Split files are fixed once and shared by all methods, and model selection is performed on validation only\.

##### Prediction targets\.

Diagnosis codes are mapped to CCS categories[Agency for Healthcare Research and Quality \(2017\)](https://arxiv.org/html/2609.01839#bib.bib19)to define the multi\-label target space𝒜\\mathcal\{A\}\(Table[3](https://arxiv.org/html/2609.01839#A1.T3)\)\. Only diagnoses are used as model inputs and for visit\-graph construction, except for the richer\-input experiment in §[3\.5](https://arxiv.org/html/2609.01839#S3.SS5)\(Table[14](https://arxiv.org/html/2609.01839#A4.T14)\)\. Medications and procedures are not otherwise used for graph expansion\. Online message passing uses an untyped, symmetrized adjacency\.

##### Additional tasks\.

For in\-hospital mortality, the binary label is 1 if the patient dies during the admission\. For 30\-day readmission, the label is 1 if the patient is readmitted within 30 days of discharge\. Both tasks use the same visit graphs and knowledge pool as diagnosis prediction, with only the prediction head changed \(single sigmoid output with binary cross\-entropy\)\.

##### Cross\-dataset transfer\.

For the transfer rows in Table[1](https://arxiv.org/html/2609.01839#S3.T1), each method is trained on one dataset and evaluated on the other without retraining\. ICD\-9 codes are mapped with the AHRQ CCS software[Agency for Healthcare Research and Quality \(2017\)](https://arxiv.org/html/2609.01839#bib.bib19)and ICD\-10 codes with the beta CCS for ICD\-10\-CM[Agency for Healthcare Research and Quality \(2019\)](https://arxiv.org/html/2609.01839#bib.bib36), which shares the same 283 single\-level categories, so the label space𝒜\\mathcal\{A\}is identical across datasets\. The label space𝒜\\mathcal\{A\}and PrimeKG linker are therefore shared across datasets\. Visit graphs, templates, and encoder architectures are identical, and only the input ICD codes and patient populations differ\.

### A\.2Implementation and Hyperparameters

Table 4:Hyperparameter settings\.ModuleParameterValueGeneralEmbedding dimdd256Batch size32Learning rate10−410^\{\-4\}Weight decay10−510^\{\-5\}BackboneGNN layersLL2Attention heads4Dropout0\.3TrainingStage 1 epochsEpreE\_\{\\mathrm\{pre\}\}30Stage 2 iterationsIrlI\_\{\\mathrm\{rl\}\}50Exposure rate \(Stage 1\)0\.3PolicyDiscount factorγ\\gamma0\.95Retrieval sizeKK20Reward weightλ1\\lambda\_\{1\}1\.0Hard Import penaltyλ2\\lambda\_\{2\}0\.1Baseline decay0\.99Policy updatePolicy learning rate10−510^\{\-5\}Max grad norm0\.5##### Hardware and training time\.

Experiments run on 2×\\timesNVIDIA L40S GPUs \(48 GB each\) and use Adam\. Stage 1 converges in approximately 3 hours and Stage 2 in 8 hours, for a total of∼\{\\sim\}11 hours\. Hyperparameters from Table[4](https://arxiv.org/html/2609.01839#A1.T4)are selected on validation\. All results are averaged over 5 random seeds\.

##### Policy optimization\.

The policy is categorical over2​K\+12K\{\+\}1augment actions \(KKtemplates×\\times2 modes\+\+skip\), implemented as a lightweight MLP onsts\_\{t\}\. We optimize the policy with REINFORCE[Zhang et al\. \(2021\)](https://arxiv.org/html/2609.01839#bib.bib35)using a running\-mean baseline \(decay 0\.99\) for variance reduction\. Patient trajectories are short \(median 2–3 visits\), and the policy parameters are limited to the MLP, making critic\-based methods unnecessary \(Algorithm[1](https://arxiv.org/html/2609.01839#alg1)\)\.

##### Ablation variants\.

No\-LLM Cascade replaces LLM\-distilled cascades with CCS hierarchy expansions up to 2 ancestor levels per code\. Frozen Encoder freezes all encoder parametersψ\\psiduring Stage 2, updating only the policyθ\\theta\. The uncertainty\-threshold heuristic assigns Skip ifut<0\.3u\_\{t\}\{<\}0\.3, Soft Import ifut<0\.6u\_\{t\}\{<\}0\.6, and Hard Import otherwise, selecting the highest\-scoring template by Eq\.[1](https://arxiv.org/html/2609.01839#S2.E1)\. The supervised selector trains an MLP on per\-visit oracle labels obtained by evaluating all2​K\+12K\{\+\}1actions and recording which achieves the lowest loss\. The greedy oracle runs this evaluation at test time\.

##### Inference latency\.

Table[5](https://arxiv.org/html/2609.01839#A1.T5)shows where inference time is spent\. ReTA’s skip\-eligible visits avoid graph assembly entirely \(0\.0 ms\), reducing the average per\-visit cost below both GraphCare and KARE despite the additional policy forward pass\. Offline knowledge\-pool construction is excluded\.

Table 5:Inference latency per visit on MIMIC\-IV \(ms\)\.MethodRetr\.PolicyGraphEnc\.TotalGraphCare4\.2–6\.85\.816\.8KARE3\.8–5\.45\.915\.1ReTA2\.61\.42\.35\.511\.8w/ Skip2\.61\.40\.05\.59\.5Algorithm 1Two\-stage training curriculum\.0:Trajectories

𝒟\\mathcal\{D\}, global knowledge pool

𝒫global\\mathcal\{P\}\_\{\\mathrm\{global\}\}
0:Policy

πθ\\pi\_\{\\theta\}, encoder

fψf\_\{\\psi\}
1:Stage 1: Encoder warm\-up

2:for

e=1e=1to

EpreE\_\{\\mathrm\{pre\}\}do

3:forbatch

ℬ⊂𝒟\\mathcal\{B\}\\subset\\mathcal\{D\}do

4:Construct visit graphs

\{Gt\}\\\{G\_\{t\}\\\}for

ℬ\\mathcal\{B\}
5:Set

Gt′←GtG^\{\\prime\}\_\{t\}\\leftarrow G\_\{t\}\{default: no import\}

6:Sample exposure flag

u∼Bernoulli⁡\(0\.3\)u\\sim\\mathrm\{Bernoulli\}\(0\.3\)
7:if

u=1u=1then

8:Retrieve candidates

𝒫sub\(t\)\\mathcal\{P\}^\{\(t\)\}\_\{\\mathrm\{sub\}\}\(Top\-

KKby Eq\.[1](https://arxiv.org/html/2609.01839#S2.E1)\)

9:Sample

a~t∼Uniform⁡\(𝒫sub\(t\)×\{0,1\}\)\\tilde\{a\}\_\{t\}\\sim\\mathrm\{Uniform\}\(\\mathcal\{P\}^\{\(t\)\}\_\{\\mathrm\{sub\}\}\\times\\\{0,1\\\}\)
10:Apply

a~t\\tilde\{a\}\_\{t\}to obtain

Gt′G^\{\\prime\}\_\{t\}\{stochastic Soft/Hard\}

11:endif

12:Update

ψ←arg⁡minψ​ℒtask​\(fψ,Gt′\)\\psi\\leftarrow\\arg\\min\_\{\\psi\}\\mathcal\{L\}\_\{\\mathrm\{task\}\}\(f\_\{\\psi\};G^\{\\prime\}\_\{t\}\)
13:endfor

14:endfor

15:Stage 2: Policy learning \(REINFORCE\)

16:for

i=1i=1to

IrlI\_\{\\mathrm\{rl\}\}do

17:Clear rollout buffer

ℳ\\mathcal\{M\}
18:fortrajectory

τ∼Sample⁡\(𝒟\)\\tau\\sim\\mathrm\{Sample\}\(\\mathcal\{D\}\)do

19:for

t=1t=1to

TτT\_\{\\tau\}do

20:Observe

st=\[GRU\(𝐯1:t−1\)⊕𝐯t\]s\_\{t\}=\[\\mathrm\{GRU\}\(\\mathbf\{v\}\_\{1:t\-1\}\)\\oplus\\mathbf\{v\}\_\{t\}\]
21:Retrieve

𝒫sub\(t\)\\mathcal\{P\}^\{\(t\)\}\_\{\\mathrm\{sub\}\}via Top\-

KK
22:Sample

at∼πθ\(⋅∣st\)a\_\{t\}\\sim\\pi\_\{\\theta\}\(\\cdot\\mid s\_\{t\}\)\{Soft, Hard, or Skip\}

23:Execute

ata\_\{t\}to obtain

Gt′G^\{\\prime\}\_\{t\}
24:Compute reward

rtr\_\{t\}\{paired; dropout off\}

25:Store

\(at,rt,log⁡πθ​\(at∣st\)\)\(a\_\{t\},r\_\{t\},\\log\\pi\_\{\\theta\}\(a\_\{t\}\\mid s\_\{t\}\)\)in

ℳ\\mathcal\{M\}
26:endfor

27:endfor

28:Compute baseline\-subtracted returns

R^t=Rt−R¯\\hat\{R\}\_\{t\}=R\_\{t\}\-\\bar\{R\}
29:Update

θ\\thetavia

∇θ𝒥RL=𝔼⁡\[R^t​∇θ​log⁡πθ​\(at∣st\)\]\\nabla\_\{\\theta\}\\mathcal\{J\}^\{\\mathrm\{RL\}\}=\\mathbb\{E\}\[\\hat\{R\}\_\{t\}\\nabla\_\{\\theta\}\\log\\pi\_\{\\theta\}\(a\_\{t\}\\mid s\_\{t\}\)\]
30:Update

ψ\\psito minimize

ℒtask−η​𝒥RL\\mathcal\{L\}\_\{\\mathrm\{task\}\}\-\\eta\\mathcal\{J\}^\{\\mathrm\{RL\}\}
31:endfor

##### Complexity\.

Under bounded Hard Import with Top\-KKtemplates of average sizes¯\\bar\{s\}, the added edges scale asΔ​\|E\|=𝒪⁡\(K​s¯\)\\Delta\|E\|=\\mathcal\{O\}\(K\\bar\{s\}\), giving total encoder cost𝒪⁡\(L⁡\(\|V\|​d2\+\(\|E\|\+K​s¯\)​d\)\)\\mathcal\{O\}\(L\(\|V\|d^\{2\}\+\(\|E\|\+K\\bar\{s\}\)d\)\)forLLGAT layers\. Template scoring costs𝒪⁡\(\|Vt\|​\|𝒫global\|​d\)\\mathcal\{O\}\(\|V\_\{t\}\|\|\\mathcal\{P\}\_\{\\mathrm\{global\}\}\|d\)per visit\.

## Appendix BKnowledge Pool Construction

All steps in this section are executed offline from external resources and distilled artifacts only, with no access to patient trajectories, outcome labels, or split\-dependent statistics\.

### B\.1CCS Hierarchy and Hard Import

Figure 8:CCS hierarchy with a Hard Import graft example\.ICD codes form the leaf nodes of the diagnosis\-side ontology graph \(Figure[8](https://arxiv.org/html/2609.01839#A2.F8)\), connected to CCS categories via ICD\-to\-CCS links\. CCS categories are connected by is\-a edges\. Online message passing treats all links as an untyped, symmetrized adjacency, so shared ancestors act as short bridges across related diagnoses\.

Hard Import exploits this structure by grafting a small subgraph containing shared CCS ancestors, creating short message\-passing paths between otherwise weakly connected codes with minimal added edges\.

### B\.2LLM Distillation

System You are an expert clinical pathologist\. Given the diagnosis below, provide a structured knowledge summary to assist in sequential predictive modeling\.Input Diagnosis:<concept description\> PrimeKG neighborhood density:<sparse \| moderate \| dense\> Output Constraints 1\.Definition\(for Soft Import\): one sentence focusing on pathology\.2\.Clinical Cascade\(for Hard Import\): \{1–5\} downstream complications\(sparse neighborhoods→\\rightarrowup to 5, dense→\\rightarrowas few as 1\)\.

Figure 9:Offline distillation prompt with adaptive cascade length\.For every unique medical concept, we prompt GPT\-4o[Hurst et al\. \(2024\)](https://arxiv.org/html/2609.01839#bib.bib16)with its canonical textual description and request two fields\. The first is a one\-sentence Definition describing the pathology, used to parameterize Soft Import\. The second is a Clinical Cascade listing downstream complications or comorbidities, used to materialize the Hard Import subgraph\.

We adapt the cascade length to each concept’s neighborhood density in PrimeKG\. Concepts with few verified KG neighbors receive longer cascades \(up to five items\) to compensate for sparse relational context, while concepts with dense neighborhoods receive shorter ones \(as few as one item\)\. For example, diabetes with moderate PrimeKG coverage receives three cascade items \(retinopathy, neuropathy, nephropathy\), while a well\-connected cardiovascular concept may receive only one\. Figure[9](https://arxiv.org/html/2609.01839#A2.F9)shows the prompt template\.

Each concept is queried independently with fixed decoding parameters \(temperature=0\.2=0\.2, Top\-p=0\.9p=0\.9, max\_tokens=256=256\) and no patient context\. ICD descriptions are taken from dataset\-provided dictionaries \(MIMIC\-III for ICD\-9, MIMIC\-IV for ICD\-10\), falling back to the mapped CCS category name when a description is missing\.

##### Cost and release\.

Distillation usesgpt\-4o\-2024\-11\-20with one request per concept, 4,137 requests for MIMIC\-III and 8,507 for MIMIC\-IV, matching\|𝒞d​x\|\|\\mathcal\{C\}\_\{dx\}\|in Table[3](https://arxiv.org/html/2609.01839#A1.T3), with output lengths and pass rates in Table[7](https://arxiv.org/html/2609.01839#A2.T7)\. We release the frozen pool, the prompt and decoding configuration, the filtering code, and per\-template provenance under/knowledge/releases/in our repository, so all results can be reproduced and ReTA can be rerun without access to GPT\-4o\.

### B\.3Grounding and Filtering

Each distilled mention is grounded to a canonical biomedical identifier by exact matching against ICD, CCS, and PrimeKG[Chandak et al\. \(2023\)](https://arxiv.org/html/2609.01839#bib.bib34)node vocabularies\. If exact matching fails, we compute cosine similarity betweenℓ2\\ell\_\{2\}\-normalized name embeddings from ClinicalBERT[Alsentzer et al\. \(2019\)](https://arxiv.org/html/2609.01839#bib.bib17)\(cached offline\) and accept the Top\-1 candidate only if similarity exceedsτmap=0\.90\\tau\_\{\\text\{map\}\}=0\.90\. Otherwise, the mention is discarded\.

A distilled triple is retained only if both endpoints are groundable and the relation is supported by external ontology evidence, either via a direct PrimeKG edge or an ancestor/descendant relation within two CCS hierarchy levels\. All thresholds are fixed once and applied consistently across datasets\.

### B\.4Template Construction

Each grounded cascade is materialized into a template subgraphg𝐩k=\(V𝐩k,E𝐩k\)g\_\{\\mathbf\{p\}\_\{k\}\}=\(V\_\{\\mathbf\{p\}\_\{k\}\},E\_\{\\mathbf\{p\}\_\{k\}\}\)that may include ICD leaves, CCS category nodes, and cascade entities\. We de\-duplicate nodes by canonical identifier, drop self\-loops, and merge duplicate edges\. Online aggregation collapses multi\-relational links into one untyped edge per node pair\.

The grounded outputs are then compressed by clustering\. Each concept text \(definition concatenated with cascade\) is embedded with ClinicalBERT and grouped via agglomerative clustering under cosine distance with cut thresholdτ\\tau\. Each template vector𝐩k\\mathbf\{p\}\_\{k\}is set to theℓ2\\ell\_\{2\}\-normalized cluster centroid projected into the model embedding space\. The representative subgraph is the cluster medoid \(closest to the centroid\)\. Two representative examples are shown in Table[6](https://arxiv.org/html/2609.01839#A2.T6)\.

Table 6:Knowledge template examples\. Each template pairs a definition \(for Soft Import\) with a clinical cascade \(for Hard Import\)\.DiagnosisTemplateDiabetesDef\.Chronic hyperglycemia due to insulin defects\.
Cas\.Retinopathy, neuropathy, nephropathy\.SepsisDef\.Life\-threatening organ dysfunction from dysregulated host response\.
Cas\.Shock→\\toAKI→\\torespiratory failure\.Heart failureDef\.Inadequate cardiac output due to structural or functional impairment\.
Cas\.Pulmonary edema→\\torenal hypoperfusion\.
### B\.5Pool Diagnostics

Table 7:Knowledge\-pool diagnostics \(offline\)\.MetricIIIIVGeneration\# Requests \(one per concept\)4,1378,507Format pass rate \(regex/schema\)97\.6%97\.1%Mean tokens / request148156GroundingOntology mapping success95\.3%93\.8%Ext\. supported candidate rate \(pre\-filter\)83\.7%81\.9%Filtering \(first\-failed attribution\)Format violation2\.4%2\.9%Failed mapping / missing concept4\.7%6\.2%Low external support11\.6%12\.8%After clustering\# TemplatesMM9201,180Avg\. nodes / edges per template7\.6 / 16\.88\.1 / 17\.9Median intra\-cluster cosine dist\.0\.140\.15The externally supported rates in Table[7](https://arxiv.org/html/2609.01839#A2.T7)\(83\.7% and 81\.9%\) are pre\-filter candidate pass rates over all distilled links, not support rates for the final pool\. Candidates without external support are removed before template construction, so every retained Hard\-Import relation has grounded endpoints and support from PrimeKG or CCS\.

The largest source of attrition is low external support \(11–13% of concepts, Table[7](https://arxiv.org/html/2609.01839#A2.T7)\), where the LLM produces clinically plausible but ontologically unattested relations that the strict support filter correctly rejects\. After clustering, the resulting templates are compact \(7–8 nodes, 17–18 edges on average\), which keeps Hard Import efficient at inference time\.

For ReTAUMLS, we replace PrimeKG with disease\-complication and disease\-finding relations from UMLS Metathesaurus[Bodenreider \(2004\)](https://arxiv.org/html/2609.01839#bib.bib8)\. The vocabulary bridge, distillation prompt, grounding thresholds, and clustering procedure remain identical\. The resulting pool contains 874 \(III\) and 1,092 \(IV\) templates with comparable subgraph density \(7\.2 / 15\.3 avg\. nodes/edges\)\.

### B\.6Clinical Audit

Structural support does not by itself establish clinical correctness, so we audited a frequency\-stratified sample of 240 retained templates, 120 mapped to common diagnoses \(\>\>500 training occurrences\) and 120 to rare ones \(<<5\)\. Two physicians independently reviewed each template, and disagreements were resolved by discussion\. Annotators viewed each template blinded to provenance and performance information and rated whether the definition is correct, whether each cascade relation is clinically correct, whether the cascade is adequate for the concept, and whether the template contains a major error that could mislead prediction\. Table[8](https://arxiv.org/html/2609.01839#A2.T8)reports the results, and the higher error rates for rare diagnoses are discussed in the Limitations\.

Table 8:Blinded audit of retained templates\.StratumnnDef\. corr\.Rel\. corr\.Casc\. adeq\.Major err\.Common \(\>\>500\)12096\.7%96\.7%94\.2%0\.8%Rare \(<<5\)12091\.7%90\.8%86\.7%2\.5%Overall24094\.2%93\.8%90\.4%1\.7%

### B\.7Generator Dependence

To test dependence on a single proprietary generator, we rebuild the pool with Qwen3\-32B under the identical prompt, grounding, filtering, and clustering procedure\. Table[9](https://arxiv.org/html/2609.01839#A2.T9)shows comparable candidate support, majority Jaccard overlap with the GPT\-4o retained grounded\-link set, and downstream AUPRC within 0\.36 and 0\.40 of the GPT\-4o pool\.

Table 9:Generator dependence\.GeneratorCand\. support \(III/IV\)Link overlap \(III/IV\)AUPRC \(III/IV\)GPT\-4o83\.7 / 81\.9%100 / 100%34\.52±\\pm0\.43 / 35\.18±\\pm0\.36Qwen3\-32B81\.1 / 79\.4%76\.8 / 74\.9%34\.16±\\pm0\.46 / 34\.78±\\pm0\.41

## Appendix CSensitivity

Figure 10:Sensitivity sweeps on MIMIC\-IV \(Δ\\DeltaAUPRC relative to default\)\.All five parameters in Figure[10](https://arxiv.org/html/2609.01839#A3.F10)are stable near their defaults, with degradation concentrated at the extremes\.

##### Pool and retrieval\.

The pool cutτ\\tau\(panel a\) has minimal impact within the tested range, with less than 0\.2 AUPRC variation\. The retrieval sizeKK\(panel b\) shows an inverted\-U pattern, where too few candidates \(K=10K\{=\}10\) miss relevant templates and too many \(K=30K\{=\}30\) dilute quality with noise\. The history weightα\\alpha\(panel c\) controls how much the retrieval scoring relies on trajectory context versus code\-level similarity \(Eq\.[1](https://arxiv.org/html/2609.01839#S2.E1)\)\. Settingα=0\\alpha\{=\}0removes trajectory context entirely, dropping AUPRC by 0\.41, which aligns with the direction and magnitude of the history\-aware retrieval ablation \(−\-0\.54 in Table[11](https://arxiv.org/html/2609.01839#A4.T11)\)\. The gap reflects the difference between removing trajectory context from retrieval scoring alone \(α=0\\alpha\{=\}0\) versus removing the mechanism entirely \(ablation\)\. Moderate values \(α∈\[0\.2,0\.3\]\\alpha\\in\[0\.2,0\.3\]\) perform best, while higher values over\-weight trajectory context at the expense of visit\-specific code matching\.

##### Augmentation controls\.

The Hard Import penaltyλ2\\lambda\_\{2\}\(panel d\) exhibits two\-sided degradation\. Too large a penalty suppresses topology edits that would help, while too small a penalty triggers grafting too aggressively\. The defaultλ2=0\.10\\lambda\_\{2\}\{=\}0\.10sits in the stable middle\. The Soft Import scaleξ\\xi\(panel e\) is similarly stable across moderate values, degrading when feature editing becomes too aggressive \(ξ\>1\.0\\xi\{\>\}1\.0\) or too weak \(ξ=0\\xi\{=\}0, no semantic enrichment\)\. Cascade depth thresholds and template utility decayγr\\gamma\_\{r\}\(not shown\) are comparably stable within their tested ranges and do not alter the qualitative conclusions\.

##### Budget and deployment\.

Table 10:Per\-visit budgetmmtrade\-offs on MIMIC\-IV\.SettingΔ\\DeltaAUPRCΔ\\DeltaLat\. \(ms\)Δ\\DeltaTrain \(h\)m=1m\{=\}1\(default\)0\.000\.00\.0m=2m\{=\}2\+0\.09\+4\.5\+3\.9m=3m\{=\}3\+0\.06\+8\.7\+9\.0The per\-visit budgetmmis not included in the sweep figure because its effect is better understood jointly with latency and training cost \(Table[10](https://arxiv.org/html/2609.01839#A3.T10)\)\. Increasingmmfrom 1 to 2 yields only \+0\.09 AUPRC while adding 4\.5 ms/visit and 3\.9 hours of training, andm=3m\{=\}3degrades AUPRC while further increasing cost\. This supports the defaultm=1m\{=\}1as the best accuracy\-efficiency trade\-off\. The discount factorγ\\gamma\(not shown\) performs best near the default \(γ=0\.95\\gamma\{=\}0\.95\) and degrades under the myopic setting \(γ=0\\gamma\{=\}0\)\.

## Appendix DExtended Ablation Results

This appendix reports the exact values behind Figure[3](https://arxiv.org/html/2609.01839#S3.F3)\. The rate\-matched shuffle keeps the Stage 1 checkpoint, Stage 2 updates, training budget, and action rates fixed and shuffles only which visits receive each action, so it omits the policy forward pass and runs 1\.4 ms below the full model at the same skip rate \(Table[5](https://arxiv.org/html/2609.01839#A1.T5)\)\. Always augment retrains Stage 2 without Skip and matches the Skip ablation in Figure[3](https://arxiv.org/html/2609.01839#S3.F3)\. In Table[11](https://arxiv.org/html/2609.01839#A4.T11), the lower block reports MIMIC\-IV deltas only, and removing the uncertainty signalutu\_\{t\}also cuts the skip rate from 31% to 12%\. In Table[12](https://arxiv.org/html/2609.01839#A4.T12), Labels denotes per\-action supervision required at training time and Eval\./visit counts policy evaluations per visit at test time\. In Table[13](https://arxiv.org/html/2609.01839#A4.T13), template overrides are measured on non\-Skip visits, total departures include Skip, and positive\-gain rates are post\-hoc diagnostics rather than policy inputs\. In Table[14](https://arxiv.org/html/2609.01839#A4.T14), both methods receive prior medication and procedure codes under the same cutoff\.

Table 11:Component ablations, AUPRC \(Δ\\Delta\)\.VariantMIMIC\-IIIMIMIC\-IVFull ReTA34\.52 \(0\.00\)35\.18 \(0\.00\)w/o refined pool31\.74 \(−\-2\.78\)32\.06 \(−\-3\.12\)Rate\-matched shuffle33\.36 \(−\-1\.16\)33\.76 \(−\-1\.42\)w/o decoupled fusion33\.65 \(−\-0\.87\)34\.25 \(−\-0\.93\)History\-aware retrieval—−\-0\.54Frozen encoder—−\-0\.51Uncertainty signalutu\_\{t\}—−\-0\.46Adaptive cascade depth—−\-0\.43Template credit—−\-0\.33Gate\-only fusion—−\-0\.21Table 12:Selector comparison and matched controls on MIMIC\-IV\.SelectorLabelsTraj\. ret\.Eval\./visitAUPRC \(Δ\\Delta\)Lat\. \(ms\)Uncertainty heuristicNoneNo133\.66 \(−\-1\.52\)10\.6Supervised selectorExhaustiveNo134\.47 \(−\-0\.71\)11\.7Greedy myopic oracleTest outcomeNo4134\.80 \(−\-0\.38\)—Contextual banditNoneNo134\.68 \(−\-0\.50\)11\.5Rate\-matched shuffleNoneNo033\.76 \(−\-1\.42\)10\.4Always augmentNoneNo034\.56 \(−\-0\.62\)12\.8Full RLNoneYes135\.1811\.8

Table 13:Policy departures from code\-only Top\-1 retrieval\.DatasetTempl\. ovr\.Total dep\.Pos\.\-gainForced Top\-1MIMIC\-III31\.7%53\.4%67\.8%34\.03 \(−\-0\.49\)MIMIC\-IV35\.4%59\.2%70\.6%34\.62 \(−\-0\.56\)

Table 14:Richer structured inputs on MIMIC\-IV\.InputMethodAUPRCLat\. \(ms\)Skip/Soft/HardDiagnosisKARE33\.42±\\pm0\.3315\.1—DiagnosisReTA35\.18±\\pm0\.3611\.831/35/34%\+ Med\./proc\.KARE34\.61±\\pm0\.3816\.3—\+ Med\./proc\.ReTA36\.29±\\pm0\.3912\.936/39/25%

## Appendix EAdditional Results

### E\.1Label\-Frequency Stratification

Table 15:Per\-stratum AUPRC \(%\) on MIMIC\-IV\.\>\>500200 –50 –20 –5 –<<55002005020Trans\.30\.5228\.7325\.8322\.2418\.4114\.52HAP31\.8629\.8227\.5623\.8720\.4316\.28SeqCare32\.4131\.1428\.7325\.1821\.6717\.38KARE34\.3833\.1730\.8427\.2824\.2819\.91ReTA35\.9234\.2833\.2130\.7427\.8624\.63Δ\\Delta\+1\.54\+1\.11\+2\.37\+3\.46\+3\.58\+4\.72The gain over KARE increases monotonically from \+1\.54 on head diagnoses to \+4\.72 on the rarest bin \(Table[15](https://arxiv.org/html/2609.01839#A5.T15)\)\. Two patterns are worth noting beyond the aggregate trend reported in the main text\. First, the gap widens sharply at the 50–200 boundary \(\+1\.11→\\rightarrow\+2\.37\), suggesting that this is the frequency threshold below which code\-level co\-occurrence statistics become too sparse for data\-driven methods and external knowledge begins to dominate\. Second, non\-KG baselines degrade more steeply across strata than KG\-augmented methods, with Transformer losing 52% of its head\-bin AUPRC in the rarest bin compared to 42% for KARE and 31% for ReTA\.

### E\.2Calibration

Table 16:Calibration on MIMIC\-IV \(macro\-averaged over CCS labels, 5 seeds\)\. Lower is better\.MethodECE \(%\)↓\\downarrowBrier \(×10−2\\times 10^\{\-2\}\)↓\\downarrowTransformer8\.14±\\pm0\.225\.27±\\pm0\.14HAP7\.36±\\pm0\.254\.89±\\pm0\.16SeqCare6\.91±\\pm0\.214\.65±\\pm0\.14KARE5\.47±\\pm0\.173\.89±\\pm0\.11ReTA4\.76±\\pm0\.143\.43±\\pm0\.09Δ\\Deltavs\. KARE−\-0\.71−\-0\.46ReTA achieves the lowest expected calibration error and Brier score among all methods \(Table[16](https://arxiv.org/html/2609.01839#A5.T16)\)\. The calibration gap over KARE \(−\-0\.71 ECE\) is proportionally larger than the AUPRC gap \(\+1\.76\), suggesting that the skip mechanism improves probability estimation as well as discrimination\. Non\-KG methods \(Transformer\) show the worst calibration, consistent with the pattern that external knowledge improves both ranking and probability estimation\.

## Appendix FMechanism Analysis

All diagnostics in this section are computed on the validation split under a fixed encoder snapshot \(no additional training\) and are not used for model selection\.

### F\.1Policy Behavior

Figure 11:Hard vs\. Soft Import probability by diagnosis frequency \(MIMIC\-IV validation\)\.Complementing the discrete Head/Torso/Tail breakdown in Figure[6](https://arxiv.org/html/2609.01839#S3.F6)d, Figure[11](https://arxiv.org/html/2609.01839#A6.F11)reveals a smooth crossover at approximately 50 training\-set occurrences\. Below this threshold, Hard Import dominates because rare diagnoses have sparse co\-occurrence statistics and benefit most from explicit structural enrichment\. Above it, Soft Import and Skip become increasingly preferred as the base encoder has sufficient data to learn meaningful representations without modifying its topology\.

![Refer to caption](https://arxiv.org/html/2609.01839v1/case_pool.png)Figure 12:\(a\) Template retrieval density \(UMAP\)\. \(b\) Policy\-to\-channel alluvial flow\.Figure[12](https://arxiv.org/html/2609.01839#A6.F12)provides a population\-level view of template selection and augmentation flow\. Panel \(a\) shows that retrieval exposure is concentrated on a small set of templates near cluster centers, with peripheral templates rarely selected, consistent with the tight clustering in Table[7](https://arxiv.org/html/2609.01839#A2.T7)\(median intra\-cluster cosine distance 0\.14–0\.15\)\. Panel \(b\) traces the flow from frequency bin through augmentation mode, template cluster, and fusion channel\. Two patterns emerge\. First, the Tail→\\rightarrowHard ribbon is substantially wider than Tail→\\rightarrowSoft, confirming the frequency\-dependent mode preference at the population level\. Second, Hard Import flows predominantly to the structural channel while Soft Import flows to the semantic channel, validating that the two augmentation modes serve complementary roles rather than redundant ones\.

### F\.2Training Stability

Table 17:Training stability \(MIMIC\-IV validation, mean±\\pmstd\)\.MetricEarlyLateAllEntropy↑\\uparrow2\.56±\\pm0\.181\.84±\\pm0\.142\.10±\\pm0\.16Reward std↓\\downarrow0\.28±\\pm0\.050\.17±\\pm0\.030\.21±\\pm0\.04MaxPr⁡\(a\)\\Pr\(a\)↓\\downarrow0\.086±\\pm0\.0120\.118±\\pm0\.0150\.104±\\pm0\.013Hard ratio0\.52±\\pm0\.060\.34±\\pm0\.050\.41±\\pm0\.05Entropy decreases from early to late training while the reward standard deviation drops by roughly 40% \(Table[17](https://arxiv.org/html/2609.01839#A6.T17)\), indicating stable convergence without mode collapse\. The maximum single\-action probability remains below 12% even at convergence, confirming that the policy maintains diversity across its2​K\+12K\{\+\}1actions\. The Hard Import ratio decreases from 0\.52 to 0\.34 as the policy learns to favor lighter augmentation when structural enrichment is unnecessary, consistent with the skip behavior reported in §[3\.4](https://arxiv.org/html/2609.01839#S3.SS4)\.

### F\.3Paired Reward Ablation

Table 18:Reward ablation on MIMIC\-IV\.RewardAUPRC \(%\)Skip \(%\)Paired \(default\)35\.18±\\pm0\.3631\.2±\\pm1\.8Unpaired \(−ℒC​E\-\\mathcal\{L\}\_\{CE\}only\)34\.03±\\pm0\.4218\.7±\\pm2\.3Replacing the paired reward with an unpaired variant \(−ℒC​E\-\\mathcal\{L\}\_\{CE\}only\) drops AUPRC by 1\.15 points and halves the skip rate \(Table[18](https://arxiv.org/html/2609.01839#A6.T18)\)\. The mechanism is straightforward\. The paired comparison runs both raw and augmented forward passes on the same mini\-batch with dropout disabled, so the policy receives positive reward only when augmentation actually improves prediction beyond what the base encoder achieves alone\. Without this comparison, the policy receives credit for augmentation even at visits where the base encoder is already sufficient, reducing its incentive to skip\.

### F\.4Qualitative Analysis

##### Structural shortcut\.

Figure[7](https://arxiv.org/html/2609.01839#S3.F7)shows the topology produced by the case study in §[3\.6](https://arxiv.org/html/2609.01839#S3.SS6), and the mechanism is worth spelling out\. AtV4V\_\{4\}, the clinical state shifts acutely, and the policy switches to Hard Import, triggering retrieval that connectsV1V\_\{1\}’s chronic context to cascade nodes \(Systemic Inflammation, Septic Shock\)\. These nodes create short message\-passing paths toV5V\_\{5\}\(Sepsis\) that would otherwise require traversing distant shared ancestors in the CCS hierarchy\. The fusion gate responds to this structural enrichment, shifting fromβ=0\.74\\beta\{=\}0\.74atV3V\_\{3\}\(no structural input\) toβ=0\.48\\beta\{=\}0\.48atV4V\_\{4\}andβ=0\.33\\beta\{=\}0\.33atV5V\_\{5\}\.

Note that the retrieval context edge originates fromV1V\_\{1\}rather thanV3V\_\{3\}becauseV3V\_\{3\}is skipped and produces no retrieval\. This illustrates how the history\-aware statests\_\{t\}atV4V\_\{4\}can draw on earlier visits to inform retrieval even when intermediate visits are skipped\.

Figure 13:Over\-pruning under ambiguity\. The dashed path denotes a clinically plausible dependency pruned by the policy\.
##### Failure mode\.

The primary failure mode involves ambiguous symptoms where no single template scores high enough to justify Hard Import \(Figure[13](https://arxiv.org/html/2609.01839#A6.F13)\)\. Under ambiguous symptoms \(e\.g\., fatigue and nausea that could indicate either viral gastroenteritis or adrenal insufficiency\), the Hard Import penaltyλ2\\lambda\_\{2\}discourages structural grafting\. The policy falls back to Soft Import, which selects the semantically closest template \(viral gastroenteritis\) rather than the structurally informative one \(adrenal insufficiency\)\. This failure is most common for rare conditions with ambiguous symptom overlap, where the template pool contains a high\-frequency match that dominates retrieval scoring\. The paired reward cannot correct this because both the raw and augmented predictions agree on the wrong answer, producing near\-zero reward signal\. Improving template diversity or introducing uncertainty\-aware retrieval could mitigate this failure mode\.

Similar Articles

Injecting Structured Biomedical Knowledge into Language Models: Continual Pretraining vs. GraphRAG

arXiv cs.CL

This paper compares two strategies for injecting structured biomedical knowledge from the UMLS Metathesaurus into language models: continual pretraining (embedding knowledge into model parameters) and GraphRAG (querying a knowledge graph at inference time). Results show improvements on biomedical QA benchmarks, with GraphRAG on LLaMA 3-8B yielding over 3 and 5 accuracy points on PubMedQA and BioASQ respectively without any retraining.