Show HN: I have trained a model to predict my blood sugar github.com · 4 points ...
Show HN @show
Show HN: I have trained a model to predict my blood sugar github.com · 4 points · 2 comments · HN thread
TL;DR A Show HN post from a person with type 1 diabetes who trained a 31,253-parameter encoder-only transformer on about one million synthetic simulated CGM traces, then fine-tuned it with a LoRA adapter on 80 days of their own data (35 held out for testing). The repo benchmarks it against classical, deep, and foundation-model forecasters on the author's data and on the public MetaboNet dataset, reporting it as competitive but not best overall, with the author noting it is still worse than them at predicting hypoglycemia in the next 30 minutes. The project is explicitly research-only and not a medical device.
- Model is a 16-layer, width-16 transformer with one attention head and about 31k parameters, pretrained on 1M simulated people (7 days each) and outputting 7 quantiles for the next 2 hours in 5-minute steps.
- Inputs are CGM in a risk-scaled space plus insulin and carb action curves; insulin is exact, while carbs and glycemic index are the author's estimates.
- On the author's own data, the LoRA-adapted D16 DILATE model ranks 3rd of 26 at 60-minute error (RMSE 22.8 vs 22.2 for XGBoost), and catches 40-47% of lows at 60 minutes versus 29% for XGBoost.
- On MetaboNet it ranks 9th overall (34.6 at 60 minutes) but has the lowest RMSE at 90 minutes, and nearly all models, including this one, miss almost all lows there.
- The author stresses that the test sets differ in range and variability, that their data is a single person over 35 days, and that the comparison to published paper scores is not like-for-like.
- The model is slower on CPU than most classical baselines (about 5.7 ms per forecast versus 0.5 ms for XGBoost's 506 µs), and the code was largely written by AI, as the README states.
Discussion The thread is short, with only two comments. The top comment is a personal anecdote from a commenter who built a blood sugar and blood pressure tracking site for a relative a decade ago, praising the project and expressing optimism about the future of such tools. The author replies that the models are weaker than them at predicting hypoglycemia but better at predicting hyperglycemia, speculates that they may unconsciously sense falling glucose, and links a paper on neurons that detect falling blood sugar. The mood is warm and appreciative rather than critical.
- Impressed by the project and optimistic about AI for diabetes care (some): The commenter who built a diabetes tracking site for a relative calls the work far beyond their own effort and says it makes them optimistic about where such tools are heading.
- Models underperform the author on hypoglycemia prediction (a few): The author notes that all models predict hypos much worse than hypers and suggests they may have access to unconscious signals, citing research on glucose-sensing neurons.
Links from the comments
#diabetes #timeSeriesForecasting #transformers #glucoseMonitoring #syntheticData #showHN