XRL4T1D: A Post-hoc Explainability Framework for Reinforcement Learning in Type 1 Diabetes Management

Malay Phadke, Chirath HettiarachchiarXiv 2026

TL;DR

Reinforcement learning (RL) controllers can manage Type 1 diabetes remarkably well in simulation, yet they operate as opaque black boxes in a domain where a single miscalculated dose can be dangerous. This paper introduces XRL4T1D, an evaluation framework that opens up pretrained RL insulin-dosing policies without retraining them, revealing which historical glucose and insulin signals drive each decision—and rigorously testing whether those post-hoc explanations actually hold water.

What Problem Does This Paper Address?

Managing Type 1 diabetes requires an endless, delicate balancing act of exogenous insulin delivery. Automated RL controllers promise to take the burden off patients, and researchers routinely benchmark them using aggregate clinical metrics like "Time in Range" (the percentage of the day blood sugar stays between 70 and 180 mg/dL).

Here is the catch: two RL policies can achieve the exact same Time in Range while relying on completely different physiological cues under the hood. In safety-critical healthcare AI, knowing that a controller works isn't enough; clinicians and engineers need to know how it uses recent history to pick a dose. Furthermore, simply slapping a standard explainability tool onto time-series data can produce plausible-looking charts that don't reflect actual model sensitivity—especially when adjacent 5-minute sensor readings are heavily correlated.

Methods

The authors examine two pretrained RL controllers—standard PPO and a planning-augmented variant called G2P2C—that take 60 minutes of continuous glucose monitor (CGM) readings and administered insulin (12 five-minute steps each, totaling 24 inputs) to output the next insulin dose.

Figure 1: Overview of XRL4T1D. Every five minutes, an RL insulin-dosing policy receives a 60- minute history of CGM and administered-insulin measurements and produces the insulin recom- mendation for the next five-minute interval. SHAP attributes the recommendation to these historical inputs; insulin-history attributions are summarized over three 20-minute windows and checked us- ing feature masking, direct window replacement, and TimeSHAP.

While using KernelSHAP to compute feature importance is standard, the novelty of XRL4T1D lies in its domain-tailored aggregation and strict validation pipeline:

  • Channel & Temporal Summarization (A-IOB): First, the framework splits total attribution between CGM history and insulin history. Next, inspired by the clinical concept of insulin-on-board (how much prior insulin is still active in the body to prevent dangerous "insulin stacking"), it groups the 12 insulin lags into three 20-minute windows: recent (0–20 min), middle (20–40 min), and older (40–60 min).
  • Sensitivity & Explainer Validation: Rather than trusting SHAP blindly, the authors actively intervene. They swap out top-ranked, bottom-ranked, and random features (as well as entire 20-minute windows) with background averages to verify if the policy's output actually shifts as predicted. They also cross-check KernelSHAP against TimeSHAP, a sequential explainer, and test explanation stability under simulated sensor noise and missing data.

Datasets

Instead of static clinical datasets, evaluation takes place in closed-loop in-silico trials using the FDA-accepted UVA/Padova Type 1 Diabetes simulator (via Simglucose). The authors evaluate pretrained policies across 20 virtual patients (10 adolescents, 10 adults) over 24-hour simulations (288 decision steps each), testing one stochastic baseline meal protocol alongside two fixed meal disturbance protocols.

Key Insights and Ideas

  • Both controllers are massively glucose-dominated: Despite having full access to recent insulin delivery, both RL policies base their decisions overwhelmingly on CGM history—especially G2P2C, which assigns 98.9% of its total SHAP importance to glucose (versus 92.2% for PPO).
  • Normalization creates an optical illusion for minor channels: Because G2P2C places only 1.1% of its total weight on insulin history, normalizing that tiny sliver into recent/middle/older percentages makes small numerical fluctuations look like dramatic shifts across explainers or hyperparameter settings. You cannot interpret temporal insulin profiles without looking at overall channel share first.
  • Three distinct bars for explainability: Showing that an explanation tracks model sensitivity (do top features move the output?) does not guarantee that fine-grained comparisons between two controllers will hold steady across different patient cohorts or explainer algorithms.

