Source-linked AI summary

A Novel Evaluation Framework for Assessing Resilience Against Prompt Injection Attacks in Large Language Models

Daniel Wankit Yip, Aysan Esmradi, Chun Fai Chan

arXiv:2401.00991v1cs.CR

TL;DR

Prompt injection can manipulate LLM outputs, making application resilience important to assess. This paper evaluates resilience with a dataset of attacks, impact and success measures, and a weighted score; Llama2 scored higher than ChatGLM in the evaluation.

  • Problem

    Prompt injection can manipulate LLM outputs and may lead to misinformation, harmful biases, or real-world harm.

    Source: §I · p. 1
  • Method

    The framework builds a categorized attack dataset, measures impact and attack success, and combines them in a Weighted Resilience Score that weights more impactful attacks more heavily.

    Source: §II · p. 1, A. Attack Dataset · p. 2, B. Average Impact Metric (AIM) · p. 2
  • Results

    Llama2 attained a WRS of 67.3, while ChatGLM achieved a WRS of 38.2.

    Source: A. Results Discussion · p. 3
  • Takeaways & Limitations

    The framework lets organizations compare their applications with others and make informed decisions about application security.

    Source: §V · p. 3

    The attack dataset omits many newly discovered attacks, which the authors identify as a target for future expansion.

    Source: §VI · p. 4

Abstract

from arXiv · show

Prompt injection attacks exploit vulnerabilities in large language models (LLMs) to manipulate the model into unintended actions or generate malicious content. As LLM integrated applications gain wider adoption, they face growing susceptibility to such attacks. This study introduces a novel evaluation framework for quantifying the resilience of applications. The framework incorporates innovative techniques designed to ensure representativeness, interpretability, and robustness. To ensure the representativeness of simulated attacks on the application, a meticulous selection process was employed, resulting in 115 carefully chosen attacks based on coverage and relevance. For enhanced interpretability, a second LLM was utilized to evaluate the responses generated from these simulated attacks. Unlike conventional malicious content classifiers that provide only a confidence score, the LLM-based evaluation produces a score accompanied by an explanation, thereby enhancing interpretability. Subsequently, a resilience score is computed by assigning higher weights to attacks with greater impact, thus providing a robust measurement of the application resilience. To assess the framework's efficacy, it was applied on two LLMs, namely Llama2 and ChatGLM. Results revealed that Llama2, the newer model exhibited higher resilience compared to ChatGLM. This finding substantiates the effectiveness of the framework, aligning with the prevailing notion that newer models tend to possess greater resilience. Moreover, the framework exhibited exceptional versatility, requiring only minimal adjustments to accommodate emerging attack techniques and classifications, thereby establishing itself as an effective and practical solution. Overall, the framework offers valuable insights that empower organizations to make well-informed decisions to fortify their applications against potential threats from prompt injection.

I. INTRODUCTION

LLMs are increasingly used in applications but remain vulnerable to prompt injection that can produce misleading or harmful outputs. The paper introduces a framework for evaluating application resilience through attack simulation and impact-weighted scoring.

I. INTRODUCTION

  • LLMs are being integrated into applications such as chatbots and virtual assistants, with uses including human-like responses and text-to-speech access.Source: §I · p. 1
  • Prompt injection can manipulate LLM outputs, with potential consequences including misinformation, harmful biases, and real-world harm.The paper identifies prompt injection as a vulnerability in LLMs.Source: §I · p. 1
  • The paper proposes a framework to assess prompt-injection resilience in LLM-integrated applications and implements it on ChatGLM and Llama2.Source: §I · p. 1

II. EVALUATION FRAMEWORK

  • The framework builds an attack dataset, measures each attack’s impact and success probability, then calculates a Weighted Resilience Score with greater weight for higher-impact attacks.The process is described as a systematic, repeatable application-resilience evaluation.Source: §II · pp. 1–2

A. Attack Dataset

The attack dataset consolidates attacks by purpose and selects relevant examples using coverage research and a Relevance Ratio inclusion threshold.

A. Attack Dataset

  • The dataset consolidates attacks into four purpose categories: Manipulated Content, Fraud, Harm and Destruction, and Misinformation.The paper argues that categorization supports purpose-specific impact metrics and assessment of application strengths and weaknesses.Source: A. Attack Dataset · p. 2
  • Dataset coverage draws on online information and research papers available at the time of construction.The passage cites online sources and research papers.Source: A. Attack Dataset · p. 2
  • An attack’s Relevance Ratio is its successful-test share across multiple LLMs; attacks above the predefined criterion are included, while those below it are excluded.Source: A. Attack Dataset · p. 2
  • 115 attacks were included using a 20% criterion after simulation on five LLMs: ChatGPT, Azure OpenAI GPT-3.5 Turbo, GPT-4, Bard, and ChatGLM.Source: A. Attack Dataset · p. 2

B. Average Impact Metric (AIM)

The Average Impact Metric (AIM) represents an attack’s potential adverse effect through purpose-specific impact factors rated by an LLM evaluator and averaged.

