Skip to content
Search

What are vector embeddings?

A vector embedding is a list of numbers that represents the meaning of text. OpenAI's text-embedding-3-large returns 3,072 of them by default.

numbers in one default vector from OpenAI's text-embedding-3-large. Google's Gemini embedding models also default to 3,072.Source: OpenAI API documentation

In short. A vector embedding is a list of numbers that an embedding model produces to represent the meaning of a text, image or other input. Inputs with similar meanings get vectors that are close together. Retrieval systems embed every passage and each query, then return the passages whose vectors are closest to the query, usually measured by cosine similarity.

On this page 9 sections

The evidence

Confirmed

OpenAI's text-embedding-3-small returns 1,536 numbers per embedding by default, and text-embedding-3-large returns 3,072. A dimensions parameter shortens both.1

1OpenAI API documentationOpenAI API documentation. Checked Nov 20, 2026.
Confirmed

OpenAI recommends cosine similarity. Its embeddings are normalized to length 1, so cosine similarity and Euclidean distance give identical rankings.1

1OpenAI API documentationOpenAI API documentation. Checked Nov 20, 2026.
Confirmed

Google's gemini-embedding-001 scored 68.17 on the MTEB benchmark at 1,536 dimensions and 67.99 at 768 dimensions.4

4Gemini API documentationGemini API documentation. Checked Nov 20, 2026.
Tested

A retriever that used only embeddings outperformed a Lucene BM25 keyword system by 9 to 19 percentage points in top-20 passage retrieval accuracy.9

9arXiv (Karpukhin et al.)Karpukhin et al., Dense Passage Retrieval, 2020. Open-domain question answering datasets.
Tested

The number of distinct top-k result sets that single-vector embeddings can return is limited by their dimension, and state-of-the-art models failed a simple dataset built to test this.12

12arXiv (Weller et al.)Weller et al., 2025, accepted to ICLR 2026. LIMIT dataset.

Embeddings are how many AI retrieval systems match a question to your passages by meaning. Microsoft said in 2019 that Bing had turned more than 150 billion pieces of indexed data into vectors for web results. A vector embedding is a list of numbers that represents the meaning of an input, such as a sentence, a passage or an image. An embedding model produces it. Inputs with similar meanings get vectors that are close together, so software can compare meanings by comparing numbers. OpenAI's embeddings guide lists search, clustering, recommendations, anomaly detection and classification as uses.1 Retrieval for AI answers depends on the first of these, semantic search.

#How models produce embeddings

Embedding models read a page in passages of limited length, so a long page is matched passage by passage. Early embeddings represented single words. The 2013 paper Efficient Estimation of Word Representations in Vector Space proposed two model architectures that learn a vector for each word from a large body of text. The authors trained vectors on a dataset of 1.6 billion words in less than a day.2

Search needs a vector for a whole query or passage. A Transformer model such as BERT can judge whether two sentences mean the same thing, but it has to read both sentences together. The Sentence-BERT paper calculated that finding the most similar pair among 10,000 sentences this way takes about 50 million model runs, or about 65 hours. Sentence-BERT changed BERT to output one embedding per sentence, which can be compared with cosine similarity. The same search took about 5 seconds.3

Embedding APIs from OpenAI, Google and Cohere work the same way. An application sends text to the model and gets a vector back. Each model has an input limit, measured in tokens:

  • OpenAI's text-embedding-3 models accept up to 8,192 tokens.1
  • Google's Gemini embeddings documentation gives 8,192 tokens for gemini-embedding-2 and 2,048 for gemini-embedding-001. The page says gemini-embedding-2 silently truncates input over its limit.4

A long page has to be split into passages before it is embedded. The step is called chunking. How retrieval-augmented generation works describes where chunking fits in a retrieval pipeline.

#Dimensions

For a team building its own retrieval, vector length trades storage and speed against quality. Each number in an embedding is one dimension. Providers set a default length and let developers request shorter vectors.

Table 1.Embedding sizes in providers' documentation, Nov 20, 2026.
ModelDefault dimensionsShorter sizesMax input (tokens)
OpenAI text-embedding-3-small1,536Shorter sizes, with the dimensions parameter8,192
OpenAI text-embedding-3-large3,072Shorter sizes, with the dimensions parameter8,192
Google gemini-embedding-0013,072128 to 3,0722,048
Google gemini-embedding-23,072128 to 3,0728,192
Cohere embed-v5.0-proNot stated256, 512, 768, 1,024, 1,536 or 2,048Not stated

