Focusing Condition: Inference-Time Self-Contrastive Steering Elicits Better Conditional Text Embeddings in LLMs
Zifeng Cheng, Lingyun Qian, Zhiwei Jiang, Cong Wang, Yafeng Yin, Fei Shen, Ao Zhou, Qing Gu
Abstract
Extracting conditional text embeddings from large language models (LLMs) is a promising paradigm, as it requires neither additional data nor fine-tuning. Existing methods incorporate conditions into prompts to guide LLMs to focus on specific aspects and elicit conditional text embeddings. However, relying solely on prompts often fails to produce high-quality conditional text embeddings, as they remain entangled with general text embeddings, ultimately degrading their quality. To this end, we propose an inference-time, plug-and-play Self-Contrastive Steering (SCS) method that constructs unconditional general text embeddings and uses them to refine conditional text embeddings, making them more focused on the target condition. Specifically, we modify the attention mask and positional encodings to mask the condition, thereby obtaining unconditional text embeddings and intervening in the multi-head self-attention computation process. Notably, our method is highly efficient, requiring only a single additional multihead self-attention computation at inference time. Extensive experiments on clustering, Semantic Textual Similarity, and triplet alignment datasets demonstrate that our method can seamlessly improve the performance of existing prompt-based methods across different LLMs in a training-free and plug-and-play manner. Our code will be released at https: //github.com/zifengcheng/SCS .
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext cae2cb52-bbc2-49f2-9c79-794b9b82f8a5Builds on16
- SimCSE: Simple Contrastive Learning of Sentence EmbeddingsTianyu Gao, Xingcheng Yao, Danqi ChenEMNLP 2021 · 2,496 citations
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order SensitivityYao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel et al.ACL 2022 · 1,494 citations
- PromptBERT: Improving BERT Sentence Embeddings with PromptsTing Jiang, Jian Jiao, Shaohan Huang, Zihan Zhang et al.EMNLP 2022 · 148 citations
- Why Larger Language Models Do In-context Learning Differently?Zhenmei Shi, Junyi Wei, Zhuoyan Xu, Yingyu LiangICML 2024 · 54 citations
- Goal-Driven Explainable Clustering via Language DescriptionsZihan Wang, Jingbo Shang, Ruiqi ZhongEMNLP 2023 · 19 citations
Related papers
- Contrastive Prompting Enhances Sentence Embeddings in LLMs through Inference-Time SteeringZifeng Cheng, Zhonghui Wang, Yuchen Fu, Zhiwei Jiang et al.ACL 2025
- Meta-Task Prompting Elicits Embeddings from Large Language ModelsYibin Lei, Di Wu, Tianyi Zhou, Tao Shen et al.ACL 2024 · 6 citations
- Following the Autoregressive Nature of LLM Embeddings via Compression and AlignmentJingcheng Deng, Zhongtao Jiang, Liang Pang, Zihao Wei et al.EMNLP 2025
- Token Prepending: A Training-Free Approach for Eliciting Better Sentence Embeddings from LLMsYuchen Fu, Zifeng Cheng, Zhiwei Jiang, Zhonghui Wang et al.ACL 2025
- SCOPE: A Self-supervised Framework for Improving Faithfulness in Conditional Text GenerationSong Duong, Florian Le Bronnec, Alexandre Allauzen, Vincent Guigue et al.ICLR 2025
