Lesson 2.1
The Vector Store
Where the passage vectors live, and how you ask it for the ones nearest a query.
A catalog organized by meaning.
Think of an old library catalog. A title catalog lets you find a book if you already know its name. A subject catalog is different: you walk up and say "I want something about volcanoes," and it hands you the shelf that is about that, even books you never knew existed. A vector store is the second kind of catalog. You do not ask it for a passage by name. You ask it for the passages that are about what you mean, and it finds them by closeness of meaning.
By the end of the last unit, every passage you want to search has been turned into a vector: a list of numbers that pins its meaning to a point in space (its embedding). A vector store is just the place those points live, plus the machinery to find the ones nearest a question.
A vector store keeps the meaning of every passage as a point, and its one job is to hand back the points sitting closest to a new point you give it.
What it actually holds.
Each thing in the store is a pair: the vector (the point in meaning-space) and the passage it came from (the actual text you will later show the reader and the model). The vector is what you search on. The passage is what you get back. You keep both because a point with no text behind it is useless, and text with no point is unsearchable.
a single entry in the store
vector [0.12, -0.47, 0.88, ...] the point
passage "Refunds are issued within 5 business days." the text
A real store keeps thousands or millions of these pairs. The text rides along as a payload; the search only ever looks at the vectors.
Two operations, and only two.
For all its parts, a vector store does two things, at two different moments.
Insert, at ingest time
Once, up front, before any questions arrive. You embed each passage and drop the (vector, passage) pair into the store. This is the slow, bulk step you run when documents change, not when a user asks something.
Query, at question time
Every time someone asks a question, you embed the question into a point and ask the store: which stored points sit closest to this one? Give me the nearest k of them. This is the step that has to be fast.
That nearest-k is the heart of retrieval. The "k" is just how many neighbors you want back, say the 5 closest passages. The next lesson is entirely about how the store finds them. Here, the point is only the shape: you load it once, then query it again and again.
What a vector store is not
A key-value lookup by id
A regular database fetches the one row whose id you already know. It matches exactly or not at all. A vector store has no "the right id" to ask for. You hand it a meaning and it ranks everything by how near it sits.
An exact match
It does not return "the answer." It returns a ranked shortlist of the closest candidates, best guess first. Sorting the good ones from the noise in that shortlist is the work of the rest of this unit.
Key takeaways
A vector store keeps (vector, passage) pairs: the point is what you search on, the text is what you get back.
It has two operations: insert pairs once at ingest time, then query for the nearest k points at question time.
It searches by similarity, not by id. You ask for what is closest in meaning, not for an exact match.