Skip to content

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

Open
behinddwalls wants to merge 7 commits into
mainfrom
preetam/outcome-predictor
Open

behinddwalls wants to merge 7 commits into
mainfrom
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. The evidence factor for the land-stage batch is Landing / YAML landing.

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

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
@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
@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
@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch from 0ff6ea7 to 8d345c0 Compare September 14, 2026 19:33
Base automatically changed from preetam/outcome-predictor-rfc to main September 14, 2026 19:47
@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch 2 times, most recently from 5eb7dfe to 3280c67 Compare September 14, 2026 19:48
## 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.

# Conflicts:
#	submitqueue/extension/speculation/scorer/scorer.go

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# interactive rebase in progress; onto 2de5499
# Last commands done (5 commands done):
#    pick ff043d9 # docs(speculation): document predictor extension
#    pick 0ff6ea7 # feat(speculation): fold predictor into Scorer
# No commands remaining.
# You are currently rebasing branch 'preetam/outcome-predictor' on '2de54998'.
#
# Changes to be committed:
#	modified:   submitqueue/extension/speculation/generator/bestfirst/bestfirst.go
#	modified:   submitqueue/extension/speculation/generator/bestfirst/bestfirst_test.go
#	deleted:    submitqueue/extension/speculation/predictor/BUILD.bazel
#	deleted:    submitqueue/extension/speculation/predictor/README.md
#	deleted:    submitqueue/extension/speculation/predictor/mock/BUILD.bazel
#	deleted:    submitqueue/extension/speculation/predictor/mock/predictor_mock.go
#	deleted:    submitqueue/extension/speculation/predictor/predictor.go
#	modified:   submitqueue/extension/speculation/scorer/README.md
#	modified:   submitqueue/extension/speculation/scorer/composite/scorer.go
#	modified:   submitqueue/extension/speculation/scorer/composite/scorer_test.go
#	renamed:    submitqueue/extension/speculation/predictor/evidence/BUILD.bazel -> submitqueue/extension/speculation/scorer/evidence/BUILD.bazel
#	renamed:    submitqueue/extension/speculation/predictor/evidence/evidence.go -> submitqueue/extension/speculation/scorer/evidence/evidence.go
#	renamed:    submitqueue/extension/speculation/predictor/evidence/evidence_test.go -> submitqueue/extension/speculation/scorer/evidence/evidence_test.go
#	modified:   submitqueue/extension/speculation/scorer/fake/fake.go
#	modified:   submitqueue/extension/speculation/scorer/fake/fake_test.go
#	modified:   submitqueue/extension/speculation/scorer/heuristic/scorer.go
#	modified:   submitqueue/extension/speculation/scorer/heuristic/scorer_test.go
#	modified:   submitqueue/extension/speculation/scorer/mock/scorer_mock.go
#	modified:   submitqueue/extension/speculation/scorer/scorer.go
#	modified:   submitqueue/extension/speculation/speculator/standard/standard_test.go
#
BatchStateLanding replaced Merging on main. Keep the YAML/factor name aligned with that state, and point the package at outcome-scorer.md.
@behinddwalls
behinddwalls force-pushed the preetam/outcome-predictor branch from 3280c67 to 56a09e1 Compare September 14, 2026 19:50
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