Build your own semantic search
Vectors & the dot product·5 min

What is an embedding?

0 / 1

An embedding is a list of numbers — a point in a high-dimensional space. A model like all-MiniLM-L6-v2 turns any sentence into 384 numbers; our synthetic corpus uses 64. The magic property is the same either way: sentences that mean similar things land near each other. "vitamin D and infection" sits near a vaccine-efficacy abstract and far from a paper on bridge construction.

One point per document

Why 64 (or 384) dimensions?

It's the model's hidden size after pooling. More dims = more capacity to separate meanings, but more compute per comparison. Real MiniLM uses 384; this course uses 64 so everything stays instant — the math is identical at any width.

A 2-D sketch of the idea (real space is 64-D)
        vaccine•   •infection
                •vitamin-D
   bridges•
   •concrete            •(query: "does vitamin D prevent infection?")

Real space is 64-D (or 384-D), but the intuition is exactly this picture — retrieval is finding the nearest points to the query point. Everything you build in this course is a way to compute and rank that nearness.

You already have these vectors

Doc 0's 64 numbers are sitting in corpus_emb.f32 right now (you just read its norm). By the end of this chapter you'll be able to measure how close any two of them are.