BUG QuestionAnswerScorer counts a wrong option as correct when the answer appears inside a longer word or number
メンテナーはふだん 2 日以内に返信
関連するプルリクエストがすでにマージされています。
- #3159 @barkha1research-ai による — マージ済み
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 25/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 944
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 328
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG UnicodeReplacementConverter writes characters outside the BMP as invalid five-digit \u escapes対応中かも @ShivamSharma43 が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
microsoft/PyRIT#3095 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
-
BUG Configuration keeps runtime-status errors after polling recovers対応中かも @joeyvictorino が 3 日前に担当しました。 オープンBug: triage GUI help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
microsoft/PyRIT#2868 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG: MemoryInterface.get_request_from_response fails with IndexError for non-zero starting sequence or sequence gaps対応中かも @RohithPariki が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
-
Conversation editor never revokes blob URLs of removed attachments対応中かも @ManoharPaturi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
onyx-dot-app/onyx#16016 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
black --check exits 0 and prints All done when a multi file run is interrupted対応中かも @jiteshgulati が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
Non-positive worker counts wait for results without starting workers対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信