Age-Matched Risk Sets for Detecting Rare Deterioration in ICU Streams

Models that watch a patient's vital signs hour by hour and warn of approaching death face two problems at once. Death is rare relative to the number of monitored hours, so a model trained naively learns that "nothing ever happens." Death is also steeply concentrated by age. In one hospital cohort, inpatient mortality was 1.4% under age 65 and 30% at 65 and older (The effect of COVID-19 epidemic on vital signs in hospitalized patients). In registry-scale data, age is the single strongest predictor (One-year mortality prediction of patients with hepatitis in Kazakhstan). Put together, these produce a specific failure. A model can earn most of its score by learning "old means risky." It then never learns the physiological warning signs that would let it catch the uncommon but salvageable deterioration of a younger patient. Pooled metrics hide this failure, because the young contribute few deaths.

We propose to train streaming mortality models on age-matched risk sets, a sampling scheme borrowed from classical epidemiology. Each training example pairs one patient-hour that precedes a death with a few control patient-hours. The controls come from other patients of similar age who are still alive at the same point in their stay. The model is asked only which member of the set is the one heading toward death. Because every member of a set shares the same age, age carries no information about the answer. The model cannot use the age shortcut and must rank patients by their physiological trajectory. The same scheme fixes the event-to-background ratio at a known, small value, so there is no gradient drowning, and the ratio can be corrected for exactly. Absolute risk is recovered afterward by adding back a separately fitted age baseline. Unlike undersampling, calibration is therefore not distorted.

Core Claim

Temporal imbalance in age-stratified mortality streams is not one problem but two tangled together. One part is a base-rate problem, which can be fixed after training by recalibration. The other is a representation problem: low-incidence age groups provide too few events for the model to learn their warning patterns, especially when age itself is an easier signal. Existing imbalance remedies apply one global setting to every stream, and the obvious extension, a focal loss whose weights depend on age, still mostly reshapes the base rate. Age-matched risk-set training separates the two parts. The age baseline cancels out of the training objective, and the matched sets give every age group a fixed share of events that are learned against age-equivalent controls.

The claim can be falsified directly. At a matched alarm rate in the youngest age groups, the method should improve early detection of death over the strongest simple competitor: a sequence model that receives age as an input and has per-age thresholds re-tuned after training. If it does not, the honest conclusion is that age-specific imbalance in this setting is purely a calibration problem. That negative result would be worth publishing, because it would close off the line of age-conditioned loss design.

Relation to Prior Work

Three groups of work motivate the gap. The first is the mortality-prediction benchmarks, which show that strong ranking scores coexist with weak detection of rare positives. MIMIC-Extract builds hourly physiological series from MIMIC-III and reports AUROC of 0.85–0.90 alongside AUPRC below 0.50 on its sparse targets. AUROC (area under the receiver operating characteristic curve) measures how well a model ranks positives above negatives. AUPRC (area under the precision–recall curve) also penalizes false alarms, so it drops sharply when positives are rare. Revisiting Clinical Outcome Prediction for MIMIC-IV documents the same gap for long-tail outcomes on notes and codes. An Extensive Data Processing Pipeline for MIMIC-IV audits mortality predictions after the fact and finds large differences in positive-prediction rates across demographic groups, but does not change training. None of the three stratifies the training objective by age, and that is the step we take.

The second group is the strongest static mortality models. Predicting ICU In-Hospital Mortality Using Adaptive Transformer Layer Fusion reaches the top AUPRC in the file on a first-24-hour benchmark. Predicting in-hospital mortality by combining clinical notes with time-series data fuses notes with 48 hours of vitals. Both use fixed observation windows, and the first explicitly names the lack of trajectory modeling as a limitation. Our task is the dynamic counterpart: an hourly prediction of death within the next horizon, made throughout the stay.

