1. Install
  2. Example
  3. 3 Your data
Demo · Linear probe · ~5 min runtime

End-to-end
example.

This demo illustrates the data formats, core functions, and results for using the smb-v1-1.7b model. The Python script loads MIMIC-IV demo data in MEDS format, extracts patient-representative embeddings using the Standard Model, and trains four linear classifiers on those embeddings to predict clinical outcomes.

Data files

Two parquet files.
One patient view.

Two parquet files are used in the demo:

  1. 1. An events table in MEDS (Medical Event Data Standard) format (one row per clinical event) used to create embeddings, and
  2. 2. A labels table (one row per patient with task targets) used to record the clinical outcomes for the classifiers.

This example contains a brief preview of each data file included in the demo, focused on the columns the model and classifiers use. We then describe how the demo script deploys the model to extract embeddings and provide clinical outcome predictions.

This example uses the MIMIC-IV Clinical Database Demo (a reduced, publicly available subset for teaching and development — not the full MIMIC-IV database) in MEDS format.

§ 01 · Events data

Events data

MEDS event stream

The events file is a long table of timestamped clinical events (e.g. diagnoses, medications, labs). Although the MIMIC-IV Clinical Database Demo parquet file contains other columns, prep_mimic_demo_data.py reshapes it to focus only on the columns listed below for this demo. The final demo parquet file contains ~916K rows for 100 subjects.

Events data preview — example rowsScroll →

subject_idtimecodetablevalue
100000322022-01-15 08:00:00ICD10:I10condition
100000322022-01-15 09:30:00LOINC:2093-3lab145.2
100012172022-02-01 14:00:00RxNorm:861004medication

Columns used

ColumnDescription
subject_idPatient identifier; links events table to the labels table by patient.
timeWhen the event occurred (used for ordering events and censoring them from the model).
codeClinical code (e.g. ICD10:, RxNorm:, LOINC:); the primary categorical descriptor of the measurement.
tableModality of the row's event data: condition, medication, lab, or procedure (used by the model's text serialization).
valueOptional numeric value (e.g. lab result); may be null.

The table column is derived from the code column in this demo, using prep_mimic_demo_data.py.

More information about these and other columns in the MEDS format schemas can be found here. A collection of ETLs from common data formats, including OMOP, MIMIC-IV, and MEDS Unsorted can be found here.

§ 02 · Labels data

Labels data

One row per subject

The labels file contains columns recording the clinical outcomes for the four demo tasks we will predict, per subject. This is used for training the classifiers and evaluating test prediction metrics.

Outcome labels and prediction_time in this demo are artificially generated (see data/README.md for methodology); they are not directly derived from events data and are for demonstration purposes only.

In a real use case, outcome labels should be directly derived from an events dataset, and prediction_time should be set as the timestamp strictly before the event that defines the label.

Preview — example rowsScroll →

subject_id prediction_time readmission phenotype survival_mo observed
100000322022-06-15 12:00:000068.11
100012172022-06-15 12:00:000245.81
100024282022-06-15 12:00:001135.51

Columns used

ColumnDescription
subject_idMust match the events table order; one row per patient.
prediction_timeAs-of time for the prediction (inclusive endpoint of data used). The model uses this time as the cutoff when considering events to build embeddings.
readmission_riskBinary (0/1) for Task A, a classifier to predict subject readmission to the hospital.
phenotype_classInteger (e.g. 0–3) for Task B, a phenotype classifier to predict cancer staging progression.
overall_survival_monthsNumeric; for Task C (regression — months survival for subjects who died) and Task D (Cox survival prediction).
event_observed1 if the outcome of death was observed; used in Task D.
§ 03 · via agent

Run the demo with
an AI agent.

Copy and paste the prompt into your coding assistant of choice (Claude Code, Codex, Gemini). Runtime from prompt through model download, inference, and classifier train/test should take ~5 minutes.

Claude Code Codex Gemini CLI
Prompt

Use the Standard Model Biomedicine docs here (https://docs.standardmodel.bio) and the quickstart repo here (https://github.com/standardmodelbio/quickstart) to install the model with the provided one-line command, then run demo.py. Tell me about the outputs.

§ 04 · manual

Or run it
manually.

Running demo.py loads both pre-configured data files from the quickstart repo (main branch) into memory, then performs two stages:

Stage 1

Events Embeddings

For each patient, the script serializes that patient's events (using subject_id, time, code, table, value) into a token stream with smb_utils up to prediction_time from the labels file. It then runs the Standard Model and takes the last-token hidden state as the patient embedding.

Stage 2

Embeddings + Labels Metrics

After extracting embeddings, demo.py trains four separate task heads on an 80/20 train/test split. ROC-AUC, accuracy, MAE, and C-Index are reported.

Four clinical task heads

A

Binary classification

Readmission risk

Will the patient be readmitted?

→ ROC-AUC
B

Multiclass classification

Phenotype stage

Cancer staging progression class.

→ Accuracy
C

Regression

Overall survival

Continuous months until death.

→ MAE
D

Survival analysis

Cox proportional hazards

Time-to-event with censoring.

→ C-Index

If you ran the quickstart model installation, you can run the demo with:

bash
cd quickstart
uv run python demo.py

You should see something like the following output:

output live
[1/4] Loading MIMIC-IV demo data from GitHub...
   -> main  (data/README.md, PhysioNet ODbL)
   -> Loaded 916166 events, 100 subjects.

[2/4] Loading Standard Model (smb-v1-1.7b)...
model.safetensors: 100%|█████████████████| 3.66G/3.66G [00:12<00:00, 287MB/s]
generation_config.json: 100%|██████████████| 127/127 [00:00<00:00, 939kB/s]

[3/4] Generating embeddings for 100 patients...
   -> Strategy: Causal Inference (Last Token Pooling)
   -> Processed 50/100 patients...
   -> Processed 100/100 patients...
   -> Inference complete.

[4/4] Training Clinical Task Heads...
   -> Split: 80 Train / 20 Test examples.

   --- Task A: Binary Classification (Readmission Risk) ---
   -> ROC-AUC: 0.xxx

   --- Task B: Multiclass Classification (Phenotype Stage) ---
   -> Accuracy: 0.xxx

   --- Task C: Regression (Overall Survival Time) ---
   -> MAE: x.xx months

   --- Task D: Survival Analysis (Cox Proportional Hazards) ---
   -> Projecting embeddings to 10D PCA for stability...
   -> C-Index: 0.xxx
Next steps

Where to go from here.

Step 03 · Coming soon

Use the model on your own data

Format your EHR data into MEDS, extract embeddings, and train custom clinical predictors on your cohort.

Step 04 · Architecture

More about the Standard Model

JEPA architecture, state prediction, fusion layers, training paradigms, and memory optimization.

Contact us

Having trouble, or just want to talk about your project?

Get in touch

Attribution: Events are from the MIMIC-IV Clinical Database Demo converted to MEDS.

van de Water et al. (2025). MIMIC-IV demo data in the Medical Event Data Standard (MEDS) (version 0.0.1). PhysioNet. RRID:SCR_007345.

Licensed under the Open Database License (ODbL). Redistribution must be under ODbL (share-alike); do not apply technical measures that restrict reuse. Predictive task labels are artificially generated.