← All models

feature-extraction · text · WebAssembly (CPU) · ~585 MB

Qwen3-Embedding 0.6B — instruction-aware, multilingual retrieval, on your CPU

Most embedders are BERT encoders that mean-pool their tokens. Qwen3-Embedding is different: it's a 0.6B Qwen3 decoder LLM turned into an embedder. It reads the sentence with causal attention and takes the last token's hidden state as the vector, it accepts a one-line instruction per query to steer the objective, and it embeds 100+ languages into one shared space. It sits at the top of the MTEB multilingual board — and it runs here on the CPU in your browser. Nothing is uploaded; no key, no server.

At a glance

Modelonnx-community/Qwen3-Embedding-0.6B-ONNX (base: Qwen/Qwen3-Embedding-0.6B)
Taskfeature-extraction → sentence embeddings
ArchitectureQwen3 decoder-only transformer (0.6B), last-token pooling
Output1024-d vector · L2-normalized for cosine · Matryoshka-truncatable (MRL)
Poolinglast_token — the EOS position's hidden state (not mean pooling)
Query conventionInstruct: {task}\nQuery:{query} — documents embedded raw
Params / dtype0.6B · q8 (8-bit weights, onnx/model_quantized.onnx)
BackendWebAssembly (CPU) — no WebGPU required
Download~585 MB, cached after first load
Languages100+ (strong cross-lingual retrieval)
LicenseApache-2.0
Web APIsWebAssembly, Web Workers

Embed a set of sentences

Vectors are last-token-pooled then L2-normalized; cells are cosine similarity.

See inside — the instruction changes the vector

This is the model's signature move. A query is wrapped as Instruct: {task}\nQuery:{query}; a document is embedded raw. The same query text, embedded with vs. without the instruction, produces a different vector — and for a genuine query→passage pair the instruction should raise the cosine to the right passage. Below: pick a task, and compare plain vs. instructed scoring against two candidate passages.

The exact instructed query string appears here.

Why it matters

Retrieval quality is the ceiling on every RAG system, semantic search box, and dedup pipeline. A top-tier multilingual embedder that runs on the client means your search index, your document clustering, and your "find similar" features can be private, offline-capable, and free to run — with no embedding API bill and no data leaving the device.

Use cases

Basics

Two sentences in, one cosine number out — and watch the instruction move the score.

Practical

Instructed semantic search over a small corpus, with Matryoshka dimension trade-offs.

Wild

Cross-lingual search: query in English, retrieve passages in five languages.

Multi-model

On-device RAG: Qwen3-Embedding retrieves, Qwen2.5 answers with citations.

How the API works

It's the standard feature-extraction pipeline with two Qwen3-specific choices: pooling: "last_token" and the instruction wrapper on queries only.

import { pipeline } from "@huggingface/transformers";

const extractor = await pipeline(
  "feature-extraction",
  "onnx-community/Qwen3-Embedding-0.6B-ONNX",
  { device: "wasm", dtype: "q8" },   // CPU / WebAssembly — no WebGPU
);

const task = "Given a web search query, retrieve relevant passages that answer the query";
const detailed = (q) => `Instruct: ${task}\nQuery:${q}`;

// Queries get the instruction; documents are embedded raw.
const input = [ detailed("What is the capital of China?"), "The capital of China is Beijing." ];

const out = await extractor(input, { pooling: "last_token", normalize: true });
// out.data holds the 1024-d unit vectors → cosine = dot product.

Everything runs in a Web Worker so the CPU-bound embedding never blocks the page; the shared loader auto-inits an already-cached copy and never silently re-downloads.

References