The third group supplies methods. Sparse-event work in video and surgery reshapes the loss so that rare frames are not drowned out. Mamba-OTR uses focal loss, a loss that down-weights examples the model already classifies easily. Stab-TCN combines focal loss with uncertainty weighting and a temporal smoothing term in a multi-stage temporal convolutional network (TCN, a sequence model built from stacked one-dimensional convolutions). Mamba-OTR also shows that a recurrent state-space model keeps its accuracy in streaming mode, whereas a standard Transformer collapses there. We reuse such streaming backbones unchanged. The contrast is that these methods apply one imbalance setting to all streams, while our sampling is conditioned on age by construction.

One result constrains the design. Prediction of Kidney Transplantation Infection shows that naive training on 2.95% positives gives 0% recall. Sliding-window undersampling lifts recall to 65% but at a heavy cost in false positives. Any scheme that changes the class ratio must therefore correct for it exactly, which risk-set sampling does and ad hoc undersampling does not.

Method

At each hour $t$ of each stay, let the label be 1 if the patient dies within the next 24 hours. We build training sets from these labels.

For every positive patient-hour $i$, we draw $m$ controls from patients who are alive and not positive at the same hour since admission and whose age is within a ±5-year caliper. Matching on hour since admission matters because the first ICU hours are physiologically distinctive. Matching on age is the point of the method.

A causal sequence encoder reads the hourly measurements up to time $t$, written $x_{\le t}$, and produces a score $f(x_{\le t})$. The encoder is the same across all experimental conditions; we use a causal TCN in the style of Stab-TCN, with a state-space variant as a secondary backbone. It is trained on the matched-set objective

$$ \mathcal{L} = -\sum_{j} \log \frac{\exp f(x^{(i_j)})}{\sum_{k \in S_j} \exp f(x^{(k)})}, $$

where $S_j$ is the $j$-th matched set and $i_j$ is its positive member. This is the conditional likelihood used in nested case-control studies. Any additive age term in the risk is identical for every member of $S_j$, so it cancels from the fraction. The positive-to-negative ratio within each set is exactly $1:m$, whatever the age group's incidence.

After training, we fit absolute risk as $p = \sigma\big(g(a,\tau) + f(x_{\le t})\big)$, holding $f$ fixed. Here $\sigma$ is the logistic function, $a$ is age, $\tau$ is hour since admission, and $g$ is a smooth spline fitted by ordinary logistic regression on unsampled data. Because $g$ is fitted on the true data distribution, the final probabilities are calibrated to real incidence rather than to the 1:m training ratio.

The objective assumes that $f$ means the same thing at every age, analogous to the proportional-hazards assumption in survival analysis. We test this assumption directly, as described below. We also measure whether $f$ has quietly re-learned age through features that correlate with it, such as creatinine or heart-rate variability. To do so, we train a linear probe to predict age from the encoder's final representation and compare its accuracy across training schemes.

Research Program

We build the hourly dynamic-mortality task in two places: on MIMIC-III through MIMIC-Extract's 104 hourly features, with adults only, and on MIMIC-IV through the extended pipeline's binned time series. We hold out by patient and, in MIMIC-IV, also by later admission years.

We first characterize the problem, before any new method is trained. We measure how incidence, AUPRC and false-alarm burden of a standard focal-loss sequence model vary by age decade. We also quantify how much of its performance an age-only model already explains.

We then compare training schemes on a single fixed encoder, so that every difference is attributable to the objective. Finally, we test transfer: models are trained on MIMIC-III and evaluated on MIMIC-IV hourly streams, to see whether physiology-based scores that cannot rely on age generalize better than age-dependent ones.

Baselines

The naive reference is an age-and-hour-only logistic model, $g(a,\tau)$ alone. It is the "do nothing" floor: any sequence model that fails to beat it in a given age group has learned nothing physiological for that group.

The second baseline is the standard sparse-event recipe. The same causal TCN is trained on all patient-hours with focal-uncertainty loss and temporal smoothing, following Stab-TCN, with focal parameters tuned globally. It represents current imbalance practice transplanted to this task.

The strongest competitor is the same model with age supplied as an input feature, followed by per-age-decade threshold selection and recalibration on the validation set. It is the strongest because it already captures every base-rate effect that an age-dependent loss could. Its only possible weakness is the representation problem we hypothesize.

