Embedding
Definition
A vector representation of text or other data that places items with similar meaning close together, so they can be searched by similarity.
In more detail
An embedding model maps text to a fixed-length list of numbers. Comparing vectors finds semantically similar items even when they share no words. Queries and documents must be embedded with the same model.
Related terms
Cosine similarity
A measure of how similar two vectors are based on the angle between them, ranging from -1 (opposite) to 1 (same direction).
Retrieval-augmented generation (RAG)
Retrieving relevant documents and adding them to the prompt before the model generates an answer from them.
Semantic search
Search that ranks results by how close their meaning is to the query rather than by shared keywords, usually by comparing embeddings.
Vector database
A database designed to store embeddings and quickly find the nearest neighbours to a query vector, often with metadata filtering.
Chunking
Splitting documents into pieces sized for embedding and retrieval, ideally along natural boundaries such as sections or paragraphs.
HNSW
Hierarchical Navigable Small World: a graph-based index for fast approximate nearest-neighbour search, widely used by vector databases.
Read more about Embedding
- Embeddings and vector search, hands on
Embed documents, store them in Postgres with pgvector, index them and run similarity and hybrid search.
- Embeddings and vector search
Turning text into vectors to find similar items, alone or with keywords.