Reinforcement learning optimization of automated insulin delivery in type 1 and type 2 diabetes mellitus

Nelida Elizabeth López-Palau, Pablo Naranjo-Meneses, Julia Szendroedi, Roland Eils, Stefan M. KallenbergermedRxiv 2025

TL;DR

Researchers have developed a deep reinforcement learning (RL) framework that automates insulin delivery for both Type 1 and Type 2 diabetes without requiring manual meal announcements. By using Proximal Policy Optimization (PPO), the system significantly outperforms traditional control algorithms, maximizing "Time in Range" while virtually eliminating the risk of dangerous hypoglycemia.

What Problem Does This Paper Address?

Managing diabetes is a relentless cognitive burden. Current "artificial pancreas" or Automated Insulin Delivery (AID) systems are mostly semi-automated; they require users to "announce" meals and estimate carbohydrate counts. This is a major point of failure: human error in carb counting is common, leading to poor glucose regulation. Furthermore, most AID research focuses on Type 1 Diabetes (T1DM), leaving the growing population of insulin-dependent Type 2 Diabetes (T2DM) patients with fewer optimized technological options.

The authors sought to create a "fully closed-loop" system—one that reacts to glucose fluctuations in real-time using only Continuous Glucose Monitor (CGM) data, effectively handling unannounced meals and physiological variability without any user intervention.

Methods

The researchers employed an Actor-Critic Reinforcement Learning framework, specifically using the Proximal Policy Optimization (PPO) algorithm.

  • The Environment: Instead of simple linear models, they used complex compartmental Ordinary Differential Equations (ODEs) that simulate the dynamics of glucose, insulin, glucagon, and incretins across different organs.
  • The Agent: The "Actor" (which decides the dose) and the "Critic" (which evaluates the decision) were built using deep artificial neural networks. Notably, they included Gated Recurrent Units (GRUs) to help the networks "remember" past glucose trends, allowing the agent to understand the temporal context of a glucose spike.
  • The Reward Function: The agent was trained to maximize a heuristic reward. It received high points for maintaining blood glucose (BG) between 90–120 mg/dL and faced heavy penalties for hypoglycemia (<70 mg/dL). It also used the "rate of change" to encourage the agent to steer the BG back to the target range quickly but safely.
  • Safety Features: A built-in "attenuation factor" acted as a safety switch, automatically cutting off insulin delivery if BG dropped too low or showed a sharp downward trend.

Datasets

The study was conducted in silico (via simulation) using a cohort of 4,000 virtual patients (2,000 T1DM and 2,000 T2DM).

  • Training/Validation: 75% of the patients were used to train the RL policies, and 25% were used for validation.
  • Testing: A separate group of 200 virtual patients was subjected to a rigorous 24-hour "test environment" featuring three unannounced meals of varying sizes at random times.
  • Physiological Basis: The virtual patients were generated based on established physiological distributions from existing clinical literature (e.g., Zhao et al. and Abdul-Ghani et al.).

Key Insights and Ideas

  • Inference over Prediction: The RL agent doesn't need to "know" when a meal is coming. Instead, it learns to infer the state of the body from subtle fluctuations in CGM data. It reacts to the onset of a disturbance more effectively than traditional controllers.
  • The "Aggression" Trade-off: The authors found that untrained or "naive" policies often try to maximize short-term rewards by aggressively lowering BG. However, the trained RL agent learns a "conservative" strategy—prioritizing long-term stability to avoid the heavy penalties associated with "crashing" into hypoglycemia.
  • Pathophysiological Versatility: By simply retraining the agent on different virtual patient models, the framework proved equally effective for T1DM (total insulin deficiency) and T2DM (insulin resistance and residual secretion), demonstrating its potential as a universal control platform.

Key Results

