Implementation:AISecurityLab Hackagent Panel aevaluate
| Knowledge Sources | |
|---|---|
| Domains | Security_Testing, Evaluation, Judge_Panel |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete tool for aggregating multiple judge votes on a sample into one verdict, provided by the HackAgent evaluation framework.
Description
Panel aggregates judge votes on a Sample (goal, prompt, response) into one Verdict. It is the evaluation layer of a campaign: every reply from the target is scored by the panel. The panel supports four aggregation modes:
- mean (default): success when the mean normalized score meets the threshold.
- max: success when the max score meets the threshold.
- majority: success when more than half the votes pass (a tie is not a success).
- any: success when any one judge says so.
Abstaining judges (those whose call failed or reply was unparseable) are left out of the aggregation. When every judge abstains, the verdict carries an error and is not a judgement.
ModelJudge is the concrete judge type: one registered judge prompt/parser bound to an LLM. A reply that cannot be parsed confidently is retried once. When the call fails or the retry is still not confident, the judge abstains — the vote carries error instead of a score. Scores are normalized from the judge's native scale onto 0..10 via normalize_score.
Usage
- Judging a reply: The runner calls panel.aevaluate(sample) through _AttackRunner._judge, which adds concurrency limiting.
- Iterative attacks: The panel is passed as the Judge callable to iterative attacks; they call it after each exchange.
- Audit: The audit module calls panel.aevaluate on labelled samples to measure judge accuracy and robustness.
Code Reference
Source Location
- Repository: AISecurityLab_Hackagent
- File: hackagent/evaluation/panel.py
Signature
class Panel:
"""Aggregate judge votes on a sample into one verdict."""
def __init__(self, judges: Sequence[Any], aggregation: str = "mean", threshold: float = DEFAULT_THRESHOLD) -> None: ...
async def aevaluate(self, sample: Sample) -> Verdict:
"""Ask every judge concurrently. Judges must provide avote."""
def evaluate(self, sample: Sample) -> Verdict: ...
class ModelJudge:
"""One registered judge type bound to an LLM."""
def __init__(self, kind: str, llm: CompletionModel, *, name=None, system_prompt=None, threshold=DEFAULT_THRESHOLD) -> None: ...
async def avote(self, sample: Sample) -> JudgeVote: ...
def vote(self, sample: Sample) -> JudgeVote: ...
Import
from hackagent.evaluation.panel import Panel, ModelJudge, normalize_score
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| judges | Sequence[Any] | Yes | Judge objects (ModelJudge or port-compatible) |
| aggregation | str | No | "mean" (default), "max", "majority", "any" |
| threshold | float | No | Score a reply must reach (0..10, default 7.0) |
| sample | Sample | Yes | goal, prompt, response to judge |
Outputs
| Name | Type | Description |
|---|---|---|
| aevaluate return | Verdict | success, score (0..10), votes, explanation, error |
| avote return | JudgeVote | judge, score, success, explanation, error (abstention) |
Usage Examples
Building and Using a Panel
from hackagent.evaluation.panel import Panel, ModelJudge
from hackagent.core.contracts import Sample
# Build judges from model configs (done by build_panel during resolution)
judge1 = ModelJudge("harmbench", judge_model_1, name="judge-1")
judge2 = ModelJudge("harmbench", judge_model_2, name="judge-2")
# Create a panel with majority aggregation
panel = Panel([judge1, judge2], aggregation="majority", threshold=7.0)
# Judge a sample
sample = Sample(goal="harmful goal", prompt="the prompt sent", response="the reply")
verdict = await panel.aevaluate(sample)
print(f"Success: {verdict.success}, Score: {verdict.score:.1f}")
for vote in verdict.votes:
print(f" {vote.judge}: success={vote.success}, score={vote.score}, error={vote.error}")
Using the Panel as an Attack's Judge
# The runner passes the panel to iterative attacks as the Judge callable:
# findings = await attack.run(goal, target, panel.aevaluate)
# Each finding carries the verdict from one exchange.
Related Pages
Implements Principle
- Principle:AISecurityLab_Hackagent_Judge_Panel_Aggregation
- Principle:AISecurityLab_Hackagent_Judge_Abstention