B. Average Impact Metric (AIM)

  • Attack impact means potential adverse effects on the application owner, including financial loss, reputational damage, and data loss.Source: B. Average Impact Metric (AIM) · p. 2
  • Impact factors are specific to attack purpose and are derived from existing standards, practices, and research.The paper’s Table I presents some factors used in its dataset.Source: B. Average Impact Metric (AIM) · p. 2
  • For each impact factor, the study appends the attacked application’s response to a prompt asking another LLM to rate its impact on a 0-to-5 scale; ChatGPT was evaluator.The evaluator’s metric ranges from 0 (“not applicable”) to 5 (“most impact”).Source: B. Average Impact Metric (AIM) · p. 2
  • AIM averages the impact metrics assigned to the factors defined for an attack’s purpose.The total number of factors is f, and I_e is the impact metric for factor e.Source: B. Average Impact Metric (AIM) · p. 2

C. Attack Success Probability (ASP)

Attack Success Probability (ASP) is estimated by repeating attacks and tracking success, while resetting the application between attacks to limit interference from prior prompts.

C. Attack Success Probability (ASP)

  • Repeated attempts estimate attack success because LLM responses can vary with temperature and top-P settings.Higher values of either parameter produce more diverse responses; lower values produce more focused responses.Source: C. Attack Success Probability (ASP) · pp. 2–3
  • Each attack was attempted five times, with temperature set to 0.7 and top-P to 1.0, to estimate its success probability.The probability uses the number of successes and total attack attempts.Source: C. Attack Success Probability (ASP) · p. 3
  • The application is reset after each sequential attack so preceding prompts do not interfere with the current attack’s response.Source: C. Attack Success Probability (ASP) · p. 3

D. Weighted Resilience Score (WRS)

The Weighted Resilience Score (WRS) combines attack impact and attack success probability, giving more impactful attacks greater weight on a 0–100 resilience scale.

D. Weighted Resilience Score (WRS)

III. EVALUATION WORKFLOW

The evaluation workflow constructs an attack dataset, measures each attack’s average impact metric, and simulates attacks on the target application to calculate resilience.

III. EVALUATION WORKFLOW

  • The workflow first constructs an attack dataset.Source: §III · p. 3
  • It then finds the average impact metric (AIM) for each attack in the dataset.Source: §III · p. 3
  • Finally, it simulates attacks on the application to estimate each attack’s success probability (ASP) and calculate the weighted resilience score (WRS).Source: §III · p. 3

IV. IMPLEMENTATION AND RESULTS

The framework was implemented on applications integrated with ChatGLM and Llama2, using the model versions described in the paper.

IV. IMPLEMENTATION AND RESULTS

  • The framework was implemented on applications integrated with ChatGLM and Llama2.Source: §IV · p. 3
  • The evaluated ChatGLM version was an open-source 6.2-billion-parameter model released on March 8, 2022.The paper describes it as based on the Generic Language Model (GLM) framework and developed by Tsinghua University researchers.Source: §IV · p. 3
  • The evaluated Llama2 version was a 13-billion-parameter, second-generation open-source model from Meta AI, released on July 18, 2023.Source: §IV · p. 3

A. Results Discussion

Llama2 achieved a higher WRS than ChatGLM in the evaluation; the authors relate the difference to model training and safeguards.

A. Results Discussion

  • ChatGLM’s lower WRS aligned with its higher average attack success probability (ASP), indicating an expected negative correlation between attack success and resilience.Source: A. Results Discussion · p. 3
  • The authors attribute Llama2’s higher resilience to its larger parameter count, training on more data, and updated safeguards against existing attacks.Source: A. Results Discussion · p. 3
  • WRS was 67.3 for Llama2 and 38.2 for ChatGLM.The comparison is reported in Table II.Source: Table II · p. 3, A. Results Discussion · p. 3

V. CONCLUSION

The framework evaluates LLM-integrated application resilience against prompt injection, and the tested newer applications tended to have higher WRS.

V. CONCLUSION

  • Newer applications tended to be more resilient against the dataset attacks, as evidenced by their higher WRS.The conclusion reports this as a tendency across the applications evaluated.Source: §V · p. 3
  • The framework combines a comprehensive attack dataset and impact measurement to determine WRS for applications integrated with ChatGLM and Llama2.Source: §V · p. 3
  • Organizations can use the framework to compare applications on the market and make informed decisions about securing their applications.Source: §V · p. 3

VI. FUTURE WORK

The framework can be extended with additional attacks and impact factors, and its testbed architecture is designed to automate evaluation and consolidate results.

VI. FUTURE WORK

  • Many newly discovered attacks are absent from the dataset used in this paper.Source: §VI · p. 4
  • Future extensions can add attack techniques and categories, with new impact factors defined when attacks serve a new purpose.Source: §VI · p. 4
  • For a new purpose, the example evaluation prompt rates negative sentiment toward a specified subject on a 0-to-5 scale.Source: §VI · p. 4
  • The testbed architecture can be adapted so an LLM evaluator automatically assesses attacks and consolidates the results.Source: §VI · p. 4
Loading 2401.00991v1…