Shorter vectors take less storage and compare faster, but they lose some quality. OpenAI says a text-embedding-3-large vector shortened to 256 numbers still outperformed a full 1,536-number vector from its older text-embedding-ada-002 on the MTEB benchmark.1 Google publishes MTEB scores for gemini-embedding-001 at each size: 68.17 at 1,536 dimensions, 67.99 at 768 and 63.31 at 128.4 Google says both of its models are trained with Matryoshka Representation Learning, which makes the first part of a vector a usable shorter version of the whole.4

Precision is a second way to save space. Cohere's embeddings documentation offers float, int8, uint8, binary and ubinary outputs. A binary embedding of 1,024 dimensions takes 128 bytes.5

#Similarity measures

For normalized embeddings such as OpenAI's, the choice of similarity measure matters less than using the same model for queries and documents. Retrieval compares a query vector with stored vectors and ranks them by similarity. Microsoft's documentation of vector relevance in Azure AI Search describes three common measures:6

  • Cosine similarity measures the angle between two vectors and ignores their lengths.
  • Dot product measures both the lengths and the angle. For vectors normalized to length 1, it gives the same result as cosine similarity and is slightly faster.
  • Euclidean distance measures the length of the difference between two vectors.

Google's page says cosine similarity values range from -1, for opposite meanings, to 1, for the greatest similarity.4 OpenAI recommends cosine similarity and says the choice of distance function typically does not matter much, because its embeddings are normalized to length 1, so cosine similarity and Euclidean distance produce identical rankings.1 A vector shortened by hand has to be normalized again. Gemini-embedding-2 does this automatically for shorter sizes, and gemini-embedding-001 does not.4

The query and the documents must be embedded by the same model. OpenAI's code search example embeds the query "using the same model" as the indexed functions.1 Some models also take a setting for the kind of input. Gemini-embedding-001 has separate task types for search queries and for documents to be retrieved. Cohere asks for search_query on queries and search_document on the passages being searched.45

#Vector databases

A vector database can search exactly or approximately, and the approximate option is faster and can miss some of the nearest passages. A vector database stores embeddings and returns the ones nearest to a query vector. OpenAI recommends one for searching many vectors quickly.1

The simplest search compares the query with each stored vector in turn. pgvector, an open-source extension that adds vector search to Postgres, does this by default and calls it exact nearest neighbor search, with perfect recall. An approximate index trades some recall for speed. pgvector notes that queries can return different results after such an index is added.7

HNSW (Hierarchical Navigable Small World) is an approximate index. The 2016 paper that introduced it builds a graph in several layers, with fewer points in the upper layers. A search starts at the top layer and moves down toward the nearest points, and its cost grows with the logarithm of the number of vectors.8 Azure AI Search and pgvector both support HNSW. Microsoft says HNSW in Azure AI Search requires all data points to be in memory for fast access.67

#Embeddings in RAG retrieval

Embeddings beat keyword search in a 2020 test, and many RAG systems now combine the two, so the exact names and terms on a page still count. The 2020 paper Dense Passage Retrieval for Open-Domain Question Answering showed that a retriever can work with embeddings alone. Its retriever outperformed a Lucene BM25 keyword system by 9 to 19 percentage points in top-20 passage retrieval accuracy.9 The paper that introduced retrieval-augmented generation models, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, used a dense vector index of Wikipedia as the model's external memory.10

Many RAG systems now use embeddings and keyword search together. Anthropic's post on Contextual Retrieval says embedding models capture meaning but can miss exact matches, such as an error code. Its pipeline splits documents into chunks of a few hundred tokens, retrieves chunks with both embeddings and BM25, and merges the two lists.11 The retrieved chunks then go into the model's context window, which how large language models work explains.

In its announcement of the SPTAG vector search algorithm, Microsoft said in 2019 that Bing used vector search for web results. It had turned more than 150 billion pieces of indexed data into vectors.14

#Limits

