Skip to content

router: train Renegade on the isotonic residual instead of a fixed 50:50 blend #4485

Description

@sanity

Motivation

The router currently combines the Renegade k-NN prediction with the distance-based isotonic estimate via a fixed convex blend whose weight grows with Renegade's data count, not its accuracy:

// crates/core/src/router.rs (predict_routing_outcome)
let w = self.renegade_predictor.failure_weight(); // = events / RAMP, capped at 0.5
failure_estimate = failure_estimate * (1.0 - w) + renegade_failure.clamp(0.0, 1.0) * w;

(same shape for response time and transfer rate)

Two problems with this:

  1. The weight ignores accuracy. As Renegade accumulates observations it earns up to half the vote even if it is noisier than the isotonic base for that query. The natural signal to weight by (Renegade's Brier / calibration vs the base) is now measured by the new prediction-accuracy dashboard, but the blend doesn't look at it.
  2. The two models overlap. Renegade already takes distance as a feature, so it is partly re-learning the same distance→outcome signal the isotonic base already captures. A 50:50 average of two predictors of the same target is a hand-tuned ensemble, not a principled one.

Proposal: train Renegade on the isotonic residual (residual boosting)

Instead of predicting the raw outcome and blending, train Renegade to predict the delta of the base model:

  • Training target = actual_outcome − isotonic_estimate(at record time).
  • Final prediction = isotonic_estimate + renegade_residual_prediction.

This is gradient-boosting / stacking with the isotonic model as the strong, monotone-prior base:

  • Renegade spends its capacity on the residual structure it is actually there for (peer x contract interactions distance can't see), instead of re-learning the distance signal.
  • Removes the arbitrary 50:50 cap and the count-based ramp.
  • Optionally shrink/gate the residual by Renegade's local confidence (neighbour count / variance) so a low-data Renegade contributes ~0 correction (what the count-ramp crudely approximates today).

Considerations / open questions

  • Record-time target: compute the isotonic estimate before adding the new observation and store the residual as Renegade's output. The accuracy-tracking path already predicts-before-add, so the hook exists.
  • Overlap with the isotonic per-peer EWMA delta: that already learns a peer-marginal correction. Decide whether residual-Renegade composes with it (Renegade = peer x contract residual, EWMA = peer-marginal residual) or replaces it.
  • Binary failure: residual in [-1, 1]; final = clamp(isotonic + residual, 0, 1). Fine.
  • Validate with the new panels: a residual-boosted Renegade should show lower Brier than both the raw-blend Renegade and the isotonic base. If it doesn't, it isn't earning its place.
  • Keep a guardrail / shadow-measure before trusting the correction in live routing (avoid a routing regression).

Context

Surfaced while building the per-peer prediction-accuracy dashboard (Outcomes vs Distance + Prediction Accuracy panels). That dashboard is the instrument to evaluate this change. Routing algorithm intentionally untouched in that PR.

[AI-assisted - Claude]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-networkingArea: Networking, ring protocol, peer discoveryE-hardExperience needed to fix/implement: Hard / a lotS-needs-designStatus: Needs architectural design or RFCT-enhancementType: Improvement to existing functionality

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions