Skip to content

feat(pi): compare LightGBM and Jev token forecasts - #1320

Draft
sabhatinas wants to merge 5 commits into
grclark/turn-metricsfrom
sabhatinas/pi-forecast-comparison
Draft

sabhatinas wants to merge 5 commits into
grclark/turn-metricsfrom
sabhatinas/pi-forecast-comparison

Conversation

@sabhatinas

@sabhatinas sabhatinas commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds switchyard/compare, a fixed-completion-model Pi demo that runs a local grouped-IR LightGBM forecaster and Jev against the same pre-call history. The example uses Opus 4.8. Two rows show remaining cost, projected total cost, ETA, token forecasts, and signed token errors; LightGBM also shows next-call predictions.

Both remaining predictions and their error targets include all input, cache reads/writes, and output, counting reasoning once. Jev uses the probability-weighted band-midpoint point estimate. The launcher passes through medium, high, or max and keeps their Pi settings and sessions separate.

Each prediction saves typed cost-to-go accounting: observed spending, remaining and projected total costs, the frozen initial estimate (C0), first-priced fallback, forecast revisions, and forecasting API fees separately. At normal completion, remaining cost/tokens and ETA become zero; the final dollar error compares actual acting-model cost with the original baseline. Prediction records remain unchanged for scoring and restore on resume.

Why

Makes the two forecasting approaches comparable during one task execution, with shared token accounting and cost/ETA projections. Tracks changes to the total-cost forecast without summing or double-counting remaining forecasts. Replaces machine-specific paths with configuration and packages the worker and setup instructions for sharing.

Notes for reviewers

  • Stacked on grclark/turn-metrics; this PR contains only the comparison additions.
  • Start with the setup and calculation notes, then switchyard-compare.ts and cost-forecast.ts.
  • Research checkpoint/scripts and the pinned TokenCast checkout remain external; access to the research repository is required. No checkpoints or session traces are included.
  • Projected total is observed task spending plus the current remaining forecast. C0 err is actual minus the frozen initial total, whereas token avg err uses predicted minus actual. Missing first-call cost calibration leaves C0 unknown; a later baseline is explicitly reported as first err.
  • Costs use actual recorded usage and saved catalog rates, not provider invoices. Forecasting API fees are tracked separately from the acting-model target. Future forecasting fees/latency are excluded from cost/ETA projections.
  • A normal Pi turn boundary defines the measured horizon; it is not independent task verification. Aborted/failed turns are not scored as task completion.
  • Original composite-routing behavior and its default display remain available.

Validation: TypeScript typecheck; 48 Node tests requiring no private checkpoint or API calls; 3 Python tests against the real checkpoint; successful packaged Node-to-Python prediction; local comparison integration with checkpoint 20260721; offline checks that Opus 4.8 sends the selected adaptive effort; launcher syntax and staged whitespace checks. Tests cover frozen baselines, cold starts, unknown prices, cache accounting, forecast revisions, completion, resume, and aborts.

Signed-off-by: sabhatinas <sabhatinas@nvidia.com>
@sabhatinas
sabhatinas requested a review from a team as a code owner November 13, 2026 22:37
@sabhatinas
sabhatinas marked this pull request as draft November 13, 2026 22:42
Signed-off-by: sabhatinas <sabhatinas@nvidia.com>
Signed-off-by: sabhatinas <sabhatinas@nvidia.com>
Signed-off-by: sabhatinas <sabhatinas@nvidia.com>
Signed-off-by: sabhatinas <sabhatinas@nvidia.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant