Token Prepending: A Training-Free Approach for Eliciting Better Sentence Embeddings from LLMs

AI-generated keywords: Token Prepending

AI-generated Key Points

The license of the paper does not allow us to build upon its content and the key points are generated using the paper metadata rather than the full article.

  • Authors explore extracting sentence embeddings from large language models (LLMs)
  • Highlight the potential of LLMs in showcasing robust semantic understanding capabilities
  • Introduce Token Prepending (TP) technique to address limitations in decoder-only LLMs with causal attention
  • TP involves adding each layer's decoded sentence embedding at the beginning of the input sentence for the next layer
  • TP is described as plug-and-play and training-free, allowing seamless integration with various prompt-based methods and autoregressive LLMs
  • Extensive experiments validate effectiveness of TP on Semantic Textual Similarity (STS) tasks and downstream classification tasks
  • Significant performance improvements observed across different LLMs compared to existing prompt-based methods
  • Enhancements achieved with minimal additional inference cost
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

Authors: Yuchen Fu, Zifeng Cheng, Zhiwei Jiang, Zhonghui Wang, Yafeng Yin, Zhengliang Li, Qing Gu

14 pages, 5 figures

Abstract: Extracting sentence embeddings from large language models (LLMs) is a promising direction, as LLMs have demonstrated stronger semantic understanding capabilities. Previous studies typically focus on prompt engineering to elicit sentence embeddings from LLMs by prompting the model to encode sentence information into the embedding of the last token. However, LLMs are mostly decoder-only models with causal attention and the earlier tokens in the sentence cannot attend to the latter tokens, resulting in biased encoding of sentence information and cascading effects on the final decoded token. To this end, we propose a novel Token Prepending (TP) technique that prepends each layer's decoded sentence embedding to the beginning of the sentence in the next layer's input, allowing earlier tokens to attend to the complete sentence information under the causal attention mechanism. The proposed TP technique is a plug-and-play and training-free technique, which means it can be seamlessly integrated with various prompt-based sentence embedding methods and autoregressive LLMs. Extensive experiments on various Semantic Textual Similarity (STS) tasks and downstream classification tasks demonstrate that our proposed TP technique can significantly improve the performance of existing prompt-based sentence embedding methods across different LLMs, while incurring negligible additional inference cost.

Submitted to arXiv on 16 Dec. 2024

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

The license of the paper does not allow us to build upon its content and the AI assistant only knows about the paper metadata rather than the full article.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2412.11556v1

This paper's license doesn't allow us to build upon its content and the summarizing process is here made with the paper's metadata rather than the article.

, , , , In their paper titled "Token Prepending: A Training-Free Approach for Eliciting Better Sentence Embeddings from LLMs," authors Yuchen Fu, Zifeng Cheng, Zhiwei Jiang, Zhonghui Wang, Yafeng Yin, Zhengliang Li, and Qing Gu delve into the realm of extracting sentence embeddings from large language models (LLMs). They highlight the potential of LLMs in showcasing robust semantic understanding capabilities. Previous research has primarily focused on prompt engineering to extract sentence embeddings by encoding information into the last token's embedding. However, the authors point out a limitation in decoder-only LLMs with causal attention that restricts earlier tokens in a sentence from attending to later tokens. This can lead to biased encoding and subsequent effects on the final decoded token. To address this issue, the authors introduce a novel technique called Token Prepending (TP). This approach involves adding each layer's decoded sentence embedding at the beginning of the input sentence for the next layer. By doing so, earlier tokens can now access complete sentence information under the causal attention mechanism. The TP technique is described as plug-and-play and training-free, allowing seamless integration with various prompt-based sentence embedding methods and autoregressive LLMs. The effectiveness of the proposed TP technique is validated through extensive experiments on Semantic Textual Similarity (STS) tasks and downstream classification tasks. The results demonstrate significant performance improvements across different LLMs when compared to existing prompt-based methods. Importantly, these enhancements are achieved with minimal additional inference cost. Overall, this study sheds light on a promising approach for enhancing sentence embeddings from LLMs by addressing limitations in existing methodologies. The Token Prepending technique offers a practical and efficient solution that could potentially advance various natural language processing applications requiring robust semantic understanding capabilities.
Created on 13 Jan. 2025

Assess the quality of the AI-generated content by voting

Score: 0

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

Similar papers summarized with our AI tools

Navigate through even more similar papers through a

tree representation

Look for similar papers (in beta version)

By clicking on the button above, our algorithm will scan all papers in our database to find the closest based on the contents of the full papers and not just on metadata. Please note that it only works for papers that we have generated summaries for and you can rerun it from time to time to get a more accurate result while our database grows.

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.