Skip to main content
QUICK REVIEW

[Paper Review] LLM Lies: Hallucinations are not Bugs, but Features as Adversarial Examples

Jia-Yu Yao, Kun-Peng Ning|arXiv (Cornell University)|Oct 2, 2023
Adversarial Robustness in Machine LearningComputer Science60 citations
TL;DR

The paper frames LLM hallucinations as adversarial phenomena and introduces gradient-based hallucination attacks (weak semantic and OoD prompts) with a simple entropy-based defense.

ABSTRACT

Large Language Models (LLMs), including GPT-3.5, LLaMA, and PaLM, seem to be knowledgeable and able to adapt to many tasks. However, we still cannot completely trust their answers, since LLMs suffer from extbf{hallucination} extemdash fabricating non-existent facts, deceiving users with or without their awareness. However, the reasons for their existence and pervasiveness remain unclear. In this paper, we demonstrate that nonsensical prompts composed of random tokens can also elicit the LLMs to respond with hallucinations. Moreover, we provide both theoretical and experimental evidence that transformers can be manipulated to produce specific pre-define tokens by perturbing its input sequence. This phenomenon forces us to revisit that \emph{hallucination may be another view of adversarial examples}, and it shares similar characteristics with conventional adversarial examples as a basic property of LLMs. Therefore, we formalize an automatic hallucination triggering method as the extit{hallucination attack} in an adversarial way. Finally, we explore the basic properties of attacked adversarial prompts and propose a simple yet effective defense strategy. Our code is released on GitHub\footnote{https://github.com/PKU-YuanGroup/Hallucination-Attack}.

Motivation & Objective

  • Motivate rethinking hallucinations as a fundamental feature beyond training data.
  • Formalize automatic hallucination triggering as adversarial prompts.
  • Develop two attack modes (weak semantic and OoD) to elicit pre-defined hallucinations.
  • Propose a simple defense based on inference-time entropy thresholds.
  • Evaluate attacks on open-source LLMs and discuss defense practicality.

Proposed method

  • Define hallucination as outputs that do not align with reality.
  • Propose a gradient-based token replacement strategy to maximize likelihood of predefined hallucinations.
  • Construct two attack modes: weak semantic prompts that preserve human semantics and OoD prompts that are nonsensical.
  • Generate and utilize hallucination data to train or guide attacks.
  • Evaluate attack success on Vicuna-7B and LLaMA2-7B-chat with predefined metrics.
  • Propose entropy-threshold defense at inference time.

Experimental results

Research questions

  • RQ1Can random OoD prompts reliably trigger predefined hallucinations in LLMs?
  • RQ2Do weak semantic perturbations that preserve semantics significantly increase hallucination triggers?
  • RQ3Is an entropy-based inference defense effective against these hallucination attacks?
  • RQ4How do Vicuna-7B and LLaMA2-7B-chat differ in susceptibility to such attacks?

Key findings

  • Weak semantic attacks achieve a 92.31% success rate on Vicuna-7B and 53.85% on LLaMA2-7B-chat.
  • OoD attacks achieve 80.77% success on Vicuna-7B and 30.77% on LLaMA2-7B-chat.
  • Longer OoD prompts increase attack success (e.g., 30 tokens yield 65.38% on LLaMA2-7B-chat).
  • Hallucination attacks reveal that small token changes can alter outputs to fake facts.
  • Entropy-based defenses can reduce the recall of successful attacks at certain thresholds.

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.