fix(bandit): repair PairedModel when Thompson sampling switches model#754
Open
rohith500 wants to merge 2 commits into
Open
fix(bandit): repair PairedModel when Thompson sampling switches model#754rohith500 wants to merge 2 commits into
rohith500 wants to merge 2 commits into
Conversation
Mirror banditexplore.repairBandPair so serving the scorer's runner-up cannot collapse the session-pin band pair and silently disable Stage 2 band swap. Fixes workweave#753 Signed-off-by: N Rohith Reddy <rohithreddy2202@gmail.com>
|
PR author is not in the allowed authors list. |
Match AGENTS.md: concise comments that state the asserted behavior, without scenario narration. Signed-off-by: N Rohith Reddy <rohithreddy2202@gmail.com>
Contributor
|
Thanks for this, @rohith500 — subtle bug, nicely fixed. 🙏 When Thompson sampling serves the runner-up, the scorer's
Approving from a conventions standpoint — great find. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bug: When
x-weave-router-strategy: banditThompson-samples the cluster scorer's runner-up,bandit.RouterrewroteModelbut leftMetadata.PairedModelpointing at that same slug.writeNewPinpersisted{pinned_model, paired_model}as identical values, which silently disabled Stage 2bandSwapServedfor the pin's life (LARGE and SMALL resolved to one model).Fix: On a real model switch, recompute the runner-up against the served model — same contract as
banditexplore.repairBandPair. Argmax draws leave the scorer pair untouched.Fixes #753
What changed
internal/router/bandit/bandit.gorepairBandPairafter annotate when TS switches off the argmaxinternal/router/bandit/bandit_test.goVerification
Local (author):
make check— all checks passedgo test ./internal/router/bandit/... -raceGitHub Actions (fork PR):
action_required(first-time contributor workflow approval). A maintainer needs to click Approve and run workflows on the PR checks tab before these can go green.Checklist (CONTRIBUTING.md / AGENTS.md)
main)Signed-off-by