core practice · implementation task

Embed a corpus and search it

Embed a small corpus with an embedding model, embed a query, and return the nearest documents by cosine similarity.

The mechanism

An embedding model projects content into a space where 'close' means 'semantically similar'. Search becomes geometry: find the nearest vectors to the query vector.

Study Embeddings

Expected evidence

Semantically relevant documents for a query that shares no exact keywords.

Try this drill in the practice workspace →

Hints when you need them
  • Normalize vectors before cosine.
  • Use the same model for corpus and query.

Watch for these mistakes

  • Comparing vectors from two different embedding models
  • Forgetting to normalize when using cosine similarity
  • Ignoring the model's max input length and silently truncating

Check the sources

Browse all practice briefs