GangHo Lee

Author directory

2026

Decoder-only large language models (LLMs) carry rich semantic information in their hidden states, but these states are not directly usable for retrieval: they exhibit strong anisotropy and excessive dimensionality, producing distorted cosine-similarity rankings and prohibitive index sizes. A standard solution is to train a dedicated embedding model, which requires positive pairs and substantial compute. We ask a different question: can we make frozen LLM hidden states retrieval-usable purely through post-hoc transformation, without fine-tuning the LLM backbone or using labeled positive pairs? We propose NCWP (Neighbor-Contrastive Whitening Projection), a post-hoc alignment method for symmetric sentence-similarity retrieval that combines ZCA-shrink whitening for global isotropy correction with augmentation-free neighbor-contrastive projection learning, requiring only a single linear projection at inference. On the official STS-Benchmark test split and BEIR-Quora across three decoder-only LLM backbones (Llama-3.1-8B, Qwen1.5-4B, Qwen2-7B), NCWP substantially exceeds the raw Base hidden states at aggressive-compression dimensions (e.g., +23.8 Spearman over Qwen1.5-4B Base on STSBenchmark at 8× compression; +13.6 nDCG@10 over Qwen1.5-4B Base on BEIR-Quora at 32× compression), simultaneously delivering retrieval-quality improvements and index-size reductions; the pattern also holds in breadth analyses on STS12–16+SICK-R and CQADupStack. All main results are reported as mean over three random seeds. We characterize a dimensional crossover in which NCWP’s advantage over PCA-whitening widens monotonically down to 256× compression on Qwen1.5-4B and Qwen2-7B, and provide geometric evidence consistent with the proposed mechanism via anisotropy measurements: NCWP reduces anisotropy on all three LLM backbones by roughly an order of magnitude, to a near-zero residual on Qwen1.5-4B and Llama-3.1-8B and a smaller reduction on Qwen2-7B. NCWP is also complementary to prompt-based extraction: applied on top of PromptEOL it improves over full-dimensional PromptEOL while compressing up to 64×. Code is available at https://github.com/ianleeGH20/NCWP.