blood sugar prediction

From Simulated Data to Real World: Predicting Blood Sugar with 31K Parameters

A model with just 31,251 parameters, 16 layers, one attention head per layer, trained only on synthetic data, yet able to predict real-world blood glucose for two hours ahead.

4 min readMachine Learning
From Simulated Data to Real World: Predicting Blood Sugar with 31K Parameters
I have trained a model to predict my blood sugar (Part 2) [P]

A 31,251-parameter transformer trained entirely on synthetic data is predicting real-world blood sugar with zero-shot accuracy across three different CGM sensors. That is not a headline we expected to write, but it is the one we are paying closest attention to. For anyone who manages Type 1 diabetes, or who builds tools for those who do, this work from developer 0xdeadf1sh represents a practical shift in what small, efficient models can accomplish when they are trained on the right simulated environments rather than on mountains of messy human data.

The model is an encoder-only transformer with 16 layers, a single attention head per layer, and a hidden dimension of just 16. It was trained in under 60 minutes on an Nvidia DGX Spark using outputs from a T1DM patient simulator, then tested on real continuous glucose monitor (CGM) traces from three different sensors: Libre 3 Plus, Anytime CT5, and Linx. No LoRA adapters were attached during testing. The base model had never seen those blood glucose readings. Yet it predicted the next two hours of glucose levels, and could run autoregressively for eight-hour nocturnal forecasts. The entire testing pipeline ran on an Android app using ExecuTorch. That is not a lab demo. That is a deployable, on-device inference pipeline that fits in a pocket.

What matters most here is the counterfactual reasoning capability baked into the training. The model was not just taught to mimic patterns from synthetic data. It was taught to simulate what *would* happen if conditions changed, a fundamentally different skill from pattern matching. That is the difference between a model that predicts your next reading and one that could eventually help you decide what to do about it. The synthetic-to-real transfer worked because the simulator was built to produce biologically plausible traces, not generic curves. Compare this to the approach taken in Explore X's rebuilt Android app, designed for a smoother experience, where the focus is on interface fluidity rather than underlying intelligence. That rebuild serves a purpose, but it is a different kind of improvement. Here, the improvement is in the model's ability to generalize from fabricated data to a real body with real metabolism.

The open question is whether this approach scales beyond the individual. The developer tested on their own CGM traces across three sensor brands over 30 days. That is a rigorous personal test, but it is not a clinical trial. The model's 31K parameters are absurdly small by modern standards, most large language models start at hundreds of millions, which means the architecture is efficient enough to run locally on a phone without cloud dependency. That is the concrete takeaway: a sub-60-minute training run on a single GPU produced a model that can sit on your phone, predict glucose for the next eight hours, and never send your health data to a server. The next step is to see whether that zero-shot performance holds across dozens or hundreds of other patients. If it does, the simulator becomes as important as the model itself. If it does not, the approach still teaches us that synthetic data, when built with biological fidelity, can bridge a gap we assumed required thousands of real-world examples.

From Machine Learning

This is related to my previous post where I shared an encoder-only transformer model trained on ohiot1dm + shanghait1dm + azt1d datasets. This time I trained the model on the outputs of my T1DM patient simulator and then measured its zero-shot performance on my real-world blood glucose traces.

Read the original at Machine Learning