Open-Source Transformer Predicts Blood Glucose Levels

Research Architecture

TL;DR: A developer released an encoder-only transformer that forecasts blood glucose up to 2 hours ahead, with uncertainty bands, under an MIT license.

Summary: The model consumes past glucose, carbs, and insulin along with announced future carbs and insulin to predict blood glucose for the next 2 hours, using BERT-style bidirectional attention with masked future values. It is trained with DILATE loss for the median and pinball loss for uncertainty bands, with sizes up to 17M parameters. Pretraining took about 48 hours, while finetuning took under 10 minutes.

Why it matters: This is a concrete example of applying transformer architectures to personalized time-series forecasting with conditional future inputs. AI builders can study the repo for techniques like mixed loss functions and risk-space reparameterization to apply to other forecasting tasks.

Source: reddit