GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — fix(multi_choices): read bracketed multi-select labels that run together by simin-yuan · Pull Request #2075 · modelscope/evalscope Conversation
Contributor
Problem
Fixes #2074. Change
Scope and compatibility
MeasurementRe-scored 450 stored outputs from a Chinese multi-select AGIEval run (qwen2.5:7b 150, llama3.2:3b 300) with the change; no new model calls:
48/150 qwen outputs used a bracketed label written without a separator. 13 correct answers are recovered; 4 answers that the old fallback had awarded credit to are now recorded as wrong; 0 new false acceptances. Tests
Simin Yuan
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Yunnglin
requested changes
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Requesting changes: the normal multi-select cases work, but the new regular expression introduces exponential backtracking on short malformed model outputs. Reviewed head: [P1] Avoid ambiguous whitespace consumption in Inside the repeated group, Reproducer on the PR checkout (POSIX; the alarm prevents a long-running process): import signal import time from evalscope.api.dataset import Sample from evalscope.api.evaluator import TaskState from evalscope.api.model import ModelOutput from evalscope.utils.multi_choices import parse_answers, parse_answers_zh def expired(*args): raise TimeoutError signal.signal(signal.SIGALRM, expired) for parse, marker in [(parse_answers, 'ANSWER: '), (parse_answers_zh, '答案:')]: text = marker + '[' + 'A ' * 40 + '!]' state = TaskState( model='mock', sample=Sample(input='question', choices=['a', 'b', 'c', 'd'], target='A'), output=ModelOutput.from_content(model='mock', content=text), ) started = time.perf_counter() signal.setitimer(signal.ITIMER_REAL, 2) try: print(parse.__name__, parse(state, multiple_correct=True)) except TimeoutError: print(parse.__name__, len(text), 'characters: TIMEOUT >2s') finally: signal.setitimer(signal.ITIMER_REAL, 0) print('elapsed:', time.perf_counter() - started) Locally on Python 3.10.18, both public parsers hit the 2-second cutoff for just 91 English / 86 Chinese characters. The actual base functions at Model output is an input boundary: a malformed answer must not stall scoring. The existing 74 multi-choice tests pass, so the normal-case coverage does not catch this regression. Please remove the ambiguous repeated whitespace matching (or separate bracket extraction from label validation), and add regression coverage for repeated labels with an invalid suffix and a missing closing bracket. A thread timeout alone does not fix the underlying regex execution. Please push the fix and request re-review; this PR should remain unmerged until the regression is resolved.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe optional separator sat between two whitespace runs, so a space could be claimed by either of them and a malformed label run such as '[A A ... !]' made the engine try every split: exponential in the number of labels, enough that a 91-character malformed reply stalled scoring (2.9s at 24 labels). Put the separator and its surrounding whitespace in one character class, which keeps the scan linear (0.03ms for 40 labels, 1.8ms for 10k). Labels are still validated in _label_prefix afterwards, so bracketed prose stays unparseable and the fallback result is unchanged. Cover both malformed shapes (invalid suffix, missing closing bracket) for both parsers; the tests read the answer in a child process so a regression fails instead of hanging the test session.
|
There was an error while loading. Please reload this page.
|
Thanks for the catch — the ambiguous whitespace is gone.
Pushed |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-reviewed the backtracking fix and the latest comment cleanup. The previous P1 blocker is resolved: the original malformed inputs return promptly, and regressions cover invalid suffixes and missing closing brackets in both parsers.
The latest commit only condenses comments/docstrings; executable code and assertions are unchanged. Local verification: 76 multi-choice tests plus the mock CLI-lite check passed, and all make lint checks passed. Current-head CI is also green. Approved.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[Bug] Bracketed multi-select answers such as 答案:[AD] keep only the last label
There was an error while loading. Please reload this page.