bandit-spec live sim

Thompson sampling over draft lengths K=1..7, T=300 steps, regime shifts at t=100/200. Reward = E[tokens]/(1+c·K), p99 SLO guard vetoes large K. Vanilla JS + canvas.

← back to portfolio

p99 over trailing 50-step window → shrink K by 1 (2 if far over)
step0 / 300 mean pick (bandit)– final cum. regret– bandit vs oracle tok/step– p99 lat / vetoes–

draft length K over time — bandit (accent) vs oracle (gray) · dashed = regime shift

cumulative regret vs oracle

Update: geometric accept chain per step (run of accepts ∼ true p, cap K); posterior a[K]+=acc, b[K]+=rej. Oracle = argmax of true E[tokens]/(1+0.15·K) per phase. Latency model 8+2.2·K+N(0,1.5) ms.