Understanding Token Probability Encoding in Output Embeddings

Hakaze Cho, Yoshihiro Sakai, Kenshiro Tanaka, Mariko Kato, Naoya Inoue

Abstract

In this paper, we investigate the output token probability information in the output embedding of language models. We find an approximate common log-linear encoding of output token probabilities within the output embedding vectors and empirically demonstrate that it is accurate and sparse. As a causality examination, we steer the encoding in output embedding to modify the output probability distribution accurately. Moreover, the sparsity we find in output probability encoding suggests that a large number of dimensions in the output embedding do not contribute to causal language modeling. Therefore, we attempt to delete the output-unrelated dimensions and find more than 30% of the dimensions can be deleted without significant movement in output distribution and sequence generation. Additionally, in the pre-training dynamics of language models, we find that the output embeddings capture the corpus token frequency information in early steps, even before an obvious convergence of parameters starts.

Introduction

In standard Transformer architectures, output embeddings (the "LM Head") map internal hidden states to token probability distributions. While input embeddings have been extensively analyzed, output embeddings are often treated as a black box. This is particularly relevant for modern models like LLaMA and GPT-J that use "untied" embeddings, where the input and output weights are distinct. This study explores the underlying mathematical structure of these vectors, specifically how they represent the likelihood of a token appearing in a given context.

Methodology

Researchers combined theoretical derivation with empirical validation to uncover these patterns. Mathematically, they demonstrated that a softmax-based output head naturally tends toward a log-linear encoding of averaged token probabilities. To validate this, Multiple Linear Regression (MLR) was used to fit the negative log of averaged token probabilities against output embedding vectors across several models, including GPT-2, Pythia (up to 2.8B), and GPT-J (6B).

The study utilized several benchmarks for evaluation:

  • WIKIDPR: A subset of 8,192 samples used to detect averaged token probabilities.
  • BOOKCORPUS: Used for out-of-domain evaluation to ensure findings were generalizable.
  • The PILE: A 14.3B token sample used to investigate training dynamics.

The Log-Linear Structure of Output Embeddings

The primary finding is that LLMs encode token probabilities in a surprisingly simple log-linear fashion. The log-linear fit was remarkably accurate across models, with Adjusted $R^2$ values typically ranging from 0.82 to 0.99.

PCA of output embeddings colored by token rank, showing a clear gradient corresponding to frequency.

As illustrated in Figure 1, a Principal Component Analysis (PCA) of the output embeddings reveals a clear structural gradient based on token rank. This "probability direction" appears to be orthogonal to semantic encoding, suggesting that frequency information is stored independently of a token's contextual meaning.

Sparsity and Dimensionality Pruning

A significant insight from this work is that probability information is not distributed uniformly but is instead highly sparse. It is concentrated within the top principal components and a small subset of original dimensions.

Correlation and slope analysis across various models, highlighting the sparsity of probability information in both principal component and original dimension spaces.

Figure 6 quantifies this sparsity across multiple models, showing that only a few dimensions have high Spearman correlation with output probabilities. This "dead weight" in the LM head allows for significant optimization; the authors successfully removed 30-40% of output embedding dimensions in GPT-2 with almost zero impact on text quality, as measured by MAUVE scores. This suggests that a large portion of the embedding space is not utilized for causal language modeling.

Training Dynamics and Causality

To establish causality, the researchers developed a steering algorithm to modify embeddings along the detected probability directions. This allowed for precise scaling of a token's probability (up to 20x) with minimal side effects on the rest of the distribution.

Furthermore, the study of training dynamics using the Pythia suite revealed that output embeddings capture "unigram" frequency (global corpus frequency) almost instantly. In the Pythia-1B model, an $R^2$ of ~0.8 was reached within the first few hundred training steps, suggesting that models learn word frequencies before they begin to master complex linguistic structures or grammar.

Conclusion

This research demonstrates that LLMs utilize a sparse, log-linear encoding for token probabilities in their output embeddings. This discovery clarifies the internal mechanics of the LM head and provides a path for model compression through dimension pruning. While the current work focuses on global frequency, future research could explore context-dependent probability steering for more nuanced model control. Limitations include the dependency on specific hidden state properties (like Layer Normalization) and the fact that steering, while diagnostic, may not yet outperform existing logit bias filters in production environments.

Summary updated

BibTeX
@inproceedings{cho2025understanding,
  author = {Hakaze Cho and Yoshihiro Sakai and Kenshiro Tanaka and Mariko Kato and Naoya Inoue},
  title = {{Understanding Token Probability Encoding in Output Embeddings}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2025},
  url = {https://openreview.net/forum?id=vkoT244Riw},
}
Figure