Text and Code Embeddings by Contrastive Pre-Training

By Arvind Neelakantan, Tao Xu, Raul Puri, Alec Radford, Jesse Michael Han, Jerry Tworek, Qiming Yuan, Nikolas A. Tezak, Jong Wook Kim, Chris Hallacy and 15 more. 2022

613 citations recorded by the source corpus.

Text embeddings are useful features in many applications such as semantic search and computing text similarity. Previous work typically trains models customized for different use cases, varying in dataset choice, training objective and model architecture. In this work, we show that contrastive pre-training on unsupervised data at scale leads to high quality vector representations of text and code. The same unsupervised text embeddings that achieve new state-of-the-art results in linear-probe classification also display impressive semantic search capabilities and sometimes even perform competitively with fine-tuned models. On linear-probe classification accuracy averaging over 7 tasks, our best unsupervised model achieves a relative improvement of 4% and 1.8% over previous best unsupervised and supervised text embedding models respectively. The same text embeddings when evaluated on large-scale semantic search attains a relative improvement of 23.4%, 14.7%, and 10.6% over previous best unsupervised methods on MSMARCO, Natural Questions and TriviaQA benchmarks, respectively. Similarly to text embeddings, we train code embedding models on (text, code) pairs, obtaining a 20.8% relative improvement over prior best work on code search.

Subfields: Artificial Intelligence, Information Systems, Information Retrieval & Search, Natural Language Processing, Representation & Self-Supervised Learning

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Furu Wei
  2. Ji-rong Wen
  3. Wayne Xin Zhao
  4. Hong-Liu Cao
  5. Jianfeng Gao
  6. Jimmy J. Lin
  7. Mohit Bansal
  8. Siva Reddy

In Information Systems

  1. Ji-rong Wen
  2. Wayne Xin Zhao
  3. Xueguang Ma
  4. Jing Liu
  5. Ruiyang Ren
  6. Chao Huang
  7. Lianghao Xia
  8. Daxin Jiang

In Information Retrieval & Search

  1. Jimmy J. Lin
  2. Jing Liu
  3. Xueguang Ma
  4. Ruiyang Ren
  5. Ji-rong Wen
  6. Wayne Xin Zhao
  7. Niklas Muennighoff
  8. Nils Reimers

In Natural Language Processing

  1. Furu Wei
  2. Siva Reddy
  3. Mohit Bansal
  4. Nan Yang
  5. Jimmy J. Lin
  6. Ji-rong Wen
  7. Niklas Muennighoff
  8. Jing Liu

In Representation & Self-Supervised Learning

  1. Niklas Muennighoff
  2. Shitao Xiao
  3. Zheng Liu
  4. Peitian Zhang
  5. Siva Reddy
  6. Liang Wang
  7. Dzmitry Bahdanau
  8. Nicolas Chapados

Citations in the corpus