CLMay 19, 2025

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

arXiv:2505.12831v114 citationsh-index: 16Has CodeACL
Originality Incremental advance
AI Analysis

This work addresses the practical problem of enhancing sentence embeddings for NLP applications without fine-tuning, though it appears incremental as it builds on existing prompt-based methods.

The paper tackles the problem of extracting sentence embeddings from large language models (LLMs) by addressing the issue of non-essential information in last-token embeddings, proposing a Contrastive Prompting (CP) method that improves performance on Semantic Textual Similarity (STS) and downstream classification tasks across different LLMs.

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.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes