Scaling Sentence Embeddings with Large Language Models

Ting Jiang, Shaohan Huang, Zhongzhi Luan, Deqing Wang, Fuzhen Zhuang
7/31/2023
cs.CL

Official code: kongds/scaling_sentemb (109 stars, last commit 2024-03-22).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

Scaling Sentence Embeddings with Large Language Models

1095Shell, PythonJul 31, 20232 years ago

Similar Papers

Cite this paper

@article{jiang2023scaling,
  title  = {Scaling Sentence Embeddings with Large Language Models},
  author = {Ting Jiang and Shaohan Huang and Zhongzhi Luan and Deqing Wang and Fuzhen Zhuang},
  year   = {2023},
  eprint = {2307.16645},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2307.16645v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2307.16645.svg)](https://codeofpaper.com/paper/2307.16645)

Discussion