Key Results

XRL4T1D demonstrates strong validation fidelity while exposing subtle fragilities in finer controller comparisons:

Validation results showing feature replacement output changes, temporal window agreement, and explainer-dependent recent-window profiles.
  • Feature-level fidelity: Across all 80/80 tested cases, masking the top-$m$ SHAP-ranked inputs alters the normalized insulin dose far more (mean change 0.01090) than masking random (0.00391) or bottom-$m$ (0.000086) inputs.
  • Temporal window fidelity: The highest-attributed 20-minute insulin window matches the most output-sensitive window under direct replacement in 115/120 configurations (mean Spearman $\rho = 0.913$), and agrees with TimeSHAP's top window in 111/120 cases.
  • Subtle controller nuances: While PPO and G2P2C achieve similar median Time in Range (e.g., 58.85% vs. 58.16% in adolescents; 64.76% vs. 67.53% in adults), their pooled KernelSHAP recent-insulin shares are nearly indistinguishable (55.7% vs. 54.1%). Yet switching to TimeSHAP bumps G2P2C's recent-window share to 64.2% while leaving PPO at 56.2%.
  • Sensor corruption stability: Global 24-feature attribution rankings remain highly stable when explanations are computed on counterfactual histories corrupted with 10 mg/dL Gaussian noise or 10% missing values.

Limitations and Future Work

The study is confined to 20 virtual patients and two pretrained RL architectures inside a simulator that omits real-world curveballs like exercise, illness, and infusion-site failures. Technically, replacing masked features with empirical background means can create physiologically implausible combinations of correlated time-series readings, making this an intervention-specific check rather than true causal validation. Furthermore, the authors emphasize that Attribution-based Insulin-on-Board (A-IOB) reflects policy attention, not actual pharmacokinetic residual insulin. Future work points toward replacement strategies that preserve realistic temporal dependencies, alongside prospective clinical and clinician-centered evaluations.

Summary updated

Abstract

Type 1 diabetes (T1D) requires lifelong insulin therapy, and reinforcement learning (RL) has shown promise for automated dosing in the UVA/Padova simulator. However, the decisions of RL controllers remain difficult to interpret. We present XRL4T1D, a post-hoc explainability framework for evaluating pretrained insulin-dosing policies without retraining. Each policy uses 60 minutes of continuous glucose monitor (CGM) and administered-insulin history, sampled every 5 minutes, to recommend insulin. We use SHapley Additive exPlanations (SHAP) to compare the importance of CGM and insulin-history inputs and summarize insulin-history attributions over three 20-minute windows motivated by insulin-on-board. We assess whether these attributions correspond to policy-output sensitivity through targeted input replacement and compare temporal rankings with TimeSHAP. In all 80 patient-policy-mask-size cases, replacing the highest-attribution inputs changes the normalized insulin recommendation more than replacing the lowest-attribution or random inputs. The highest-attribution insulin-history window is also the most output-sensitive in 115 of 120 patient-policy-scenario configurations, and KernelSHAP and TimeSHAP select the same top window in 111 of 120. Applying XRL4T1D to PPO and G2P2C across 20 virtual patients, we find that both controllers rely predominantly on CGM history, especially G2P2C. However, the distribution of insulin-history importance across recent, middle, and older windows varies by cohort, explainer, and analysis settings, without a consistent separation between controllers. Global feature-attribution rankings remain stable under the tested observation corruptions. These results show why attribution fidelity, temporal reproducibility, and controller-comparison robustness should be assessed separately.
BibTeX
@misc{phadke2026xrl,
  author = {Malay Phadke and Chirath Hettiarachchi},
  title = {{XRL4T1D: A Post-hoc Explainability Framework for Reinforcement Learning in Type 1 Diabetes Management}},
  year = {2026},
  eprint = {2611.31498},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31498},
}
Figure