arXiv(opens in a new tab)Computer ScienceJun 2023Cited by 27 papers on PaperVantageClassic Paper

Manuscript Offprint

arXiv:2306.03341

Inference-Time Intervention: Eliciting Truthful Answers from a Language Model

Kenneth Li, Oam Patel, Fernanda B. Viégas, H. Pfister, M. Wattenberg

Abstract

We introduce Inference-Time Intervention (ITI), a technique designed to enhance the “truthfulness” of large language models (LLMs). ITI operates by shifting model activations during inference, following a set of directions across a limited number of attention heads. This intervention significantly improves the performance of LLaMA models on the TruthfulQA benchmark. On an instruction-finetuned LLaMA called Alpaca, ITI improves its truthfulness from 32.5%32.5\% to 65.1%65.1\%. We identify a trade-off between truthfulness and helpfulness and demonstrate how to balance it by tuning the intervention strength. ITI is minimally invasive and computationally inexpensive. Moreover, the technique is data efficient: while approaches like RLHF require extensive annotations, ITI locates truthful directions using only few hundred examples. Our findings suggest that LLMs may have an internal representation of the likelihood of something being true, even as they produce falsehoods on the surface. Code: https://github.com/likenneth/honest_llama.

1 Introduction

Figure

Figure 1: Answers to the same question from LLaMA without (red) and with (blue) inference-time intervention. Gold standard answers are: “Scholars thought the Earth was round” and “I have no comment,” respectively. The first question reflects a common misconception; the second is an example of hallucination.

Large language models (LLMs) are capable of generating text that seems correct—but often only at first glance. Close inspection sometimes reveals a range of inaccuracies, from minor errors to flat-out “hallucinations” (Shuster et al.,, 2021) (Figure 1). Such mistakes are a clear issue in contexts where correctness counts.

Enhancing the correctness of LLMs is a multifaceted challenge. In this paper, we focus on a specific category of mistake where the model, in a certain sense, “knows” the correct answer, but standard generation tactics fail to elicit this response. Users of LLM-based systems, for example, have discovered that they can give a wrong answer in one context while yielding the correct answer in a different context (Wei et al.,, 2022).

Indeed, evidence from several directions suggests that LLMs sometimes “know” more than they “say”. Wang et al., (2021) construct high-quality knowledge graphs from LLMs without human supervision. Kadavath et al., (2022) find language models can generate and then self-evaluate their own answers with high accuracy. Saunders et al., (2022) coin the term generation-discrimination gap (G-D gap) and use language models’ self-critique to refine their own answers. Burns et al., (2022) find linear directions that separate correct and incorrect statements through unsupervised clustering across a series of language models. These results suggest that language models contain latent, interpretable structures related to real-world correctness—structure that may potentially be useful in reducing incorrect answers.

To investigate this area further, we begin by operationalizing what it means for a network to “know” the right answer to a question, even if it doesn’t produce that answer. We focus on the difference between generation accuracy (measured by a model’s output) and probe accuracy (classifying a sentence using a classifier with a model’s intermediate activations as input). Using the LLaMA 7B model, applied to the TruthfulQA benchmark from Lin et al., (2021)—a difficult, adversarially designed test for truthful behavior—we observe a full 40%40\% difference between probe accuracy and generation accuracy. This statistic points to a major gap between what information is present at intermediate layers and what appears in the output.

To close this gap, we introduce a technique we call Inference-Time Intervention (ITI). At a high level, we first identify a sparse set of attention heads with high linear probing accuracy for truthfulness (as defined by the TruthfulQA benchmark). Then, during inference, we shift activations along these truth-correlated directions. We repeat the same intervention autoregressively until the whole answer is generated. ITI results in a significant performance increase on the TruthfulQA benchmark. We also see a smaller but nonzero performance improvement on three benchmarks with different data distributions.

ITI contrasts with existing methods such as RLHF (Ouyang et al.,, 2022; Bai et al., 2022a, ; Menick et al.,, 2022) and RLAIF (Bai et al., 2022b, ), which work by finetuning pretrained language models with reinforcement learning. Both require huge annotation and computation resources. Furthermore, the training process involves pleasing a human or AI annotator, raising the possibility that some form of deception could be an optimal strategy (e.g., see the “sycophancy” results of Perez et al., (2022)).

This work makes two main contributions. First, we propose a minimally-invasive control method, inference-time intervention (ITI), to close the gap between “knowing” and “telling” (section 3). ITI increases performance on relevant benchmarks and is efficient in terms of annotation and computation (section 4). Second, the generation experiments on TruthfulQA suggest that the pretraining process endows a language model with a world model of real-world truths, even when its output indicates otherwise. We do not claim that ITI by itself is anywhere near sufficient for ensuring truthful answers from LLMs. However, we believe the technique shows promise; with additional testing and development, it can be useful as part of a more comprehensive approach.

References (54)

Cited by (27)