Multi-model Β· Two-Stage Retrieve & Rerank Β· ~46.3 MB Total WASM q8

MDBR-LEAF-IR Recall β†’ MS MARCO Cross-Encoder Rerank

The classic production search stack in a single browser tab: Stage 1 (MongoDB/mdbr-leaf-ir, 23.17 MB) recalls top candidates fast via bi-encoder cosine similarity, then Stage 2 (Xenova/ms-marco-MiniLM-L-6-v2, 23.14 MB) reads each [CLS] query [SEP] passage [SEP] pair jointly to rerank precision β€” visualized live as a Rank-Shift Bump Chart.

1. Independent Stage Loaders (~46.3 MB combined)

Stage 1 Β· Bi-Encoder Recall (MongoDB/mdbr-leaf-ir Β· 23.17 MB)

Stage 2 Β· Cross-Encoder Reranker (Xenova/ms-marco-MiniLM-L-6-v2 Β· 23.14 MB)

Initialise both workers above to run the full two-stage Retrieve β†’ Rerank pipeline locally.

2. Query, corpus & stage controls

Stage 1 recall –
Stage 2 rerank –
Spearman ρ –
Top-1 winner –
Max promotion –

3. Live Rank-Shift Bump Chart (Stage 1 Bi-Encoder β†’ Stage 2 Cross-Encoder)

Green ribbons promoted up the rankings after cross-attention read the query and passage together; red ribbons dropped (often lexical traps that shared keywords without answering the question).

Stage 1 bi-encoder vs Stage 2 cross-encoder rank shifts
Final # Stage 1 # Shift Passage LEAF cos Cross-Enc logit Sigmoid

Stage 1 Recall Shortlist Preview

    Exact implementation code

    Show the code β€” Stage 1 β†’ Stage 2 Rank-Shift & Spearman correlation (leaf-core.mjs) Lines 528–586