UnEmbedding矩阵:文本嵌入的潜在特征透镜
阅读原文· arxiv.org大语言模型在零样本文本嵌入任务中表现不佳,原因在于嵌入向量倾向于与高频但无信息的token对齐,抑制语义捕获。本文提出EmbedFilter,一种简单的线性变换方法,通过利用LLM内部unembedding矩阵编码的潜在空间,过滤掉高频token子空间,从而增强语义表示。该方法可自然降维,减少索引存储并加速检索,同时保持精炼后嵌入质量。实验表明,嵌入EmbedFilter的LLM在显著降低嵌入维度时仍取得更优零样本下游性能。代码已开源。
Large language models exhibit impressive zero-shot capabilities across a wide range of downstream tasks. However, they struggle to function as off-the-shelf embedding models, leading to suboptimal performance on massive text embedding benchmarks. In this paper, we identify a potential cause underlying this deficiency. Our motivation stems from an unexpected observation: text embeddings tend to align with frequent but uninformative tokens when projected onto the vocabulary space. We argue that this excessive expression of high-frequency tokens suppresses the model's ability to capture nuanced semantics. To address this, we introduce EmbedFilter, a simple linear transformation designed to refine text embeddings derived from LLMs directly. Specifically, we uncover that the unembedding matrix within LLMs encodes a latent space that is actively writing these frequent tokens into embedding space. By filtering out this subspace, EmbedFilter suppress the influence of high-frequency tokens, thereby enhancing semantic representations. As a compelling byproduct, this enables an inherent dimensionality reduction, lowering index storage and speedup retrieval while fully preserving the refined embedding quality. Our experiments across multiple LLM backbones demonstrate that LLMs equipped with EmbedFilter achieve superior zero-shot downstream performance even with significantly reduced embedding dimensions. We hope our findings provide deeper insights into the mechanisms of LLM-based representations and inspire more principled designs to improve text embeddings training. Our code is available at https://github.com/CentreChen/EmbFilter.