Encoder-only Next Token Prediction

Ethan Ewer, Daewon Chae, Thomas Zeng, Jinkyu Kim, Kangwook LeeOpenReview 2025 · Submission to ICLR 2025 · Rejected

In the landscape of Large Language Models (LLMs), the "decoder-only" architecture reigns supreme. From GPT-4 to Llama-3, virtually every state-of-the-art model relies on causal attention, a mechanism where each token can only attend to preceding tokens. This design is highly efficient for inference, but a recent paper from researchers at the University of Wisconsin-Madison and Korea University asks a provocative question: If we were not limited by compute, is the decoder-only architecture actually the best choice?

Their paper, ENTP: Encoder-only Next Token Prediction, suggests that by discarding the efficiency of causal masking, we can unlock a level of expressive power that standard decoders simply cannot match.

The Problem with the Causal Constraint

Standard LLMs use causal attention. When a model predicts the 10th token in a sentence, the representation of the 1st token is fixed—it can never "know" what tokens 2 through 9 turned out to be. This restriction is intentional; it allows for efficient KV-caching, where previous computations are reused to drastically speed up text generation.

However, the authors argue that this is an artificial constraint. In a bidirectional encoder (like BERT), every token in a sequence can attend to every other token. The researchers investigate whether this "all-to-all" communication allows the model to learn complex functions that a restricted, causal decoder never could, regardless of its parameter count.

Methods: How ENTP Works

The core idea of ENTP (Encoder-only Next Token Prediction) is straightforward: use a standard Transformer encoder for autoregressive next-token prediction.

  1. External Causality: To predict token $x_{n+1}$, the sequence $(x_1, \dots, x_n)$ is fed into an encoder.
  2. Full Attention: Unlike a decoder, the encoder allows the first token $x_1$ to attend to the last token $x_n$, and vice versa.
  3. No Caching: Because $x_1$’s representation changes every time a new token is added to the prefix, KV-caching is impossible. The model must recompute the entire hidden state for the whole prefix for every single new token generated.
Comparison between a standard causal decoder (left) and the proposed Encoder-only Next Token Prediction (right).

This architectural shift makes ENTP $O(n^3)$ in total time complexity for a sequence of length $n$, compared to the $O(n^2)$ complexity of a standard decoder. While computationally heavy, this translates directly into higher expressive power.

The "Count3" Benchmark

To prove the theoretical superiority of ENTP, the authors designed a specific synthetic reasoning task called Count3. Given a sequence of integers, the model must count how many pairs $(x_i, x_j)$ exist such that $x_i + x_j + x_n \equiv 0 \pmod n$.

  • The Catch: This requires "triple-wise" logic across the sequence.
  • The Theory: The authors prove mathematically that for a decoder to solve this as the sequence length $n$ grows, the number of layers $L$ must also grow linearly with $n$. An encoder, however, can solve it with a fixed, small number of layers.

Perhaps the most striking insight from the paper is that even frontier models like GPT-4o and Llama-3-8B fail to solve the Count3 task when fine-tuned. This suggests that the limitation is not just about scale, but a fundamental flaw in the architecture of causal attention.

Experimental Results

The researchers evaluated ENTP across several regimes, from synthetic reasoning to natural language modeling, yielding impressive results:

  • Count3 Mastery: ENTP achieved near-perfect accuracy on the Count3 task, while standard decoders (and even modified "Prefix" decoders) completely failed to learn the underlying pattern.
  • Superior Length Generalization: In arithmetic tasks, ENTP showed remarkable robustness. When trained on 10-digit addition, ENTP maintained high accuracy when tested on 15-digit numbers. In contrast, the performance of standard decoders plummeted.
  • Language Modeling Gains: When pre-trained on OpenWebText (a subset of the GPT-2 training data), the ENTP model achieved a lower validation perplexity (103.8) compared to a decoder-only baseline of the same size (110.0).
  • Downstream Performance: On commonsense reasoning benchmarks like TinyWinoGrande, ENTP reduced the error rate from 43.5% to 38.0% compared to its decoder counterpart.

Limitations and Future Directions

The primary limitation of ENTP is its computational cost. Because it requires $O(n^2)$ compute per token (and $O(n^3)$ per sequence), it is currently impractical for the massive long-context windows (100k+ tokens) demanded by modern LLM applications.

However, this research opens several exciting avenues for future work:

  • Compute-Efficient ENTP: Can researchers find a way to approximate this bidirectional advantage without incurring the cubic cost?
  • Hybrid Architectures: Future models might use ENTP-style blocks selectively for critical reasoning steps while maintaining causal efficiency for standard text generation.
  • Scaling Up: It remains to be seen if these architectural advantages persist when scaling from hundreds of millions of parameters to the multi-billion parameter regime.

By demonstrating that the "standard" way of building LLMs might be leaving significant reasoning performance on the table, ENTP challenges the status quo and opens a new door for architectural innovation in AI.

Summary updated

Abstract

Next-token prediction is conventionally done using decoder-only Transformers with causal attention, as this approach allows for efficient reuse of keys and values. What if we were not compute-limited, should we still use decoder-only Transformers? In this work, we introduce Encoder-only Next Token Prediction (ENTP). We use small scale experiments to explore the differences between ENTP and decoders, highlighting potential advantages of ENTP in setting with unbounded compute. We introduce the $\operatorname{Count3}$ task and show, both theoretically and experimentally, that while ENTP can perform this task easily, a decoder-only Transformer cannot. Finally, we empirically demonstrate ENTP’s superior performance across various synthetic tasks, such as length generalization and in-context learning.
BibTeX
@misc{ewer2025encoder,
  author = {Ethan Ewer and Daewon Chae and Thomas Zeng and Jinkyu Kim and Kangwook Lee},
  title = {{Encoder-only Next Token Prediction}},
  year = {2025},
  url = {https://openreview.net/forum?id=6ApaDkSMtX},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2025},
}
Figure