← All models · Gemma 3 270M

use case · multi-model

On-device RAG: GTE-small retrieves, Gemma answers

Two models, one pipeline, zero server. A GTE-small embedder turns your knowledge base into vectors and finds the passages closest to the question; Gemma 3 270M then answers only from those passages and cites them. This is retrieval-augmented generation — the pattern behind "chat with your docs" products — running entirely on-device.

Run it

Two models load independently: GTE-small is ~34 MB, Gemma is ~1.05 GB fp32 on the CPU path (~200 MB q4f16 on WebGPU), cached after first load.

Retriever · GTE-small

Generator · Gemma 3 270M

Retrieved passages (GTE-small · cosine similarity)

The top passages GTE-small selects will appear here.

Grounded answer (Gemma)

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

How the pipeline works

  1. Embed — GTE-small (feature-extraction, mean-pooled + normalised) maps each passage and the question to a 384-dim vector in a shared space.
  2. Retrieve — cosine similarity ranks the passages; the top 2 are kept.
  3. Generate — the retrieved passages become Gemma'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.