Skip to main content
DigiTransact AI Learning Centre

Module 3 of 4

Retrieval and ranking

Embeddings, hybrid search, reranking and permissions.

Lesson 1

Embeddings and vector search

An embedding turns text into a vector so similar meanings sit near each other. Vector search finds passages that are close to the question.

It handles paraphrase well and exact identifiers badly.

  • Good for meaning, weak for codes and names.
  • Embedding models must match the index.
  • Re-embed when you change the model.

Check yourself. Which query does keyword search handle better than vectors?

Lesson 2

Keyword and hybrid search

Keyword search matches exact terms, codes and names. Hybrid combines both scores and often beats either alone.

For policy documents full of clause numbers, hybrid is usually the safest default.

  • Combine lexical and semantic scores.
  • Weight them and test.
  • Keep exact-match paths for identifiers.

Check yourself. Why do clause numbers need keyword matching?

Lesson 3

Reranking

A reranker reads the question and each candidate passage and scores relevance more carefully. It is slower than retrieval but improves the top few results.

Retrieve broadly, rerank narrowly, then send only the best passages to the model.

  • Retrieve 20, rerank to 5.
  • Reranking costs latency.
  • Measure the gain before adding it.

Check yourself. What does reranking trade away for accuracy?

Lesson 4

Permissions in retrieval

Every chunk inherits the access rules of its source. Filtering after retrieval is too late if the text has already entered the prompt.

Filter before ranking, by user group and classification.

  • Filter on the way in, not the way out.
  • Test with a user who should see nothing.
  • Log the filter applied.

Check yourself. Why is post-retrieval filtering unsafe?