azure-ai-evaluation: PromptyEvaluatorBase falls back to the first digit anywhere in the judge's reply, and the threshold turns a stray digit into a wrong pass/fail (15 evaluators)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- ai, testing-qa
Hướng nghiên cứu
Lỗi nằm trong sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py tại dòng 196-198. Bắt đầu bằng cách đọc phương thức _do_eval và hiểu về fallback regex. Viết một bài kiểm tra tái tạo các phản hồi của giám khảo có vấn đề được liệt kê trong issue. Bản sửa lỗi nên cải thiện regex để tìm điểm số dự định, không phải chữ số đầu tiên. Kiểm tra mười lăm bộ đánh giá kế thừa từ PromptyEvaluatorBase để đảm bảo bản sửa lỗi áp dụng cho tất cả. Chạy các bài kiểm tra hiện có để xác minh không có hồi quy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py (HEAD 4993311), _do_eval:
- line 188 — structured path:
score = parsed_output.get("score", math.nan)✓ - lines 196-198 — fallback when the reply is not parseable JSON:
match = re.search(r"\d", llm_output) if match: score = float(match.group()) - lines 115-123 — the score is then compared to
self._threshold(default 3) to produce the boolean result.
re.search(r"\d", …) returns the first digit anywhere in the text. The prompts ask for a bare integer, but nothing enforces it, and judge models routinely add reasoning before the number.
Measured
The fallback expression executed verbatim, with the threshold applied as at lines 115-123:
reply first-digit score >= 3 ?
'5' 5.0 pass (correct)
'The answer is grounded. 5' 5.0 pass (correct)
'The answer makes 3 claims, all supported by the context. Score: 5' 3.0 pass (score wrong: judge said 5)
'2 of the statements are unsupported, so this is not grounded: 1' 2.0 fail (score wrong: judge said 1)
'Score: 4 (one minor gap)' 4.0 pass (correct)
'10 out of 10' 1.0 fail (wrong: reads "10" as 1)
'0' 0.0 fail (out of range, no check)
Rows 3 and 4 are the point: the judge's verdict is correct, the recorded score is a number lifted from its explanation, and the pass/fail derived from it can differ from what the judge concluded. There is also no range check, so 0 and 7 are accepted on a 1–5 scale, and 10 becomes 1.
Stated plainly: I ran the fallback expression rather than importing the package; it is a two-line regex and the class wrapper does not alter it.
Who inherits this
grep -rl PromptyEvaluatorBase _evaluators/ — fifteen: coherence, fluency, groundedness, intent_resolution, relevance, response_completeness, retrieval, similarity, task_adherence, task_completion, tool_call_accuracy, tool_call_success, tool_input_accuracy, tool_output_utilization, tool_selection. One base class, one fix site.
Related
The deprecated promptflow-evals carried the identical re.search(r"\d") in five evaluators; this SDK inherited it into the base class and added the threshold on top, which is what turns a wrong number into a wrong verdict.
Suggested fix
In the fallback, prefer an anchored or labelled match before a bare digit: re.fullmatch(r"\s*(\d+)\s*", llm_output) (the whole reply is the number), then re.search(r"[Ss]core\s*[:=]?\s*(\d+)", llm_output), then the last number in the reply rather than the first; validate the result against the evaluator's declared range and return math.nan (which the aggregation already skips) with the raw reply in the reason field when it fails. One parametrized test with rows 3 and 4 above would pin it.
Happy to open the PR.
- Ngôn ngữ chính
- Python
- Star
- 5.6k
- Fork
- 3.4k
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 214
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
- Đọ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 Azure/azure-sdk-for-python
-
Evaluation Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Azure/azure-sdk-for-python#49190 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update CODEOWNERSĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Azure/azure-sdk-for-python#49183 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Search Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Azure/azure-sdk-for-python#48555 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Azure.Core customer-reported feature-request needs-team-attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Azure/azure-sdk-for-python#47186 ·
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 68/100
Azure/azure-sdk-for-python#46697 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/azure-sdk-for-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
PedestrianDynamics/pyFDS-Evac#343 ·
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 88/100
theskumar/python-dotenv#708 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Docs Timedelta
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pandas-dev/pandas#69919 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
API documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
zephyrproject-rtos/west#1009 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày