AdvPrompter: Adaptación Rápida de Ataques Adversarios mediante Prompting para Modelos de Lenguaje Grandes
AdvPrompter: Fast Adaptive Adversarial Prompting for LLMs
April 21, 2024
Autores: Anselm Paulus, Arman Zharmagambetov, Chuan Guo, Brandon Amos, Yuandong Tian
cs.AI
Resumen
Si bien los Modelos de Lenguaje de Gran Escala (LLMs, por sus siglas en inglés) han logrado éxitos notables recientemente, son vulnerables a ciertos ataques de "jailbreaking" que resultan en la generación de contenido inapropiado o dañino. El red-teaming manual requiere encontrar indicaciones adversas que provoquen dicho jailbreaking, por ejemplo, añadiendo un sufijo a una instrucción dada, lo cual es ineficiente y consume mucho tiempo. Por otro lado, la generación automática de indicaciones adversas a menudo produce ataques semánticamente carentes de sentido que pueden ser detectados fácilmente por filtros basados en perplejidad, pueden requerir información de gradientes del TargetLLM, o no escalan bien debido a procesos de optimización discreta que consumen mucho tiempo en el espacio de tokens. En este artículo, presentamos un método novedoso que utiliza otro LLM, llamado AdvPrompter, para generar indicaciones adversas legibles por humanos en segundos, aproximadamente 800 veces más rápido que los enfoques basados en optimización existentes. Entrenamos el AdvPrompter utilizando un algoritmo novedoso que no requiere acceso a los gradientes del TargetLLM. Este proceso alterna entre dos pasos: (1) generar sufijos adversos de alta calidad optimizando las predicciones del AdvPrompter, y (2) ajuste fino de bajo rango del AdvPrompter con los sufijos adversos generados. El AdvPrompter entrenado genera sufijos que ocultan la instrucción de entrada sin cambiar su significado, de modo que el TargetLLM es engañado para dar una respuesta dañina. Los resultados experimentales en TargetLLMs de código abierto populares muestran resultados de vanguardia en el conjunto de datos AdvBench, que también se transfieren a APIs de LLMs de caja negra de código cerrado. Además, demostramos que al ajustar fino en un conjunto de datos sintéticos generado por AdvPrompter, los LLMs pueden volverse más robustos contra ataques de jailbreaking mientras mantienen su rendimiento, es decir, altas puntuaciones en MMLU.
English
While recently Large Language Models (LLMs) have achieved remarkable
successes, they are vulnerable to certain jailbreaking attacks that lead to
generation of inappropriate or harmful content. Manual red-teaming requires
finding adversarial prompts that cause such jailbreaking, e.g. by appending a
suffix to a given instruction, which is inefficient and time-consuming. On the
other hand, automatic adversarial prompt generation often leads to semantically
meaningless attacks that can easily be detected by perplexity-based filters,
may require gradient information from the TargetLLM, or do not scale well due
to time-consuming discrete optimization processes over the token space. In this
paper, we present a novel method that uses another LLM, called the AdvPrompter,
to generate human-readable adversarial prompts in seconds, sim800times
faster than existing optimization-based approaches. We train the AdvPrompter
using a novel algorithm that does not require access to the gradients of the
TargetLLM. This process alternates between two steps: (1) generating
high-quality target adversarial suffixes by optimizing the AdvPrompter
predictions, and (2) low-rank fine-tuning of the AdvPrompter with the generated
adversarial suffixes. The trained AdvPrompter generates suffixes that veil the
input instruction without changing its meaning, such that the TargetLLM is
lured to give a harmful response. Experimental results on popular open source
TargetLLMs show state-of-the-art results on the AdvBench dataset, that also
transfer to closed-source black-box LLM APIs. Further, we demonstrate that by
fine-tuning on a synthetic dataset generated by AdvPrompter, LLMs can be made
more robust against jailbreaking attacks while maintaining performance, i.e.
high MMLU scores.