[Paper Review] Scaling Sentence Embeddings with Large Language Models
The paper shows that in-context learning with PromptEOL can generate high-quality sentence embeddings from LLMs without fine-tuning, and that scaling helps STS transfer tasks but may eventually hurt STS gains; coupling with efficient fine-tuning yields state-of-the-art results.
Large language models (LLMs) have recently garnered significant interest. With in-context learning, LLMs achieve impressive results in various natural language tasks. However, the application of LLMs to sentence embeddings remains an area of ongoing research. In this work, we propose an in-context learning-based method aimed at improving sentence embeddings performance. Our approach involves adapting the previous prompt-based representation method for autoregressive models, constructing a demonstration set that enables LLMs to perform in-context learning, and scaling up the LLMs to different model sizes. Through extensive experiments, in-context learning enables LLMs to generate high-quality sentence embeddings without any fine-tuning. It helps LLMs achieve performance comparable to current contrastive learning methods. By scaling model size, we find scaling to more than tens of billion parameters harms the performance on semantic textual similarity (STS) tasks. However, the largest model outperforms other counterparts and achieves the new state-of-the-art result on transfer tasks. We also fine-tune LLMs with current contrastive learning approach, and the 2.7B OPT model, incorporating our prompt-based method, surpasses the performance of 4.8B ST5, achieving the new state-of-the-art results on STS tasks. Our code is available at https://github.com/kongds/scaling_sentemb.
Motivation & Objective
- Motivate the use of LLMs for sentence embeddings beyond traditional encoder-based methods.
- Investigate prompt-based representations tailored for autoregressive LLMs.
- Assess the impact of model scale on STS and transfer tasks.
- Explore in-context learning and efficient fine-tuning as pathways to improve embeddings without full fine-tuning.
Proposed method
- Propose PromptEOL, a prompt-based method with explicit one-word limitation for autoregressive LLMs to produce sentence embeddings.
- Use in-context learning by constructing demonstration sets and selecting effective demonstrations to guide LLMs in encoding semantic information.
- Evaluate representations from LLMs (OPT and LLaMA families) across model scales from millions to tens of billions of parameters.
- In the fine-tuning setting, apply efficient contrastive learning via QLoRA to enable memory-efficient fine-tuning with 4-bit quantization.
- Compare prompt-based representations to averaging and previous prompt-based methods, showing superiority of PromptEOL across settings.
- Provide a framework to automatically generate demonstrations (word labels via ChatGPT and dictionary-based pairs) for in-context learning.
Experimental results
Research questions
- RQ1Can LLMs produce effective sentence embeddings via prompt engineering without fine-tuning?
- RQ2Does in-context learning improve the quality of LLM-based sentence embeddings across model scales?
- RQ3How does scaling from millions to tens of billions of parameters affect STS and transfer tasks?
- RQ4Can contrastive learning with efficient fine-tuning further enhance LLM-based sentence embeddings?
Key findings
- In-context learning enables high-quality sentence embeddings from LLMs without fine-tuning, achieving performance comparable to contrastive learning methods.
- Scaling up to tens of billions of parameters improves STS results inconsistently; the largest models outperform others on transfer tasks, but very large scales may not further improve STS.
- PromptEOL generally outperforms other representation methods (averaging, basic prompt) across model sizes.
- Efficient fine-tuning with QLoRA and 4-bit quantization allows STS-state-of-the-art results with moderate compute, e.g., 2.7B OPT surpassing 4.8B ST5 on STS tasks.
- With fine-tuning, larger models (13B OPT, 13B LLaMA) achieve best STS results, while very large models continue to improve transfer task performance.
- PromptEOL+ICL (in-context learning) demonstrates strong STS gains even for smaller models, and larger models show amplified benefits from demonstrations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.