Your bookmarks

Loading your bookmarks

Latest updates

New courses, skills, book chapters, and site improvements will appear here.

Create free accountSign upDashboardDashboard

Vector database

  • Context
  • Standard term

A vector database stores embeddings, lists of numbers that represent text or images, and finds the ones closest to a query's numbers. AI apps use it to look up passages related to a question.

Each stored vector, one of those lists of numbers, sits beside an ID and often details such as its source document or date. Each question goes through the embedding model that made the stored vectors, since two models' numbers can't be compared. An index built ahead of time finds near matches without checking every item.

Where you’ll meet it

You built a help bot for your team with a coding agent, and it answers from company policy documents stored in a vector database. A coworker asks how many vacation days carry over, and the bot quotes last year's policy, which reads almost word for word like this year's.

What to do

Ask the agent to store each document's effective date beside its vectors and to search only current versions. Then ask the bot the carry-over question again, plus one about a policy that changed more, to confirm the old text no longer comes back.

Easy to mix up

RAG includes a model that writes an answer from what was found. A vector database writes nothing: it hands back the stored items closest to the query, with their scores.

Check yourself

Your online shop's help bot answers from a vector database of your policy pages, none of which mentions gift wrapping. Asked whether you gift-wrap orders, it quotes a passage about how orders are packed. Which change lets it reply that it found nothing?

Go deeperIts index and how documents were split decide what it finds

Most vector databases use approximate nearest-neighbor indexes, such as HNSW, a layered graph that hops toward close matches, described by Yury Malkov and Dmitry Yashunin in 2016. They accept a small chance of missing the best match for large gains in speed, and index settings adjust that tradeoff.

Documents are split into chunks before embedding, and each chunk gets one vector. A chunk too small loses the context that makes it findable, and one too large averages several topics into a single vector that matches none of them closely.

Dedicated stores include Pinecone, Chroma, Weaviate, Milvus, and Qdrant. Existing systems add vector search too, such as pgvector for PostgreSQL, Elasticsearch, and Redis. A retrieval-augmented generation (RAG) system can also retrieve with keyword search alone, so a vector database is one option among several.

Practice Modern AI

Or take the learning quiz on a mix of every set