ONNX Model Zoo

dssjon/Qwen3-Embedding-4B-ONNX

By dssjon · ↓ 0 · ♥ 0 · Updated 2025-10-07

What's in this repo

This page lists the files in dssjon/Qwen3-Embedding-4B-ONNX, including model.onnx and more.

  • 2 ONNX models (.onnx files)
  • 14 files, including 6 .json, 2 .onnx, 2 .onnx_data, 1 .md, 1 .jinja, 1 .txt
  • Last updated 2025-10-07

ONNX files

File Size Download
model.onnx — Download
onnx/model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

Qwen3-Embedding-4B-ONNX

This is an ONNX conversion of Qwen/Qwen3-Embedding-4B for use with Transformers.js in the browser.

Model Details

  • Model Type: Text Embedding
  • Base Model: Qwen3-Embedding-4B
  • Parameters: 4B
  • Embedding Dimensions: 2560
  • Context Length: 32K
  • MTEB v2 Score: 74.60
  • Languages: 100+

Usage (Transformers.js v3)

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

Usage (Python - Original Model)

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)

Conversion Details

  • ONNX Opset: 14
  • Precision: FP32
  • Optimization: None (Qwen3 not yet supported by ONNX Runtime optimizer)
  • File Size: ~15.3 GB

Performance

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

License

Apache 2.0 (same as base model)

Citation

@article{qwen3embedding2025,
  title={Qwen3 Embedding},
  author={Qwen Team},
  year={2025},
  url={https://huggingface.co/Qwen/Qwen3-Embedding-4B}
}

Acknowledgments

Model info

feature-extraction transformers.js
transformers.js onnx qwen3 text-generation sentence-transformers feature-extraction sentence-similarity license:apache-2.0 text-embeddings-inference endpoints_compatible region:us
↓ 0 ♥ 0

Created: 2025-10-07

Updated: 2025-10-07

View on Hugging Face

Files (14)

.gitattributes
README.md
added_tokens.json
chat_template.jinja
config.json
merges.txt
model.onnx ONNX
model.onnx_data
onnx/model.onnx ONNX
onnx/model.onnx_data
special_tokens_map.json
tokenizer.json
tokenizer_config.json
vocab.json

Related models