use case · multi-model · RAG
One model rarely ships alone. Here two run side by side: all-MiniLM-L6 (Transformers.js) turns a pasted document into vectors and retrieves the passages closest to your question, then Llama 3.2 3B (WebLLM) answers using only those passages. That's RAG — grounded, less prone to making things up — and the whole pipeline runs in this tab with no server and no vector database. The 3B reader is a stronger "answer from these passages" engine than the 1B, so grounded answers hold together over longer contexts.
Retriever · all-MiniLM-L6 (Transformers.js · WASM fallback, no GPU needed)
Generator · Llama 3.2 3B (WebLLM · WebGPU only)
A chat model doesn't know your documents, and asking it to memorise them in a prompt gets expensive and unreliable. Instead, MiniLM (a 25 MB embedding model) indexes the text once; each question is embedded and matched by cosine similarity, and only the closest few chunks are handed to Llama. The LLM's job shrinks to "read these passages and answer" — cheaper, faster, and grounded in source you control. Swap the corpus for a product manual, a policy doc, or your own notes.