Contrastive Prompting Enhances Sentence Embeddings in LLMs through Inference-Time Steering
Not on the map. Why?
Abstract (arXiv)
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 plug-and-play inference-time intervention method that can be combined with various prompt-based 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.
Key facts. Cited by 13 papers in the map (data through 14 Oct 2026). Builds on 24 of its 47 references that are in the map. First posted on arXiv 19 May 2025.
Builds on
24 of 47 references.
References · 24
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
- 2023Representation Engineering: A Top-Down Approach to AI Transparencycited by 1,336
- 2023Inference-Time Intervention: Eliciting Truthful Answers from a Language Modelcited by 1,302
- 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,085
- 2017SemEval-2017 Task 1: Semantic Textual Similarity - Multilingual and Cross-lingual Focused Evaluationcited by 1,001
- 2024NV-Embed: Improved Techniques for Training LLMs as Generalist Embedding Modelscited by 472
- 2021Sentence-T5: Scalable Sentence Encoders from Pre-trained Text-to-Text Modelscited by 463
- 2024LLM2Vec: Large Language Models Are Secretly Powerful Text Encoderscited by 404
12 more
- 2022One Embedder, Any Task: Instruction-Finetuned Text Embeddingscited by 333
- 2024Generative Representational Instruction Tuningcited by 233
- 2024IMAGDressing-v1: Customizable Virtual Dressingcited by 100
- 2023Self-Detoxifying Language Models via Toxification Reversalcited by 46
- 2024Fantastic Semantics and Where to Find Them: Investigating Which Layers of Generative LLMs Reflect Lexical Semanticscited by 44
- 2023BeLLM: Backward Dependency Enhanced Large Language Model for Sentence Embeddingscited by 32
- 2024Simple Techniques for Enhancing Sentence Embeddings in Generative Language Modelscited by 26
- 2024When Text Embedding Meets Large Language Model: A Comprehensive Surveycited by 19
- 2023Meaning Representations from Trajectories in Autoregressive Modelscited by 18
- 2024Token Prepending: A Training-Free Approach for Eliciting Better Sentence Embeddings from LLMscited by 18
- 2023Composition-contrastive Learning for Sentence Embeddingscited by 14
- 2024Multi-Prompting Decoder Helps Better Language Understandingcited by 2
Built on by
Citing papers per year: 2025: 5; 2026: 8.
13 papers.
Sort:
By area:
- 2025Position: Text Embeddings Should Capture Implicit Semantics, Not Just Surface Meaningcited by 10
- 2025Advanced Sign Language Video Generation with Compressed and Quantized Multi-Condition Tokenizationcited by 9
- 2025Steering When Necessary: Flexible Steering Large Language Models with Backtrackingcited by 8
- 2025RegionMarker: A Region-Triggered Semantic Watermarking Framework for Embedding-as-a-Service Copyright Protectioncited by 4
- 2025Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddingscited by 3
- 2026LLM-based Embeddings: Attention Values Encode Sentence Semantics Better Than Hidden Statescited by 3
- 2026The Truth Lies Somewhere in the Middle (of the Generated Tokens)cited by 3
- 2026SemPA: Improving Sentence Embeddings of Large Language Models through Semantic Preference Alignmentcited by 1
- 2026Focusing Condition: Inference-Time Self-Contrastive Steering Elicits Better Conditional Text Embeddings in LLMscited by 1
- 2026Activation Steering for Synthetic Data Generation: The Role of Diversity in Downstream Safety Detectioncited by 0
- 2026DySem: Uncovering Dynamic Semantic Components of Large Language Models for Calculating Semantic Textual Similaritycited by 0
- 2026ReverseEOL: Improving Training-free Text Embeddings via Text Reversal in Decoder-only LLMscited by 0
- 2026Selecting What Matters: Semantic Compression-Guided Selective Pooling for Long-Context Embeddings29 Sep 2026
- 2026Focusing Condition: Inference-Time Self-Contrastive Steering Elicits Better Conditional Text Embeddings in LLMs26 Sep 2026
- 2026ReverseEOL: Improving Training-free Text Embeddings via Text Reversal in Decoder-only LLMs4 Jun 2026
- 2026DySem: Uncovering Dynamic Semantic Components of Large Language Models for Calculating Semantic Textual Similarity28 May 2026
- 2026Activation Steering for Synthetic Data Generation: The Role of Diversity in Downstream Safety Detection27 May 2026
- 2026The Truth Lies Somewhere in the Middle (of the Generated Tokens)11 May 2026
- 2026LLM-based Embeddings: Attention Values Encode Sentence Semantics Better Than Hidden States2 Feb 2026
- 2026SemPA: Improving Sentence Embeddings of Large Language Models through Semantic Preference Alignment8 Jan 2026
- 2025Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddings18 Nov 2025
- 2025RegionMarker: A Region-Triggered Semantic Watermarking Framework for Embedding-as-a-Service Copyright Protection17 Nov 2025
- 2025Steering When Necessary: Flexible Steering Large Language Models with Backtracking25 Aug 2025
- 2025Advanced Sign Language Video Generation with Compressed and Quantized Multi-Condition Tokenization19 Jun 2025
- 2025Position: Text Embeddings Should Capture Implicit Semantics, Not Just Surface Meaningcited by 10
- 2025RegionMarker: A Region-Triggered Semantic Watermarking Framework for Embedding-as-a-Service Copyright Protectioncited by 4
- 2025Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddingscited by 3
- 2026LLM-based Embeddings: Attention Values Encode Sentence Semantics Better Than Hidden Statescited by 3
- 2026The Truth Lies Somewhere in the Middle (of the Generated Tokens)cited by 3
- 2026Focusing Condition: Inference-Time Self-Contrastive Steering Elicits Better Conditional Text Embeddings in LLMscited by 1
- 2026DySem: Uncovering Dynamic Semantic Components of Large Language Models for Calculating Semantic Textual Similaritycited by 0
- 2026ReverseEOL: Improving Training-free Text Embeddings via Text Reversal in Decoder-only LLMscited by 0
- 2026Selecting What Matters: Semantic Compression-Guided Selective Pooling for Long-Context Embeddingscited by 0
- 2026Selecting What Matters: Semantic Compression-Guided Selective Pooling for Long-Context Embeddings29 Sep 2026
- 2026Focusing Condition: Inference-Time Self-Contrastive Steering Elicits Better Conditional Text Embeddings in LLMs26 Sep 2026
- 2026ReverseEOL: Improving Training-free Text Embeddings via Text Reversal in Decoder-only LLMs4 Jun 2026
- 2026DySem: Uncovering Dynamic Semantic Components of Large Language Models for Calculating Semantic Textual Similarity28 May 2026
- 2026The Truth Lies Somewhere in the Middle (of the Generated Tokens)11 May 2026
- 2026LLM-based Embeddings: Attention Values Encode Sentence Semantics Better Than Hidden States2 Feb 2026
- 2025Hierarchical Token Prepending: Enhancing Information Flow in Decoder-based LLM Embeddings18 Nov 2025
- 2025RegionMarker: A Region-Triggered Semantic Watermarking Framework for Embedding-as-a-Service Copyright Protection17 Nov 2025
- 2025Position: Text Embeddings Should Capture Implicit Semantics, Not Just Surface Meaning10 Jun 2025