Attention Tracker: Detecting Prompt Injection Attacks in LLMs

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Hung, Kuo-Han, Ko, Ching-Yun, Rawat, Ambrish, Chung, I-Hsin, Hsu, Winston H., Chen, Pin-Yu
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866910916689264640
author Hung, Kuo-Han
Ko, Ching-Yun
Rawat, Ambrish
Chung, I-Hsin
Hsu, Winston H.
Chen, Pin-Yu
author_facet Hung, Kuo-Han
Ko, Ching-Yun
Rawat, Ambrish
Chung, I-Hsin
Hsu, Winston H.
Chen, Pin-Yu
contents Large Language Models (LLMs) have revolutionized various domains but remain vulnerable to prompt injection attacks, where malicious inputs manipulate the model into ignoring original instructions and executing designated action. In this paper, we investigate the underlying mechanisms of these attacks by analyzing the attention patterns within LLMs. We introduce the concept of the distraction effect, where specific attention heads, termed important heads, shift focus from the original instruction to the injected instruction. Building on this discovery, we propose Attention Tracker, a training-free detection method that tracks attention patterns on instruction to detect prompt injection attacks without the need for additional LLM inference. Our method generalizes effectively across diverse models, datasets, and attack types, showing an AUROC improvement of up to 10.0% over existing methods, and performs well even on small LLMs. We demonstrate the robustness of our approach through extensive evaluations and provide insights into safeguarding LLM-integrated systems from prompt injection vulnerabilities.
format Preprint
id arxiv_https___arxiv_org_abs_2411_00348
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Attention Tracker: Detecting Prompt Injection Attacks in LLMs
Hung, Kuo-Han
Ko, Ching-Yun
Rawat, Ambrish
Chung, I-Hsin
Hsu, Winston H.
Chen, Pin-Yu
Cryptography and Security
Artificial Intelligence
Machine Learning
Large Language Models (LLMs) have revolutionized various domains but remain vulnerable to prompt injection attacks, where malicious inputs manipulate the model into ignoring original instructions and executing designated action. In this paper, we investigate the underlying mechanisms of these attacks by analyzing the attention patterns within LLMs. We introduce the concept of the distraction effect, where specific attention heads, termed important heads, shift focus from the original instruction to the injected instruction. Building on this discovery, we propose Attention Tracker, a training-free detection method that tracks attention patterns on instruction to detect prompt injection attacks without the need for additional LLM inference. Our method generalizes effectively across diverse models, datasets, and attack types, showing an AUROC improvement of up to 10.0% over existing methods, and performs well even on small LLMs. We demonstrate the robustness of our approach through extensive evaluations and provide insights into safeguarding LLM-integrated systems from prompt injection vulnerabilities.
title Attention Tracker: Detecting Prompt Injection Attacks in LLMs
topic Cryptography and Security
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2411.00348