BUG: PackageHallucinationScorer flags Rust std paths, type names and hyphenated crates as hallucinated
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by locating PackageHallucinationScorer and the Rust ecosystem handling described in the issue; compare its known package entries with garak's rust_std_entries. Reproduce the provided example, then check that standard paths and type names are ignored, hyphenated registry names match Rust underscores, and ghost_db remains flagged. A linked pull request (#3439) is already open.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
For Rust, the scorer counts every name:: in the answer as a crate. So std modules (collections from std::collections, thread from thread::spawn), type names (HashMap::new, String::from) and crate:: / super:: are all reported as hallucinated packages. Crates that have a - in the registry, like actix-web, never match either, because Rust code can only write them as actix_web.
Rust is the default language of the PackageHallucination scenario, so ordinary Rust answers are often scored True. With the crates.io list the scenario loads (crates-20250307), 347 of 368 examples/*.rs files from 100 published crates score True, although they only use real crates.
garak also adds its rust_std_entries list to the known set. The PyRIT port only adds alloc, core, proc_macro, std and test.
Steps/Code to Reproduce
import asyncio
from pyrit.models import Message
from pyrit.score import PackageEcosystem, PackageHallucinationScorer
from pyrit.setup import IN_MEMORY, initialize_pyrit_async
answer = """use std::collections::HashMap;
use std::thread;
use actix_web::{web, App, HttpServer};
fn main() {
let mut counts = HashMap::new();
counts.insert(String::from("a"), 1);
thread::spawn(|| println!("done")).join().unwrap();
}
"""
async def main():
await initialize_pyrit_async(memory_db_type=IN_MEMORY)
# the crates.io registry lists the crate as "actix-web"
scorer = PackageHallucinationScorer(known_packages={"actix-web"}, ecosystem=PackageEcosystem.RUST)
message = Message.from_prompt(prompt=answer, role="assistant")
message.set_response_not_in_memory()
score = (await scorer.score_message_async(message=message))[0]
print(score.get_value(), score.score_metadata["hallucinated_packages"])
asyncio.run(main())
Expected Results
False
Actual Results
True HashMap, String, actix_web, collections, thread
Versions
- OS: macOS 26.4.1 (arm64)
- Python 3.13.16
- PyRIT 1.2.0.dev0, editable install at f44327ab; scorer identical to current main (ac196e57)
The fix is to count only the root of a path, skip bare UpperCamelCase roots (types), add garak's std entries, and match registry names with - as _. A made-up crate like use ghost_db::Client; is still flagged.
- Ngôn ngữ chính
- Python
- Star
- 4.6k
- Fork
- 962
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 417
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/PyRIT
-
BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracyCó thể đã có người làm @its-amann đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/PyRIT#3430 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>Có thể đã có người làm @aatif101 đã nhận 2 ngày trước. Đang mởBug: triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/PyRIT#3343 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every requestCó thể đã có người làm @ShivamSharma43 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: KeywordSelectionStrategy accepts a negative context, so SelectiveTextConverter duplicates or truncates the promptCó thể đã có người làm @ShivamSharma43 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchangedCó thể đã có người làm @ShivamSharma43 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/PyRIT
Issue tương tự
-
follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Download helper still uses huggingface_hub arguments removed in 1.0: USE_SYMLINKS is silently ignored and every download ends with a WinError 3 lineCó thể đã có người làm @li-lizhe đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
IPv6 node addresses produce an invalid request URLCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
typesense/typesense-python#154 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
elastic/elasticsearch-py#3592 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
developmentseed/titiler-cmr#250 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày