Lab 4: Retrieval by Hand & the Vector Store

Score a question against every sentence, keep the top few. Then let a store do it โ€” and see what happens when a document changes.

๐Ÿ—„๏ธ
Retrieval is: embed the question, score it against everything stored, keep the top k
Five sentences you can score by hand. A million chunks you cannot โ€” that is what a vector database is for. It stores the vector and the text, and answers one question: which stored vectors are nearest to this one?

Section 1: Retrieval, by hand

Edit the sentences or the question if you like. The question deliberately shares no words with the answer.

The stored sentences
s1
s2
s3
s4
s5
The question
you choose k โ€” the model has no say

Section 2: The vector store

Same sentences, now stored as records โ€” id, vector, text. Query it. Then add a new version of a policy line and see what comes back.

Collection "policy" โ€” 0 records
Empty. Press 1 to store.
operation log
Takeaway: Retrieval = embed the question, score it against everything stored, keep the top k โ€” and you set k. A vector database does this at scale with an index, keeps the original text beside each vector (you cannot get it back from the numbers), and adds โ€” never replaces. Next class: chunking a real document, choosing k, and handing the top chunks to the model.