use case Β· multi-model Β· all-MiniLM-L6-v2 (25 MB) β†’ DeBERTa-v3-Small NLI (172.4 MB) Β· ~197.4 MB total

2-Stage Large-Taxonomy Fast Routing

Scoring 24 categories directly with a cross-encoder takes 24 NLI forward passes. Instead, chain two independent local WebAssembly workers: Stage 1 (all-MiniLM-L6-v2) embeds all 24 categories once and shortlists the Top-5 by cosine similarity in ~20 ms; Stage 2 (DeBERTa-v3-Small NLI) verifies only the Top-5 shortlist (~4.8× fewer NLI passes).

1 Β· Independent Local Model Workers

Stage 1 Β· all-MiniLM-L6-v2 (25 MB q8 WASM)

Reuses ../minilm-embeddings/worker.js (Xenova/all-MiniLM-L6-v2) for 384-d cosine shortlisting.

Stage 2 Β· DeBERTa-v3-Small NLI (172.4 MB q8 WASM)

Uses ./worker.js (Xenova/nli-deberta-v3-small) to verify & rerank the Top-K shortlist.

2 Β· Incoming Dispatch & 2-Stage Pipeline Controls

Prepare both models above (or run Stage 1 independently once ready).

Stage 1 Top-1 (Cosine) β€”
Stage 2 Top-1 (NLI) β€”
Stage 1 Query Latency β€”
Stage 2 NLI Latency β€”
NLI Pass Reduction 4.8Γ— (5 vs 24)
NaN Count β€”

3 Β· Embedding Cosine Rank vs DeBERTa-v3 NLI Entailment Rank

Side-by-Side Cosine vs NLI Probability Chart

24-Category Fine-Grained Taxonomy (Highlighted = Stage 1 Shortlist)

Shortlisted Category Stage 1 Rank & Cosine Stage 2 Rank & NLI Rank Shift (Δ) Raw Entail / Neutral / Contra
Run Stage 1 + Stage 2 to inspect Embedding vs NLI reranking.