timmers's picture
Upload README.md with huggingface_hub
2d8f7db verified
---
license: cc-by-nc-4.0
language: [pt, en]
tags:
- rare-disease
- patient-trajectory
- benchmark
- disease-progression
- brazilian-sus
- datasus
- world-model
- time-to-event
pretty_name: RareBench-BR Trajectory v2
task_categories:
- time-series-forecasting
- tabular-classification
size_categories:
- 100K<n<1M
---
# RareBench-BR Trajectory v2 (RBT-v2)
> **The first rare-disease patient-trajectory benchmark designed to be
> autocorrelation-immune.** Built from 44,051 real CNS-linked Brazilian SUS
> (DATASUS) rare-disease treatment trajectories. Five tasks, balanced/stratified
> splits, geographic-external test, strong count-based baselines, full datasheet.
**Authors:** Raras AI · **License:** CC-BY-NC 4.0 · **Contact:** dimas@raras.ai
**Companion architecture:** [Raras-AI/gemeo-arch](https://huggingface.co/Raras-AI/gemeo-arch)
## Why this benchmark exists
Patient-trajectory prediction on EHR data is dominated by **event autocorrelation**:
in a rare-disease orphan-drug trajectory, ~82% of events are repeats of the same
monthly dispensing code. A model that just copies the patient's last code scores
near-perfectly on naive next-event tasks — the documented "repeated event tokens
inflate metrics" pitfall (RAVEN, arXiv 2603.24562). There was **no public
rare-disease trajectory benchmark**, and our own first attempt (an L6 next-event
track) was 99.5% one class — trivially won by "always repeat".
RBT-v2 is built so that **a repeat-last baseline cannot win**: the core task
scores only *transition* points (where the trajectory actually changes), binary
tasks are balanced 50/50, and we ship the autocorrelation oracle as an explicit
baseline so you can see it fail.
## The five tasks
| Task | Definition | Metric | Why it's hard |
|---|---|---|---|
| **T1 — Next-proc @ transition** | Given a prefix, predict the next procedure code *at a point where the trajectory changes* (switch / gap-resumption) | Recall@1/5, MRR | Repeats excluded — the autocorrelation oracle scores only 12.4% |
| **T2 — Will-change** | Will the next event be a change vs a continuation? (balanced 50/50) | Balanced acc, AUROC | Majority baseline = 50.0% by construction |
| **T3 — New-onset** | Predict the *first* occurrence of a procedure the patient has never had | Recall@1/5 | First-occurrences only (RAVEN-style) |
| **T4 — Discontinuation** | Will the patient discontinue therapy (>6-mo gap) within follow-up? (balanced) | Balanced acc, AUROC | Treatment dropout — clinically critical; majority = 50.0% |
| **T5 — Time-to-transition** | Months until the next treatment change (right-censored) | C-index, Brier | Genuine time-to-event / world-model capability |
## Baselines (the bar to beat)
Computed on `train`, evaluated on `test` (95% bootstrap CI). **Count-based
baselines are strong** (per arXiv 2511.00782) — beating the bigram is the real bar.
| Task | Baseline | test |
|---|---|---|
| **T1** | frequency Top-1 | 26.9% [25.8, 28.0] |
| T1 | **bigram Top-1** | **64.4% [63.2, 65.6]** ← the bar |
| T1 | bigram Top-5 | 96.0% [95.5, 96.5] |
| T1 | **repeat-last (autocorrelation oracle)** | **12.4% [11.6, 13.2]** ← fails by design |
| T2 | majority / always-continue | 50.0% |
| T3 | frequency Top-1 / Top-5 | 17.5% / 57.9% |
| T4 | majority | 50.0% |
**The repeat-last oracle scoring 12.4% (not ~99%) is the proof of
autocorrelation-immunity.** A real model must beat the bigram, not just copy.
### GEMEO leads every novelty & long-context task
The flagship [`gemeo-sus`](https://huggingface.co/Raras-AI/gemeo-sus)
world model (recurrence-aware) sets the current bar — see [`LEADERBOARD.md`](./LEADERBOARD.md):
| Task | GEMEO | Strong baseline | Margin |
|---|---:|---:|---:|
| **New-onset prediction** (Top-1) | **53.7%** | 38.2% (frequency) | **+15.5 pp** |
| **T2 — will-change** (AUROC) | **0.906** | 0.889 (count-based) | +0.017 |
| **T5 — transition-within-12mo** (AUROC) | **0.827** | 0.790 (count-based) | +0.037 |
| **T4 — treatment discontinuation** (AUROC) | **0.838** | 0.696 (count-based) | **+0.142** |
The world model's learned representation pulls clearly ahead on the context-rich
tasks that matter most in rare disease. For single-step Markov transitions (T1),
the count-based bigram remains near-optimal — the expected task-dependent split
(arXiv 2511.00782).
## Data provenance & ethics
- **Source:** DATASUS APAC-SIA (high-complexity outpatient, orphan-drug authorizations), CNS-hash linked. 7 Brazilian states, 2017–2021.
- **Cohort:** 44,051 patients with ≥5 treatment events; 11 rare diseases (Gaucher, MPS I/II, SMA, DMD, CF, Wilson, Friedreich, Marfan, NF1, Rett, …); 33 distinct SIGTAP procedure codes.
- **De-identification:** ages bucketed, UF only (no município), CNS hashed, k-anonymity ≥ 5.
- **Ethics:** Brazilian Res. CNS 466/2012 + 510/2016; LGPD-compliant.
- **Splits:** patient-level 70/15/15 (train/val/test) on the 5 largest UFs + a **geographic-external** test on the remaining states (external validity / equity probe; note ext_test is small, n≈22 patients — interpret as a probe, not a powered test).
## Files
```
tasks/
├── T1_next_proc_transition.{train,val,test,ext_test}.jsonl
├── T2_will_change.{...}.jsonl (balanced 50/50)
├── T3_new_onset.{...}.jsonl
├── T4_discontinuation.{...}.jsonl (balanced 50/50)
└── T5_time_to_transition.{...}.jsonl
baselines.json # all baseline numbers + bootstrap CI
stats.json # cohort + vocab statistics
DATASHEET.md # full datasheet-for-datasets
```
Each case: `{case_id, split, orpha, sex, uf, prefix_procs:[...], target:..., ...}`.
## How to evaluate your model
1. Train on `*.train.jsonl` (+ `*.val.jsonl`).
2. Predict on `*.test.jsonl` (and `*.ext_test.jsonl` for external validity).
3. Report the metric in the table above with bootstrap 95% CI.
4. **You must report the repeat-last and bigram baselines** alongside your model — a result that doesn't beat the bigram on T1 is not a positive result.
## Citation
```bibtex
@misc{rarebench_br_trajectory_v2_2026,
title = {RareBench-BR Trajectory v2: An Autocorrelation-Immune
Rare-Disease Patient-Trajectory Benchmark from Brazilian SUS},
author = {Timmers, Dimas and the Raras AI team},
year = {2026},
url = {https://huggingface.co/datasets/Raras-AI/rarebench-br-trajectory},
note = {First public rare-disease trajectory benchmark. CC-BY-NC 4.0.}
}
```
⚠️ Research only. Not a medical device. Derived from de-identified aggregate SUS data.