Proceedings

Feint and Attack: Jailbreaking and Protecting LLMs via Attention Distribution Modeling

Download BibTeX Cite

Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Main Track. Pages 493-501.

https://doi.org/10.24963/ijcai.2025/56

Abstract

Most jailbreak methods for large language models (LLMs) focus on superficially improving attack success through manually defined rules. However, they fail to uncover the underlying mechanisms within target LLMs that explain why an attack succeeds or fails. In this paper, we propose investigating the phenomenon of jailbreaks and defenses for LLMs from the perspective of attention distributions within the models. A preliminary experiment reveals that the success of a jailbreak is closely linked to the LLM's attention on sensitive words.Inspired by this interesting finding, we propose incorporating critical signals derived from internal attention distributions within LLMs, namely Attention Intensity on Sensitive Words and Attention Dispersion Entropy, to guide both attacks and defenses. Drawing inspiration from the concept of "Feint and Attack", we introduce an attention-guided jailbreak model, ABA, which redirects the model's attention to benign contexts, and an attention-based defense model, ABD, designed to detect attacks by analyzing internal attention entropy. Experimental results demonstrate the superiority of our proposal when compared to SOTA baselines.

  1. [Alon and Kamfonas, 2023] Gabriel Alon and Michael Kamfonas. Detecting language model attacks with perplexity. arXiv preprint arXiv:2308.14132, 2023.
  2. [Attanasio et al., 2022] Giuseppe Attanasio, Debora Nozza, Dirk Hovy, and Elena Baralis. Entropy-based attention regularization frees unintended bias mitigation from lists. In Findings of the Association for Computational Linguis- tics: ACL 2022, Dublin, Ireland, May 22-27, 2022, pages 1105-1119. Association for Computational Linguistics, 2022.
  3. [Bae et al., 2022] Jongseong Bae, Byung Do Cheon, and Ha Young Kim. Pro-attention: Efficient probability dis- tribution matching-based attention through feature space conversion. IEEE Access, 10:131192-131201, 2022.
  4. [Ball et al., 2024] Sarah Ball, Frauke Kreuter, and Nina Pan- ickssery. Understanding jailbreak success: A study of la- tent space dynamics in large language models, 2024.
  5. [Chao et al., 2024] Patrick Chao, Alexander Robey, Edgar Dobriban, Hamed Hassani, George J. Pappas, and Eric Wong. Jailbreaking black box large language models in twenty queries, 2024.
  6. [Daikoku and Yumoto, 2023] Tatsuya Daikoku and Masato Yumoto. Order of statistical learning depends on per- ceptive uncertainty. Current Research in Neurobiology, 4:100080, 2023.
  7. [Ding et al., 2024] Peng Ding, Jun Kuang, Dan Ma, Xuezhi Cao, Yunsen Xian, Jiajun Chen, and Shujian Huang. A wolf in sheep's clothing: Generalized nested jailbreak prompts can fool large language models easily. In Pro- ceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), NAACL 2024, Mexico City, Mexico, June 16-21, 2024, pages 2136-2153. Association for Computational Linguis- tics, 2024.
  8. [Jiang et al., 2025] Shuyu Jiang, Xingshu Chen, Kaiyu Xu, Liangguo Chen, Hao Ren, and Rui Tang. Decomposition, synthesis and attack: A multi-instruction fusion method for jailbreaking llms. IEEE Internet of Things Journal, pages 1-1, 2025.
  9. [Jin et al., 2024] Haibo Jin, Ruoxi Chen, Andy Zhou, Yang Zhang, and Haohan Wang. Guard: Role-playing to gener- ate natural-language jailbreakings to test guideline adher- ence of large language models, 2024.
  10. [Li et al., 2017] Chaozhuo Li, Senzhang Wang, Dejian Yang, Zhoujun Li, Yang Yang, Xiaoming Zhang, and Jian- she Zhou. Ppne: property preserving network embedding. In Database Systems for Advanced Applications: 22nd In- ternational Conference, DASFAA 2017, Suzhou, China, March 27-30, 2017, Proceedings, Part I 22, pages 163- 179. Springer, 2017.
  11. [Li et al., 2019] Chaozhuo Li, Senzhang Wang, Yukun Wang, Philip S. Yu, Yanbo Liang, Yun Liu, and Zhoujun Li. Adversarial learning for weakly-supervised social net- work alignment. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Inno- vative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 -February 1, 2019, pages 996- 1003. AAAI Press, 2019.
  12. [Li et al., 2024a] Xuan Li, Zhanke Zhou, Jianing Zhu, Jiangchao Yao, Tongliang Liu, and Bo Han. Deepincep- tion: Hypnotize large language model to be jailbreaker, 2024.
  13. [Li et al., 2024b] Yanjie Li, Bin Xie, Songtao Guo, Yuanyuan Yang, and Bin Xiao. A survey of robustness and safety of 2d and 3d deep learning models against adversarial attacks. ACM Comput. Surv., 56(6):138:1- 138:37, 2024.
  14. [Li et al., 2025] Tianlong Li, Zhenghua Wang, Wenhao Liu, Muling Wu, Shihan Dou, Changze Lv, Xiaohua Wang, Xiaoqing Zheng, and Xuanjing Huang. Revisiting jail- breaking for large language models: A representation en- gineering perspective. In Proceedings of the 31st Inter- national Conference on Computational Linguistics, pages 3158-3178, Abu Dhabi, UAE, January 2025. Association for Computational Linguistics.
  15. [Lin et al., 2024] Yuping Lin, Pengfei He, Han Xu, Yue Xing, Makoto Yamada, Hui Liu, and Jiliang Tang. To- wards understanding jailbreak attacks in llms: A represen- tation space analysis. In Proceedings of the 2024 Con- ference on Empirical Methods in Natural Language Pro- cessing, EMNLP 2024, Miami, FL, USA, November 12-16, 2024, pages 7067-7085. Association for Computational Linguistics, 2024.
  16. [Liu et al., 2024] Xiaogeng Liu, Nan Xu, Muhao Chen, and Chaowei Xiao. AutoDAN: Generating stealthy jailbreak prompts on aligned large language models. In The Twelfth International Conference on Learning Representations, 2024.
  17. [Liu et al., 2025] Qiang Liu, Xinlong Chen, Yue Ding, Shizhen Xu, Shu Wu, and Liang Wang. Attention- guided self-reflection for zero-shot hallucination detection in large language models, 2025.
  18. [Mazeika et al., 2024] Mantas Mazeika, Long Phan, Xuwang Yin, Andy Zou, Zifan Wang, Norman Mu, Elham Sakhaee, Nathaniel Li, Steven Basart, Bo Li, David A. Forsyth, and Dan Hendrycks. Harmbench: A standardized evaluation framework for automated red teaming and robust refusal. In Forty-first International Conference on Machine Learning, ICML 2024, Vienna, Austria, July 21-27, 2024. OpenReview.net, 2024.
  19. [Mehrotra et al., 2024] Anay Mehrotra, Manolis Zam- petakis, Paul Kassianik, Blaine Nelson, Hyrum S. Anderson, Yaron Singer, and Amin Karbasi. Tree of attacks: Jailbreaking black-box llms automatically. In Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2024, NeurIPS 2024, Vancouver, BC, Canada, December 10 -15, 2024, 2024.
  20. [Pu et al., 2024] Rui Pu, Chaozhuo Li, Rui Ha, Litian Zhang, Lirong Qiu, and Xi Zhang. Baitattack: Alleviating in- tention shift in jailbreak attacks via adaptive bait craft- ing. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, EMNLP 2024, Miami, FL, USA, November 12-16, 2024, pages 15654- 15668. Association for Computational Linguistics, 2024.
  21. [Qian et al., 2024] Cheng Qian, Hainan Zhang, Lei Sha, and Zhiming Zheng. Hsf: Defending against jailbreak attacks with hidden state filtering, 2024.
  22. [Shen et al., 2024] Xinyue Shen, Zeyuan Chen, Michael Backes, Yun Shen, and Yang Zhang. "do anything now": Characterizing and evaluating in-the-wild jailbreak prompts on large language models, 2024.
  23. [Touvron et al., 2023] Hugo Touvron, Thibaut Lavril, Gau- tier Izacard, Xavier Martinet, Marie-Anne Lachaux, Tim- othée Lacroix, Baptiste Rozière, Naman Goyal, Eric Ham- bro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023.
  24. [Vaswani et al., 2017] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Sys- tems 30: Annual Conference on Neural Information Pro- cessing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998-6008, 2017.
  25. [Wang et al., 2022] Yiqi Wang, Chaozhuo Li, Zheng Liu, Mingzheng Li, Jiliang Tang, Xing Xie, Lei Chen, and Philip S Yu. An adaptive graph pre-training framework for localized collaborative filtering. ACM Transactions on Information Systems, 41(2):1-27, 2022.
  26. [Xiao et al., 2024] Zeguan Xiao, Yan Yang, Guanhua Chen, and Yun Chen. Distract large language models for auto- matic jailbreak attack. In Proceedings of the 2024 Confer- ence on Empirical Methods in Natural Language Process- ing, pages 16230-16244, Miami, Florida, USA, Novem- ber 2024. Association for Computational Linguistics.
  27. [Xie et al., 2023] Yueqi Xie, Jingwei Yi, Jiawei Shao, Justin Curl, Lingjuan Lyu, Qifeng Chen, Xing Xie, and Fangzhao Wu. Defending chatgpt against jailbreak attack via self- reminders. Nat. Mac. Intell., 5(12):1486-1496, 2023.
  28. [Xu et al., 2024] Zhangchen Xu, Fengqing Jiang, Luyao Niu, Jinyuan Jia, Bill Yuchen Lin, and Radha Pooven- dran. Safedecoding: Defending against jailbreak attacks via safety-aware decoding. In Proceedings of the 62nd Annual Meeting of the Association for Computational Lin- guistics (Volume 1: Long Papers), ACL 2024, Bangkok, Thailand, August 11-16, 2024, pages 5587-5605. Associ- ation for Computational Linguistics, 2024.
  29. [Yan et al., 2023] Hao Yan, Chaozhuo Li, Ruosong Long, Chao Yan, Jianan Zhao, Wenwen Zhuang, Jun Yin, Peiyan Zhang, Weihao Han, Hao Sun, Weiwei Deng, Qi Zhang, Lichao Sun, Xing Xie, and Senzhang Wang. A com- prehensive study on text-attributed graphs: Benchmark- ing and rethinking. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural In- formation Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 -16, 2023, 2023.
  30. [Zeng et al., 2024] Yi Zeng, Hongpeng Lin, Jingwen Zhang, Diyi Yang, Ruoxi Jia, and Weiyan Shi. How johnny can persuade llms to jailbreak them: Rethinking persuasion to challenge AI safety by humanizing llms. In Proceedings of the 62nd Annual Meeting of the Association for Computa- tional Linguistics (Volume 1: Long Papers), ACL 2024, Bangkok, Thailand, August 11-16, 2024, pages 14322- 14350. Association for Computational Linguistics, 2024.
  31. [Zhang et al., 2024a] Litian Zhang, Xiaoming Zhang, Chaozhuo Li, Ziyi Zhou, Jiacheng Liu, Feiran Huang, and Xi Zhang. Mitigating social hazards: Early detection of fake news via diffusion-guided propagation path generation. In ACM Multimedia 2024, 2024.
  32. [Zhang et al., 2024b] Litian Zhang, Xiaoming Zhang, Ziyi Zhou, Feiran Huang, and Chaozhuo Li. Reinforced adap- tive knowledge learning for multimodal fake news detec- tion. In Michael J. Wooldridge, Jennifer G. Dy, and Sri- raam Natarajan, editors, ACM Multimedia 2024, pages 16777-16785. AAAI Press, 2024.
  33. [Zhang et al., 2024c] Litian Zhang, Xiaoming Zhang, Ziyi Zhou, Xi Zhang, Senzhang Wang, S Yu Philip, and Chaozhuo Li. Early detection of multimodal fake news via reinforced propagation path generation. IEEE Trans- actions on Knowledge and Data Engineering, 2024.
  34. [Zhang et al., 2024d] Qingru Zhang, Chandan Singh, Liyuan Liu, Xiaodong Liu, Bin Yu, Jianfeng Gao, and Tuo Zhao. Tell your model where to attend: Post-hoc attention steer- ing for LLMs. In The Twelfth International Conference on Learning Representations, 2024.
  35. [Zhao et al., 2023] Yi Zhao, Chaozhuo Li, Jiquan Peng, Xi- aohan Fang, Feiran Huang, Senzhang Wang, Xing Xie, and Jibing Gong. Beyond the overlapping users: Cross- domain recommendation via adaptive anchor link learn- ing. In Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 1488-1497, 2023.
  36. [Zou et al., 2023] Andy Zou, Zifan Wang, Nicholas Carlini, Milad Nasr, J. Zico Kolter, and Matt Fredrikson. Universal and transferable adversarial attacks on aligned language models, 2023.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards