← Qwen2.5 0.5B (WASM)

Multi-model · embeddings + text-generation · WebAssembly (CPU)

On-device RAG: MiniLM retrieves, Qwen answers

Two models, one pipeline, zero server. MiniLM turns your knowledge base into vectors and finds the passages closest to the question; Qwen2.5-0.5B then answers only from those passages and cites them. This is retrieval-augmented generation — the pattern behind most "chat with your docs" products — running entirely on the CPU.

Run it

Two models load independently. Both are small on the CPU; MiniLM is ~30 MB, Qwen ~530 MB.

Retriever · MiniLM

Generator · Qwen2.5-0.5B

Retrieved passages (MiniLM · cosine similarity)

The top passages MiniLM selects will appear here.

Grounded answer (Qwen)

Qwen's answer, built only from the retrieved passages, streams here.

How the pipeline works

  1. Embed — MiniLM (feature-extraction, mean-pooled + normalised) maps each passage and the question to a 384-dim vector.
  2. Retrieve — cosine similarity ranks the passages; the top 2 are kept.
  3. Generate — the retrieved passages become Qwen's context with an instruction to answer only from them and say "I don't know" otherwise — the guard against hallucination.

Change a passage and the retrieval changes; ask something not covered and a good RAG answer declines. Everything — both models, the vectors, the similarity — runs on your device.