Where will my blood sugar be in an hour?
People with type 1 diabetes juggle meals, insulin and a glucose sensor all day. This study pairs an AI forecaster with a tiny four-number model of the body, so the forecast stays accurate and still reacts the right way when you add insulin or eat.
Why it matters
A blood-sugar forecast 30 to 60 minutes ahead could warn someone with type 1 diabetes before their glucose goes dangerously high or low, but a pure AI forecaster can learn that insulin goes with rising sugar (pumps give more insulin when glucose is already climbing) and so react the wrong way to an extra dose. By training the AI to agree with a simple four-number body model, this study beat the body model alone in all six tests (a typical miss of about 15–16 mg/dL at 30 minutes) and lowered its forecast after a 2-unit correction dose in 85 % of tested cases, against 11 % for a standard recurrent network (GRU).
The paper
PMB-NN: Physiological-Model-Based Neural Network for Glucose Forecasting in Type 1 Diabetes
Yaowen Zhang, Shuhao Que & Ying Wang. arXiv:2610.15456 [physics.med-ph; cs.LG], v1 submitted 11 Oct 2026, revised 15 Oct 2026. Read on arXiv · PDF
In plain language: the team used 6–8 weeks of real-life sensor, insulin-pump and meal records from 25 people with type 1 diabetes (the public AZT1D dataset) and asked a neural network to predict glucose 30, 60 and 120 minutes ahead from the last three hours. While it learned, the network was also asked to agree with a very small model of the body that has just four personal numbers: the level a person’s glucose drifts back to, how fast it drifts there, how strongly active insulin pulls it down, and how strongly carbohydrate still being digested pushes it up. The body model learns those four numbers for each person at the same time.
The result, called PMB–NN, had a median typical error (mean absolute error) of 16.24, 25.00 and 30.20 mg/dL at 30, 60 and 120 minutes when basal-insulin records were available, and 15.38, 24.21 and 31.79 mg/dL without them. It beat the body model alone in all six settings and was the most accurate model at 30 and 60 minutes without basal records. It also behaved more sensibly: a 2-unit correction bolus at high glucose lowered its forecast in 85 % of tested cases (median), and 20 g of rescue carbohydrate at low glucose raised it in 100 %. A three-term variant that also fitted the body model directly to glucose did not lower overall error and reacted less sensibly, so the authors favour the simpler two-term version.
Try it
Panel 1 runs the paper’s physiological branch exactly as written (Eqs. 2 and 5, with the 240-min insulin and 120-min carbohydrate decay filters and the paper’s parameter bounds). The default personal numbers are the cohort medians from Table 2. The neural network’s own forecast needs the trained weights and each person’s data, so it is not reproduced here. Panels 2 and 3 plot the published results (Tables 1 and 3, Section 5.2). The scenarios you build — meal size, dose, timing — are your own inputs, not patient data. This is a teaching demo, not dosing advice.
1 · Forecast the next two hours with the four-number body model
For comparison, the paper reports that in the trained PMB–NN a 2-U correction bolus lowered the median 60-min forecast by 3.90 mg/dL and a 20-g rescue raised it by 14.10 mg/dL — much smaller responses than the standalone body model, because the network also leans on the recent glucose trend.
2 · How accurate were the forecasters? (paper Table 1)
3 · How many days of personal data does it need? (paper Table 3, with basal records)
| Model | More active insulin | More active carbs | Correction bolus (2 U) | Rescue carbs (20 g) |
|---|---|---|---|---|
| PMB–NN (two-term) | 0.57 | 0.56 | 0.85 | 1.00 |
| TCN, no body model | — | — | 0.71 | ≈ 1 |
| Transformer | — | — | 0.41 | ≈ 1 |
| GRU | — | — | 0.11 | ≈ 1 |
| LSTM | — | — | 0.01 | ≈ 1 |
| Body model alone | 1.00 | 1.00 | 1.00 | 1.00 |
1.00 means every tested forecast moved the expected way. “—” = not stated in the paper’s text; “≈ 1” = the paper says all models responded correctly to rescue carbs “in nearly every tested record”. The body model scores 1.00 by construction, because its equation fixes the signs.
The maths in this page
Reduced personal body model (Eq. 2). For each person, glucose G (mg/dL) drifts back toward an operating level, is pulled down by insulin on board and pushed up by carbohydrate on board:
Action filters. On a 5-minute grid, doses D (units) and carbs C (grams) decay with fixed time constants:
Exact 5-minute step (Eq. 5), holding IOB and COB fixed within each step, with b = kG and a = kGGb − SI·IOB + kcarb·COB:
As in the paper, the forecast starts from the current glucose and lets the current IOB and COB decay; doses after “now” are not known, so they are not added. Parameter bounds (Eqs. 3–4): 70 ≤ Gb ≤ 250 mg/dL, 0.001 ≤ kG ≤ 0.03 /min, 0 ≤ SI ≤ 2.0 mg/dL/min/U, 0 ≤ kcarb ≤ 0.08 mg/dL/min/g. The SI slider stops at 0.3 to give fine control over the range the cohort actually used.
| Parameter (Table 2, median [IQR]) | With basal records | No basal records |
|---|---|---|
| Gb, mg/dL | 167.73 [148.87–174.57] | 156.24 [146.08–166.97] |
| kG, /min | 0.00882 [0.00757–0.01000] | 0.00752 [0.00685–0.00884] |
| SI, mg/dL/min/U | 0.0776 [0.0615–0.0836] | 0.0854 [0.0699–0.0967] |
| kcarb, mg/dL/min/g | 0.02282 [0.01849–0.02984] | 0.01932 [0.01548–0.02478] |
Training objective (Eqs. 7–9). A temporal convolutional network fTCN reads 36 five-minute steps of 9 inputs and outputs ĜNN at 30, 60, 120 min. It is trained jointly with the body model’s forecast ĜPM:
Our additions (not from the paper). The basal slider assumes a steady rate over the past day, so basal IOB = (rate × 5⁄60) ⁄ (1 − e−5/240); the paper itself assigns each recorded hourly rate to at most 75 minutes. The shaded “typical miss” band joins the paper’s median MAE at 0, 30, 60 and 120 min with straight lines (0 at “now”, our assumption) and wraps it around the body-model curve; it is a size guide, not a confidence interval. The “early warning” stat flags when that curve crosses 70 or 180 mg/dL within 120 min. 1 mmol/L = 18 mg/dL.
Teaching demo built from the paper’s equations and published results — not the authors’ code and not medical or dosing advice.
How to use it
In panel 1, set today’s glucose, then say how many carbs were eaten and how much bolus insulin was given, and how long ago. The blue line is the body model’s forecast; the grey line shows where glucose would go with no meal and no bolus, so the gap between them is the effect of your inputs. Slide the meal time back and watch the carb push fade faster than the insulin pull — carbs decay with a 120-minute filter and insulin with a 240-minute one, so in this model insulin keeps pulling glucose down after the meal’s push has faded. Switch between the two cohort-median profiles, or drag the four personal numbers to see a person whose insulin works harder or whose glucose settles higher. Turn on mmol/L if that is what your meter shows. In panel 2, flip between “with basal” and “no basal” records to compare the six forecasters at each horizon. In panel 3, drag the days slider to see how quickly the forecaster improves as it gets to know a new person.