Repository navigation
fix(security): keep red teaming results when the evaluator fails on an item - #2610
Conversation
…n item When the red teaming evaluator raises on an item (for example, the judge LLM call fails after its retries), the evaluation returns a plain EvalOutputItem with `error` set in place of a RedTeamingEvalOutputItem. RedTeamingRunner._build_flat_results raised ValueError on that item, so `nat red-team` stopped after every scenario had run and wrote no summary, results file or report. Record such an item as one failed evaluation, with its error message and no condition name, so the summary counts it under evaluation failures and leaves it out of the attack success rate, and the other items are still reported. An item of another type without an error is still rejected. Signed-off-by: Siddhant Rajhans <[email protected]>
|
Warning
Pull request policy: Only bug fixes may be opened as pull requests. |
|
No actionable comments were generated in the recent review. WalkthroughThe red-teaming runner now records evaluator error items as failed evaluations instead of stopping on those items. It includes scenario tags and group in failed-item and condition-level records. It still raises ChangesRed-team failure reporting
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk:
|
|
/ok to test 10231e5 |
|
/merge |
Description
Closes #2609
When the red teaming evaluator raises on an item (for example, the judge LLM call still fails after its retries),
BaseEvaluator.evaluatereturns a plainEvalOutputItemwitherrorset in its place.RedTeamingRunner._build_flat_resultsraisedValueErrorfor any item that is not aRedTeamingEvalOutputItem, sonat red-teamstopped after every scenario had run and wrote no summary, results file or report._build_flat_resultsnow records such an item as one failed evaluation: its error message, no condition name, and the score the evaluator returned._compute_result_summaryalready counts rows with anerror_messageunder evaluation failures and leaves them out of the attack success rate, and the report drops them before plotting, so the other items are reported as before. An item of another type without an error still raises. The scenario's tags and group are now looked up once per scenario, and yapf reflowed the existing record dict after that change.Tests, in
packages/nvidia_nat_security/tests/eval/runners/red_teaming_runner/test_red_teaming_runner.py:test_judge_failure_on_one_item_counts_as_failed_evaluationrunsRedTeamingEvaluatorwith a judge that raises on one of two items, then builds the flat results and the summary: one failed evaluation, one success, an attack success rate of 1.0, and both items counted for the scenario. It fails ondevelopwith theValueErrorfrom [BUG]: nat red-team stops without a summary or report when the red teaming evaluator fails on one item #2609.test_flat_results_reject_unexpected_item_without_errorkeeps the check for other item types.pytest packages/nvidia_nat_security/tests/eval: 39 passed.yapf0.43.0 andruff check0.15.0 are clean on the changed files. The reproducer in #2609 now completes, and the results file, summary and HTML report build from its output.By Submitting this PR I confirm:
Summary by CodeRabbit