Skip to content

Multi-model · 392.2 MB combined CPU WASM · 2 independent Web Workers · Apache-2.0 + Apache-2.0

Local RAG: all-MiniLM-L6-v2 retrieval → MNN-Pocket 0.3B grounded answers

Stage 1 — built Xenova/all-MiniLM-L6-v2 (feature-extraction, 23.7 MB q8 WASM, reusing models/minilm-embeddings/worker.js) embeds a small product manual and ranks passages by exact cosine similarity. Stage 2 — onnx-community/MNN-Pocket-0.3B-ONNX (368.5 MB int8 WASM) answers the same question without context and with the top-K passages, and a deterministic grounding check scores both.

Stage 1 · all-MiniLM-L6-v2 retriever (23.7 MB q8)

Xenova/all-MiniLM-L6-v2 · feature-extraction · 384-d · Apache-2.0

Stage 2 · MNN-Pocket 0.3B generator (368.5 MB int8)

onnx-community/MNN-Pocket-0.3B-ONNX · text-generation · Apache-2.0

1. Ask the manual

3

Initialise both models above (392.2 MB combined) to run the comparison.

Zero-context answer (no retrieval)

–

RAG-grounded answer (top-K passages)

–

Show the code

mnn.js MiniLmStageClient — reusing the built all-MiniLM-L6-v2 worker as Stage 1
mnn-core.mjs cosineSimilarity(): exact cosine (no unit-norm assumption)
mnn-core.mjs scoreGrounding(): fact recall + unsupported-number hallucination check