Selecting the correct model format depends on your hardware capabilities and memory constraints.
BF16 (Brain Float 16) – Use if BF16 acceleration is available
A 16-bit floating-point format designed for faster computation while retaining good precision.
Provides similar dynamic range as FP32 but with lower memory usage.
Recommended if your hardware supports BF16 acceleration (check your device's specs).
Ideal for high-performance inference with reduced memory footprint compared to FP32.
📌 Use BF16 if:
✔ Your hardware has native BF16 support (e.g., newer GPUs, TPUs).
✔ You want higher precision while saving memory.
✔ You plan to requantize the model into another format.
📌 Avoid BF16 if:
❌ Your hardware does not support BF16 (it may fall back to FP32 and run slower).
❌ You need compatibility with older devices that lack BF16 optimization.
F16 (Float 16) – More widely supported than BF16
A 16-bit floating-point high precision but with less of range of values than BF16.
Works on most devices with FP16 acceleration support (including many GPUs and some CPUs).
Slightly lower numerical precision than BF16 but generally sufficient for inference.
📌 Use F16 if:
✔ Your hardware supports FP16 but not BF16.
✔ You need a balance between speed, memory usage, and accuracy.
✔ You are running on a GPU or another device optimized for FP16 computations.
📌 Avoid F16 if:
❌ Your device lacks native FP16 support (it may run slower than expected).
❌ You have memory limitations.
Hybrid Precision Models (e.g., bf16_q8_0, f16_q4_K) – Best of Both Worlds
These formats selectively quantize non-essential layers while keeping key layers in full precision (e.g., attention and output layers).
Named like bf16_q8_0 (meaning full-precision BF16 core layers + quantized Q8_0 other layers).
Strike a balance between memory efficiency and accuracy, improving over fully quantized models without requiring the full memory of BF16/F16.
📌 Use Hybrid Models if:
✔ You need better accuracy than quant-only models but can’t afford full BF16/F16 everywhere.
✔ Your device supports mixed-precision inference.
✔ You want to optimize trade-offs for production-grade models on constrained hardware.
📌 Avoid Hybrid Models if:
❌ Your target device doesn’t support mixed or full-precision acceleration.
❌ You are operating under ultra-strict memory limits (in which case use fully quantized formats).
Quantized Models (Q4_K, Q6_K, Q8, etc.) – For CPU & Low-VRAM Inference
Quantization reduces model size and memory usage while maintaining as much accuracy as possible.
Lower-bit models (Q4_K) → Best for minimal memory usage, may have lower precision.
Higher-bit models (Q6_K, Q8_0) → Better accuracy, requires more memory.
📌 Use Quantized Models if:
✔ You are running inference on a CPU and need an optimized model.
✔ Your device has low VRAM and cannot load full-precision models.
✔ You want to reduce memory footprint while keeping reasonable accuracy.
📌 Avoid Quantized Models if:
❌ You need maximum accuracy (full-precision models are better for this).
❌ Your hardware has enough VRAM for higher-precision formats (BF16/F16).
Very Low-Bit Quantization (IQ3_XS, IQ3_S, IQ3_M, Q4_K, Q4_0)
These models are optimized for very high memory efficiency, making them ideal for low-power devices or large-scale deployments where memory is a critical constraint.
IQ3_XS: Ultra-low-bit quantization (3-bit) with very high memory efficiency.
Use case: Best for ultra-low-memory devices where even Q4_K is too large.
Trade-off: Lower accuracy compared to higher-bit quantizations.
IQ3_S: Small block size for maximum memory efficiency.
Use case: Best for low-memory devices where IQ3_XS is too aggressive.
IQ3_M: Medium block size for better accuracy than IQ3_S.
Use case: Suitable for low-memory devices where IQ3_S is too limiting.
Q4_K: 4-bit quantization with block-wise optimization for better accuracy.
Use case: Best for low-memory devices where Q6_K is too large.
Q4_0: Pure 4-bit quantization, optimized for ARM devices.
Use case: Best for ARM-based devices or low-memory environments.
*Ultra-low-bit quantization (1 2-bit) with extreme memory efficiency.
Use case: Best for cases were you have to fit the model into very constrained memory
Trade-off: Very Low Accuracy. May not function as expected. Please test fully before using.
Summary Table: Model Format Selection
Model Format
Precision
Memory Usage
Device Requirements
Best Use Case
BF16
Very High
High
BF16-supported GPU/CPU
High-speed inference with reduced memory
F16
High
High
FP16-supported GPU/CPU
Inference when BF16 isn’t available
Q4_K
Medium-Low
Low
CPU or Low-VRAM devices
Memory-constrained inference
Q6_K
Medium
Moderate
CPU with more memory
Better accuracy with quantization
Q8_0
High
Moderate
GPU/CPU with moderate VRAM
Highest accuracy among quantized models
IQ3_XS
Low
Very Low
Ultra-low-memory devices
Max memory efficiency, low accuracy
IQ3_S
Low
Very Low
Low-memory devices
Slightly more usable than IQ3_XS
IQ3_M
Low-Medium
Low
Low-memory devices
Better accuracy than IQ3_S
Q4_0
Low
Low
ARM-based/embedded devices
Llama.cpp automatically optimizes for ARM inference
Ultra Low-Bit (IQ1/2_*)
Very Low
Extremely Low
Tiny edge/embedded devices
Fit models in extremely tight memory; low accuracy
Hybrid (e.g., bf16_q8_0)
Medium–High
Medium
Mixed-precision capable hardware
Balanced performance and memory, near-FP accuracy in critical layers
Qwen3-Embedding-8B
Highlights
The Qwen3 Embedding model series is the latest proprietary model of the Qwen family, specifically designed for text embedding and ranking tasks. Building upon the dense foundational models of the Qwen3 series, it provides a comprehensive range of text embeddings and reranking models in various sizes (0.6B, 4B, and 8B). This series inherits the exceptional multilingual capabilities, long-text understanding, and reasoning skills of its foundational model. The Qwen3 Embedding series represents significant advancements in multiple text embedding and ranking tasks, including text retrieval, code retrieval, text classification, text clustering, and bitext mining.
Exceptional Versatility: The embedding model has achieved state-of-the-art performance across a wide range of downstream application evaluations. The 8B size embedding model ranks No.1 in the MTEB multilingual leaderboard (as of June 5, 2025, score 70.58), while the reranking model excels in various text retrieval scenarios.
Comprehensive Flexibility: The Qwen3 Embedding series offers a full spectrum of sizes (from 0.6B to 8B) for both embedding and reranking models, catering to diverse use cases that prioritize efficiency and effectiveness. Developers can seamlessly combine these two modules. Additionally, the embedding model allows for flexible vector definitions across all dimensions, and both embedding and reranking models support user-defined instructions to enhance performance for specific tasks, languages, or scenarios.
Multilingual Capability: The Qwen3 Embedding series offer support for over 100 languages, thanks to the multilingual capabilites of Qwen3 models. This includes various programming languages, and provides robust multilingual, cross-lingual, and code retrieval capabilities.
Qwen3-Embedding-8B has the following features:
Model Type: Text Embedding
Supported Languages: 100+ Languages
Number of Paramaters: 8B
Context Length: 32k
Embedding Dimension: Up to 4096, supports user-defined output dimensions ranging from 32 to 4096
For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our blog, GitHub.
MRL Support indicates whether the embedding model supports custom dimensions for the final embedding.
Instruction Aware notes whether the embedding or reranking model supports customizing the input instruction according to different tasks.
Our evaluation indicates that, for most downstream tasks, using instructions (instruct) typically yields an improvement of 1% to 5% compared to not using them. Therefore, we recommend that developers create tailored instructions specific to their tasks and scenarios. In multilingual contexts, we also advise users to write their instructions in English, as most instructions utilized during the model training process were originally written in English.
Usage
With Transformers versions earlier than 4.51.0, you may encounter the following error:
KeyError: 'qwen3'
Sentence Transformers Usage
python
1# Requires transformers>=4.51.02# Requires sentence-transformers>=2.7.034from sentence_transformers import SentenceTransformer
56# Load the model7model = SentenceTransformer("Qwen/Qwen3-Embedding-8B")89# We recommend enabling flash_attention_2 for better acceleration and memory saving,10# together with setting `padding_side` to "left":11# model = SentenceTransformer(12# "Qwen/Qwen3-Embedding-8B",13# model_kwargs={"attn_implementation": "flash_attention_2", "device_map": "auto"},14# tokenizer_kwargs={"padding_side": "left"},15# )1617# The queries and documents to embed18queries =[19"What is the capital of China?",20"Explain gravity",21]22documents =[23"The capital of China is Beijing.",24"Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun.",25]2627# Encode the queries and documents. Note that queries benefit from using a prompt28# Here we use the prompt called "query" stored under `model.prompts`, but you can29# also pass your own prompt via the `prompt` argument30query_embeddings = model.encode(queries, prompt_name="query")31document_embeddings = model.encode(documents)3233# Compute the (cosine) similarity between the query and document embeddings34similarity = model.similarity(query_embeddings, document_embeddings)35print(similarity)36# tensor([[0.7493, 0.0751],37# [0.0880, 0.6318]])
Transformers Usage
python
1# Requires transformers>=4.51.023import torch
4import torch.nn.functional as F
56from torch import Tensor
7from transformers import AutoTokenizer, AutoModel
8910deflast_token_pool(last_hidden_states: Tensor,11 attention_mask: Tensor)-> Tensor:12 left_padding =(attention_mask[:,-1].sum()== attention_mask.shape[0])13if left_padding:14return last_hidden_states[:,-1]15else:16 sequence_lengths = attention_mask.sum(dim=1)-117 batch_size = last_hidden_states.shape[0]18return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]192021defget_detailed_instruct(task_description:str, query:str)->str:22returnf'Instruct: {task_description}\nQuery:{query}'2324# Each query must come with a one-sentence instruction that describes the task25task ='Given a web search query, retrieve relevant passages that answer the query'2627queries =[28 get_detailed_instruct(task,'What is the capital of China?'),29 get_detailed_instruct(task,'Explain gravity')30]31# No need to add instruction for retrieval documents32documents =[33"The capital of China is Beijing.",34"Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."35]36input_texts = queries + documents
3738tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen3-Embedding-8B', padding_side='left')39model = AutoModel.from_pretrained('Qwen/Qwen3-Embedding-8B')4041# We recommend enabling flash_attention_2 for better acceleration and memory saving.42# model = AutoModel.from_pretrained('Qwen/Qwen3-Embedding-8B', attn_implementation="flash_attention_2", torch_dtype=torch.float16).cuda()4344max_length =81924546# Tokenize the input texts47batch_dict = tokenizer(48 input_texts,49 padding=True,50 truncation=True,51 max_length=max_length,52 return_tensors="pt",53)54batch_dict.to(model.device)55outputs = model(**batch_dict)56embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])5758# normalize embeddings59embeddings = F.normalize(embeddings, p=2, dim=1)60scores =(embeddings[:2] @ embeddings[2:].T)61print(scores.tolist())62# [[0.7493016123771667, 0.0750647559762001], [0.08795969933271408, 0.6318399906158447]]
vLLM Usage
python
1# Requires vllm>=0.8.52import torch
3import vllm
4from vllm import LLM
5defget_detailed_instruct(task_description:str, query:str)->str:6returnf'Instruct: {task_description}\nQuery:{query}'7# Each query must come with a one-sentence instruction that describes the task8task ='Given a web search query, retrieve relevant passages that answer the query'9queries =[10 get_detailed_instruct(task,'What is the capital of China?'),11 get_detailed_instruct(task,'Explain gravity')12]13# No need to add instruction for retrieval documents14documents =[15"The capital of China is Beijing.",16"Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."17]18input_texts = queries + documents
19model = LLM(model="Qwen/Qwen3-Embedding-8B", task="embed")20outputs = model.embed(input_texts)21embeddings = torch.tensor([o.outputs.embedding for o in outputs])22scores =(embeddings[:2] @ embeddings[2:].T)23print(scores.tolist())24# [[0.7482624650001526, 0.07556197047233582], [0.08875375241041183, 0.6300010681152344]]
📌 Tip: We recommend that developers customize the instruct according to their specific scenarios, tasks, and languages. Our tests have shown that in most retrieval scenarios, not using an instruct on the query side can lead to a drop in retrieval performance by approximately 1% to 5%.
Evaluation
MTEB (Multilingual)
Model
Size
Mean (Task)
Mean (Type)
Bitxt Mining
Class.
Clust.
Inst. Retri.
Multi. Class.
Pair. Class.
Rerank
Retri.
STS
NV-Embed-v2
7B
56.29
49.58
57.84
57.29
40.80
1.04
18.63
78.94
63.82
56.72
71.10
GritLM-7B
7B
60.92
53.74
70.53
61.83
49.75
3.45
22.77
79.94
63.78
58.31
73.33
BGE-M3
0.6B
59.56
52.18
79.11
60.35
40.88
-3.11
20.1
80.76
62.79
54.60
74.12
multilingual-e5-large-instruct
0.6B
63.22
55.08
80.13
64.94
50.75
-0.40
22.91
80.86
62.61
57.12
76.81
gte-Qwen2-1.5B-instruct
1.5B
59.45
52.69
62.51
58.32
52.05
0.74
24.02
81.58
62.58
60.78
71.61
gte-Qwen2-7b-Instruct
7B
62.51
55.93
73.92
61.55
52.77
4.94
25.48
85.13
65.55
60.08
73.98
text-embedding-3-large
-
58.93
51.41
62.17
60.27
46.89
-2.68
22.03
79.17
63.89
59.27
71.68
Cohere-embed-multilingual-v3.0
-
61.12
53.23
70.50
62.95
46.89
-1.89
22.74
79.88
64.07
59.16
74.80
gemini-embedding-exp-03-07
-
68.37
59.59
79.28
71.82
54.59
5.18
29.16
83.63
65.58
67.71
79.40
Qwen3-Embedding-0.6B
0.6B
64.33
56.00
72.22
66.83
52.33
5.09
24.59
80.83
61.41
64.64
76.17
Qwen3-Embedding-4B
4B
69.45
60.86
79.36
72.33
57.15
11.56
26.77
85.05
65.08
69.60
80.86
Qwen3-Embedding-8B
8B
70.58
61.69
80.89
74.00
57.65
10.06
28.66
86.40
65.63
70.88
81.08
Note: For compared models, the scores are retrieved from MTEB online leaderboard on May 24th, 2025.
MTEB (Eng v2)
MTEB English / Models
Param.
Mean(Task)
Mean(Type)
Class.
Clust.
Pair Class.
Rerank.
Retri.
STS
Summ.
multilingual-e5-large-instruct
0.6B
65.53
61.21
75.54
49.89
86.24
48.74
53.47
84.72
29.89
NV-Embed-v2
7.8B
69.81
65.00
87.19
47.66
88.69
49.61
62.84
83.82
35.21
GritLM-7B
7.2B
67.07
63.22
81.25
50.82
87.29
49.59
54.95
83.03
35.65
gte-Qwen2-1.5B-instruct
1.5B
67.20
63.26
85.84
53.54
87.52
49.25
50.25
82.51
33.94
stella_en_1.5B_v5
1.5B
69.43
65.32
89.38
57.06
88.02
50.19
52.42
83.27
36.91
gte-Qwen2-7B-instruct
7.6B
70.72
65.77
88.52
58.97
85.9
50.47
58.09
82.69
35.74
gemini-embedding-exp-03-07
-
73.3
67.67
90.05
59.39
87.7
48.59
64.35
85.29
38.28
Qwen3-Embedding-0.6B
0.6B
70.70
64.88
85.76
54.05
84.37
48.18
61.83
86.57
33.43
Qwen3-Embedding-4B
4B
74.60
68.10
89.84
57.51
87.01
50.76
68.46
88.72
34.39
Qwen3-Embedding-8B
8B
75.22
68.71
90.43
58.57
87.52
51.56
69.44
88.58
34.83
C-MTEB (MTEB Chinese)
C-MTEB
Param.
Mean(Task)
Mean(Type)
Class.
Clust.
Pair Class.
Rerank.
Retr.
STS
multilingual-e5-large-instruct
0.6B
58.08
58.24
69.80
48.23
64.52
57.45
63.65
45.81
bge-multilingual-gemma2
9B
67.64
68.52
75.31
59.30
86.67
68.28
73.73
55.19
gte-Qwen2-1.5B-instruct
1.5B
67.12
67.79
72.53
54.61
79.5
68.21
71.86
60.05
gte-Qwen2-7B-instruct
7.6B
71.62
72.19
75.77
66.06
81.16
69.24
75.70
65.20
ritrieve_zh_v1
0.3B
72.71
73.85
76.88
66.5
85.98
72.86
76.97
63.92
Qwen3-Embedding-0.6B
0.6B
66.33
67.45
71.40
68.74
76.42
62.58
71.03
54.52
Qwen3-Embedding-4B
4B
72.27
73.51
75.46
77.89
83.34
66.05
77.03
61.26
Qwen3-Embedding-8B
8B
73.84
75.00
76.97
80.08
84.23
66.99
78.21
63.53
Citation
If you find our work helpful, feel free to give us a cite.
@article{qwen3embedding,
title={Qwen3 Embedding: Advancing Text Embedding and Reranking Through Foundation Models},
author={Zhang, Yanzhao and Li, Mingxin and Long, Dingkun and Zhang, Xin and Lin, Huan and Yang, Baosong and Xie, Pengjun and Yang, An and Liu, Dayiheng and Lin, Junyang and Huang, Fei and Zhou, Jingren},
journal={arXiv preprint arXiv:2506.05176},
year={2025}
}
🚀 If you find these models useful
Help me test my AI-Powered Quantum Network Monitor Assistant with quantum-ready security checks:
The full Open Source Code for the Quantum Network Monitor Service available at my github repos ( repos with NetworkMonitor in the name) : Source Code Quantum Network Monitor. You will also find the code I use to quantize the models if you want to do it yourself GGUFModelBuilder
💬 How to test:
Choose an AI assistant type:
TurboLLM (GPT-4.1-mini)
HugLLM (Hugginface Open-source models)
TestLLM (Experimental CPU-only)
What I’m Testing
I’m pushing the limits of small open-source models for AI network monitoring, specifically:
Function calling against live network services
How small can a model go while still handling:
Automated Nmap security scans
Quantum-readiness checks
Network Monitoring tasks
🟡 TestLLM – Current experimental model (llama.cpp on 2 CPU threads on huggingface docker space):
✅ Zero-configuration setup
⏳ 30s load time (slow inference but no API costs) . No token limited as the cost is low.
🔧 Help wanted! If you’re into edge-device AI, let’s collaborate!
Other Assistants
🟢 TurboLLM – Uses gpt-4.1-mini :
**It performs very well but unfortunatly OpenAI charges per token. For this reason tokens usage is limited.
Create custom cmd processors to run .net code on Quantum Network Monitor Agents
Real-time network diagnostics and monitoring
Security Audits
Penetration testing (Nmap/Metasploit)
🔵 HugLLM – Latest Open-source models:
🌐 Runs on Hugging Face Inference API. Performs pretty well using the lastest models hosted on Novita.
💡 Example commands you could test:
"Give me info on my websites SSL certificate"
"Check if my server is using quantum safe encyption for communication"
"Run a comprehensive security audit on my server"
'"Create a cmd processor to .. (what ever you want)" Note you need to install a Quantum Network Monitor Agent to run the .net code from. This is a very flexible and powerful feature. Use with caution!
Final Word
I fund the servers used to create these model files, run the Quantum Network Monitor service, and pay for inference from Novita and OpenAI—all out of my own pocket. All the code behind the model creation and the Quantum Network Monitor project is open source. Feel free to use whatever you find helpful.
If you appreciate the work, please consider buying me a coffee ☕. Your support helps cover service costs and allows me to raise token limits for everyone.
I'm also open to job opportunities or sponsorship.