abcd_grader: patterns 0.1, 2 and 9 lack a boundary after the letter, so refusals and prose answers are graded as A/B/C/D instead of None
gpt_oss/evals/abcd_grader.py:20-30 (pattern 0.1), :36 (pattern 2) and :71-77 (fallback 9), consumed by gpt_oss/evals/gpqa_eval.py:82-83.
# 0.1) -- no \b and no $ after the letter, (?i) makes [ABCD] match a lowercase word start
re.compile(r'''(?ix)
^\s*
(?:\*{1,2}|_{1,2})?
Answer:?
(?:\*{1,2}|_{1,2})?
\s*:?\s*
(?:\*{1,2}|_{1,2})?
([ABCD]) # capture the letter
(?:\*{1,2}|_{1,2})?
\s* # optional trailing whitespace, end of line
''', re.MULTILINE),
# 2) -- (?i) + optional separator: "cannot answer a question" matches "answer a"
re.compile(r'(?ix)\bAnswer[s]?\b\s*[:\-–]?\s*([ABCD])\b'),
# 9) final fallback: a line that's exactly "A", "B.", "C)", "**D**", etc.
re.compile(r'''(?x)^\s*
(?:\*{1,2}|_{1,2})?
([ABCD])
(?:\*{1,2}|_{1,2})?
\s*[\.\)\-–:]?
\s*.*$ # allow any following text
''', re.MULTILINE),Pattern 0.1 sits at priority index 1, so it outranks patterns 1-3, which do carry \b. Pattern 9 matches any line whose first non-space character is A, B, C or D, with any text after it.
Measured
Real gpt_oss/evals/abcd_grader.py at 7b58334 imported directly (Python 3.12); extract_abcd(text) result and, for GPQA, score = 1.0 if extracted == gold else 0.0 (gpqa_eval.py:83).
| input | extracted | matched by | human expectation |
|---|---|---|---|
As an AI I cannot help with that. |
A |
fallback 9 (whole line) | None |
Because the data is insufficient, I cannot decide. |
B |
fallback 9 | None |
Considering all factors, the value is 3.2 m/s. |
C |
fallback 9 | None |
Data not available. |
D |
fallback 9 | None |
I cannot answer a question about this. |
A |
pattern 2, fragment answer a |
None |
Sorry, I can't answer a medical question. |
A |
pattern 2, fragment answer a |
None |
Answer: 42 |
A |
fallback 9 | None |
The value is 2.08e-6.⏎Another note. |
A |
fallback 9 on line 2 | None |
Answer: Approximately 3 km |
A |
pattern 0.1, fragment Answer: A |
None |
Answer: Both are correct |
B |
pattern 0.1 | None |
Answer: correct option is (B) |
C |
pattern 0.1, fragment Answer: c (beats pattern 1's (B) on priority) |
B |
answer: because of X, choose (D) |
B |
pattern 0.1 | D |
Answer: After checking, C |
A |
pattern 0.1 | C |
Clearly the answer is B. |
C |
fallback 9 | B |
Based on the analysis, the answer is C. |
B |
fallback 9 | C |
After simplifying, the answer is D. |
A |
fallback 9 | D |
Answer: C |
C |
pattern 0.1 | C (control) |
**Answer:** B |
B |
pattern 0 | B (control) |
The answer is (D). |
D |
pattern 4 | D (control) |
\boxed{A} |
A |
pattern 7 | A (control) |
Score consequence: As an AI I cannot help with that. scores 1.0 whenever the permuted gold is A; Clearly the answer is B. scores 0.0 on gold B and 1.0 on gold C.
Applying the patch from #249 on top of the current patterns changes none of the rows above (only '' and Zebra. move from ''/Z to None), because these patterns match before the line-101 fallback is reached. #249's regression input is lowercase because ..., which pattern 9 (case-sensitive) never matched.
Consequence
- A refusal or non-answer whose first line begins with A, B, C or D, or that contains the fragment "answer a", scores 1.0 on whichever of the four permutations puts the gold on that letter, instead of returning None. How often gpt-oss emits such replies instead of
**Answer: X**(which takes the boundary-safe path) is not measured here; the mechanism is what this report shows. - A correct answer stated in prose is scored as the first letter of the sentence, so a model that writes "Clearly the answer is B." is marked wrong on B and right on C. The direction of the error depends on the permutation, so it does not cancel out per item.
- Pattern 0.1 outranks the boundary-safe patterns 1-3, so
Answer: correct option is (B)is graded C even though pattern 1 would have extracted B. - The HTML report's "Extracted Answer" shows a letter, so the mis-grade is not visible as a parse failure.
Suggested fix
Follow the boundary already used by the other patterns in the same list (pattern 0 at :14 ends with ([ABCD])\b; patterns 4/5 at :52/:55 use (?![A-Za-z0-9])):
- Pattern 0.1 (:27-29):
([ABCD])(?![A-Za-z0-9])and honour the comment by anchoring\s*$, or drop the pattern, since patterns 0 and 2 already cover**Answer:** XandAnswer: Xwith a boundary. - Pattern 2 (:36): keep
(?i)for the wordAnswerbut make the letter case-sensitive,((?-i:[ABCD]))\b, soanswer a questionno longer matches; the prompt asks for an uppercase letter. - Fallback 9 (:75-76): match what its comment says, a line that is exactly the letter plus optional wrapper and separator: replace
\s*[\.\)\-–:]?\s*.*$with\s*(?:[\.\)\-–:]\s*.*)?$, soD) The fourth option.(the case pinned by the tests in #255) still returns D whileData not available.andClearly the answer is B.do not. - Add the rows above to
tests/gpt_oss/evals/test_abcd_grader.py(introduced by #249) as regressions, alongside the existing controls.
#249 is a prerequisite rather than a companion: without it, line 101 still returns text[:1], so As an AI ... stays A even after the three patterns are fixed. #255 (final-declaration precedence) is independent. The same missing boundary in openai/simple-evals is documented in a comment on simple-evals #33; this grader is a separate copy with two extra unbounded patterns.
Happy to open the PR.
Source: openai/gpt-oss