Skip to content

Fix false positives in quote and repeat-change checkers - #41

Open
Lazarus-coder wants to merge 1 commit into
allenai:mainfrom
Lazarus-coder:fix/checker-false-positives-38
Open

Lazarus-coder wants to merge 1 commit into
allenai:mainfrom
Lazarus-coder:fix/checker-false-positives-38

Conversation

@Lazarus-coder

Copy link
Copy Markdown

QuoteExplanationChecker currently accepts an unexplained curly-quoted phrase, and RepeatChangeChecker accepts an unchanged request when only its whitespace differs. Both produce false positives in strict and loose evaluation.

This change normalizes curly double quotes before the existing quote checks. It also compares whitespace-split words consistently: the first word must differ and every remaining word must match. Empty token lists are rejected, including an empty response to a single-word request. Existing case-sensitive comparisons and whitespace-insensitive matching are preserved.

Adds 33 regression subcases covering valid and invalid responses, straight/curly/mixed quotes, whitespace variations, changed tails, and single-word requests.

Before / after

The following results agree across direct checker calls and both strict and loose evaluation, using the actual package and evaluator:

Response Before After Expected
“Hello” pass fail fail
"Hello" fail fail fail
“Hello” A greeting. pass pass pass
"Write a poem about rain\n" (trailing newline) pass fail fail
" Write a poem about rain " (surrounding spaces) pass fail fail
Compose a poem about rain pass pass pass

The repeat examples use Write a poem about rain as the request.

Validation

Python 3.12.14, dependencies installed with uv sync --locked --group dev, and local NLTK resources:

  • New tests against unchanged 1c40f0c: 12 failing subcases; 21 of the 33 added subcases already pass.
  • python -m pytest instructions_test.py -q -k 'quote_unquote or repeat_change': 5 passed, 35 subtests passed after the fix.
  • python -m pytest -q: 74 passed, 176 subtests passed.
  • uv pip check and git diff --check: passed.

Model score impact has not been measured. This preserves the existing lexical quote heuristic.

Fixes #38.

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.

Two checker bugs in instructions.py: QuoteExplanationChecker curly-quote no-op, RepeatChangeChecker raw-string comparison

1 participant