The RL-based system consistently outperformed standard Proportional-Integral-Derivative (PID) controllers:

  • Time in Range (TIR): The RL agent kept T1DM patients in the healthy range 97.3% of the time and T2DM patients 99.7% of the time. In contrast, standard PID controllers only managed ~88% and ~98% respectively.
  • Hypoglycemia Prevention: For T1DM, the RL agent reduced "Time Below Range" (TBR) to a negligible 0.02%, compared to 8.8% for the PID controller. For T2DM, the RL agent achieved a 0% TBR.
  • Clinical Significance: The 10–15% improvement in TIR observed here is clinically massive; literature suggests a 10% increase in TIR correlates with a roughly 0.6% reduction in HbA1c, a key marker for long-term diabetes complications.

Limitations and Future Work

  • Simulation Only: While the ODE models are sophisticated, the system has only been tested in silico. Real-world clinical trials are the necessary next step.
  • Narrow Scope of Disturbances: The current model only accounts for oral glucose intake. Future iterations need to incorporate other real-world variables like physical exercise, illness, and psychological stress.
  • Dual-Hormone Potential: The authors suggest expanding the model to a "dual-hormone" system that delivers both insulin (to lower BG) and glucagon (to raise it), which could provide an even greater safety margin.
  • Personalization: The ultimate goal is an AID system that performs "online" training, fine-tuning its parameters to the specific, unique physiology of an individual user over time.

Summary updated

Abstract

Abstract Closed-loop insulin delivery systems have proven effective in regulating blood glucose (BG) concentration, thereby reducing the burden of self-care in the management of type 1 and type 2 diabetes mellitus. However, the prevalence of unexpected disturbances resulting from oral glucose intake represents a considerable challenge to the full automation of these systems. Here, we propose an actor-critic reinforcement learning (RL) framework implemented within environments governed by compartmental ordinary differential equation models of the glucose–insulin–glucagon–incretins dynamics. This approach was employed to optimize automated insulin delivery in virtual patients with type 1 and type 2 diabetes mellitus, under scenarios involving unforeseen BG disturbances. The resulting optimal RL policies were tested in silico on virtual patients subjected to three unannounced glucose disturbances over the course of a day. The findings demonstrated that optimal RL policies could sustain the BG a significantly higher percentage of time within the normoglycemic range and a significantly lower percentage of time below the normoglycemic range in comparison to either continuous or discrete proportional-integral-derivative control algorithms. These results set the basis for developing new approaches to optimizing automated dosing regimens for chronic disease management. Author Summary Managing diabetes requires constant attention to glucose levels and the corresponding adjustment of insulin doses, which can be demanding for insulin-dependent patients. Semi-automated systems, frequently referred to as “artificial pancreas”, aim to mitigate this burden by adjusting insulin delivery based on glucose levels obtained from a continuous glucose sensor. However, these systems underperform in scenarios involving unexpected glucose disturbances, such as those triggered by the omission of meal announcing within the system interface. In the present study, we developed a computer-based learning approach to identify deep network-based functions that determine the appropriate insulin doses to regulate glucose in real time and mitigate unannounced disturbances. This approach has been demonstrated to be effective in the management of Type 1 and Type 2 diabetes and it does not require any additional input other than the continuous glucose measurements. The findings of our study demonstrate that our functions were able to maintain glucose levels within a healthy range for a longer period of time than the standard functions, while also reducing the risk of threating low glucose levels. This research contributes to the development of fully automated insulin delivery systems that are capable of adapting to real-life situations of individuals living with diabetes.
BibTeX
@misc{lopezpalau2025reinforcement,
  author = {Nelida Elizabeth López-Palau and Pablo Naranjo-Meneses and Julia Szendroedi and Roland Eils and Stefan M. Kallenberger},
  title = {{Reinforcement learning optimization of automated insulin delivery in type 1 and type 2 diabetes mellitus}},
  year = {2025},
  doi = {10.1101/2025.10.12.25337835},
  howpublished = {medRxiv},
}

Loading related content...

Figure