BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracy
维护者通常 2 天内回复
@its-amann 已经在做这个了。
开始于 2026年10月21日。
评估
调研方向
从 pyrit/score/scorer_evaluation/scorer_evaluator.py 中的 run_evaluation_async() 开始,追踪 human_labeled_datasets_files 模式如何选择 CSV。为重叠和重复模式添加回归测试,同时保留版本字符串相同的不同文件;验证两种配置都会评估两个响应,准确率为 0.5。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Overlapping human_labeled_datasets_files patterns load the same CSV more than once in run_evaluation_async(), changing sample weights and reported accuracy. For the same two files and deterministic scorer, adding an already-matched filename changes accuracy from 0.5 to 0.6667.
Steps/Code to Reproduce
No model API or external dataset needed. Only the dataset root is redirected; loading, scoring, and metrics use the real implementations.
import asyncio
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch
from pyrit.memory import CentralMemory, SQLiteMemory
from pyrit.score import RegistryUpdateBehavior, SubStringScorer
from pyrit.score.scorer_evaluation import scorer_evaluator as se
async def run_async(root: Path) -> None:
try:
with patch.object(se, "SCORER_EVALS_PATH", root):
for patterns in (["*.csv"], ["*.csv", "a.csv"]):
evaluator = se.ObjectiveScorerEvaluator(SubStringScorer(substring="marker"))
result = await evaluator.run_evaluation_async(
dataset_files=se.ScorerEvalDatasetFiles(
human_labeled_datasets_files=patterns, result_file="unused.jsonl"
),
num_scorer_trials=1,
update_registry_behavior=RegistryUpdateBehavior.NEVER_UPDATE,
)
print(patterns, result.num_responses, round(float(result.accuracy), 4))
finally:
await CentralMemory.get_memory_instance().dispose_engine_async()
with TemporaryDirectory() as directory:
root = Path(directory)
for name, label in [("a.csv", 1), ("b.csv", 0)]:
(root / name).write_text(
"# dataset_version=1.0\nassistant_response,objective,human_score\n"
f"marker,Synthetic objective,{label}\n",
encoding="utf-8",
)
CentralMemory.set_memory_instance(SQLiteMemory(db_path=":memory:", silent=True))
asyncio.run(run_async(root))
Expected Results
Both configurations evaluate the same two responses, with accuracy 0.5.
Actual Results
['*.csv'] 2 0.5
['*.csv', 'a.csv'] 3 0.6667
Would deduplicating matched paths before loading be appropriate? I'd keep distinct files with equal version strings intact and add regression tests for overlapping and repeated patterns. I'd like to take this if you mark it ready for contribution; I'll wait for triage before preparing a PR.
Versions
macOS ARM64, Python 3.12.13, PyRIT 1.2.0.dev0 (ac196e57, main), numpy 2.4.6, pandas 3.0.6, scipy 1.17.1. Dependencies installed with uv sync --locked --no-dev.
AI-assisted investigation; the reproduction above was executed locally against unmodified source.
- 主要语言
- Python
- 星标
- 4.6k
- 派生
- 962
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 398
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/PyRIT 的其他 Issue
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>可能已有人在做 @aatif101 于 2 天前认领。 未关闭Bug: triage
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/PyRIT#3343 · 2 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every request可能已有人在做 @ShivamSharma43 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
维护者通常 2 天内回复
-
BUG: KeywordSelectionStrategy accepts a negative context, so SelectiveTextConverter duplicates or truncates the prompt可能已有人在做 @ShivamSharma43 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
维护者通常 2 天内回复
-
BUG: PackageHallucinationScorer flags Rust std paths, type names and hyphenated crates as hallucinated可能已有人在做 @nniiovoo 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 2 天内回复
-
BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchanged可能已有人在做 @ShivamSharma43 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
维护者通常 2 天内回复
相似的 Issue
-
comp/tools P2 type/bug
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-agent#142908 · 1 条评论 ·
-
[oblt-aw][autodoc] Fix malformed headings in new Buildkite docs pages可能已有人在做 @github-actions 今天认领。 未关闭documentation
难度 1/5 1 小时以内 新手友好度 83/100
维护者通常 1 天内回复
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offline可能已有人在做 @r2jaff 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
ComposioHQ/composio#5054 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
pytorch/tensordict#3286 ·
维护者通常 1 天内回复