TL;DR
Transformer-based embedding models systematically degrade when processing long texts because their embeddings collapse into a narrow subspace near the origin. By modeling self-attention through Fourier analysis, the authors prove that longer inputs accelerate low-pass filtering, stripping away high-frequency features and forcing embeddings toward an uninformative mean. To fix this, they introduce TempScale, a simple, tuning-free inference adjustment that scales attention logits with a temperature $\tau < 1$, recovering embedding diversity and improving downstream performance across standard benchmarks.
What Problem Does This Paper Address?
Text embedding models are expected to map arbitrary-length texts into a shared semantic space. However, existing models perform noticeably worse on longer documents than on short snippets—even models explicitly trained with extended context windows (e.g., 4k tokens).
The authors identify the root cause as Length Collapse: as input length increases, embeddings cluster into a tight, low-variance region around the origin, driving pairwise cosine similarities toward 1. This creates a severe distributional mismatch between short texts (which remain dispersed and expressive) and long texts (which collapse toward their mean). In tasks like retrieval, classification, and clustering, this collapse skews decision boundaries and hurts accuracy.
Methods
The authors analyze the spectral dynamics of multi-head self-attention (MSA):
- Fourier Perspective on Attention: Repeated self-attention acts as a low-pass filter on token sequences, attenuating high frequencies and retaining only the Direct-Current (DC) component (the token mean).
- Length-Dependent Attenuation Rate: The authors prove that the attenuation rate depends on the largest singular value ($\sigma_a$) of the high-frequency components of the attention matrix $A$. Assuming Gaussian query/key distributions, they prove that $\sigma_a$ shrinks as sequence length $n$ increases. Consequently, longer inputs eliminate high-frequency variations significantly faster across layers.
- TempScale (Temperature Scaling): To prevent this over-smoothing, the authors introduce a scalar temperature $\tau \in (0, 1]$ directly into the attention softmax: $$\text{Attention}(X) = \text{softmax}\left(\frac{X W_Q (X W_K)^\top}{\tau \sqrt{d}}\right) X W_V$$ Setting $\tau < 1$ (typically $\tau = 0.8$) sharpens the attention distribution, producing a sparser attention graph and increasing $\sigma_a$. This slows down low-pass filtering and preserves token-level discriminability. TempScale is completely training-free and model-agnostic.
Long Inputs ──> Accelerated Low-Pass Filtering ──> Embeddings Collapse to DC Mean
│
TempScale (Softmax / τ, τ < 1) ────────────┘
Preserves High frequencies & Embedding Variance
Datasets
The authors evaluate TempScale across standard benchmarks without introducing new datasets:
- MTEB (Massive Text Embedding Benchmark): 36 English datasets spanning Classification (e.g., AmazonPolarity, Banking77, IMDB), Clustering (e.g., ArxivClustering, RedditClustering), STS (STS12–STS22, BIOSSES, SICK-R), Reranking (e.g., SciDocsRR, MindSmall), and Summarization (SummEval).
- LongEmbed Benchmark: 4 long-document retrieval tasks curated from long-form QA and summarization (NarrativeQA, QMSum, SummScreenFD, WikiMultiHopQA), with average document lengths exceeding thousands of words.
- BEIR: NFCorpus and SciFact.
- Additional LLM-Embedder Analysis: LongRAG (NQ, HotpotQA) and LongAlpaca-12k.
Key Insights and Ideas
- Collapse is intrinsic to sequence length, not just depth: Prior work linked over-smoothing to model depth. Here, the authors demonstrate that sequence length alone accelerates feature collapse—even a 12-layer model will over-smooth long inputs far more severely than short ones.
- Synthetically unrelated repetitions still collapse: Repeating "dog" and "cat" $N$ times leads to embeddings with cosine similarity approaching 1.0 as $N$ grows, empirically confirming that length collapse forces completely distinct tokens to converge.
- Why existing solutions fail:
- Standard post-processing (e.g., BERT-whitening or Flow-based methods) attempts to enforce isotropy globally, but breaks down on modern fine-tuned models, often drastically reducing downstream scores.
- Length-extrapolated attention scaling (such as YaRN) was built for generative LLMs where per-token distributions matter locally; applying variable per-token scalers distorts the unified representation space required for dual encoders.
- Task-specific benefits: In retrieval, short queries and long documents originally occupy mismatched geometric spaces; TempScale brings long documents out of the central cluster, boosting long-document rank positions.
Key Results
Experiments across multiple encoder architectures (BERT-, RoBERTa-, and T5-based: ANCE, GTR, GIST, BGE, E5) demonstrate consistent, tuning-free gains:
- General Benchmarks: TempScale achieves an average +0.53% improvement across 40 evaluation tasks from MTEB and LongEmbed.
- Long-Context Tasks: Gains are highest on long-context retrieval, averaging +0.82% across 4 LongEmbed tasks.
- Long-Window Architecture: For E5-4K (native 4,096 context window), TempScale yields a +1.07% average improvement across all tasks and +1.56% on LongEmbed retrieval.
- Ranking Improvements: On NFCorpus and SciFact, lowering $\tau$ consistently moves the longest relevant documents up the ranking lists (e.g., E5-4K SciFact average rank of long documents improved from 66.8 to 38.9).
Limitations and Future Work
- Static vs. Length-Aware Temperature: Currently, a single static temperature ($\tau = 0.8$) is applied globally. While the authors demonstrate that longer texts benefit from smaller $\tau$, finding a dynamic or learned length-dependent schedule without distorting the joint embedding space remains open.
- LLM-Based Embedding Models: Although the authors confirm that causal LLM embedding backbones (e.g., NV-Embed-v2, E5-Mistral-7B) also suffer from length collapse, causal/unidirectional attention was not formally modeled in their spectral proofs.
- Other Transformer Modules: The theoretical analysis primarily focuses on self-attention; the compounding or mitigating effects of LayerNorm, residual scale factors, and MLP layers on length collapse warrant deeper theoretical study.
Summary updated