Lune

ACL2025Top-tier venue

Contrastive Prompting Enhances Sentence Embeddings in LLMs through Inference-Time Steering

Zifeng Cheng, Zhonghui Wang, Yuchen Fu, Zhiwei Jiang, Yafeng Yin, Cong Wang, Qing Gu

Abstract

Extracting sentence embeddings from large language models (LLMs) is a practical direction, as it requires neither additional data nor fine-tuning. Previous studies usually focus on prompt engineering to guide LLMs to encode the core semantic information of the sentence into the embedding of the last token. However, the last token in these methods still encodes an excess of non-essential information, such as stop words, limiting its encoding capacity. To this end, we propose a Contrastive Prompting (CP) method that introduces an extra auxiliary prompt to elicit better sentence embedding. By contrasting with the auxiliary prompt, CP can steer existing prompts to encode the core semantics of the sentence, rather than non-essential information. CP is a plugand-play inference-time intervention method that can be combined with various promptbased methods. Extensive experiments on Semantic Textual Similarity (STS) tasks and downstream classification tasks demonstrate that our method can improve the performance of existing prompt-based methods across different LLMs. Our code will be released at https://github.com/zifengcheng/CP .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

10 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • One Embedder, Any Task: Instruction-Finetuned Text Embeddings cites SimCSE: Simple Contrastive Learning of Sentence Embeddings
  • One Embedder, Any Task: Instruction-Finetuned Text Embeddings cites Sentence-T5: Scalable Sentence Encoders from Pre-trained Text-to-Text Models
  • LLM-based Embeddings: Attention Values Encode Sentence Semantics Better Than Hidden States cites Sentence-T5: Scalable Sentence Encoders from Pre-trained Text-to-Text Models
  • Steering When Necessary: Flexible Steering Large Language Models with Backtracking cites Inference-Time Intervention: Eliciting Truthful Answers from a Language Model
  • Steering When Necessary: Flexible Steering Large Language Models with Backtracking cites Advanced Sign Language Video Generation with Compressed and Quantized Multi-Condition Tokenization
  • PromptBERT: Improving BERT Sentence Embeddings with Prompts cites SimCSE: Simple Contrastive Learning of Sentence Embeddings
  • Sentence-T5: Scalable Sentence Encoders from Pre-trained Text-to-Text Models cites SimCSE: Simple Contrastive Learning of Sentence Embeddings
  • Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddings cites PromptBERT: Improving BERT Sentence Embeddings with Prompts
  • Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddings cites SimCSE: Simple Contrastive Learning of Sentence Embeddings
  • Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddings cites Sentence-T5: Scalable Sentence Encoders from Pre-trained Text-to-Text Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers10

  1. Advanced Sign Language Video Generation with Compressed and Quantized Multi-Condition TokenizationCong Wang, Zexuan Deng, Zhiwei Jiang, Yafeng Yin et al.NeurIPS 2025 · 13 citations
  2. Steering When Necessary: Flexible Steering Large Language Models with BacktrackingZifeng Cheng, Jinwei Gan, Zhiwei Jiang, Cong Wang et al.NeurIPS 2025 · 9 citations
  3. Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM EmbeddingsXueying Ding, Xingyue Huang, Mingxuan Ju, Liam Collins et al.ACL 2026 · 3 citations
  4. LLM-based Embeddings: Attention Values Encode Sentence Semantics Better Than Hidden StatesYeqin Zhang, Yunfei Wang, Jiaxuan Chen, Ke Qin et al.ICML 2026 · 1 citation
  5. Beyond Step Pruning: Information Theory Based Step-level Optimization for Self-Refining Large Language ModelsJinman Zhao, Erxue Min, Hui Wu, Ziheng Li et al.AAAI 2026 · 1 citation

Builds on14

  1. SimCSE: Simple Contrastive Learning of Sentence EmbeddingsTianyu Gao, Xingcheng Yao, Danqi ChenEMNLP 2021 · 2,496 citations
  2. Inference-Time Intervention: Eliciting Truthful Answers from a Language ModelKenneth Li, Oam Patel, Fernanda B. Viégas, Hanspeter Pfister et al.NeurIPS 2023 · 1,549 citations
  3. Sentence-T5: Scalable Sentence Encoders from Pre-trained Text-to-Text ModelsJianmo Ni, Gustavo Hernández Ábrego, Noah Constant, Ji Ma et al.ACL Findings 2022 · 358 citations
  4. PromptBERT: Improving BERT Sentence Embeddings with PromptsTing Jiang, Jian Jiao, Shaohan Huang, Zihan Zhang et al.EMNLP 2022 · 148 citations
  5. One Embedder, Any Task: Instruction-Finetuned Text EmbeddingsHongjin Su, Weijia Shi, Jungo Kasai, Yizhong Wang et al.ACL Findings 2023 · 134 citations

Related papers

  1. Focusing Condition: Inference-Time Self-Contrastive Steering Elicits Better Conditional Text Embeddings in LLMsZifeng Cheng, Lingyun Qian, Zhiwei Jiang, Cong Wang et al.ACL 2026
  2. Scaling Sentence Embeddings with Large Language ModelsTing Jiang, Shaohan Huang, Zhongzhi Luan, Deqing Wang et al.EMNLP Findings 2024 · 61 citations
  3. Token Prepending: A Training-Free Approach for Eliciting Better Sentence Embeddings from LLMsYuchen Fu, Zifeng Cheng, Zhiwei Jiang, Zhonghui Wang et al.ACL 2025
  4. Refining Sentence Embedding Model through Ranking Sentences Generation with Large Language ModelsLiyang He, Chenglong Liu, Rui Li, Zhenya Huang et al.ACL Findings 2025 · 1 citation
  5. Meta-Task Prompting Elicits Embeddings from Large Language ModelsYibin Lei, Di Wu, Tianyi Zhou, Tao Shen et al.ACL 2024 · 6 citations
Dusk over the sea between two cliffs drawn in fine vertical lines