Expand description
Off-policy evaluation (OPE): direct-method replay and IPS/SNIPS for start-rung policies.
§Direct method (ladder/threshold changes)
Answers: “if I changed my ladder or serve threshold, what would my logged traffic have cost and how many failures would I have served?” — from the trace store, before enforcing anything.
For each trace, walk the CANDIDATE ladder cheapest-first. At each rung, if the logged trace has an attempt for that exact model string, reuse its logged gate verdicts and cost. The first rung whose outcome would SERVE under the candidate rule ends the replay. If any candidate rung has no logged attempt the trace is UNEVALUABLE and excluded — never guessed.
Coverage < 1.0 is the principal limitation: a candidate that adds models never logged cannot be evaluated. The report always surfaces coverage and n_correctness_known.
§IPS / SNIPS for start-rung policies (requires exploration)
Answers: “what would mean cost be if I always started at rung N?” — using importance-sampling on traffic logged under an epsilon-greedy policy that recorded propensities.
Estimators (Horvitz-Thompson 1952 / Swaminathan-Joachims 2015):
wᵢ = 𝟙[logged_start == N] / pᵢ (importance weight)
IPS = (1/n) Σᵢ wᵢ · costᵢ (unbiased, higher variance)
SNIPS = Σ(wᵢ·costᵢ) / Σwᵢ (self-normalised, lower variance)
ESS = (Σwᵢ)² / Σwᵢ² (effective sample size)Valid only when the candidate start rung N is in the logging policy’s support (guaranteed
under ε-greedy since p = ε/K > 0 for every rung). Traces without propensity are excluded
and counted in n_with_propensity. The direct-method path remains for ladder-structure
changes.
§Doubly-robust (DR) estimator
DR combines the direct-method baseline with an IPS residual correction:
DRᵢ = DM(xᵢ, a) + wᵢ · (rᵢ − DM(xᵢ, aᵢ))
DR = (1/n) Σᵢ DRᵢwhere DM(x, rung) is the per-(task-kind, start-rung) empirical mean cost built from
logged receipts. DR is unbiased when either the propensities or the reward model
is correctly specified (double robustness). In practice, both are coarse approximations;
DR tends to have lower variance than IPS while inheriting IPS’s unbiasedness under
correct propensities.
Structs§
- Candidate
Policy - A candidate routing policy to evaluate against logged traffic.
- IpsReport
- IPS, SNIPS, and doubly-robust (DR) estimates for evaluating a fixed candidate start-rung policy.
- OpeReport
- The result of evaluating a candidate policy against logged traffic.
Functions§
- ips_
from_ store - Run IPS/SNIPS OPE from the trace store for a fixed candidate start-rung policy.
- ope_
from_ store - Run OPE from the trace store.