Introduction
In the ecosystem of Information Retrieval (IR) and Retrieval-Augmented Generation (RAG), text embedding models serve as the foundational mechanism for converting human language into high-dimensional mathematical vectors. Ideally, these embeddings should represent the semantic essence of an entire text snippet with uniform fidelity. However, researchers at UC Berkeley have identified a systematic "beginning-of-document" bias that challenges this assumption. Regardless of the underlying architecture or positional encoding scheme—be it Absolute Positional Embeddings (APE), Rotary (RoPE), or ALiBi—popular embedding models disproportionately prioritize the initial sentences of an input, potentially leading to the omission of critical information located at the end of a text chunk.
Experimental Framework
To quantify these biases, the study evaluated eight prominent embedding models, including BGE-m3, E5-Large-V2, and Nomic-Embed, across five diverse datasets (PubMed, Paul Graham essays, Amazon reviews, ArguAna, and Reddit). The investigation employed two primary methodologies:
- Ablation Studies: The researchers performed "needle-in-a-haystack" tests by inserting or removing irrelevant text (Lorem Ipsum) at various positions within a document. They then measured the resulting change in cosine similarity relative to the original embedding.
- Regression Analysis: Using Ordinary Least Squares (OLS) regression, the team attempted to reconstruct a full document's embedding as a linear combination of its constituent sentence embeddings. This allowed them to mathematically isolate the "weight" or importance assigned to each sentence based on its position.
To ensure the observed bias was a property of the models rather than human writing patterns, the researchers also conducted control experiments using randomly shuffled sentences.
Quantifying the Positional Bias
The results revealed a universal bias across all tested positional encoding techniques. As shown in the ablation studies, inserting irrelevant text at the beginning of a document reduced cosine similarity significantly more than inserting the same text at the end. In some cases, the disparity in similarity drop reached 12.3%.
This bias persisted even when content was shuffled, confirming that the effect is an inherent property of the model's internal mechanics. While ALiBi-based models (such as Jina-v2) demonstrated slightly more robustness than RoPE or APE-based models, they still exhibited a clear downward trend in importance as the document progressed.
Regression and Linear Decomposition
The regression analysis provided further evidence of this decay. The researchers found that document embeddings are largely linear combinations of their parts, with the regression model accounting for 87.6% of the variance in long-content embeddings. However, the coefficients assigned to these parts were heavily skewed toward the start of the document.
As illustrated in the regression plots, the "slope of importance" is consistently negative. In a simple two-sentence document, the first sentence was found to be approximately 33.3% more influential on the final semantic vector than the second sentence. This suggests that as document length increases, the model effectively becomes "blind" to information appearing later in the sequence.
The Truncation Hypothesis and Implications
The authors hypothesize that this bias is an artifact of the pre-training process. During training, long sequences are frequently truncated to fit fixed context windows. Consequently, models encounter the beginnings of sequences far more often than the ends, leading the optimization process to favor early tokens.
For practitioners in the RAG space, these findings have immediate implications for "chunking" strategies. If a chunk is too large, the embedding model may fail to capture the nuances of the latter half of the data, leading to retrieval failures. Future work must focus on improved training strategies, such as sequence "packing" that does not consistently favor the start, to ensure that embedding models provide a truly holistic representation of text.
Summary updated