Skip to content

feat(speculation): add outcome predictor implementation - #683

Open
behinddwalls wants to merge 4 commits into
preetam/outcome-predictor-rfcfrom
preetam/outcome-predictor
Open

feat(speculation): add outcome predictor implementation#683
behinddwalls wants to merge 4 commits into
preetam/outcome-predictor-rfcfrom
preetam/outcome-predictor

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

A scorer prices change content, but speculation also needs a separate contract for revising that price with evidence observed during a run. Keeping the concerns separate avoids adding path data that every content scorer would discard.

What?

Add the predictor.Predictor contract and an evidence implementation that combines factors for the passed or failed all-succeeds path plus merging and cancelling states, then revises the scorer's price while keeping the result a probability. Neutral factors preserve the scorer price exactly, including 0 and 1; non-finite factors are rejected; revised results remain strictly between the endpoints. Add the predictor package guide and clarify its relationship to the scorer.

Test Plan

  • ./tool/bazel test //submitqueue/extension/speculation/predictor/...
  • make check-gazelle

Issues

Stack

@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch from c1143a8 to 3ebd06c Compare September 7, 2026 23:52
@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch from 3ebd06c to e3dbe23 Compare September 7, 2026 23:54
@behinddwalls behinddwalls changed the title feat(speculation): predict a batch's outcome from its scorer price and its builds feat(speculation): add outcome predictor implementation Sep 7, 2026
@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch 2 times, most recently from c8114ac to ecd4305 Compare September 8, 2026 00:51
## Summary

### Why?

A scorer prices change content, but speculation also needs a separate contract for revising that price with evidence observed during a run. Keeping the concerns separate avoids adding path data that every content scorer would discard.

### What?

Add the `predictor.Predictor` contract and an evidence implementation that converts the scorer probability to odds, applies factors for passed and failed all-succeed paths plus merging and cancelling states, and converts the result back to a probability. Include generated mocks and unit coverage for neutral factors, compounding evidence, path filtering, bounds, validation, and scorer failures.

## Test Plan

- `bazel test //submitqueue/extension/speculation/predictor/...`
- `make check-gazelle`
## Summary

### Why?

The evidence implementation still described the model as logistic regression over odds and referenced fitting work that the RFC no longer proposes. That made the code's vocabulary diverge from the factor contract exposed to operators.

### What?

Combine the applicable evidence factors first and revise the scorer price with the equivalent bounded formula. Remove stale fitting rationale and keep implementation and tests in the RFC's scorer-price and factor terminology without changing behavior.

## Test Plan

- ✅ `./tool/bazel test //submitqueue/extension/speculation/predictor/...`
## Summary

### Why?

Neutral prediction changed exact scorer prices at 0 and 1, non-finite factors could create certainty, and failed-path compounding relied on duplicate logical paths that a valid path set cannot contain.

### What?

Return the scorer price unchanged for a neutral combined factor, reject non-finite configured factors, keep revised outputs strictly inside the probability range, and apply failed all-succeeds evidence at most once. Extend tests for exact endpoints, large factors, and infinite-factor rejection.

## Test Plan

- ✅ `./tool/bazel test //submitqueue/extension/speculation/predictor/...`
Add the predictor package guide and clarify how it composes over the scorer without adding path evidence to the scorer contract.
@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch from ecd4305 to 1068958 Compare September 8, 2026 00:57
@behinddwalls
behinddwalls marked this pull request as ready for review September 8, 2026 01:09
@behinddwalls
behinddwalls requested review from a team and sbalabanov as code owners September 8, 2026 01:09
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