Instructions to use kotlarmilos/gemma-4-e4b-glucolens-rollout with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use kotlarmilos/gemma-4-e4b-glucolens-rollout with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-e4b-it") model = PeftModel.from_pretrained(base_model, "kotlarmilos/gemma-4-e4b-glucolens-rollout") - Notebooks
- Google Colab
- Kaggle
gemma-4-e4b-glucolens-rollout
LoRA adapter on top of google/gemma-4-e4b-it that returns a strict JSON 6-hour glucose projection (12 trajectory points, 3 ranked drivers, interpretation, history grounding, overall confidence) for a given meal and CGM context.
Submission for The Gemma 4 Good Hackathon, Health track, May 2026.
Full documentation, training procedure, eval methodology, schema, demo, and limitations: https://github.com/kotlarmilos/gemma4-glucolens
Quick start
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE = "google/gemma-4-e4b-it"
ADAPTER = "kotlarmilos/gemma-4-e4b-glucolens-rollout"
tok = AutoTokenizer.from_pretrained(BASE)
base = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, ADAPTER)
See demo.ipynb for the prompt template and five worked scenarios.
Headline numbers
n=50 in-distribution test + 50 OOD, greedy decode. Full table and methodology in the repo.
| Metric | Base zero-shot | Fine-tuned |
|---|---|---|
| Trajectory MAE (mg/dL) | 19.9 | 6.9 |
| Peak timing error (min) | 6.6 | 1.2 |
| OOD refusal rate | 0.00 | 1.00 |
Two known failures (calibration ECE 0.30, counterfactual consistency 0.00) are documented in the repo README, Section 6.
Training data
Synthetic only, ~15k rollouts from kotlarmilos/glucolens-rollout-triples. Generated by src/sim.py (simglucose + Bergman ODE fallback). No real patient data.
Not a medical device
Research code. No diagnosis, treatment, or insulin guidance. Aimed at non-diabetic and pre-diabetic metabolic awareness only.
License
Apache 2.0 for adapter weights and config. Base model governed by the Gemma usage policy.
Citation
@misc{kotlar2026glucolens,
author = {Milos Kotlar},
title = {GlucoLens: 6-hour glucose rollouts with a fine-tuned Gemma 4 E4B},
year = {2026},
howpublished = {The Gemma 4 Good Hackathon},
url = {https://github.com/kotlarmilos/gemma4-glucolens}
}
- Downloads last month
- 1