feat(experiment): add trigger-shift replay evaluator#602
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8f866c1. Configure here.
|
|
||
| function labelReward(predicted, expected) { | ||
| return normLabel(predicted) === normLabel(expected) ? 1 : 0; | ||
| } |
There was a problem hiding this comment.
Empty expected yields false reward
Medium Severity
When expectedDecision is missing or only whitespace, normLabel turns it into an empty string, and labelReward awards reward 1 whenever both train and shifted predictions are also empty. Malformed or incomplete pairs can therefore look perfectly aligned and inflate meanTrainReward, meanShiftedReward, and understate gap.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8f866c1. Configure here.
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
Source
Ported from private source-of-truth merge:
ffdf00a71325321508da521f96c0bff1a930d85cValidation
node --test test/triggerShift.test.jsnode --check src/experiment/triggerShift.js && node --check test/triggerShift.test.jsRisk / rollback
🤖 Generated with Claude Code
Note
Low Risk
New isolated experiment code with no production wiring, I/O, or network; rollback is a straight revert.
Overview
Adds an offline experiment helper that scores policies on paired train vs shifted tasks (same objective, different wrapper trigger, temporal context, or instruction phrasing) to surface trigger/context overfitting.
evaluateTriggerShiftrunspolicy.predicton each pair, computes binary train/shifted rewards againstexpectedDecision, and returns aggregate metrics plus per-pair gap (trainReward - shiftedReward). Report rows omit raw prompt text so diagnostics can be logged without leaking task bodies.smallTriggerShiftSuiteships one calibration pair per axis.Tests cover empty suites, stable policies, a trigger-sensitive dummy policy, axis coverage, and that serialized reports include reward/gap fields without embedding full prompts. No I/O, live triggers, or GEP selection wiring.
Reviewed by Cursor Bugbot for commit 8f866c1. Bugbot is set up for automated code reviews on this repo. Configure here.