AdvPrompter: Prompting Adversariale Adattivo Rapido per Modelli Linguistici di Grande Dimensione
AdvPrompter: Fast Adaptive Adversarial Prompting for LLMs
April 21, 2024
Autori: Anselm Paulus, Arman Zharmagambetov, Chuan Guo, Brandon Amos, Yuandong Tian
cs.AI
Abstract
Sebbene i Modelli Linguistici di Grande Dimensione (LLM) abbiano recentemente ottenuto risultati straordinari, sono vulnerabili a determinati attacchi di jailbreaking che portano alla generazione di contenuti inappropriati o dannosi. Il red-teaming manuale richiede la ricerca di prompt avversari che causino tale jailbreaking, ad esempio aggiungendo un suffisso a una determinata istruzione, un processo inefficiente e dispendioso in termini di tempo. D'altra parte, la generazione automatica di prompt avversari spesso produce attacchi semanticamente privi di significato che possono essere facilmente rilevati da filtri basati sulla perplessità, richiedono informazioni sul gradiente del TargetLLM o non scalano bene a causa di processi di ottimizzazione discreta lunghi nello spazio dei token. In questo articolo, presentiamo un metodo innovativo che utilizza un altro LLM, chiamato AdvPrompter, per generare prompt avversari leggibili in pochi secondi, circa 800 volte più velocemente rispetto agli approcci basati sull'ottimizzazione esistenti. Addestriamo l'AdvPrompter utilizzando un nuovo algoritmo che non richiede l'accesso ai gradienti del TargetLLM. Questo processo alterna due fasi: (1) la generazione di suffissi avversari di alta qualità ottimizzando le previsioni dell'AdvPrompter e (2) il fine-tuning a basso rango dell'AdvPrompter con i suffissi avversari generati. L'AdvPrompter addestrato genera suffissi che velano l'istruzione di input senza modificarne il significato, in modo da indurre il TargetLLM a fornire una risposta dannosa. I risultati sperimentali su popolari TargetLLM open source mostrano risultati all'avanguardia sul dataset AdvBench, che si trasferiscono anche alle API di LLM closed-source a scatola chiusa. Inoltre, dimostriamo che, effettuando il fine-tuning su un dataset sintetico generato da AdvPrompter, gli LLM possono essere resi più robusti contro gli attacchi di jailbreaking mantenendo prestazioni elevate, ovvero alti punteggi 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.