Yes—an LSTM can be trained to predict a threshold-defined low-glucose event before it occurs, and a Transformer can forecast future CGM values. But “anomaly predictor” is not a single task: forecasting a number, predicting a low-glucose event, and flagging an unusual pattern require different targets and evaluation. The published results below are research findings, not evidence that a prototype is a clinical alarm or treatment guide.
First decide what the predictor should predict
Before building a model, define what counts as an “anomaly,” how far ahead it should look, and what output it must return. A glucose forecast and a hypoglycemia alert are not interchangeable.
As an Amazon Associate I earn from qualifying purchases.
| Task | Target to define | Useful evaluation |
|---|---|---|
| Glucose forecasting | A future glucose value at a specified horizon, such as 30 minutes or one hour. | MAE or RMSE at each horizon, with results also broken out by glucose range. |
| Threshold-event prediction | Whether glucose will cross a defined threshold within a specified time window. For example, the cited LSTM study defined mild hypoglycemia as 54–70 mg/dL and severe hypoglycemia as below 54 mg/dL within 30 minutes. | Sensitivity or recall, specificity, precision, and false alarms at a stated decision threshold. |
| Anomaly scoring | A score for a pattern the model regards as unusual. The score needs an explicit definition and a validation set of representative patterns. | Measures appropriate to the labelled anomaly task; a low forecast error alone does not establish that clinically meaningful anomalies are detected. |
For a first prototype, choose one primary task. If the goal is an early warning, a threshold-event classifier gives a direct yes/no target; if the goal is to estimate the glucose trajectory, use regression. You can build both, but assess each against its own target rather than calling any forecast deviation an anomaly.
Recommended Free Tools
What published CGM models show—and what they do not
LSTM: a 30-minute hypoglycemia target
Shao and colleagues’ 2024 study used CGM data from 192 Chinese participants to develop an LSTM and a separate US cohort of 427 participants for validation. Its target was mild or severe hypoglycemia within a 30-minute prediction horizon. The inputs included 72 CGM readings covering six hours, along with age, gender, diabetes type, and HbA1c. The authors reported AUC above 97% for mild hypoglycemia in the primary data and above 93% in validation subgroups. These figures describe that study’s model and cohorts; they are not a performance guarantee for another implementation. Read the JMIR Medical Informatics study.
#1 Best Overall
- HSA/FSA eligible. No prescription needed.
- 24/7 GLUCOSE TRACKING. See your glucose response to food, exercise, sleep, and other lifestyle factors via the Lingo app.
- OPTIMIZE YOUR NUTRITION. Discover which foods work for you and those that don't. The Lingo app shows you how specific meals and other factors impact your glucose, so you can learn from your insights and build healthier habits
- NAVIGATE PREDIABETES WITH A NEW VIEW OF YOU. More time in healthy glucose range is linked to lower diabetes risk. Three out of four users with prediabetes say Lingo was effective in helping to achieve their health goals¹.
- HEALTHY GLUCOSE SUPPORTS HEART HEALTH. What you eat matters to your glucose and your heart. Keeping your glucose in a healthy range (70–140 mg/dL) more often can help protect your heart from heart disease²⁻⁴.
An AUC does not say how many false alarms a particular deployed threshold would produce. The study also represents one CGM manufacturer, and its authors identify further validation—including on CGM data without missing values—as needed. Do not generalize its result to every sensor, population, data-quality condition, or operating threshold.
Transformer: forecasting values at multiple horizons
The 2026 CGM-LSM study describes a decoder-only Transformer pretrained on more than 15 million CGM records from 592 people with diabetes and evaluated on OhioT1DM. It reports the following rMSE values on that dataset:
| Forecast horizon | CGM-LSM rMSE | LSTM baseline rMSE | Vanilla Transformer baseline rMSE |
|---|---|---|---|
| 30 minutes | 9.02 mg/dL | 36.022 mg/dL | 27.886 mg/dL |
| 1 hour | 15.90 mg/dL | 37.17 mg/dL | 30.869 mg/dL |
| 2 hours | 26.88 mg/dL | 38.703 mg/dL | 36.653 mg/dL |
The paper reports CGM-LSM’s one-hour rMSE as 48.51% lower than its vanilla Transformer baseline. This is a comparison within the paper’s OhioT1DM benchmark setup, not a universal ranking of architectures or a promise for a new model. The authors also report higher errors in low-glucose (<70 mg/dL) and high-glucose (>250 mg/dL) ranges, particularly at longer horizons; a good aggregate score can therefore conceal weaker performance where accuracy matters most. Read the CGM-LSM paper.
Rank #2
- HSA/FSA eligible. No prescription needed.
- 24/7 GLUCOSE TRACKING. See your glucose response to food, exercise, sleep, and other lifestyle factors via the Lingo app.
- OPTIMIZE YOUR NUTRITION. Discover which foods work for you and those that don't. The Lingo app shows you how specific meals and other factors impact your glucose, so you can learn from your insights and build healthier habits.
- NAVIGATE PREDIABETES WITH A NEW VIEW OF YOU. More time in healthy glucose range is linked to lower diabetes risk. Three out of four users with prediabetes say Lingo was effective in helping to achieve their health goals¹.
- HEALTHY GLUCOSE SUPPORTS HEART HEALTH. What you eat matters to your glucose and your heart. Keeping your glucose in a healthy range (70–140 mg/dL) more often can help protect your heart from heart disease²⁻⁴.
Other work is context, not proof of free-living performance
The 2023 “Glucose Transformer” paper describes forecasting glucose levels and hypo- and hyperglycemia events using one week of inpatient CGM data from people with type 2 diabetes. Its inpatient population and limited collection window make it an example of the approach, not direct evidence that it generalizes to people living freely with diabetes. See the paper record.
A 2026 medRxiv preprint describes a residual-gated multimodal Transformer using CGM data and sparse meal logs, with chronological within-person testing and participant-level cross-validation for horizons up to two hours. Because it is a preprint, treat it as preliminary evidence rather than independent clinical validation. Read version 2 of the preprint.
Build the prototype around a leakage-resistant test
Overlapping windows from one person can be very similar. If windows are randomly assigned to training and test sets, the model may effectively see that person in both and appear to generalize better than it does to unseen people or future periods. GlucoBench describes chronological splits and a held-out-subject evaluation, and curates public CGM datasets for forecasting benchmarks. See GlucoBench.
Rank #3
- ✅ For people NOT using insulin, ages 18 years and older
- ❌ Don’t use if: On insulin, on dialysis, if you have problematic hypoglycemia, are modifying medication without HCP consultation, or if you have a history of eating disorders
- YOUR SUCCESS, OUR COMMITMENT: Should you experience an issue with your biosensor before its 15-day wear is up,[2] we’ll replace it for free. [3]
- POWERFUL FEATURES: Get AI-powered coaching, plus discover in-app nutrition & glucose insights, advanced meal and activity logging, trend summaries and deep dives, pattern insights and much more—plus, effortlessly sync your data with Apple Health, Google Health Connect, and Oura.
- PRODUCT SUPPORT: Provided by Stelo through SteloBot, which can be accessed via the Stelo app by going to Settings > Contact. SteloBot virtual support assistant is available 24/7, and live agent support available during regular business hours.
- Choose the target and horizon. State whether the output is a glucose value or a threshold event, define the event boundaries if relevant, and choose the forecast horizon or event window before creating examples.
- Inspect and regularize the time series. Record sensor cadence, missing readings, and any covariates. GlucoBench describes regularizing sequences, interpolating short gaps, and splitting sequences when gaps exceed dataset-specific thresholds. Do not silently treat long gaps as ordinary observations; document the chosen handling rule.
- Split participants and time periods before making windows. Keep a chronological future segment for testing known participants. If the intended use includes new users, also reserve participants entirely for a held-out-subject test. Only then generate overlapping training, validation, and test windows within their assigned partitions.
- Fit preprocessing on training data only. Estimate scaling or normalization parameters from the training partition, then apply those same parameters to validation and test data. This prevents information from evaluation periods from influencing training.
- Train a simple baseline first. Compare a basic persistence forecast or another clearly specified simple predictor with an LSTM and a Transformer. Use the same participants, splits, lookback window, forecast horizons, covariates, and target definition for each model.
- Evaluate by horizon and subgroup. For forecasts, calculate MAE or RMSE separately for every horizon and glucose range. For event predictions, report sensitivity, specificity, precision, and false alarms at a chosen threshold; show how the operating point changes those measures.
These steps answer two distinct questions: whether the model predicts later periods for people it has already seen, and whether it transfers to participants it has never seen. If deployment would involve either situation, report that evaluation rather than relying on a single randomly split score.
Choose an LSTM or Transformer for a fair comparison
Both architectures can model ordered CGM observations. An LSTM processes a sequence recurrently; a Transformer uses attention over sequence representations. That distinction does not establish a general winner: the cited papers differ in targets, data, and benchmark setups. Compare implementations under matched conditions, and describe compute cost or interpretability only if you measured them in your own project.
A practical LSTM experiment
Represent each training example as a lookback sequence plus any permitted participant-level covariates. The Shao et al. study’s six-hour input of 72 CGM readings and demographic and clinical covariates is a published example, not a universal window specification. For regression, train the output to estimate glucose at each selected future horizon. For event prediction, train a classifier against the event label defined for the chosen threshold and horizon.
Rank #4
- The information below is per-pack only
- HSA/FSA eligible. No prescription needed.
- 24/7 GLUCOSE TRACKING. See your glucose response to food, exercise, sleep, and other lifestyle factors via the Lingo app.
- OPTIMIZE YOUR NUTRITION. Discover which foods work for you and those that don't. The Lingo app shows you how specific meals and other factors impact your glucose, so you can learn from your insights and build healthier habits
- NAVIGATE PREDIABETES WITH A NEW VIEW OF YOU. More time in healthy glucose range is linked to lower diabetes risk. Three out of four users with prediabetes say Lingo was effective in helping to achieve their health goals¹.
A practical Transformer experiment
Use the same input windows, covariates, targets, and data partitions as the LSTM. A decoder-only design is one demonstrated option in CGM-LSM, but reproducing its reported performance would require matching the paper’s data and benchmark setup; architecture name alone is not enough to reproduce a result. If you add meal logs or other modalities, compare against a CGM-only version to determine whether the extra inputs help under the same evaluation.
Interpret results without hiding the failure modes
- Separate average accuracy from extreme-range accuracy. Report errors for low, in-range, and high glucose where the dataset supports those groups. CGM-LSM reports worse error in the low and high ranges than aggregate results suggest.
- Show the alert trade-off. For event classification, a threshold that raises sensitivity may also increase false alarms. Report both at the selected threshold and show how they change as the threshold moves; AUC by itself does not specify that burden.
- Distinguish people from time periods. State whether a score comes from future periods of known participants, held-out participants, or both. These tests answer different generalization questions.
- Document data conditions. Describe sensor source, participant population, missingness handling, input variables, and forecast horizon. A result established on one device or cohort should not be presented as device-independent.
- Keep task claims narrow. A model that predicts a threshold event has not thereby become a general detector of every clinically important abnormal pattern.
Keep a research prototype separate from care
Published prediction results do not validate a newly built model for patient care. A research prototype can be useful for comparing forecasting methods, testing data pipelines, or studying a defined prediction task; it should not be presented as a clinical alarm or used to recommend treatment. Clinical use would require appropriate validation beyond a benchmark result, including evidence for the intended population, sensor and operating conditions.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




