cs.CLSep 26, 2026

Focusing Condition: Inference-Time Self-Contrastive Steering Elicits Better Conditional Text Embeddings in LLMs

Authors: Zifeng Cheng, Lingyun Qian, Zhiwei Jiang, Cong Wang, Yafeng Yin, Fei Shen, Ao Zhou, Qing Gu

Organizations: State Key Laboratory for Novel Software Technology, Nanjing University · National University of Singapore

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 multi-head 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

Figures & tables

Appendix figures & tables5 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Embedding-based In-Context Prompt Training for Enhancing LLMs as Text Encoders

    May 2, 2026Ailiang Lin, Zhuoyun Li, Keyu Mao +2Text EmbeddingsIn-Context Learning

  2. LLM2Vec-Gen: Generative Embeddings from Large Language Models

    Mar 11, 2026Parishad BehnamGhader, Vaibhav Adlakha, Fabian David Schmidt +3Text Embedding ModelsSelf-Supervised Pre-Training

  3. On The Effectiveness-Fluency Trade-Off In LLM Conditioning: A Systematic Study

    Jun 10, 2026Iuri Macocco, Pau Rodríguez, Arno Blaas +3LLM Fine-TuningActivation Steering