Future Lens: Anticipating Subsequent Tokens from a Single Hidden State

Koyena Pal, Jiuding Sun, Andrew Yuan, Byron C. Wallace, David Bau

Introduction

Standard auto-regressive transformers are trained on a singular, straightforward objective: given a sequence of tokens, predict the most likely immediate next token. However, this narrow training objective belies a more complex internal reality. When a model generates a multi-token phrase—such as a technical term or a famous name—it must, in some sense, "plan" the sequence before the first token is even emitted. This research investigates the extent to which Large Language Models (LLMs) encode a "lookahead" of several tokens within a single hidden state and introduces methods to quantify and extract this future information.

The Challenge of Decoding the Future

While existing interpretability tools like the Logit Lens or Tuned Lens allow researchers to observe a model's "thoughts" regarding the immediate next token ($t+1$) across various layers, they are less effective at revealing information about tokens further down the line ($t+2, t+3$, etc.). The central question of this study is whether a single hidden state vector ($h_t^l$) is rich enough to anticipate the distant future, and if so, what mechanism best decodes that signal.

Methodology: Four Ways to Read the Future

The researchers evaluated four distinct approaches to extract future token predictions from a single hidden state in GPT-J-6B:

  1. Direct Vocabulary Prediction: A linear probe mapping a hidden state directly to a probability distribution over the entire vocabulary for a specific future position.
  2. Linear Model Approximation: An extension of the Tuned Lens that trains a linear model to predict a future hidden state at the final layer ($h_{T+N}^L$), which is then decoded using the model's original pre-trained head.
  3. Fixed Prompt Causal Intervention: A "transplant" experiment where a hidden state from an original context (e.g., "Madison Square Garden is located in...") is grafted into a generic, unrelated prompt (e.g., "Please tell me more about..."). The researchers then observe if the model's natural generation is steered toward the original future tokens (e.g., "New York City").
  4. Learned Prompt Causal Intervention: This method optimizes a "soft prompt"—a sequence of continuous vectors—specifically designed to surface the future information hidden in the transplanted state. By using the model's own internal weights to perform the heavy lifting of decoding, this method proved to be the most effective.

Experimental Setup

The study utilized The Pile, a massive 825GB dataset. Training for the linear probes involved 100,000 token samples, while 10,000 samples were used to optimize the soft prompts. Evaluation was conducted on a separate set of 1,000 tokens, specifically focusing on instances where the base model (GPT-J) originally made a correct prediction.

Key Insights

The Middle Layer "Sweet Spot"

One of the most significant findings is that future information is not most accessible at the final layers of the model. Instead, predictive accuracy peaks in the middle layers (approximately layer 14 of 28 in GPT-J). While early layers are occupied with processing syntax and late layers focus on the immediate next token, the middle layers appear to hold the "semantic blueprint" of the upcoming phrase.

The Model as its Own Best Decoder

Linear probes (Methods 1 and 2) performed significantly worse than the Learned Prompt Causal Intervention (Method 4). This suggests that future information is stored in a complex, non-linear format that the model's own attention mechanisms and MLP layers are better equipped to extract than simple linear transformations.

Performance and Baselines

Using the Learned Prompt method, the researchers achieved 48.4% accuracy for predicting the token after next ($N=1$). This is more than double the accuracy of a bigram baseline (20.1%), which predicts based on the frequency of word pairs. Remarkably, even three tokens ahead ($N=3$), the learned prompt maintained an accuracy of 46.9%, whereas linear methods dropped to the 14-15% range.

Conclusion and Future Work

The "Future Lens" reveals that LLMs maintain a surprisingly clear internal representation of upcoming text well before those tokens are generated. While this study focused on GPT-J-6B and a short horizon of four tokens, it opens the door for future research into whether larger models (like GPT-4) exhibit even longer lookahead horizons and how different architectures, such as state-space models, handle future encoding. Understanding these internal "plans" is a crucial step toward more transparent and controllable AI systems.

Summary updated

Abstract

We conjecture that hidden state vectors corresponding to individual input tokens encode information sufficient to accurately predict several tokens ahead. More concretely, in this paper we ask: Given a hidden (internal) representation of a single token at position t in an input, can we reliably anticipate the tokens that will appear at positions ≥ t + 2? To test this, we measure linear approximation and causal intervention methods in GPT-J-6B to evaluate the degree to which individual hidden states in the network contain signal rich enough to predict future hidden states and, ultimately, token outputs. We find that, at some layers, we can approximate a model’s output with more than 48% accuracy with respect to its prediction of subsequent tokens through a single hidden state. Finally we present a “Future Lens” visualization that uses these methods to create a new view of transformer states.
BibTeX
@inproceedings{pal2023future,
  author = {Koyena Pal and Jiuding Sun and Andrew Yuan and Byron C. Wallace and David Bau},
  title = {{Future Lens: Anticipating Subsequent Tokens from a Single Hidden State}},
  booktitle = {CoNLL},
  year = {2023},
  doi = {10.18653/v1/2023.conll-1.37},
}
Figure