RAG assistants
The retrieval half of RAG is almost always a vector search.
Read more about RAG assistants
The retrieval half of retrieval-augmented generation is almost always a vector search.
Storage built to find the items closest in meaning to a query, fast.
It stores vectors with IDs and metadata and returns the nearest ones to a query. Options include pgvector inside PostgreSQL, Qdrant, Milvus and Pinecone.
A vector database stores vectors (lists of numbers) along with an ID and metadata, and supports nearest-neighbour search: give it a query vector and it returns the closest stored vectors.
Common options are pgvector (an extension that adds vector search to PostgreSQL), Qdrant, Milvus, Weaviate, Chroma and the hosted service Pinecone. Some are standalone servers; pgvector lives inside a database you may already run.
Write each embedding with its source reference and metadata such as access group.
You write each embedding with its source text reference and metadata, such as document name, customer ID, language or access group.
An approximate nearest neighbour index, often HNSW, avoids checking every vector.
Comparing a query against every vector is slow at scale, so the database builds an approximate nearest neighbour (ANN) index. HNSW, a graph-based index, is the most common.
The query walks the index and the closest matches return in milliseconds.
The query vector walks the index and the closest candidates come back, usually in milliseconds.
Metadata filters narrow results to what this client or user may see.
Metadata filters (only this client, only documents after a date, only what this user may see) narrow the results before they reach the model.
The retrieval half of RAG is almost always a vector search.
The retrieval half of retrieval-augmented generation is almost always a vector search.
Search by meaning across catalogues, help centres and internal wikis.
Semantic search over catalogues, help centres and internal wikis.
Similar descriptions or images power "customers also viewed" suggestions.
"Customers who viewed this also viewed" based on similarity of descriptions or images.
An agency stores listing embeddings in its existing PostgreSQL with pgvector, so one SQL query filters by price and locality and ranks by meaning.
A real estate agency wants staff to search tens of thousands of listings by description: "3 bedroom near a metro station with covered parking". Listing descriptions are embedded and stored in PostgreSQL with pgvector, next to the existing price, area and locality columns. One SQL query filters by price and locality and ranks the rest by vector similarity. No new database server was needed.
Below a few million vectors, pgvector in your existing Postgres is often enough.
Below a few million vectors, pgvector in your existing Postgres is often enough and saves running another service.
Codes, names and numbers match badly on meaning. Add keyword search too.
Codes, names and numbers match badly on meaning alone. Hybrid search (vector plus keyword, such as BM25) is usually more accurate.
When a document or customer's data is erased, its vectors must go too.
When a document is removed or a customer asks for erasure under the DPDP Act 2023 or GDPR, its vectors must go too.
Not always. PostgreSQL with pgvector, or the vector features in Elasticsearch or OpenSearch, handle many business workloads. A dedicated engine helps at very large scale or with heavy filtering.
Usually yes. ANN indexes trade a small amount of recall for large speed gains, and the trade-off is tunable. Measure recall on your own queries before and after tuning.
Last updated