RAG from First Principles · Part 13

MaxSim, token by token

Step the query through its tokens. Each one picks its best-matching doc token (the outlined cell); the score is the running sum of those best matches. Pooled cosine, for contrast, collapses both sides to one vector first.

Query E-4042 error

MaxSim score (late interaction)

0.00
Sum of each query token's single best doc-token match. Keeps the exact-term signal alive.

Pooled cosine (single vector)

0.00
cos( mean(query), mean(doc) )
The cosine between the two mean-pooled (averaged) vectors, one per side. Averaging dilutes the rare code, so a short generic doc can pool higher.

Toggle the candidate doc above, press Play, or step with . Press Space to play or pause.