Skip to main content
Two parquet files are used in the demo:
  1. an events table in MEDS (Medical Event Data Standard) format (one row per clinical event) used to create embeddings, and
  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 give a description of 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.

1. 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 those listed below for this demo. The final demo parquet file contains ~916k rows for 100 subjects. Events Data Preview (example rows):
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 (e.g., the performed laboratory test or recorded diagnosis).
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.
Note that 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.

2. 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 will be 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 rows):
subject_idprediction_timereadmission_riskphenotype_classoverall_survival_monthsevent_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, a regression model to predict months survival for subjects who died, and Task D, a Cox survival prediction.
event_observed1 if the outcome of death was observed; used in Task D.

Running the demo via AI coding agent

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

Install the model, download the dummy data, and run the demo.

CursorOpen in Cursor

Running the demo manually

Runningdemo.py loads both pre-configured data files from the quickstart repo (main branch) into memory, then:
  1. Events → Embeddings: For each patient, it serializes that patient’s events (using subject_id, time, code, table, valuefrom the events data) into a token stream with smb_utils up to prediction_time from the labels file. The script then runs the Standard Model, and takes the last-token hidden state as the patient embedding.
  2. Embeddings + Labels → Predictive Task Performance Metrics: After extracting embeddings, demo.py trains four separate task heads designed to predict A) binary hospital readmission, B) multiclass classification of cancer staging, C) continuous survival regression in months, and D) Cox survival. Each predictive output layer is trained on an 80/20 train/test split of the embeddings and labels. ROC-AUC, accuracy, mean absolute error, and C-index are provided for each of these tasks, respectively.
If you ran the quickstart model installation, you can run the demo with:
cd quickstart
uv run python demo.py
You should see something like the following output:
[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

Use the model on your own data

Learn more about the Standard Model

Contact Us

Having trouble, or just want to talk about your project? Send an email to erik@standardmodel.bio
Attribution: Events are from the MIMIC-IV Clinical Database Demo converted to MEDSvan 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.