Replay Ratios Are Hidden Decision Thresholds

Reinforcement learning agents often keep two memories instead of one. One memory holds the rare experiences that matter, such as trajectories that ended in success, death, or a human override. The other holds everything else. Training then draws from the rare memory more often than its natural share. This "dual-buffer" trick is standard in sparse-reward robotics and human-in-the-loop learning, and the mixing ratio is almost always picked by feel. This note argues that when a buffer is split by trajectory outcome, the mixing ratio is not a neutral optimization knob. It silently sets the exchange rate between false alarms and missed events. That exchange rate is exactly the quantity that decision curve analysis, a clinical method for judging whether a risk model is worth acting on, asks the user to state explicitly.

The concrete claim is simple. Oversampling the adverse-outcome buffer by a factor $w$ multiplies the learned odds of that outcome by $w$. Acting whenever the learned risk exceeds one half is therefore the same as acting when the true risk exceeds $1/(1+w)$. If this holds, three things follow. Heuristic replay schedules can be read off as clinical operating points. Learned values can be corrected back to calibrated probabilities exactly. And the ratio can be chosen deliberately, from a stated harm-to-benefit window, rather than tuned. The open empirical question, which could come out either way, is whether matching the ratio to the target threshold gives better decisions inside that window than training on the natural distribution and thresholding afterward.

Core Claim

Take an episodic problem with a binary terminal outcome $Y$ (for example, in-hospital death) and no intermediate reward. The value to be learned is a risk: the probability $h(s)$ that the outcome occurs, starting from state $s$ under the logged behavior. Partition the replay memory into an event buffer, holding transitions from trajectories with $Y=1$, and a non-event buffer. Sample so that each event-trajectory transition is drawn $w$ times as often as each non-event transition.

