Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddings

Xueying Ding, Xingyue Huang, Mingxuan Ju, Liam Collins, Yozen Liu, Leman Akoglu, Neil Shah, Tong ZhaoarXiv 2025 · DOI

Introduction

Decoder-only Large Language Models (LLMs) have become the standard for generative tasks. However, their inherent "causal" architecture—where attention is restricted to preceding tokens—presents a significant challenge for text embeddings. In a causal model, early tokens remain unaware of subsequent context, leading to suboptimal document representations. While methods like Echo Embeddings or simple Token Prepending (TP) attempt to bridge this gap, they often suffer from high computational costs or information bottlenecks. This paper introduces Hierarchical Token Prepending (HTP), a training-free method that restructures information flow to create high-quality embeddings for long documents.

The Information Bottleneck in Causal Decoders

Text embeddings aim to compress the semantic essence of a document into a single vector. In causal models, the first token of a long sequence has no access to the information contained in the following thousands of tokens. Existing solutions are often inefficient:

  • Echo Embeddings repeat the input twice, doubling sequence length and significantly increasing computational overhead.
  • Token Prepending moves a single summary token to the front, creating an "over-compression" bottleneck where one token must represent the entire document.

The authors identify two primary bottlenecks: an attention-level bottleneck (loss during compression) and a readout-level bottleneck (loss during the final pooling stage, often referred to as "over-squashing").

Methodology: Hierarchical Token Prepending

HTP addresses these bottlenecks through a multi-level summary structure that "rewires" information from the end of semantic blocks back to the beginning of the sequence.

Overview of the HTP architecture, illustrating input partitioning and the hierarchical prepending mechanism.

The HTP process consists of three main stages:

  1. Input Partitioning: The document is divided into semantic blocks (e.g., sentences). Local summary placeholders (<PST>) are placed before each block, and global summary placeholders (<B-PST>) are prepended to the entire sequence.
  2. Local Prepending: During the forward pass, the hidden state of each block's final token—which has naturally aggregated information from that block—is dynamically re-injected into its corresponding <PST> token across Transformer layers.
  3. Global Prepending: These local summaries are then propagated to the <B-PST> tokens at the start of the sequence. This hierarchy allows every token in the document to attend to summaries of all subsequent content.

Theoretical Justification for Mean-Pooling

Standard embedding practices often rely on "last-token pooling." However, the authors provide a theoretical proof using Jacobian norms demonstrating that last-token pooling suffers from "over-squashing" in deep networks, where the influence of early tokens decays exponentially. In contrast, mean-pooling aggregates influence across the entire attention matrix, making it "topologically depth-agnostic" and more robust for representing long-range dependencies.

Experimental Results

HTP was evaluated using Mistral-7B, Gemma2-9B, and Qwen2-1.5B across benchmarks including BEIR, MTEB, and LongEmbed.

Performance comparison (Avg. NDCG@10) across varying context lengths for Mistral 7B and Gemma2 9B.

Long-Context Retrieval

On the LongEmbed benchmark, HTP consistently outperformed vanilla mean-pooling and standard token prepending. As shown in the results, HTP maintains high performance even as document length increases to 16k tokens. For Gemma2-9B, HTP achieved an average NDCG@10 of 30.22, surpassing the Vanilla Mean baseline of 29.85.

Efficiency and Generalization

HTP is significantly more efficient than Echo embeddings. While Echo embeddings incur a ~3.5x time overhead and 4x memory cost, HTP adds only a marginal overhead (1.1x to 1.2x). Furthermore, HTP is complementary to supervised fine-tuning; it improved the performance of models already optimized for embeddings, such as NV-Embed-v2.

Conclusion

Hierarchical Token Prepending offers a scalable, training-free solution to the causal bottleneck in decoder-only LLMs. By introducing a hierarchical information flow and utilizing mathematically robust mean-pooling, HTP enables these models to produce high-quality embeddings for long-form content without the prohibitive costs of repetition-based methods.

Summary updated

BibTeX
@misc{ding2025hierarchical,
  author = {Xueying Ding and Xingyue Huang and Mingxuan Ju and Liam Collins and Yozen Liu and Leman Akoglu and Neil Shah and Tong Zhao},
  title = {{Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddings}},
  year = {2025},
  eprint = {2511.14868},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.14868},
}
Figure