Clustering-Based Stateful Defences Won't Prevent Iterative Jailbreaking

Ivan Sabolić, Advik Raj Basani, Jasmijn Remmers, Rich Barton-Cooper, Yarin Gal, Eric Winsor, Xander DaviesarXiv 2026

TL;DR

Safety filters on AI models typically suffer from amnesia: they evaluate every prompt in isolation, allowing automated attackers to brute-force their way to a "jailbreak" over thousands of slightly tweaked attempts. Giving the defense a memory—by clustering similar prompts across all user traffic to catch iterative probing—looks like a silver bullet at first, dropping standard attack success rates to near zero. However, this paper reveals that memory is a double-edged sword: smart attackers can scatter their queries in semantic space, sweet-talk the cluster judge, or frame innocent users to force a denial-of-service.

What Problem Does This Paper Address?

Imagine a bouncer at a club who forgets your face the instant you step back in line. If you try 10,000 disguises, eventually one will fool him. Today’s LLM safety classifiers are mostly stateless—they judge each prompt $x_t$ completely independently of $x_1, \dots, x_{t-1}$.

Because of this blind spot, automated "iterative jailbreaking" algorithms—like PAIR (which uses an LLM to refine prompts) and Boundary Point Jailbreaking (BPJ, which evolves prompts using only a single bit of pass/fail feedback)—can relentlessly probe a defense across multiple accounts until a harmful query slips through.

The natural fix is a stateful classifier that remembers past queries across all global traffic, groups suspiciously similar ones together, and shuts down emerging attacks. While stateful defenses exist in computer vision and for multi-part "decomposition" attacks in LLMs, nobody had systematically tested how well clustering-based stateful defenses stop iterative jailbreaking—or how an attacker might fight back.

Methods

The authors first implement a standard clustering-based stateful defense (adapted from recent literature, alongside a hierarchical Clio-style variant). Every incoming query faces a standard stateless LLM classifier, and gets mapped into an embedding space. If a cluster of similar embeddings reaches a certain size ($m=5$), it escalates to a second LLM—the "cluster classifier"—which reads the group of queries together. If judged malicious, that entire region of embedding space is permanently blocked.

Diagram of how clustering-based stateful defenses group and block iterative attack variations hidden in a query stream.

While this crushes standard iterative attacks, the authors introduce three novel adaptive attacks—each subverting a core requirement of the defense:

  1. Query Dispersion (Subverting Clustering): Using a local surrogate embedding model, the attacker wraps each harmful query in shifting benign prefixes and suffixes (a "carrier"). This scatters the attack queries across embedding space so no single cluster ever grows large enough to trigger review, while still allowing iterative optimization to progress.
  2. Cluster Classifier Bypass (Subverting the Judge): Offline, the attacker optimizes a fixed transferable prefix against a surrogate judge. Prepended to every query, it tricks the defense's cluster classifier into reading the entire cluster of attack iterations as benign, leaving the attacker free to iterate against the single-query classifier.
  3. Blocking Cost Inflation (Weaponizing False Positives): Instead of hiding, the attacker wraps harmful queries in benign text about a specific, popular topic (e.g., gradient descent). The queries route directly into legitimate user clusters, tricking the defense into banning that cluster—and locking out every innocent user asking about machine learning.

Datasets

No new benchmarks were introduced. To evaluate attack success, the authors tested 35 harmful behaviors from HarmBench spanning cybercrime, weapons, violence, and hate speech (specifically selecting harder-to-break behaviors). To measure false positive rates (FPR) on innocent users, they interleaved attacks into a pool of 560,144 real-world benign prompts drawn from LMSYS-Chat-1M, WildChat-1M, OpenAssistant, ShareGPT, and ToxicChat.

Key Insights and Ideas

  • Semantic camouflage beats geometric defenses: In computer vision, changing an image enough to fool a distance detector usually ruins the attack. In text, wrapping a bomb-making prompt inside diverse benign paragraphs shifts its embedding dramatically while leaving the core iterative search intact.
  • Even internal representations aren't safe: You might think clustering inside the safety classifier's own middle-layer latent space (using Qwen3Guard) would trap Query Dispersion—since the attack needs queries to stay near the classifier's decision boundary while staying far apart in clustering space. Remarkably, the dispersion attack still succeeds.
  • Black-box transferability holds: Attackers don't need insider knowledge. Query Dispersion works even when the attacker's surrogate embedder is a completely different architecture from the defender's, and without knowing exact cluster thresholds.
  • Stateful memory creates a DoS vector: By linking global user traffic without account metadata, the defense hands attackers a steering wheel to weaponize moderation against arbitrary benign topics.

Key Results

  • Unadapted attacks hit a wall: Adding stateful clustering slashes BPJ’s Attack Success Rate (ASR) from 77% to 0%, and PAIR’s from 80% to 9%.
  • Adaptive attacks break right back through: Against the stateful defense, Query Dispersion achieves 97% ASR (BPJ) and 100% ASR (PAIR). Cluster Classifier Bypass hits 100% ASR with both algorithms, with zero attack clusters blocked over 250,000 queries.
Figure 1. Standard iterative attacks succeed against a stateless classifier but largely fail against a stateful defence (a); our attacks adapt iterative attacks to succeed against the stateful defence (b). Each line shows the fraction of behaviours the attack has broken after a given budget of query iterations.
  • Alternative defenses also fall: Against a multi-facet, hierarchical Clio-style defense, Query Dispersion still achieves 94% ASR, and mismatched surrogate embedders still yield 89%–91% ASR.
  • High collateral damage: In Blocking Cost Inflation, an attacker controlling just 250 queries (0.1% of traffic) inflates the system's false-positive rate by 5.2 percentage points (nearly doubling the baseline stateful FPR of 3.5%).

Limitations and Future Work

The authors note that both defenses they studied rely on embedding similarity; stateful systems that link queries via other mechanisms (or incorporate account metadata) may not share these vulnerabilities. Furthermore, their defenses used prompted general-purpose models rather than purpose-trained production classifiers (like Constitutional Classifiers++), and they did not measure real-world deployment latency or compute overhead. Even without an attack, the baseline stateful defense blocked 3.5% of benign traffic (vs. 0.35% for stateless), leaving prompt refinement and low-FPR stateful architectures as urgent open problems for future work.

Summary updated

BibTeX
@misc{sabolic2026clustering,
  author = {Ivan Sabolić and Advik Raj Basani and Jasmijn Remmers and Rich Barton-Cooper and Yarin Gal and Eric Winsor and Xander Davies},
  title = {{Clustering-Based Stateful Defences Won't Prevent Iterative Jailbreaking}},
  year = {2026},
  eprint = {2611.35163},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.35163},
}
Figure