Skip to content

fix(generative): use last-match for pairwise verdict extraction - #271

Closed
AUTHENSOR wants to merge 1 commit into
allenai:mainfrom
AUTHENSOR:fix/last-match-verdict-extraction
Closed

fix(generative): use last-match for pairwise verdict extraction#271
AUTHENSOR wants to merge 1 commit into
allenai:mainfrom
AUTHENSOR:fix/last-match-verdict-extraction

Conversation

@AUTHENSOR

Copy link
Copy Markdown

Summary

process_judgement in both generative.py:493 and generative_v2.py:175 used substring in checks (if "[[A]]" in judgment checked before [[B]], [[C]], [[D]]). This means the first verdict token found anywhere in the judge response wins, regardless of whether it appears in reasoning text or the final verdict.

Fix

Replace the substring chain with re.findall(r"\\[\\[([ABCD])\\]\\]", judgment.upper())[-1] (last match). This binds the verdict to the judge's concluding token rather than to any token echoed in reasoning.

The comment at generative_v2.py:187 notes this code was adapted from FastChat's run_judge_pair, which had the same issue and was fixed with the same approach (lm-sys/FastChat#3921).

Verification

  • python3 -m py_compile: compiles OK
  • black --check --line-length 119: clean
  • 2 files changed, 6 insertions, 12 deletions

process_judgement used substring 'in' checks ([[A]] before [[B]] before
[[C]]/[[D]]) which matched the first verdict token anywhere in the judge
response. Switch to re.findall + last match so reasoning text does not
override the judge's final verdict.
@AUTHENSOR AUTHENSOR closed this Aug 5, 2026
@AUTHENSOR
AUTHENSOR deleted the fix/last-match-verdict-extraction branch August 5, 2026 23:18
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