2026-11-26 15:40 UTC

T1DMAI pairs synthetic glucose-model pretraining with on-device personalization

state: seedheat: mediumuncertainty: mediumrelevance: mediumpersonalized-health-models blood-glucose-forecasting small-models0xdeadf1sh

What is this?

On Nov. 14, 2026, developer 0xdeadf1sh shared T1DMAI, an open-source research project for forecasting glucose from continuous glucose monitor readings, insulin and carbohydrate inputs. Its 31,253-parameter transformer was pretrained on simulated traces from one million synthetic people and tested both without adaptation and with a small LoRA adapter fitted to real data. The project compares many forecasting methods on the developer’s 35-day personal test set and the public MetaboNet benchmark. The author reports the adapted model near leading methods on some measures, but results are mixed: it is not the top overall, and hypoglycemia prediction remains weak. The project explicitly says it is not clinically validated or a medical device; no independent validation is supplied.

Why it matters

This is a useful small-scale demonstration of synthetic pretraining plus lightweight personalization for a high-stakes time-series task. The 31k-parameter model can run on a phone, suggesting a path toward local, data-specific forecasts without a large cloud model. Its results make that approach worth tracking, not a basis for medical use: evaluation is limited, the author notes future insulin and carbohydrate inputs can leak information in the personal-data test, and low-glucose detection is imperfect.

Current assessment

New: the developer released T1DMAI and a detailed code-and-results repository, including synthetic pretraining, rank-1 LoRA adaptation, mobile inference support, and comparisons across personal CGM data and MetaboNet. According to the repository, the DILATE sim+LoRA version ranks third of 26 on the developer’s test data at 60 minutes (RMSE 22.8 mg/dL, versus 22.2 for XGBoost and 22.4 for LightGBM); on MetaboNet it reports 34.6 mg/dL at 60 minutes, while XGBoost leads at 33.2. The author reports improved 60-minute low detection on personal data versus XGBoost (40% vs 29%), but the project’s own table shows only 6% sensitivity at 60 minutes on MetaboNet. These are developer-reported results, not independent findings. The personal evaluation uses one person’s 80 training days and 35 test days and is non-blind: future insulin and carbohydrate entries may be available to the model; the author says this should be addressed. MetaboNet is larger but differs in population and conditions, and lows are relatively rare. The author also says the model is worse than their own judgment at predicting lows over roughly 30 minutes. Repository warning: research/education only, not clinically validated, has no regulatory clearance, and must not guide treatment or insulin dosing. The report supports interest in compact, on-device personalization and synthetic-data workflows, but not clinical efficacy or safety; broader, blind, prospective evaluation would be needed to establish those.

Measured heat

now 0 pts/hpeak 2 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 307h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

11-13 21:25 (minted)⭐ origin echo-reconstructedThe repository README describes T1DMAI as a model zoo for blood-glucose forecasters trained and tested on the author's own data. It says: “I
0xdeadf1sh on github (echo) · attributed from hn.story.50489490 · published time unknown
—
11-13 20:53first on hacker news · published · lag ?Show HN: I have trained a model to predict my blood sugar
0xdeadf1sh
—
11-13 20:53amplified on hacker news 👑hn.story.50489490
0xdeadf1sh
peak 6 · 4 comments · 100% of case engagement
11-13 21:21our radar first saw it · lag ?discovery anchor: hn.story.50489490—
pace: p52 vs 2096 stories at the 168h mark (now 307h old) — ahead of 5dive-self-hosted-coding-agents (1.2x), behind ai-screening-for-visa-document-fraud (0.9x)

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: I have trained a model to predict my blood sugar
Retrieved article excerpt

Open article · Retrieved 2026-11-13T21:22:26.876184+00:00

# T1DMAI

Note

Most of the code in this repo was written by AI. If you don't like that, feel free to leave.

This repo is a zoo. Here I train & test many blood glucose forecasting models (including my own)
on both my own data and metabonet (public).

My model is a small transformer that forecasts blood glucose 2 hours ahead. I've made two variants: D16 DILATE and D16 MSE
which use DILATE and MSE loss for training, respectively. D16 refers to the width of the model (16). They are both
trained on synthetic traces, and then a LoRA adapter is added for light fine-tuning, but I also test them without the adapter.

Feast thine eyes on some of their forecasts (these have been trained on synthetic traces, then fine-tuned with a LoRA adapter on my training split):

T1DMAI D16 DILATE forecasting my glucose, test days block 1


T1DMAI D16 DILATE forecasting my glucose, test days block 2


T1DMAI D16 MSE forecasting my glucose, test days block 1


