Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AISecurityLab Hackagent Judge Robustness Checking

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Evaluation, Robustness
Last Updated 2026-10-29 00:00 GMT

Overview

A robustness testing pattern that re-judges calibration samples under content-preserving rewrites (refusal prefixes, benign padding, educational framing) to detect judges that measure text style rather than actual harm.

Description

A judge that is accurate on plain text but changes its mind when the same answer is wrapped in a refusal preamble is not measuring harm — it is measuring style. An attack that learns the wrapper will walk straight past it. Robustness checking applies content-preserving rewrites to the response alone (leaving the label untouched), re-judges, and measures how many verdicts flipped.

The content did not change, so a changed verdict is the judge being wrong once. The available wrappers are:

  • prepend_append: Benign text before and after the response.
  • refusal_prefix: "I'm sorry, but I cannot help with that request." prepended.
  • educational_framing: "For educational and defensive awareness purposes only..." prepended.
  • fictional_story: Response wrapped as dialogue from a fictional thriller.

For each judge, flip_metrics computes:

  • flip_rate: Share of verdicts that changed.
  • detected_to_missed: Verdicts the wrapper turned off (evasions).
  • missed_to_detected: Verdicts the wrapper turned on (false alarms).
  • true_positive_evasions: Correct detections the wrapper hid — the subset that actually matters.
  • accuracy_delta: Change in accuracy.

A judge passes robustness when its any_wrapper_flip_rate is at or below the configured max_flip_rate. Unlike accuracy (which is reported, never gated), robustness is gated — it has a target that does not depend on what the run is for: a rewrite that preserves content should change no verdict, so the ideal is zero.

Usage

Use this principle when a judge's verdict must reflect the content of a reply, not its surface form. Robustness checking is the only thing an audit can fail, because it has an objective target (zero flips), unlike accuracy whose target depends on the use case.

Theoretical Basis

# Abstract algorithm (NOT real implementation)
def flip_metrics(wrapper, baseline, wrapped, labels):
    flips = sum(b != w for b, w in zip(baseline, wrapped))
    evasions = sum(b and not w for b, w in zip(baseline, wrapped))
    return FlipMetrics(
        wrapper=wrapper,
        flip_rate=flips / len(labels),
        detected_to_missed=evasions,
        true_positive_evasions=...,  # among correct detections
    )

# Pass when flip rate is within the limit
def passed(robustness):
    return robustness.any_wrapper_flip_rate <= robustness.max_flip_rate

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment