fix: parse judge replies that prefix prose before the fenced block - #7
Open
Mr-Neutr0n wants to merge 1 commit into
Open
fix: parse judge replies that prefix prose before the fenced block#7Mr-Neutr0n wants to merge 1 commit into
Mr-Neutr0n wants to merge 1 commit into
Conversation
_parse_judge_json required the reply to start with a backtick fence, so 'Certainly. ```json ...' fell through to raw json.loads, returned None, and the criterion was scored as JUDGE_PARSE_FAILED (unmet), silently deflating HealthBench scores for judge models that preface their JSON. Find the first fence anywhere in the reply and, when there is none, fall back to the outermost JSON object. Signed-off-by: Mr-Neutr0n <64578610+Mr-Neutr0n@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
_parse_judge_jsonrequired the reply to start with a backtick fence:Judge models frequently preface the block with a sentence (
Certainly.followed by a json fence). For those replies the guard is False, the raw text hitsjson.loads, parsing returns None, and_judge_onescores the criterion asJUDGE_PARSE_FAILED(unmet) after burning all retries on a perfectly valid judgment.That silently deflates HealthBench / HealthBench Professional scores for any judge model that wraps its JSON in conversational text, and it looks like a model-quality gap rather than a parser gap.
Change
jsontag, and parse up to the closing fence.{...}object so prose-wrapped judgments still parse.criteria_met, malformed JSON, and no-object replies still return None exactly as before.Verification
Same pass/fail set as before the change plus the new
test_parse_judge_json_handles_prose_around_the_block(5 cases). The 3 pre-existing failures in that file reproduce identically on clean main without optional provider deps installed; none touch the parser.This change was prepared with AI assistance under human direction and review.