Skip to content

feat(speculation): fold predictor into Scorer - #683

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

feat(speculation): fold predictor into Scorer#683
behinddwalls wants to merge 5 commits into
preetam/outcome-predictor-rfcfrom
preetam/outcome-predictor

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

The RFC now has one public ranking interface. Keeping a Predictor package after that would leave a second factory the rest of the stack still had to delete.

What?

Widen Scorer.Score with the path-set snapshot. Move evidence under scorer/evidence as a Scorer wrapping a base. Heuristic, composite, and fake implement the same signature and ignore paths (composite forwards them). Delete the Predictor package and its mocks.

Test Plan

  • make mocks && make gazelle
  • ./tool/bazel test //submitqueue/extension/speculation/scorer/... //submitqueue/extension/speculation/generator/bestfirst:go_default_test //submitqueue/extension/speculation/speculator/standard:go_default_test

Issues

@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
@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
## 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.
Score takes the path-set snapshot. Evidence is a scorer wrapping a base; heuristic and composite ignore paths. Delete the sibling Predictor factory.
@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch from 1068958 to 0ff6ea7 Compare September 11, 2026 16:47
@behinddwalls behinddwalls changed the title feat(speculation): add outcome predictor implementation feat(speculation): fold predictor into Scorer Sep 11, 2026
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