We include the obvious intersection idea as its own baseline: an age-conditioned focal loss, with $\alpha$ and $\gamma$ set as smooth functions of age. We also train separate models per age band.

Two ablations isolate the key ingredient. The first uses risk-set sampling matched on hour since admission only, without the age caliper. It separates the benefit of fixed-ratio sampling from the benefit of cancelling age. The second adds an age input to the matched model, to check whether reintroducing age undoes the effect.

A gradient-boosted tree model on demographics plus rolling summary statistics, tuned with AutoGluon, covers the tabular objection.

All methods share the same splits, the same encoder where one applies, the same input features, and an equal hyperparameter-search budget of 40 trials, selected on validation AUPRC.

For external anchoring, the strongest reported number in the file on a related task is AUPRC 0.585 for in-hospital mortality on MIMIC-IV's first-24-hour benchmark, from ALFIA. The same paper reports 0.577 for an AutoGluon ensemble. That task uses clinical notes and a static window, so it is a sanity anchor rather than a target. We will rerun our structured-data encoder on the static version and expect to land near the tabular figure. For the hourly dynamic mortality task itself, no reported result was found on Lacuna.

Beating the strongest competitor means higher AUPRC and fewer alarms per detected death, at 80% sensitivity in the under-50 and 50–64 groups. The improvement must exceed the patient-level bootstrap interval, and it must come without worse AUPRC in the 65+ groups and without worse calibration error in any group.

Why not just…?

Why not just give the model age as an input and set a separate alarm threshold per age group? This is the real threat. Thresholds and recalibration fix any mismatch in base rates. If young-patient under-detection is purely a base-rate effect, this baseline will match our method, and we will report that. Our hypothesis is narrower: a model that can see age uses it as a shortcut and learns weaker physiological features for low-incidence groups, and no threshold can recover features that were never learned. Two measurements settle this. The first is within-age-group AUROC, which thresholds cannot change. The second is the age-probe accuracy on the learned representation. If within-group ranking for the young is equal across methods, the threat wins.

Why not just train separate models for each age band? Splitting starves the low-incidence band of events. The kidney-transplant study shows that too few positives produces 0% recall (Prediction of Kidney Transplantation Infection). Risk in the SARS-CoV-2 mortality modeling study also rises continuously with age, so hard cutoffs discard variation within each band. Matched sets share one encoder across all ages while still comparing like with like. We run per-band models anyway, because with MIMIC's sample sizes the starvation argument has to be shown, not assumed.

Why not just make the focal loss depend on age? An age-dependent weight changes how much each age group's errors count. It does not stop the model from ranking patients by age. We expect it to behave mostly like the threshold baseline, improving recall in the young at the cost of more false alarms. That is the trade-off seen with undersampling in the kidney-transplant study. Its inclusion as a baseline tests this expectation directly.

Why not just use gradient-boosted trees on summary features? On the static benchmark the tabular ensemble is only slightly behind the best model (0.577 versus 0.585 AUPRC in ALFIA), so this is not a strawman. Two things count against it here. MIMIC-Extract finds AUPRC below 0.50 on its sparse targets, and the surgical work finds that static models confuse transient spikes with sustained failure. The tabular baseline is included at equal tuning budget, and if it matches the sequence models in the young groups, the backbone question is moot. The age-matching objective could in that case be applied to trees as well.

Decisive Checks

The central experiment compares alarms per detected death in the under-65 strata at fixed sensitivity, against the age-input-plus-threshold baseline. The two mechanistic checks are within-age-group AUROC and age-probe accuracy on the representation. If matching works as claimed, probe accuracy should fall and within-group ranking in the young should rise. If probe accuracy stays high, the model has re-learned age through correlated features, and we will add matching on the strongest proxies.

The proportional-hazards assumption is tested by fitting an age-by-$f$ interaction in the recalibration step. A large interaction would mean physiology means different things at different ages and that a single shared score is wrong.

Finally, we report calibration error per age group and repeat the demographic-parity audit from the MIMIC-IV pipeline. These confirm that gains for the young are not bought with miscalibration or new disparities elsewhere.