NorthPeak technicians describe the same fault in different words: "loud grinding noise from the bearing" and "rattling sound near the gearbox" share no word. A word search cannot connect them, but an embedding model can, by turning each text into a list of 768 numbers. A vector database stores these lists and returns the stored texts whose meaning is closest to a question. This lesson explains embeddings, similarity search, and what the diagnostic assistant of Week 12 will use them for.
A technician writes "loud grinding noise from the bearing". Another writes "rattling sound near the gearbox". No word is shared. A word search finds nothing. A human sees the same problem.
An embedding model reads a text and returns a list of numbers. That list is the embedding. Texts with a close meaning get close lists. The model nomic-embed-text, already in your Ollama, returns 768 numbers per text.
A vector database stores these lists, one per text, with the text itself. When a question comes, it embeds the question too. Then it returns the stored texts whose numbers are closest. That is a similarity search. The usual measure is the cosine similarity: 1.0 means identical direction, 0.0 means unrelated.
We embedded four incident descriptions with nomic-embed-text and computed the cosine similarity between each pair. You will run this yourself in Week 8. Ours was:
| bearing grinding | rattling gearbox | oil leak | fault code | |
|---|---|---|---|---|
| "Loud grinding noise from the drive shaft bearing." | 1.00 | 0.72 | 0.49 | 0.43 |
| "Operator reports a rattling sound near the gearbox." | 0.72 | 1.00 | 0.53 | 0.49 |
| "Oil leak under the outlet flange." | 0.49 | 0.53 | 1.00 | 0.46 |
| "Control panel shows fault code E70." | 0.43 | 0.49 | 0.46 | 1.00 |
The two bearing texts score 0.72 together. Each scores under 0.55 with the leak and the fault code. The model grouped them without any shared word. In Week 9 you will store the six manuals of docs/manuals/ in a vector database, Chroma, and ask it questions. The diagnostic assistant of Week 12 will use that to find the right page of the right manual.
A vector database does not know facts. It knows which text sounds like which. Ask "how many incidents in Toronto?" and it returns the descriptions that sound like Toronto, not the number 56. Counting is a job for SQL. Finding the right paragraph is a job for vectors. The assistant will need both.