Downloads · 30 days
31
29% of all-time downloads
dssjon/Qwen3-Embedding-4B-ONNX
Qwen3-Embedding-4B-ONNX is a feature extraction model from dssjon. Use it when you need embeddings to search or compare text. It is set up for transformers.js. The card lists the license as apache-2.0.
This is an ONNX conversion of Qwen/Qwen3-Embedding-4B for use with Transformers.js in the browser.
Downloads · 30 days
31
29% of all-time downloads
All-time downloads
106
Public
Repo size
16.1 GB
Likes
0
Public
Click a slice to open those files.
.onnx_data32.2 GB · 100%
From the Hugging Face model README
This is an ONNX conversion of Qwen/Qwen3-Embedding-4B for use with Transformers.js in the browser.
import { pipeline } from "@huggingface/transformers";
// Create a feature extraction pipeline
const extractor = await pipeline(
"feature-extraction",
"dssjon/Qwen3-Embedding-4B-ONNX",
{
dtype: "fp32",
device: "webgpu", // Use WebGPU for acceleration
}
);
// Format query with instruction
const taskDescription = "Given a web search query, retrieve relevant passages that answer the query";
const query = `Instruct: ${taskDescription}\nQuery:What is the capital of China?`;
// Generate embedding
const output = await extractor(query, {
pooling: "last_token",
normalize: true
});
console.log(output.data); // 2560-dimensional embedding
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Qwen/Qwen3-Embedding-4B")
# For queries
query = "What is the capital of China?"
query_embedding = model.encode(query, prompt_name="query")
# For documents (no prompt needed)
document = "The capital of China is Beijing."
doc_embedding = model.encode(document)
Benchmark scores from MTEB v2:
| Task | Score |
|---|---|
| Classification | 89.84 |
| Clustering | 57.51 |
| Pair Classification | 87.01 |
| Reranking | 50.76 |
| Retrieval | 68.46 |
| STS | 88.72 |
| Summarization | 34.39 |
| Mean | 74.60 |
Apache 2.0 (same as base model)
@article{qwen3embedding2025,
title={Qwen3 Embedding},
author={Qwen Team},
year={2025},
url={https://huggingface.co/Qwen/Qwen3-Embedding-4B}
}