Skip to content

Vector database

A vector database stores embeddings, lists of numbers that capture what a text or image means, and finds the ones closest to a query's, so you search by meaning instead of exact words.

Select any words here to ask your Maestro about them.

A store's help bot searches a vector database of 400 articles, none about pets, and is set to pass up to 3 matches to the model. A customer asks: "Can I bring my dog into the store?" What does the search hand the model?

A store's help bot that searches 400 articles stored in a vector database. Example scores; the range depends on the embedding model.

What it stores: embeddings, lists of hundreds or thousands of numbers a model computes for each text, image or product. Two texts that say the same thing in different words end up close together. Examples: Pinecone, Weaviate, Qdrant and Postgres's pgvector extension.

What it's for: searching by meaning. It's the search part of RAG: it finds the passages closest to the question and hands them to an LLM with the prompt.

Where it breaks: it finds what's similar, not what's true or current. Check what comes back for real questions before you trust the answers.

How it's used

From text to vector and back

Searching by meaning

  1. Embed: each article becomes a list of 1,536 numbersAn embedding model computes it; similar texts get similar lists.
  2. Store: the vectors go into the database with their article's id and textThe database indexes them to find neighbors fast among millions.
  3. marked: Ask: the question is embedded with the same modelIf you switch models, you have to re-embed everything.
  4. Search: return the k vectors with the highest similarityk is a setting: 3 to 10 is common.
"Return a jacket" finds "Returns and exchanges" even without the exact words.

When to look closer

Switching models halfway

A half-finished switch

  1. marked: Articles embedded in March with model A

You switched to a newer embedding model for questions only. What happens to search?

Ask your Maestro about Vector database

It answers from the free course page closest to this word, the way it answers while you study.

Example

You: What does "Vector database" mean, in plain words?

Your Maestro: I'll explain it with a case of yours: it sticks better than a definition. Which documents at work would you like to ask questions of?

Asking about: Answers from the page "Why won't pandas add up my amounts? Numbers stored as text"

Only this browser keeps what you ask here. How it works

Learn more

  • RAG (retrieval-augmented generation)

    RAG (retrieval-augmented generation) gets an AI to answer from your documents: it first searches them for the passages closest to the question and hands those to the model with the prompt.

  • LLM (large language model)

    An LLM is a program trained on huge amounts of text to continue a piece of text one chunk at a time: it works out which chunk is likeliest to come next and writes it. ChatGPT, Claude and Gemini all run on an LLM.

  • Prompt

    A prompt is what you write to an AI model to ask it for something: the question or instruction, plus everything you give it to work with, like data, examples or the format you want back.

  • Database

    A database stores data in connected tables, with rules for each column, so many people and programs can read and change it without stepping on each other.

The whole glossary