PromptInject is an open-source framework for quantitatively analyzing the robustness of large language models (LLMs), released by agencyenterprise on GitHub. The paper corresponding to this repository is "Ignore Previous Prompt: Attack Techniques For Language Models," which won the Best Paper Award at the NeurIPS ML Safety Workshop 2022. The project's core goal is to study the vulnerabilities that large language models may exhibit when facing adversarial prompt attacks, and to provide a means of assembling prompts in a modular way.
In terms of purpose, PromptInject focuses on the security issues of Transformer-based large language models for large-scale customer applications. The paper points out that although such models provide a powerful foundation for natural language tasks, research on vulnerabilities caused by malicious user interactions is still relatively scarce. To this end, the authors propose PROMPTINJECT, a naive alignment framework for mask-based iterative adversarial prompt composition, to examine how language models such as GPT-3 that are widely deployed in production environments can be easily misled by simple manual inputs.
In terms of main capabilities, the framework studies two types of attacks: goal hijacking and prompt leaking. In both attacks, the attacker's goal is to change the objective of the original prompt. Goal hijacking refers to setting a new goal to print a specific target string, which may contain malicious instructions; prompt leaking sets the new goal to print the application's prompt. Through examples, the paper shows that even an agent with low capability but sufficient maliciousness can exploit the randomness of GPT-3 to create long-tail risks. Figure 1 shows how adversarial user input can cause the model instructions to deviate: the Application Prompt in the gray box shows the original prompt, in which {user_input} is replaced by user input; normally the user would input a phrase that the application needs to correct (blue box); Goal Hijacking and Prompt Leaking in the orange box show the malicious user input for the two attacks (left) and the corresponding model output when the attack succeeds (right).
In terms of usage, the repository provides an example notebook notebooks/Example.ipynb for reference. The project welcomes additional requests and contributions, uses an issues tracker to maintain pending featureand defect lists, and provides contribution documentation to help developers get started. The repository also includes a Code of conduct.
In terms of applicable scenarios and limitations: this framework is suitable for research and large language model security assessment, especially for analyzing robustness against prompt injection attacks. The current materials do not provide detailed information about system requirements, installation commands, programming language versions, dependencies, or specific APIs; these contents are not yet provided.