BeatLens

TIMENET HACKATHON 2026

Where did the
T wave peak?

Follow one ECG beat from a supplied R peak to a model estimate. Then see which parts of the signal moved the prediction.

QT DATABASE · SELE0111 · BEAT 11

One beat, two leads

Saved model output

Choose a saved model, switch chart views, and move the time slider to inspect a point. Every model sees the same ECG beat, so the manual annotation stays fixed.

R anchor0 ms
Predicted T peak—
Annotated T peak—
Timing error · this beat—

Loading saved ECG example…

Milliseconds relative to the supplied R peak

What do the quality checks mean?

LIME weighted R² measures how closely its local approximation matches the model under the tested perturbations. The IG completeness residual checks whether the summed contributions account for the difference between the two predictions. Both checks concern the explanation. Timing accuracy comes from comparing the prediction with the manual annotation.

Why can one beat show a 0.05 ms error?

The ECG was sampled at 250 Hz, or once every 4 ms. The timing readout outputs a continuous number, which can land between samples. A tiny difference on one beat does not establish sub-millisecond precision. See cohort results for typical performance.

HOW WE GOT HERE

From annotated ECGs to a timing readout

Prepare the task in TimeNet

The local QTDB connector prototype loaded 105 records and 14,750 annotated landmark-localization tasks. T-peak experiments use a narrower task: estimate the time from a supplied R anchor to one annotated T peak. Lead D3 and lead V4 are two views of the same sampled beat.

Connector and validation notes
Fine-tune and swap the input

We used LoRA to fine-tune OpenTSLM on Nebius to generate a sample index. In the matched repeat, mean absolute error was 64.5 ms with the original ECGs and 64.5 ms with ECGs swapped between examples. That test gave us no evidence that the generated index followed the waveform.

Train a separate numerical readout

We combined aligned raw ECG samples with features from a frozen OpenTSLM SoftPrompt waveform encoder. The interaction-kernel readout was fitted on 376 QTDB windows. Across 2,201 QTDB out-of-fold windows it reached 31.38 ms mean absolute error. Swapping the waveforms raised the error to 54.69 ms.

Check explanations against different references

The Streamlit research app computes LIME and Integrated Gradients for a separate PyTorch locator and compares zero and smoothed references. This web explorer replays saved OpenTSLM outputs using a 48 ms Gaussian-smoothed reference. Switch readouts to inspect how the estimate and attributions change on the same beat.

EXPERIMENTS

How did the models transfer?

Compare mean absolute error (MAE) and large misses on the same windows within each cohort. All windows use supplied R anchors. These development panels were evaluated repeatedly during model design.

Cross-database comparison
ModelLUDB MAEMIT-BIH MAEMIT-BIH errors >80 ms
Timing prior30.92 ms56.42 ms—
Interaction kernel18.60 ms51.54 ms453
Full product kernel17.94 ms51.93 ms443
Waveform-only ranker11.08 ms50.24 ms571
LUDB · 1,603 windows across 200 records

The interaction-kernel readout placed 88.6% of predictions within 40 ms. Compared with separate kernels, its paired MAE change was −0.92 ms (95% interval −1.26 to −0.58 ms). The waveform-only ranker had the lowest mean error in this comparison.

ECG-ID · single-lead stress test

Across 2,835 windows from 90 subjects, the interaction kernel reached 17.38 ms MAE and the full product kernel reached 16.29 ms. The interaction kernel had a slightly higher share within 40 ms (94.0% versus 93.4%).

MIT-BIH · 2,112 pilot windows across 33 records

On records 109 and 214, both OpenTSLM readouts predicted more than 80 ms early on all 48 windows with annotated T peaks after 345 ms. These two recordings were selected for failure analysis.

Read the experiment notes

Glossary

ECG and lead
An ECG records the heart’s electrical activity. Each lead is a different view of that activity. D3 and V4 are the two leads shown here.
R anchor and T peak
The supplied R-peak time is zero on every chart. The task is to locate the peak of the following T wave and compare its timing with the manual annotation.
OpenTSLM, LoRA, and timing readout
OpenTSLM is the time-series model. LoRA adapts a subset of weights and was used in the sample-index pilot. The explorer shows separately trained numerical readouts using features from the frozen pretrained encoder.
Fusion and kernel
Fusion combines encoder features and raw ECG samples. A kernel is a similarity function used by the timing regressor. The readouts differ in how they combine those similarities.
Temporal LIME and Integrated Gradients
LIME fits a simple approximation around one beat using short segments blurred in different combinations. Integrated Gradients attributes the prediction change from a smoothed reference to the original input.
MAE and errors over 80 ms
Mean absolute error averages the size of timing misses in a cohort. Errors over 80 ms count large misses. A model can have a lower average and still make more large misses.
QTDB, LUDB, ECG-ID, and MIT-BIH
QTDB supplied training and development examples. LUDB, ECG-ID, and the MIT-BIH pilot tested transfer across databases.