Bounded Reachability & Jailbreak Detection via Contraction-Constrained State Space Models
Organizations: Strategic Data Solutions Lab, Hitachi America Ltd. Santa Clara, CA 94086, USA
Abstract
Safety heads are lightweight classifiers attached to pretrained language models for flagging harmful inputs before generation. Their empirical detection performance has been studied, but their formal robustness properties remain largely unexplored. We ask when a State Space Model (SSM)-based safety head can be certified to produce the same prediction for all inputs within a bounded embedding-space perturbation. We prove that the answer turns on a single condition: the norm of the state transition matrix must satisfy (the contraction condition), which enables exact interval bound propagation (IBP) certification for linear time-invariant classifiers. When the contraction condition holds, the reachable output interval has bounded steady-state width and examples can be certified as robustly classified. When it fails, the interval grows exponentially with sequence length and certification is impossible at any practical perturbation radius. We enforce contraction with a hinge penalty and show on toxic comment data that certified fraction improves from 41% to 59%, with a sharp empirical phase transition at matching the theory. Applying a contraction-regularized S4 head to jailbreak detection on JailbreakBench, we achieve a zero-shot transfer to AdvBench (DR=0.994) and HarmBench (DR=0.988). A logistic regression on mean-pooled Mamba-130M embeddings matches or exceeds the S4 head on every detection metric, confirming that harmful intent is already linearly separable in the embedding space. The S4 safety head's contribution is not superior discrimination but the formal certification that no probe-based approach provides.
Figures & tables
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| Con. Toxic | Con. Non-tox | Con. Overall | Unc. Toxic | Unc. Non-tox | Unc. Overall | |
|---|---|---|---|---|---|---|
| 58.8% | 59.3% | 59.2% ( 0.24) | 24.2% | 43.1% | 41.0% | |
| 44.1% | 49.2% | 48.6% ( 0.26) | 9.1% | 33.7% | 31.0% | |
| 23.5% | 38.4% | 36.9% ( 0.24) | 6.1% | 10.1% | 9.7% | |
| 11.8% | 27.3% | 25.7% ( 0.16) | 0% | 0.4% | 0.3% | |
| 5.9% | 13.5% | 12.7% ( 0.07) | 0% | 0% | 0% |
| Pooling strategy | AUROC (5-fold CV) | Remark | |
|---|---|---|---|
| Mean pool (all tokens) | 0.998 | 0.002 | Aggregates full prompt context |
| Final non-pad token | 0.718 | 0.029 | Much weaker: last token carries little signal alone |
| First token (position 0) | 0.515 | 0.025 | Near chance: first token is almost always punctuation/BOS |