Skip to content

Fix six instruction verifiers that mis-score correct responses#34

Open
jlu-figma wants to merge 2 commits into
allenai:mainfrom
jlu-figma:main
Open

Fix six instruction verifiers that mis-score correct responses#34
jlu-figma wants to merge 2 commits into
allenai:mainfrom
jlu-figma:main

Conversation

@jlu-figma

Copy link
Copy Markdown

I was going through eval results and found seven verifier bugs that were causing my benchmark score to be lower.

repeat:repeat_span

Prompt example: Copy the span of words that lies between (and including) index 3 and 6, the indices are word indices, split by whitespace!
Problem: The checker slices by character indices. The checker comments even used to say "the indices are character indices"

ratio:overlap

Prompt example:Maintain a trigram overlap of 72% (±2%) with the provided reference text.
Problem: Code was doing nltk.ngrams(value, 3) on the raw string. ngrams takes in lists / sequences, so we were actually calculating character trigrams instead of word trigrams

custom:sentence_alphabet

Prompt example: Tell me a 26-sentence story where each sentence's first word starts with the letters of the alphabet in order.
I specifically found this annoying when going through failing samples. When a sentence starts with a quote here, we end up counting the quote as the "first letter"

words:words_position

Prompt example: The second word in your response and the second to last word in your response should be the word whisper.
Problem: Similar issue with punctuation. nltk tokens include leading / trailing punctuation. We need to account for this in the check

ratio:sentence_words

Prompt format: Respond with three sentences, all containing the same number of characters but using all different words.
Problem: Seems like the code was missing the "all different words" check.

keywords:multiple_words

Prompt format: Include keyword door once in your response, keyword bread twice in your response, keyword blue three times in your response, keyword lamp five times in your response, and keyword river seven times in your response.
Problem: small nit, but sometimes a word can appear as a substring of another word.

Other Issues

I know that words:start_verb has an issue too. The classifier sometimes will classify words like Run or Cultivate at the start of a sentence as not a verb.

jlu-figma and others added 2 commits July 16, 2026 20:35
Six check_following verifiers assign the wrong verdict; this fixes them and adds
regression tests to instructions_test.py. Full suite passes (65 tests); no new
dependencies.

False-fail (a correct response was rejected):
- repeat:repeat_span (RepeatSpanChecker): prompt says "word indices, split by
  whitespace" but the checker sliced character indices, so the target was a
  mid-word substring. Now slices whitespace words; description/defaults use word
  indices.
- ratio:overlap (NGramOverlapChecker): nltk.ngrams(value, 3) on the raw string
  produced character trigrams, not word trigrams. Now tokenizes into word
  trigrams.
- count:keywords_multiple (KeywordsMultipleChecker): value.lower().count(kw)
  counted substrings ("door" inside "doorway"/"indoors", any -ed/-s/-ing form).
  Now counts whole words with the same \b-bounded, case-insensitive match used
  by PersonNameCountChecker and IncludeKeywordChecker.
- custom:sentence_alphabet (SentenceAlphabetChecker): only lstrip() whitespace,
  so a first word wrapped in a quote made the quote the "first letter". Now
  strips leading punctuation.
- words:words_position (WordsPositionChecker): nltk tokens included leading and
  trailing punctuation, shifting the 2nd / 2nd-to-last word positions. Now uses
  the shared _word_tokens_without_punctuation helper.

False-pass (a wrong response was accepted):
- ratio:sentence_words (CharacterCountUniqueWordsChecker): never checked "all
  different words". Now enforces word uniqueness across the three sentences.
Fix six instruction verifiers that mis-score correct responses
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