the.ai

Retrieval / Representation

verified

Dense Retrieval

Keyword search fails when the question and the answer use different words. Dense retrieval encodes both into vectors and compares meanings rather than strings, so a question about how to stop a car can find a passage about brakes. The price is that closeness is something the encoder had to learn, and it only learned it for the languages and domains it was trained on.

Viz primitive · attention-heatmaptokens = 8
query ↓key →

8 queries against 8 keys; a brighter cell means more of that query's attention went to that key. Each query sees itself and everything before it, and nothing after — the upper triangle is masked.

Query-passage scores across a batch, with the true pair on the diagonal. Drag the batch size to watch the in-batch negatives multiply.

8

Reviewed by opendroid · 2026-08-04