Skip to main content
QUICK REVIEW

[Paper Review] BadChain: Backdoor Chain-of-Thought Prompting for Large Language Models

Zhen Xiang, Fengqing Jiang|arXiv (Cornell University)|Jan 20, 2024
Topic ModelingComputer Science8 citations
TL;DR

BadChain is the first backdoor attack targeting chain-of-thought prompting in LLMs, inserting a backdoor reasoning step via manipulated demonstrations to trigger adversarial outputs when a trigger is present, tested across multiple models and reasoning tasks.

ABSTRACT

Large language models (LLMs) are shown to benefit from chain-of-thought (COT) prompting, particularly when tackling tasks that require systematic reasoning processes. On the other hand, COT prompting also poses new vulnerabilities in the form of backdoor attacks, wherein the model will output unintended malicious content under specific backdoor-triggered conditions during inference. Traditional methods for launching backdoor attacks involve either contaminating the training dataset with backdoored instances or directly manipulating the model parameters during deployment. However, these approaches are not practical for commercial LLMs that typically operate via API access. In this paper, we propose BadChain, the first backdoor attack against LLMs employing COT prompting, which does not require access to the training dataset or model parameters and imposes low computational overhead. BadChain leverages the inherent reasoning capabilities of LLMs by inserting a backdoor reasoning step into the sequence of reasoning steps of the model output, thereby altering the final response when a backdoor trigger exists in the query prompt. Empirically, we show the effectiveness of BadChain for two COT strategies across four LLMs (Llama2, GPT-3.5, PaLM2, and GPT-4) and six complex benchmark tasks encompassing arithmetic, commonsense, and symbolic reasoning. Moreover, we show that LLMs endowed with stronger reasoning capabilities exhibit higher susceptibility to BadChain, exemplified by a high average attack success rate of 97.0% across the six benchmark tasks on GPT-4. Finally, we propose two defenses based on shuffling and demonstrate their overall ineffectiveness against BadChain. Therefore, BadChain remains a severe threat to LLMs, underscoring the urgency for the development of robust and effective future defenses.

Motivation & Objective

  • Motivate the study by highlighting vulnerabilities of chain-of-thought prompting to backdoor manipulation in API-driven LLMs.
  • Propose a backdoor attack (BadChain) that requires no access to training data or model parameters and minimal computation.
  • Demonstrate BadChain’s effectiveness across multiple LLMs and reasoning benchmarks, and analyze the backdoor reasoning step mechanism.
  • Assess potential defenses and show their limited effectiveness against BadChain.

Proposed method

  • Insert a backdoor trigger into a subset of COT demonstrations via poisoned prompts.
  • Embed a backdoor reasoning step into the COT sequence to produce an adversarial target answer when the trigger is present.
  • Explore trigger design (non-word vs phrase-based) and its placement, poisoning ratio, and task sensitivity.
  • Evaluate on six benchmarks spanning arithmetic, commonsense, and symbolic reasoning using GPT-3.5, GPT-4, PaLM2, and Llama2 under standard COT-S and self-consistency (SC) strategies.
  • Compare against DT-COT and DT-base baselines and analyze attack success rate (ASR, ASRt) and benign accuracy (ACC).

Experimental results

Research questions

  • RQ1Can BadChain reliably cause targeted adversarial outputs under COT prompting without training data or parameter access?
  • RQ2How does trigger type, position, and demonstration poisoning ratio affect attack success and model utility across tasks and models?
  • RQ3Do existing defenses (e.g., input shuffling) effectively mitigate BadChain without crippling performance on benign prompts?
  • RQ4Is the backdoor reasoning step essential to BadChain’s success, and how is it interpreted by the model?

Key findings

  • BadChain achieves high average attack success rates across models: 85.1% (GPT-3.5), 76.6% (Llama2), 87.1% (PaLM2), and 97.0% (GPT-4).
  • Stronger reasoning LLMs are more susceptible to BadChain, with higher ASR observed on models with advanced reasoning capabilities.
  • The backdoor reasoning step is the key mechanism linking the trigger to the adversarial target answer, as shown by model interpretations of the trigger.
  • Two shuffling-based defenses reduce ASR but also degrade benign accuracy, indicating limited defense effectiveness against BadChain.
  • A practical attacker can determine optimal poisoning ratios and trigger placements with as few as 20 evaluation instances.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.