← ERNIE 4.5 0.3B

Multi-model · embeddings + text-generation · on-device

Cross-lingual RAG: Granite Embedding retrieves, ERNIE answers

Two brand-new 2025 models, one pipeline, zero server. IBM's multilingual Granite Embedding turns your knowledge base into vectors and finds the passages closest to the question — even when the question and the passage are in different languages; Baidu's bilingual ERNIE-4.5-0.3B then answers only from those passages and cites them. This is cross-lingual retrieval-augmented generation — the pattern behind "chat with your docs" products — running entirely on-device.

Run it

Two models load independently: Granite Embedding is ~98 MB, ERNIE ~430 MB (q8, cached after first load).

Retriever · Granite Embedding

Generator · ERNIE-4.5-0.3B

Retrieved passages (Granite Embedding · cosine similarity)

The top passages Granite Embedding selects will appear here.

Grounded answer (ERNIE)

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

How the pipeline works

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