Heuristic:AISecurityLab Hackagent Calibration Revision Pinning
| Knowledge Sources | |
|---|---|
| Domains | Evaluation, Reproducibility, Judge_Panel |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Calibration datasets are pinned to a fixed Git revision so a judge's measured accuracy means the same thing across runs and over time, preventing silent drift from upstream dataset changes.
Description
When auditing a judge panel against human-labelled samples, the calibration dataset (e.g., HarmBench's classifier validation set) is fetched from an external repository. That repository changes over time — rows are added, labels are corrected, formats shift. If the audit fetches the latest version each time, a judge's measured precision today could differ from yesterday's for no reason related to the judge itself.
HackAgent pins the calibration dataset to a fixed Git revision (DEFAULT_HARMBENCH_REVISION). The revision is a full commit hash, so the downloaded content is byte-for-byte identical on every run. Downloads are cached locally under ~/.cache/hackagent/calibration/<revision>, so later runs read from disk without re-downloading.
The revision is overridable via CalibrationSpec.revision for users who need to track upstream or compare against a specific dataset version, but the default ensures reproducibility out of the box.
= Usage
Use this heuristic whenever you audit a judge panel. It is applied automatically by load_calibration — the default revision is pinned. Override evaluation.audit.dataset.revision only when you intentionally need a different dataset version (e.g., comparing a new judge against the latest HarmBench release). Keep the default (sample_size=100, seed=42, pinned revision) for repeatable audits.
The Insight (Rule of Thumb)
- Action: Leave evaluation.audit.dataset.revision at its default (the pinned commit hash). Override only with a full commit hash, never a branch name.
- Value: DEFAULT_HARMBENCH_REVISION = "8e1604d1171fe8a48d8febecd22f600e462bdcdd"
- Trade-off: Pinning means the audit uses a fixed snapshot; it will not pick up upstream label corrections or new behaviours. This is intentional — reproducibility matters more than freshness for calibration. Override when you need the latest data, but document the revision you used.
- Caching: Downloaded data is cached per-revision at ~/.cache/hackagent/calibration/<revision>/. Changing the revision triggers a fresh download.
Reasoning
A judge audit reports accuracy metrics (precision, recall, f1). These numbers are only meaningful if the ground truth is stable. If the calibration dataset changes between runs — new behaviours added, labels flipped, format changed — a judge's measured accuracy could shift by several percentage points for reasons that have nothing to do with the judge. This makes it impossible to tell whether a change in metrics is due to a judge update or a dataset update.
Pinning to a commit hash eliminates this ambiguity. The same CalibrationSpec always produces the same sample (the stratified sampling seed is also fixed), so a judge's measured precision today is comparable to last month's. When a new HarmBench revision is desired, the user changes the revision explicitly and the comparison baseline shifts knowingly.
The local cache avoids repeated downloads and network dependency: once a revision is downloaded, audits run offline.
Code Evidence
Pinned revision from calibration.py:33-37:
HARMBENCH_RAW_URL = (
"https://raw.githubusercontent.com/centerforaisafety/HarmBench/{revision}"
)
#: Pinned so a judge's measured precision means the same thing next month.
DEFAULT_HARMBENCH_REVISION = "8e1604d1171fe8a48d8febecd22f600e462bdcdd"
Per-revision caching from calibration.py:101-103, 171-185:
root = (cache_dir or _default_cache_dir()) / revision.replace("/", "_")
validation = json.loads(_cached(f"{base}/{_VALIDATION_PATH}", root, timeout))
def _default_cache_dir() -> Path:
return Path.home() / ".cache" / "hackagent" / "calibration"
def _cached(url: str, root: Path, timeout: float) -> str:
"""Download ``url`` once; later calls read the copy on disk."""
path = root / url.rsplit("/", 1)[-1]
if path.exists():
return path.read_text(encoding="utf-8")
...
Revision field in CalibrationSpec from calibration.py:55-58:
revision: str = Field(
default=DEFAULT_HARMBENCH_REVISION,
description="Git revision of the source repository, pinned for reproducibility.",
)