Embeddings miss things in documented ways, and a retrieval system that relies on them alone inherits those gaps.

  • Embeddings can miss exact strings. Anthropic's example is a support query for "Error code TS-999" that returns pages about error codes in general.11
  • Embedding models do not always transfer to new kinds of data. The BEIR benchmark tested 10 retrieval systems on 18 datasets and found that dense retrieval models often performed worse than other approaches on data they were not trained for. The authors describe BM25 as "a robust baseline."13
  • The size of a vector limits what it can retrieve. On the Theoretical Limitations of Embedding-Based Retrieval shows that the number of distinct top-k result sets a query can return is limited by the embedding dimension. State-of-the-art models failed LIMIT, a simple dataset the authors built to test this.12
  • Gemini-embedding-2 silently truncates input beyond its token limit, so a long page has to be represented by its chunks.4
  • Approximate indexes trade recall for speed. pgvector applies filters after the index scan, so a filtered query can return fewer results than requested.7

Questions

What is the difference between an embedding and a token?

A token is a piece of text, such as a word or part of a word, that a model reads. An embedding is a vector of numbers that represents the meaning of a whole input, such as a sentence or a passage. An embedding model reads tokens and outputs one embedding.

How many dimensions should an embedding have?

It depends on the model and the storage budget. OpenAI's models return 1,536 or 3,072 numbers by default, and Gemini embedding models return 3,072. Both providers let you request shorter vectors. Gemini's own benchmark shows a small loss in quality from 1,536 to 768 dimensions and a larger loss at 128.

Can I compare embeddings from two different models?

No. Vectors from different models can have different lengths and are trained separately. Providers' examples embed the query with the same model as the documents, and Gemini and Cohere also ask for different settings for queries and for documents within one model.

Do AI search engines use embeddings?

Microsoft said in 2019 that Bing used vector search over more than 150 billion pieces of indexed data. Google says its generative AI features retrieve pages with its core Search ranking systems, which include neural matching, a system that matches representations of concepts in queries and pages.

Notes

  1. 1
    Vector embeddingsOpenAI API documentation · Checked Nov 20, 2026 · Primary source
  2. 2
    Efficient estimation of word representations in vector spacearXiv (Mikolov et al.) · Jan 16, 2013 · Checked Nov 20, 2026 · Paper
  3. 3
    Sentence-BERT: Sentence embeddings using Siamese BERT-networksarXiv (Reimers and Gurevych) · Aug 27, 2019 · Checked Nov 20, 2026 · Paper
  4. 4
    EmbeddingsGemini API documentation · Oct 29, 2026 · Checked Nov 20, 2026 · Primary source
  5. 5
    Introduction to embeddings at CohereCohere documentation · Checked Nov 20, 2026 · Primary source
  6. 6
    Vector relevance and rankingMicrosoft Learn · Checked Nov 20, 2026 · Primary source
  7. 7
    pgvector: open-source vector similarity search for Postgrespgvector on GitHub · Checked Nov 20, 2026 · Primary source
  8. 8
    Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphsarXiv (Malkov and Yashunin) · Mar 30, 2016 · Checked Nov 20, 2026 · Paper
  9. 9
    Dense passage retrieval for open-domain question answeringarXiv (Karpukhin et al.) · Apr 10, 2020 · Checked Nov 20, 2026 · Paper
  10. 10
    Retrieval-augmented generation for knowledge-intensive NLP tasksarXiv (Lewis et al.) · May 22, 2020 · Checked Nov 20, 2026 · Paper
  11. 11
    Introducing Contextual RetrievalAnthropic · Sep 19, 2024 · Checked Nov 20, 2026 · Primary source
  12. 12
    On the theoretical limitations of embedding-based retrievalarXiv (Weller et al.) · Aug 28, 2025 · Checked Nov 20, 2026 · Paper
  13. 13
    BEIR: A heterogenous benchmark for zero-shot evaluation of information retrieval modelsarXiv (Thakur et al.) · Apr 17, 2021 · Checked Nov 20, 2026 · Paper
  14. 14
    As search needs evolve, Microsoft makes AI tools for better search available to researchers and developersMicrosoft Source · May 15, 2019 · Checked Nov 20, 2026 · Primary source

About this page

Researched and reviewed by Promptly Found. Reviewed Nov 20, 2026. Next review due Feb 2027.

Cite this page
Citation style

Promptly Found. (2026, November 20). What are vector embeddings? https://promptlyfound.com/llms/embeddings

Revisions 1
First published.