fix(evaluator): guard IndexError on truncated judge choice (JudgeEvaluator/RMBEvaluator) - #2522
Open
WatchTree-19 wants to merge 1 commit into
Open
Conversation
…aluator/RMBEvaluator
prediction.split('"Choice": "Model ')[-1][0] was guarded only by len(prediction)!=0,
but crashes when the split tail is empty (a judge output truncated right at the
marker). Index the tail only when non-empty. +test.
Signed-off-by: WatchTree-19 <119982314+WatchTree-19@users.noreply.github.com>
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.
problem
JudgeEvaluator.scoreandRMBEvaluator.scoreextract the winning model letter with:the guard checks that
predictionis non-empty, but the[0]indexes the split tail, which can be empty even when the prediction isn't - e.g. a judge response truncated right at the marker (... "Choice": "Modelwith nothing after, common undermax_tokensclipping). thensplit(...)[-1]is""and""[0]raisesIndexError, crashing scoring for the whole batch.repro
fix
index the split tail only when it's non-empty (missing choice ->
None, which simply doesn't match the gold winner). applied to bothJudgeEvaluatorandRMBEvaluator.test
added
tests/openicl/test_icl_judge_evaluator.py: the truncated-marker case no longer crashes (scores 0.0), and a normal"Choice": "Model A"still scores correctly.