T1DMAI D16 MSE forecasting my glucose, test days block 2

Caution

**Research and educational use only - not a medical device.** T1DMAI is a
research artifact. It is **not** clinically validated, has **no** regulatory
clearance, and its output is a forecast of research signals, not medical
advice. It **must not** be used to make medical, diagnostic, or treatment
decisions, to calculate or adjust insulin doses, or to manage diabetes in any
way. For medical guidance consult a qualified healthcare professional. The
software is provided "as is", without warranty of any kind (see
[LICENSE](https://github.com/0xdeadf1sh/T1DMAI/blob/main/LICENSE)).

## Contents

1. [Background](https://github.com/0xdeadf1sh/T1DMAI#1-background)
2. [Main results](https://github.com/0xdeadf1sh/T1DMAI#2-main-results)
3. [Models](https://github.com/0xdeadf1sh/T1DMAI#3-models)
4. [Data](https://github.com/0xdeadf1sh/T1DMAI#4-data)
5. [Method](https://github.com/0xdeadf1sh/T1DMAI#5-method)
6. [Results](https://github.com/0xdeadf1sh/T1DMAI#6-results)
7. [Limitations](https://github.com/0xdeadf1sh/T1DMAI#7-limitations)
8. [Terms](https://github.com/0xdeadf1sh/T1DMAI#8-terms)
9. [Full tables](https://github.com/0xdeadf1sh/T1DMAI#9-full-tables)
10. [Reproduce](https://github.com/0xdeadf1sh/T1DMAI#10-reproduce)
11. [Published scores](https://github.com/0xdeadf1sh/T1DMAI#11-published-scores)
12. [References](https://github.com/0xdeadf1sh/T1DMAI#12-references)

## 1. Background

I have type 1 diabetes and I wanna know if I can train a BG forecasting model
to help me with my daily management. To this end I've made some auxiliary tools:

- [T1DMSIM](https://github.com/0xdeadf1sh/T1DMSIM) creates synthetic CGM traces since UVA/Padova was too slow on my laptop.
- [T1DMDROID](https://github.com/0xdeadf1sh/T1DMDROID) runs the models on my phone, also has some neat functionality like reading BG from multiple CGMs at once.

For evaluation, I use the recommendations by Jacobs et al., IEEE Reviews in Biomedical Engineering, 2024 [[1]](https://github.com/0xdeadf1sh/T1DMAI#12-references). It's a nice paper that you should probably read.

## 2. Main results

All models suck. XGBoost is the best one but my own model comes close. More details below:

1. On my data, D16 DILATE + LoRA comes 3rd of 26 (22.8), behind XGBoost (22.2) and LightGBM
   (22.4). Wilcoxon puts it level with both at 60 and 90 min, behind them at 30 and 120.
2. On MetaboNet, D16 DILATE + LoRA comes 9th (34.6) but has the lowest RMSE of all models at
   90 min. XGBoost leads at 30, 60 and 120.
3. At 60 min a 3771 parameter LoRA adapter helps both models on both datasets: 26.1 to 22.8 and
   27.1 to 23.5 on my data, 36.6 to 34.6 and 36.7 to 35.1 on MetaboNet. At 120 min on
   MetaboNet it makes D16 DILATE worse (48.0 to 50.4).
4. On MetaboNet, LoRA also fixes the bands. The 90% band holds the truth 75-78% of the time at
   60 min with sim only and 81-85% with LoRA. On my data both are 83-85%.
5. T1DMAI + LoRA reacts earliest on my data: 40-50 min time gain at 60 min, against 30 for
   XGBoost.
6. It also catches the most lows on my data: 40-47% at 60 min, against 29% for XGBoost. On
   MetaboNet every low-RMSE model misses nearly all lows (XGBoost 0%, T1DMAI 6-8%), while
   linear extrapolation catches 58%.
7. LightGBM matches XGBoost within 0.2 mg/dL everywhere. An LSTM with 15 hours of history comes
   3rd on MetaboNet (33.6 at 60 min), against 35.9 for the 2 hour one.
8. Zero-shot Chronos-2 and TimesFM 2.5 beat zero-shot Chronos-Bolt by 1.4-2.7 mg/dL at 60 min
   on both datasets, but trail fine-tuned Chronos-Bolt.

## 3. Models

| Model | Family | Description |
| --- | --- | --- |
| Persistence | Baseline | Last reading carried forward. |
| Linear extrapolation | Baseline | Straight line through the last few readings. |
| AR (ridge) | Classical | Linear regression on recent glucose. |
| ARX (ridge) | Classical | Linear regression on recent glucose, insulin and carbs. |
| ARIMA | Classical | Glucose only. |
| SARIMAX | Classical | With insulin and carbs. |
| Kalman filter | Classical | Damped local linear trend. |
| SVR | Classical | Glucose, insulin and carbs. |
| Sparse GP | Classical | 1000 inducing points. |
| XGBoost | Classical | Glucose, insulin and carbs [18]. |
| LightGBM | Classical | Same features, depth, rate and rounds as XGBoost [19]. |
| LSTM | Deep | 2 hours of history [5]. |
| LSTM (15 h) | Deep | Two layers of 128 over 15 hours, as in MetaboNet-Bench [3]. |
| GluNet | Deep | Dilated causal convolutions over 4 hours [6]. |
| PatchTST | Deep | [13] |
| N-HiTS | Deep | [14] |
| Chronos-Bolt tiny and mini | Foundation | 9M and 21M parameters, glucose only, zero-shot and fine-tuned [15]. |
| Chronos-2 | Foundation | 120M parameters, zero-shot. Past insulin and carbs; on my data also the future ones [16]. |
| TimesFM 2.5 | Foundation | 200M parameters, zero-shot. Glucose only on MetaboNet; on my data future insulin and carbs through in-context regression [17]. |
| T1DMAI D16 DILATE and D16 MSE | T1DMAI | 31k parameters. Glucose, carbs and insulin. |

Numbers in brackets point to [References](https://github.com/0xdeadf1sh/T1DMAI#12-references). Everything except the baselines and
the foundation models was trained from scratch on each dataset's training split. T1DMAI comes in two versions: **sim only** is the checkpoint in `models/`, and
**sim + LoRA** adds a frozen-base rank 1 adapter [23] (3771 parameters) trained on the real training
split.

T1DMAI details


|  |  |
| --- | --- |
| Architecture | encoder-only transformer, 30 min patches, one attention head, RoPE [26], SwiGLU |
| Size | 16 layers of width 16, 31k parameters |
| Loss | 7 quantile pinball loss plus a median term (DILATE [25] on soft-DTW [24], or MSE) |
| Inputs | CGM in a risk-scaled space, carb absorption curve, insulin action curve, mask bit |
| Output | 7 quantiles (5% to 95%) for every 5 minute step of the next 2 hours |
| History | up to 7 days |
| Simulator training | 1M simulated people, 7 days each, 10000 steps of batch 512 |
| Runtime | ExecuTorch or LiteRT, on the phone in T1DMDROID |

More in [docs/USAGE.md](https://github.com/0xdeadf1sh/T1DMAI/blob/main/docs/USAGE.md) and [ARCHITECTURE.md](https://github.com/0xdeadf1sh/T1DMAI/blob/main/ARCHITECTURE.md).

## 4. Data

**My data.** 115 days from T1DMDROID: days 1 to 80 for training, 81 to 115 for testing.
Note that the model sees future inputs like insulin & carbs. I should probably also
train the adapters while withholding those inputs.

| Source | Subjects | Person-days | Forecasts | CGM coverage % | Mean mg/dL | CV % | < 54 % | < 70 % | 70-180 % | > 180 % | > 250 % |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| t1dmdroid | 1 | 35 | 9764 | 97 | 130 | 28 | 0.4 | 3.0 | 89 | 8 | 0 |



Distribution of my CGM readings in the 35 test days

**MetaboNet** [[2]](https://github.com/0xdeadf1sh/T1DMAI#12-references). Official split, 279 test people from 9 studies. Blind, because most of them use
closed-loop pumps whose future insulin reacts to glucose the model hasn't seen.

| Source | Subjects | Person-days | Forecasts | CGM coverage % | Mean mg/dL | CV % | < 54 % | < 70 % | 70-180 % | > 180 % | > 250 % |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| AZT1D | 4 | 131 | 775 | 99 | 141 | 30 | 0.3 | 1.3 | 82 | 17 | 2 |
| BrisT1D | 2 | 312 | 1953 | 77 | 144 | 33 | 0.2 | 1.8 | 78 | 20 | 3 |
| CTR3 | 5 | 1157 | 1052 | 51 | 141 | 38 | 0.7 | 3.5 | 78 | 19 | 4 |
| HUPA-UCM | 4 | 315 | 896 | 100 | 132 | 36 | 0.9 | 6.8 | 78 | 16 | 2 |
| IOBP2 | 62 | 4737 | 14653 | 84 | 159 | 37 | 0.4 | 2.0 | 68 | 30 | 8 |
| Loop | 159 | 47438 | 203538 | 93 | 139 | 40 | 0.7 | 3.9 | 77 | 19 | 5 |
| PEDAP | 6 | 2070 | 6321 | 85 | 158 | 38 | 0.4 | 2.4 | 68 | 29 | 9 |
| ReplaceBG | 35 | 7967 | 35683 | 87 | 158 | 41 | 1.0 | 4.2 | 64 | 32 | 9 |
| ShanghaiT1DM | 2 | 19 | 28 | 33 | 159 | 39 | 1.0 | 3.8 | 63 | 33 | 7 |
| All | 279 | 64146 | 264899 | 90 | 143 | 40 | 0.7 | 3.7 | 75 | 22 | 6 |



Distribution of MetaboNet CGM readings in the test split

## 5. Method

|  | My data | MetaboNet |
| --- | --- | --- |
| Forecasts | every 5 min of the test days | every 10th row of the leaderboard template |
| Horizons | 30, 60, 90, 120 min | 30, 60, 90, 120 min |
| Training windows, other models | 60000 | 351000 (200000 for fine-tuned Chronos) |
| LoRA steps | 2000 | 6000 |

- LoRA checkpoints are picked by mean RMSE on the last 10 days of each subject's training data.
- All models forecast at the same moments.
- 95% intervals: bootstrap over people (MetaboNet) or days (my data).
- Significance: Wilcoxon signed-rank on paired absolute errors against the best model,
  Bonferroni corrected.
- Clinical error grids: DTS [20], Clarke [22], CG-EGA [21].

## 6. Results

RMSE per model on my data


RMSE per model on MetaboNet


RMSE by horizon, my data


RMSE by horizon, MetaboNet


RMSE at 60 min with 95% intervals, my data


RMSE at 60 min with 95% intervals, MetaboNet


Wilcoxon test against the lowest-RMSE model, my data


Wilcoxon test against the lowest-RMSE model, MetaboNet


RMSE at 60 min per test day, my data


RMSE at 60 min per person, MetaboNet


RMSE at 60 min by situation, my data


RMSE at 60 min by situation, MetaboNet


Share of lows caught by horizon, my data


Share of lows caught by horizon, MetaboNet


Low detection MCC by model and horizon, my data


Low detection MCC by model and horizon, MetaboNet


Mean error when the real value is below 70 mg/dL, my data


Mean error when the real value is below 70 mg/dL, MetaboNet


DTS error grid zone A by model and horizon, my data


DTS error grid zone A by model and horizon, MetaboNet


Calibration of the T1DMAI bands at 60 min, my data


Calibration of the T1DMAI bands at 60 min, MetaboNet


Example forecasts on my data


Example forecasts on MetaboNet


Clarke error grid by horizon, my data


Clarke error grid by horizon, MetaboNet


T1DMAI with LoRA on and off, my data


T1DMAI with LoRA on and off, MetaboNet


Accuracy against CPU time per forecast


| Model | Parameter count | Microseconds per forecast | History used |
| --- | --- | --- | --- |
| Persistence | 0 | 0.0042 | 5 min |
| Linear extrapolation | 0 | 0.033 | 30 min |
| AR (ridge) | 648 | 0.13 | 2 h |
| SARIMAX | 8,088 | 0.21 | 8 h |
| ARIMA | 4,632 | 0.27 | 4 h |
| ARX (ridge) | 1,116 | 0.36 | 6 h |
| Kalman filter | 864 | 0.48 | 3 h |
| SVR | 69,772 | 4.2 | 6 h |
| Sparse GP | 66,134 | 6.1 | 6 h |
| N-HiTS | 417,772 | 6.5 | 6 h |
| LSTM | 103,192 | 33 | 2 h |
| GluNet | 65,368 | 71 | 4 h |
| PatchTST | 182,266 | 74 | 6 h |
| XGBoost | 2,692,860 | 506 | 6 h |
| Chronos-Bolt tiny (fine-tuned) | 8,669,901 | 1,346 | 24 h |
| Chronos-Bolt tiny (zero-shot) | 8,669,901 | 1,361 | 24 h |
| Chronos-Bolt mini (zero-shot) | 21,256,141 | 3,871 | 24 h |
| Chronos-Bolt mini (fine-tuned) | 21,256,141 | 3,889 | 24 h |
| T1DMAI D16 DILATE | 31,253 | 5,679 | 168 h |
| T1DMAI D16 MSE | 31,253 | 7,342 | 168 h |

## 7. Limitations

- My data is N=1 over 35 days.
- The test sets
0xdeadf1sh64
🟧 echo.github ⭐The repository README describes T1DMAI as a model zoo for blood-glucose forecasters trained and tested on the author's own data. It says: “I0xdeadf1sh——

Interpretation history

Decision trace