---
title: "Embedding"
type: "glossary term"
url: "https://aifordevs.org/glossary#embedding"
markdown: "https://aifordevs.org/glossary/embedding.md"
publisher: "AI for Devs"
license: "https://aifordevs.org/reuse"
attribution: "Credit AI for Devs and link to https://aifordevs.org/glossary#embedding"
---

# Embedding

An embedding is a fixed-length vector of numbers that represents a piece of text, an image, or code, produced by an embedding model. Items with similar meaning end up close together, which is what vector search relies on.

Embed queries and documents with the same model, because vectors from different models are not comparable. As of November 8, 2026, OpenAI's text-embedding-3-small returns 1,536 dimensions by default and accepts a dimensions parameter to shorten the vector. OpenAI recommends cosine similarity, which on its unit-length vectors reduces to a dot product.

## Example

In pgvector a vector takes 4 bytes per dimension plus 8 bytes. At 1,536 dimensions that is 6,152 bytes each, or about 6.15 GB for one million vectors before any index.

## Source

[OpenAI docs: Vector embeddings](https://developers.openai.com/api/docs/guides/embeddings)

## Related terms

- [Vector database](https://aifordevs.org/glossary#vector-database)
- [RAG](https://aifordevs.org/glossary#rag)
- [Chunking](https://aifordevs.org/glossary#chunking)
- [HNSW](https://aifordevs.org/glossary#hnsw)

## Read the article

[What is a vector database? HNSW, IVF, and when to skip one](https://aifordevs.org/articles/what-is-a-vector-database)

## Cite this term

AI for Devs. "Embedding." https://aifordevs.org/glossary#embedding

- Page: https://aifordevs.org/glossary#embedding
- Markdown: https://aifordevs.org/glossary/embedding.md
- Reuse: Quote or summarize with a link to this page. Terms: https://aifordevs.org/reuse
- Publisher: AI for Devs
