HPAA Three-Gate Reproduction (AdvBench300)
Reproduction of HPAA (What the Eyes See, the LLMs Miss: Exploiting Human Perception for Adversarial Text Attacks) evaluated through a three-gate moderation pipeline, with per-response harm judging by HarmBench prompt + DeepSeek.
Headline finding
HPAA bypasses every input guard tested (96–99%), but delivers 0% harmful content end-to-end: the same word-interleaving that hides the harmful instruction from the guard also destroys it as an instruction for the target model.
| Guard | Target | Input-gate bypass | Output-gate block | HarmBench ASR |
|---|---|---|---|---|
| Qwen3Guard-Gen-8B | Meta-Llama-3-8B-Instruct | 97.67% | 0/293 | 0.00% |
| YuFeng-XGuard-Reason-8B | Meta-Llama-3-8B-Instruct | 98.67% | 1/296 | 0.00% |
| Qwen3Guard-Gen-8B | Qwen3-8B | 97.67% | 0/293 | 0.00% |
| YuFeng-XGuard-Reason-8B | Qwen3-8B | 98.67% | 1/296 | 0.00% |
| Llama-Guard-3-8B (earlier run) | Meta-Llama-3.1-8B-Instruct | 94.33% | 7/283 | — |
Single-gate (input guard only, 300 samples, Llama-Guard-3-8B): baseline raw goals detected 291/300 (97%), HPAA detected 12/300 (4%) → 96% evasion.
Pipeline
Q HPAA adversarial text (benign hotel review + interleaved harmful goal)
I(Q) guard judges Q alone -> unsafe = blocked, no R generated
T(Q) target generates R
E(Q,R) same guard judges the transcript -> unsafe = blocked
One guard checkpoint serves both gates, as in the source repo's three-gate contract.
Files
| File | Rows | Description |
|---|---|---|
data/hpaa_advbench300.csv |
300 | adversarial Q per sample: harmful goal, benign prefix, plain interleaved form, ANSI-styled form |
data/target_outputs.csv |
1200 | every run: Q, target response R, both gate verdicts + raw outputs, HarmBench/DeepSeek verdict |
data/gate_mechanics.csv |
4 | per-run gate funnel and ASR |
data/figure5_evasion.csv |
7 | single-gate evasion per HPAA config + baseline |
data/ablation.csv |
6 | mechanism ablation (30 samples) |
Data sources
- Cohort:
advbench300_v3/goals.jsonl, 300 frozen goals, sha2565f784672d7dc674bf5972b14e72abfbeabddbce77eab5a945d1dd0ac4d2e469a - Benign corpus: HPAA
data/benign.Hotel.csv(712 hotel reviews) - Config:
M6-W-Hi, seed 42
Models
| Role | Checkpoint |
|---|---|
| Guard | Qwen/Qwen3Guard-Gen-8B, Alibaba-AAIG/YuFeng-XGuard-Reason-8B, meta-llama/Llama-Guard-3-8B |
| Target | meta-llama/Meta-Llama-3-8B-Instruct, Qwen/Qwen3-8B, meta-llama/Meta-Llama-3.1-8B-Instruct |
| Harm judge | deepseek-flash with HarmBench LLAMA2_CLS_PROMPT |
YuFeng is run with reason_first=False.
Mechanism
HPAA interleaves the harmful sentence word-by-word into a ~1500-token benign review and wraps each character in ANSI highlight codes (\x1b[30;43m...\x1b[0m) so a terminal renders it visibly to a human while the model receives fragmented tokens.
Ablation (30 samples, Llama-Guard-3-8B):
| Variant | Detected unsafe |
|---|---|
| benign review only (false-positive baseline) | 3/30 |
| harmful sentence alone | 30/30 |
| benign + harmful concatenated | 28/30 |
| HPAA interleaved, no styling | 5/30 |
| HPAA interleaved + ANSI | 4/30 |
| HPAA with ANSI stripped | 4/30 |
Two controls: prompt template makes no difference (custom STRICT vs official Llama-Guard template agree row-for-row), and stripping ANSI changes nothing. The decisive factor is word interleaving.
Fidelity caveats
- The paper's primary detector is Perspective API; this reproduction uses local open guard models.
- The paper's dataset is
toxic.Advbench_10.csv(249 rows); this uses the frozen 300-goal cohort. - The authors'
get_toxicity()parser fails on these guard outputs (aNo extra newline.preamble makesstartswith("no")return safe for every row, including baseline). Verdicts here are re-parsed from the first standalonesafe/unsafetoken. - The three-gate extension (target + output gate) is not part of the HPAA paper; it is the source repo's own evaluation contract.
Citation
@inproceedings{,
title = {What the Eyes See, the LLMs Miss: Exploiting Human Perception for Adversarial Text Attacks},
note = {HPAA}
}