SAFER: Spectral Correlation Prior-based Attention Signature Flow for Enhanced Robustness in Harmful Prompt Detection

Neeva Oza, Kolavennu Mani Kanta Krishna Kumar, Rahul Mishra


Abstract
Most existing harmful prompt detection methods rely on surface-level semantic representations, making them vulnerable to paraphrasing, prone to false positives, and limited in their ability to generalize to novel or adversarial prompts. Recent work has explored the use of model-internal signals, such as gradients or spectral features, to train classifiers that capture latent malicious behavior beyond surface semantics. However, these approaches primarily operate on local or isolated internal features and do not model the global structure of model behavior, which limits their robustness against subtle adversarial manipulations. In this work, we focus on robust harmful prompt detection under adversarial attacks. We propose SAFER, a simple yet effective method that models cross-layer attention signature flow by learning spectral correlation priors between attention heads and constructing a cross-layer attention-head spectral graph. This facilitates explicit modeling of structured attention propagation across layers, allowing the capture of both local and global attention dynamics and leading to improved robustness. SAFER achieves superior performance across multiple benchmark datasets for harmful prompt detection, while demonstrating significantly greater resilience to diverse adversarial attacks compared to prior approaches.
Anthology ID:
2026.emnlp-main.2194
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
49877–49904
Language:
URL:
https://aclanthology.org/2026.emnlp-main.2194/
DOI:
Bibkey:
Cite (ACL):
Neeva Oza, Kolavennu Mani Kanta Krishna Kumar, and Rahul Mishra. 2026. SAFER: Spectral Correlation Prior-based Attention Signature Flow for Enhanced Robustness in Harmful Prompt Detection. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 49877–49904, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
SAFER: Spectral Correlation Prior-based Attention Signature Flow for Enhanced Robustness in Harmful Prompt Detection (Oza et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.2194.pdf