kron-ppg-age
A streaming age estimator from raw PPG (photoplethysmography), small enough to run on a phone or a watch. It has 5.85M parameters and the ONNX graph is 24 MB. A causal KronLSTM encoder reads the PPG in 0.2 s patches at 25 Hz and carries its memory from one chunk to the next. An age head reads the running mean of its hidden states, so a device can report an age at any moment of a recording.
Code, training recipe and the full report: github.com/antonkulaga/kron-fm
(src/kron_ppg, and reports/PPG foundation models and aging clocks 2026.md). Data:
GlucoseDao/ppg-windows.
Results
Tested on VitalDB people held out by person: 897 surgical patients, finger PPG at 25 Hz, ages from childhood to 94. The model predicts one age per person by averaging its 30 s windows.
| Test MAE (years) | r | |
|---|---|---|
| this model (seed 0) | 6.38 | 0.84 |
| same recipe, seeds 0–2 | 6.41 ± 0.03 | 0.84 |
| predicting the median age | 11.74 | – |
| the same architecture trained from scratch | 7.76 | – |
Read these limits before using it:
- It estimates chronological age; it is not a health measure. The gap between predicted and true age does not separate people with hypertension, diabetes or ASA ≥ 3 from those without (AUC 0.49–0.56, every 95% interval containing 0.5). That held in every run, including a clock trained on healthy people only.
- It was trained on finger PPG from surgical patients. On BIDMC ICU patients it did no better than the median age. On wrist PPG it needs calibration per device and people; expect several years of offset without it.
- The error is per person over many windows. A single 30 s window is much noisier.
How it was trained
- Pretraining: 160k steps of self-supervised training on 30 s windows from VitalDB and GalaxyPPG. It predicts the next 1 s of the signal, plus a contrast between two windows of the same person. 4,086 people were used for training.
- Age head: a small MLP on the frozen encoder's mean hidden state, trained on 4,071 VitalDB people with ages (mean 57.5, sd 14.8). The best step was chosen on 912 validation people.
Files
| File | What it is |
|---|---|
onnx/stream.onnx | the streaming graph: 5 s of samples in, age so far out, recurrent state carried by the caller |
onnx/stream.json | the graph's inputs, outputs, state shapes and the PyTorch parity check (max difference 8e-6 years) |
model.pt | PyTorch weights: encoder, head, config, bias (load with kron_ppg.train.load_clock) |
config.json | architecture, training settings and the test scores |
Using the ONNX graph
The input must be prepared exactly as the model was trained on it:
- band-pass the raw PPG at 0.5–8 Hz;
- resample it to 25 Hz;
- robust-scale each 30 s window: subtract the median and divide by IQR / 1.349.
Then feed it in 5 s chunks: samples of shape (batch, 125), plus valid, a boolean (batch, 25) marking which
0.2 s patches are real signal. Start with zero
pool_sum, pool_count and states, and pass each *_next output back as the next call's input. age is the
estimate over everything read so far. The bias correction in config.json (a + b * age) is for computing an
age gap when the true age is known. It is not applied to age.
import json, numpy as np, onnxruntime as ort
meta = json.load(open("onnx/stream.json"))
sess = ort.InferenceSession("onnx/stream.onnx")
feeds = {i.name: np.zeros([1 if isinstance(d, str) else d for d in i.shape],
np.bool_ if i.type == "tensor(bool)" else np.float32)
for i in sess.get_inputs()}
def step(chunk): # chunk: 125 scaled samples at 25 Hz
feeds["samples"] = chunk[None].astype(np.float32)
feeds["valid"] = np.ones((1, 25), np.bool_)
out = dict(zip([o.name for o in sess.get_outputs()], sess.run(None, feeds)))
for k, v in out.items():
if k.endswith("_next"):
feeds[k[:-5]] = v
return float(out["age"][0])
Data
The training data come from VitalDB (CC BY 4.0) and GalaxyPPG (CC BY 4.0). The dataset card lists their citations and the changes made.