Reweighting whole trajectories by outcome defines a new Markov chain. Its transitions are $p(s'|s)\,g(s')/g(s)$, with $g = w h + (1-h)$. This is a Doob-style reweighting: $g$ satisfies the same one-step averaging property that $h$ does, so the reweighted transitions still sum to one. The fixed point of temporal-difference learning (updating each state's value toward the value of the next state) on this reweighted data is then $$\frac{\tilde h(s)}{1-\tilde h(s)} = w\,\frac{h(s)}{1-h(s)},$$ where $\tilde h$ is the learned risk. Decision curve analysis values a flag-and-intervene rule at threshold probability $p_t$ by its net benefit $NB(p_t) = TP/N - (FP/N)\,p_t/(1-p_t)$. Here $TP$ and $FP$ count flagged patients with and without the event, and $N$ is the cohort size. Thresholding $\tilde h$ at a value $q$ is equivalent to thresholding the true risk at the $p_t$ satisfying $$\frac{p_t}{1-p_t} = \frac{1}{w}\cdot\frac{q}{1-q}.$$ A "balanced" 50/50 buffer with a 10% event base rate ($w=9$) therefore implicitly declares that nine false alarms are worth one caught event.

This identity is exact only for evaluating the logged behavior in the tabular case. Under function approximation, and for control where the greedy policy differs from the logged one, it becomes approximate. How far it drifts is one of the things to measure.

The prior work plays different roles here. On the replay side, ETGL-DDPG ramps up sampling from an elite buffer of successful trajectories. Multi-DEX separates rewarded from unrewarded trials so its dynamics model does not treat successes as outliers. PVP4Real splits human-intervention from autonomous data and reaches 100% navigation success where behavioral cloning gets 25% or 0%. These papers motivate the proposal: they show outcome partitioning helps learning. None of them asks what the ratio does to the meaning of the learned values.

On the decision side, Flores et al. prove that a bounded Brier score equals net benefit integrated over a threshold window. They also show that model rankings flip inside a narrow clinical window on BCSC. We supply the method by reusing their bounded scoring and briertools. Their work is confined to one-shot classification, whereas we carry it into replay-trained sequential value estimates.

Research Program

The first component checks the identity. We use small synthetic Markov chains where $h$ can be computed exactly, then add neural critics with increasing capacity, and measure how far the learned odds deviate from $w$ times the true odds. The critic is the network that estimates the value of each state. The same check is run for control, meaning off-policy greedy learning. There the reweighting depends on the behavior policy rather than the learned one, so we expect systematic departures.

The second component builds a threshold-conditioned critic. The user specifies an operational window $[p_{t,\min}, p_{t,\max}]$. For each minibatch, we draw a target threshold from that window, set $w$ from the relation above with $q=1/2$, sample the two buffers accordingly, and feed $w$ to the critic as an input. One network then represents a whole family of operating points. Applying the exact odds correction recovers a single calibrated risk estimate for reporting.

The third component extends decision curve analysis to sequential flagging. A patient is flagged at the first time step where the risk estimate crosses $p_t$. The flag is a true positive if the event occurs later within the horizon, and a false positive if the patient never has the event. Because the flag is an alert and not a change of treatment, evaluation needs no counterfactual off-policy estimator. This avoids the fragile importance-weighted evaluation that Raghu et al. rely on.

Baselines

The naive reference points are the two decision-curve defaults. "Flag everyone" and "flag no one" have closed-form net benefit, and no method counts as useful at a threshold unless it beats both there. A second naive reference is the clinicians' own behavior. We treat actual vasopressor initiation in the record as the flag and score it with the same sequential net benefit.

The key ablation, and in principle the strongest competitor, is a single uniform buffer. We train the same temporal-difference critic, architecture, and data, with an equal gradient-step budget and equal hyperparameter search. Its unweighted risk estimate is then thresholded post hoc at each $p_t$. The identity predicts it reaches the same decisions in the infinite-data limit. Beating it means a statistically reliable gain in integrated net benefit over the target window, with patient-level bootstrap confidence intervals, and not merely a gain in global AUC.

We also run the heuristic practice the proposal critiques. This is a fixed 50/50 dual buffer, and separately the ETGL-style ramped schedule, in each case without odds correction. It shows what operating point current practice lands on by accident.

A monolithic prioritized-replay critic follows the design of Raghu et al.: same network, tuned priority exponent. We also include a cost-weighted variant that scales the terminal reward for death to encode $p_t$.

The supervised competitor is a class-weighted gradient-boosted classifier predicting eventual death from the current window, with its threshold chosen by decision curve analysis. This mirrors the random forest of Meng et al., which reports external AUROC 0.83 and positive net benefit between 55% and 85% thresholds on a different, static ICU task.

For the strongest published results on the sepsis cohort, Yan et al. report estimated mortality 0.0138 versus 0.0632 for standard care, with model concordance rate 0.549. That is a treatment-policy metric, not a flagging metric. No reported result was found on Lacuna for sequential net benefit on MIMIC-III sepsis. The baselines above must therefore be run by us under matched budgets.

Why not just…?

Why not just train on the natural distribution and threshold afterward? This is the real threat, and the identity itself says that with unlimited data and a perfect critic it is equivalent. The proposal survives only if finite data and limited capacity make ratio-matching useful. The mechanism would be that it concentrates gradient signal and approximation accuracy near the decision boundary that matters for the chosen $p_t$. The uniform-buffer ablation, run across data-subsampling fractions, settles this directly. If the gap vanishes at full MIMIC-III scale, we will report the contribution as interpretive and diagnostic rather than performance-improving. That still exposes the operating points hidden in existing schedules and supplies the calibration correction.

Why not just use prioritized replay in one buffer? Prioritizing by surprise changes sampling in a way that depends on the critic's errors, not on outcome. So it has no fixed relation to any threshold and no exact correction. Raghu et al. used it and still saw unstable behavior in the sparse high-severity group (SOFA above 15, where SOFA is an organ-failure severity score). We expect prioritized replay to be miscalibrated in a way that post-hoc thresholding cannot fully repair. The calibration and bounded-Brier comparisons test this.

Why not just put the cost in the reward or the loss? Scaling the terminal reward by a cost matches the ratio method in expectation but encodes only one threshold per training run. As Flores et al. argue, deployment thresholds vary across sites and clinicians. The threshold-conditioned critic covers the whole window in one model. The comparison is net benefit across the window between one conditioned critic and a separately trained cost-weighted critic per threshold, at equal total compute.

Why not just use a supervised classifier? For pure alerting under logged care, a supervised classifier estimates the same quantity $h$. Its reweighting shifts the odds in exactly the same way. The case for temporal-difference learning is that bootstrapping shares information across long stays. It also extends to control, where supervised imitation fails under distribution shift, as seen with behavioral cloning in PVP4Real. If the classifier matches the temporal-difference critic on net benefit, we will say so and restrict the claim to the control setting.

Proposed Experiments

The main testbed is the MIMIC-III Sepsis-3 cohort as constructed by Raghu et al.: 17,898 patients, 48 features per 4-hour window. The outcome is in-hospital death. We fix the threshold window to a plausible escalation range, for example 5% to 30%, and we will state this as a design choice to be revisited with clinicians. Primary metrics are integrated net benefit over the window, computed with briertools bounded scoring, and decision curves against both defaults. Secondary metrics are per-threshold calibration after odds correction and data-efficiency curves at 10%, 30%, and 100% of training patients.

The first decisive check is whether the learned-to-empirical odds ratio tracks $w$ on held-out patients. If it does not, the core identity fails in practice.

The second decisive check is whether the uncorrected 50/50 dual buffer peaks in net benefit near the predicted implicit threshold $1/(1+w)$. If it does, current heuristics really are hidden threshold choices.

The third decisive check is whether ratio-matched or threshold-conditioned training beats uniform replay plus post-hoc thresholding inside the window, and whether that advantage grows as data shrinks.

For the control arm, we use D4RL AntMaze, whose binary sparse success reward is described in D4RL. We measure how far an elite-buffer greedy critic departs from the odds identity, using Monte Carlo rollouts of the learned policy as ground truth. For context, MOORL reports an average normalized locomotion score of 105.8 against 98.2 for RLPD. Those results are on different tasks and are return-based, and no reported calibration or net-benefit result was found on Lacuna for AntMaze. This arm tests how far the identity generalizes. It is not a claim about beating return benchmarks.