BUG QuestionAnswerScorer counts a wrong option as correct when the answer appears inside a longer word or number
Les mainteneurs répondent en général sous 2 jours
Une pull request liée a déjà été fusionnée.
- #3159 par @barkha1research-ai — fusionnée
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 25/100
Piste de recherche
Start by reading QuestionAnswerScorer and the AnswerMatches matching logic; reproduce the reported case with the provided scorer snippet. Check the scorer tests for substring matching and add coverage for answers embedded in longer words or numbers. Done means the correct option still scores True while the wrong option containing it scores False; pull request #3159 is already open for this issue.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
QuestionAnswerScorer checks its patterns with a plain substring test (text.lower() in response.lower()), so the correct answer also matches when it is only part of a longer word or number. A response that picks a wrong option is then scored as correct.
For example, with the correct answer 1, the response Option 2: 1000 scores True because 1000 contains 1. The same happens with 10000 inside 1000000, Vitamin B inside Vitamin B12, and the label pattern 1: inside 11:.
I ran the scorer over the WMDP test set (3,668 questions, the dataset used in the benchmark docs), answering each wrong option in the benchmark's Option {index}: {choice} format. 183 wrong answers, across 135 questions, are scored as correct.
Steps/Code to Reproduce
import asyncio
from pyrit.models import AnswerMatches, ContentScorable, ScoringExpectation
from pyrit.score import QuestionAnswerScorer
from pyrit.setup import IN_MEMORY, initialize_pyrit_async
async def main():
await initialize_pyrit_async(memory_db_type=IN_MEMORY)
scorer = QuestionAnswerScorer()
expectation = ScoringExpectation(
conditions=[
AnswerMatches(
correct_answer="1",
correct_answer_label="1",
)
]
)
for response in ["Option 1: 1", "Option 2: 1000"]:
scores = await scorer.score_async(
scorable=ContentScorable(value=response),
expectation=expectation,
)
print(f"{response!r}: {scores[0].get_value()}")
asyncio.run(main())
Expected Results
'Option 1: 1': True
'Option 2: 1000': False
Actual Results
'Option 1: 1': True
'Option 2: 1000': True
Versions
- PyRIT version: installed from main (
93bf08e4) in editable mode - Python version: 3.12
I have a fix that only matches the answer when it is not part of a longer word, and would like to open a PR for it.
- Langage dominant
- Python
- Étoiles
- 4.7k
- Forks
- 1k
- Merge moyen
- 2 j 2 h
- PR mergées (30 j)
- 439
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/PyRIT
-
BUG: LLMGenericTextConverter identifier changes between processes for set-valued template parametersOuverteBug: triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 2 jours
-
Bug: triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 2 jours
-
Description-only preset edits split comma-containing exact goals into separate goalsPeut-être pris @MRX-72 l’a pris il y a 1 jour. Ouvertehelp wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 2 jours
-
GUI rejects valid empty-string SearchReplaceConverter settings, preventing deletion convertersPeut-être pris @Darshika140 l’a pris aujourd’hui. Ouvertehelp wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
microsoft/PyRIT#3749 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
HTML scenario export replaces an intentionally empty converted message with the original textPeut-être pris @VISHNU0906 l’a pris il y a 1 jour. Ouvertehelp wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
microsoft/PyRIT#3741 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de microsoft/PyRIT
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
aws/sagemaker-python-sdk#6554 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
huggingface/diffusers#15170 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG] LLM conflict check ignores MNEMOSYNE_LLM_MAX_TOKENS, so reasoning models return empty repliesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
mnemosyne-oss/mnemosyne#1325 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement meshtastic-2.8
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
pskillen/meshflow-api#459 ·