[论文解读] Scaling Sentence Embeddings with Large Language Models
该论文表明,在上下文学习中使用 PromptEOL 可以在不微调的情况下从大语言模型生成高质量的句子嵌入,扩展对STS迁移任务的规模效应有帮助但可能最终损害STS收益;与高效微调结合可获得最先进结果。
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.
研究动机与目标
- 激发在传统的基于编码器的方法之外,使用LLMs进行句子嵌入的动机。
- 研究针对自回归LLM的提示式表示。
- 评估模型规模对STS和迁移任务的影响。
- 探索上下文学习和高效微调作为在不进行全量微调的情况下改进嵌入的途径。
提出的方法
- 提出 PromptEOL,一种基于提示的方法,针对自回归LLMs 的显式单词限制以生成句子嵌入。
- 通过构造演示集并选择有效示例来引导LLMs 编码语义信息,使用上下文学习。
- 在从百万级到数十亿参数的不同模型规模上评估来自LLMs(OPT 与 LLaMA 系列)的表示。
- 在微调设置中,应用通过 QLoRA 的高效对比学习,以实现4位量化的内存高效微调。
- 将提示型表示与平均化和先前的基于提示的方法进行比较,显示 PromptEOL 在各设定中的优越性。
- 提供一个自动生成演示的框架(通过 ChatGPT 的词标签和基于词典的对/配对)用于上下文学习。
实验结果
研究问题
- RQ1LLMs 能否通过提示工程在不进行微调的情况下产生有效的句子嵌入?
- RQ2上下文学习是否在不同模型规模上提升基于LLM的句子嵌入质量?
- RQ3从百万级到数十亿参数的尺度扩展如何影响STS和迁移任务?
- RQ4通过高效微调的对比学习是否可以进一步提升基于LLM的句子嵌入?
主要发现
| 方法 | 参数 | STS12 | STS13 | STS14 | STS15 | STS16 | STS-B | SICK-R | 平均 |
|---|---|---|---|---|---|---|---|---|---|
| SimCSE-BERT | 110M | 68.40 | 82.41 | 74.38 | 80.91 | 78.56 | 76.85 | 72.23 | 76.25 |
| SimCSE-RoBERTa | 123M | 70.16 | 81.77 | 73.24 | 81.36 | 80.65 | 80.22 | 68.56 | 76.57 |
| PromptBERT | 110M | 71.56 | 84.58 | 76.98 | 84.47 | 80.60 | 81.60 | 69.87 | 78.54 |
| PromptRoBERTa | 123M | 73.94 | 84.74 | 77.28 | 84.99 | 81.74 | 81.88 | 69.50 | 79.15 |
| BERT avg. | 110M | 30.87 | 59.89 | 47.73 | 60.29 | 63.73 | 47.29 | 58.22 | 52.57 |
| BERT prompt | 110M | 60.96 | 73.83 | 62.18 | 71.54 | 68.68 | 70.60 | 67.16 | 67.85 |
| ST5-Enc | 4.8B | 34.97 | 60.19 | 47.59 | 66.40 | 70.62 | 62.83 | 63.57 | 58.02 |
| PromptEOL OPT | 125M | 59.90 | 71.55 | 60.93 | 70.76 | 72.83 | 67.89 | 65.14 | 67.00 |
| 350M | 350M | 54.70 | 71.52 | 59.99 | 64.51 | 71.39 | 66.55 | 66.58 | 65.03 |
| 1.3B | 1.3B | 64.59 | 79.06 | 68.46 | 78.88 | 78.64 | 73.22 | 69.41 | 73.18 |
| 2.7B | 2.7B | 60.03 | 75.51 | 64.30 | 74.56 | 77.62 | 67.73 | 65.35 | 69.30 |
| 6.7B | 6.7B | 60.91 | 80.05 | 67.65 | 75.49 | 80.11 | 72.91 | 67.57 | 72.10 |
| 13B | 13B | 60.21 | 81.36 | 69.69 | 75.46 | 79.58 | 70.73 | 65.99 | 71.86 |
| 30B | 30B | 59.99 | 80.52 | 69.80 | 75.20 | 78.03 | 73.57 | 69.87 | 72.43 |
| 66B | 66B | 55.66 | 74.62 | 64.90 | 72.34 | 75.21 | 71.72 | 67.43 | 68.84 |
| PromptEOL+ICL OPT | 125M | 62.22 | 73.10 | 61.84 | 71.09 | 72.08 | 67.80 | 64.10 | 67.46 |
| 350M | 350M | 63.87 | 73.85 | 63.41 | 72.45 | 73.13 | 70.84 | 65.61 | 69.02 |
| 1.3B | 1.3B | 72.78 | 83.77 | 73.61 | 83.42 | 80.60 | 78.80 | 69.69 | 77.52 |
| 2.7B | 2.7B | 68.49 | 84.72 | 75.15 | 83.62 | 81.34 | 80.94 | 72.97 | 78.18 |
| 6.7B | 6.7B | 70.65 | 84.51 | 75.01 | 83.51 | 82.00 | 81.12 | 76.77 | 79.08 |
| 13B | 13B | 71.99 | 85.22 | 76.04 | 82.23 | 81.38 | 81.42 | 75.00 | 79.04 |
| 30B | 30B | 69.93 | 83.29 | 74.88 | 80.10 | 81.11 | 81.76 | 76.26 | 78.19 |
| 66B | 66B | 69.93 | 83.29 | 74.88 | 80.10 | 81.11 | 81.76 | 76.26 | 78.19 |
- 上下文学习使LLMs在不进行微调的情况下获得高质量的句子嵌入,其性能可与对比学习方法相媲美。
- 扩展到数十亿参数对STS结果的提升不稳定;最大的模型在迁移任务上优于其他模型,但极大规模可能并不能进一步提升STS。
- PromptEOL 通常在不同模型规模上优于其他表示方法(平均化、基本提示)。
- 使用 QLoRA 和 4 位量化的高效微调在中等计算量下实现STS最先进结果,例如 2.7B OPT 超越 4.8B ST5 在STS任务中的表现。
- 在微调下,较大模型(13B OPT、13B LLaMA)取得最佳STS结果,而非常大的模型继续提升迁移任务性能。
- PromptEOL+ICL(上下文学习)即使在较小模型上也显示出强劲的STS增益,且较大模型从示例中获得的收益更为显著。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。