BGE-M3 vs Qwen3-Embedding 0.6B para busca local
Dois modelos pequenos de embeddings multilíngues para busca local e RAG
Fatos do catálogo revisado
| Especificação | BGE-M3 | Qwen3-Embedding 0.6B |
|---|---|---|
| Tarefa | Embeddings e busca | Embeddings e busca |
| Parâmetros | 568M | 596M |
| Licença | MIT | Apache 2.0 |
| Uso comercial | Permitidotexto da licença | Permitidotexto da licença |
| Qualidade · MTEB (Multilingual, v2) | 59,561.024d · execução independente · fonte | 64,341.024d · execução independente · fonte |
| Memória | estimativa de embeddings de 8 bits (~3 GB) | estimativa de embeddings de 8 bits (~3 GB) |
| Checkpoint | ficha oficial | ficha oficial |
No MTEB (Multilingual, v2), o Qwen3-Embedding 0.6B tem 64,34 e o BGE-M3 59,56, 4,8 pontos de diferença na mesma versão do benchmark. Execuções independentes do conjunto público de resultados do MTEB, mesma versão do benchmark para os dois modelos. Escala: média das tarefas, 0 a 100, maior é melhor.
Memória em três máquinas
Estimativas de embeddings de 8 bits: pesos mais 20% de folga e reserva fixa de 2 GB, então o valor é o mesmo em todas as máquinas. Estimativas de planejamento, não execuções medidas.
| Máquina | BGE-M3 | Qwen3-Embedding 0.6B |
|---|---|---|
| RTX 4060 · 8 GB de VRAM | ~3 GBCabe na memória rápida | ~3 GBCabe na memória rápida |
| MacBook Air 13 polegadas M4 · 16 GB unificados | ~3 GBCabe na memória rápida | ~3 GBCabe na memória rápida |
| Mac mini M4 · 16 GB unificados | ~3 GBCabe na memória rápida | ~3 GBCabe na memória rápida |
BGE-M3: estimativa de embeddings de 8 bits (~3 GB). Qwen3-Embedding 0.6B: estimativa de embeddings de 8 bits (~3 GB). Fórmulas
Tudo o que roda em cada máquina: RTX 4060 · 8 GB de VRAM · MacBook Air 13 polegadas M4 · 16 GB unificados · Mac mini M4 · 16 GB unificados
Qual escolher
Os dois têm cerca de 0,6 bilhão de parâmetros e vetores de 1.024 dimensões, então rodam em quase qualquer máquina. O Qwen3-Embedding 0.6B tem nota maior no MTEB (Multilingual, v2) numa execução independente e lê até 32.768 tokens; o BGE-M3 lê 8.192. A vantagem do BGE-M3 é que um só modelo devolve saídas densas, esparsas e multivetoriais (ColBERT), úteis para busca híbrida. O BGE-M3 é MIT e o Qwen3-Embedding é Apache 2.0; os dois permitem uso comercial.
Arquivos e comandos para rodar
O arquivo padrão da fonte coletada mais baixada, ou os comandos que cada ficha documenta. Não executados por este site.
BGE-M3
Formas documentadas de rodar
Copiado como aparece na fonte vinculada (lida em 2026-10-18); não executado por este site.
pip install -U FlagEmbeddingfrom FlagEmbedding import BGEM3FlagModel
model = BGEM3FlagModel('BAAI/bge-m3',
use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
sentences_1 = ["What is BGE M3?", "Defination of BM25"]
sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.",
"BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]
embeddings_1 = model.encode(sentences_1,
batch_size=12,
max_length=8192, # If you don't need such a long length, you can set a smaller value to speed up the encoding process.
)['dense_vecs']
embeddings_2 = model.encode(sentences_2)['dense_vecs']
similarity = embeddings_1 @ embeddings_2.T
print(similarity)
# [[0.6265, 0.3477], [0.3499, 0.678 ]]pip install -U FlagEmbeddingfrom FlagEmbedding import BGEM3FlagModel
model = BGEM3FlagModel('BAAI/bge-m3', use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
sentences_1 = ["What is BGE M3?", "Defination of BM25"]
sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.",
"BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]
output_1 = model.encode(sentences_1, return_dense=True, return_sparse=True, return_colbert_vecs=False)
output_2 = model.encode(sentences_2, return_dense=True, return_sparse=True, return_colbert_vecs=False)
# you can see the weight for each token:
print(model.convert_id_to_token(output_1['lexical_weights']))
# [{'What': 0.08356, 'is': 0.0814, 'B': 0.1296, 'GE': 0.252, 'M': 0.1702, '3': 0.2695, '?': 0.04092},
# {'De': 0.05005, 'fin': 0.1368, 'ation': 0.04498, 'of': 0.0633, 'BM': 0.2515, '25': 0.3335}]
# compute the scores via lexical mathcing
lexical_scores = model.compute_lexical_matching_score(output_1['lexical_weights'][0], output_2['lexical_weights'][0])
print(lexical_scores)
# 0.19554901123046875
print(model.compute_lexical_matching_score(output_1['lexical_weights'][0], output_1['lexical_weights'][1]))
# 0.0Qwen3-Embedding 0.6B
Formas documentadas de rodar
Copiado como aparece na fonte vinculada (lida em 2026-10-18); não executado por este site.
# Requires transformers>=4.51.0
# Requires sentence-transformers>=2.7.0
from sentence_transformers import SentenceTransformer
# Load the model
model = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B")
# We recommend enabling flash_attention_2 for better acceleration and memory saving,
# together with setting `padding_side` to "left":
# model = SentenceTransformer(
# "Qwen/Qwen3-Embedding-0.6B",
# model_kwargs={"attn_implementation": "flash_attention_2", "device_map": "auto"},
# tokenizer_kwargs={"padding_side": "left"},
# )
# The queries and documents to embed
queries = [
"What is the capital of China?",
"Explain gravity",
]
documents = [
"The capital of China is Beijing.",
"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.",
]
# Encode the queries and documents. Note that queries benefit from using a prompt
# Here we use the prompt called "query" stored under `model.prompts`, but you can
# also pass your own prompt via the `prompt` argument
query_embeddings = model.encode(queries, prompt_name="query")
document_embeddings = model.encode(documents)
# Compute the (cosine) similarity between the query and document embeddings
similarity = model.similarity(query_embeddings, document_embeddings)
print(similarity)
# tensor([[0.7646, 0.1414],
# [0.1355, 0.6000]])# Requires transformers>=4.51.0
import torch
import torch.nn.functional as F
from torch import Tensor
from transformers import AutoTokenizer, AutoModel
def last_token_pool(last_hidden_states: Tensor,
attention_mask: Tensor) -> Tensor:
left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
if left_padding:
return last_hidden_states[:, -1]
else:
sequence_lengths = attention_mask.sum(dim=1) - 1
batch_size = last_hidden_states.shape[0]
return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]
def get_detailed_instruct(task_description: str, query: str) -> str:
return f'Instruct: {task_description}\nQuery:{query}'
# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'
queries = [
get_detailed_instruct(task, 'What is the capital of China?'),
get_detailed_instruct(task, 'Explain gravity')
]
# No need to add instruction for retrieval documents
documents = [
"The capital of China is Beijing.",
"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."
]
input_texts = queries + documents
tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen3-Embedding-0.6B', padding_side='left')
model = AutoModel.from_pretrained('Qwen/Qwen3-Embedding-0.6B')
# We recommend enabling flash_attention_2 for better acceleration and memory saving.
# model = AutoModel.from_pretrained('Qwen/Qwen3-Embedding-0.6B', attn_implementation="flash_attention_2", torch_dtype=torch.float16).cuda()
max_length = 8192
# Tokenize the input texts
batch_dict = tokenizer(
input_texts,
padding=True,
truncation=True,
max_length=max_length,
return_tensors="pt",
)
batch_dict.to(model.device)
outputs = model(**batch_dict)
embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])
# normalize embeddings
embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:2] @ embeddings[2:].T)
print(scores.tolist())
# [[0.7645568251609802, 0.14142508804798126], [0.13549736142158508, 0.5999549627304077]]# Requires vllm>=0.8.5
import torch
import vllm
from vllm import LLM
def get_detailed_instruct(task_description: str, query: str) -> str:
return f'Instruct: {task_description}\nQuery:{query}'
# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'
queries = [
get_detailed_instruct(task, 'What is the capital of China?'),
get_detailed_instruct(task, 'Explain gravity')
]
# No need to add instruction for retrieval documents
documents = [
"The capital of China is Beijing.",
"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."
]
input_texts = queries + documents
model = LLM(model="Qwen/Qwen3-Embedding-0.6B", task="embed")
outputs = model.embed(input_texts)
embeddings = torch.tensor([o.outputs.embedding for o in outputs])
scores = (embeddings[:2] @ embeddings[2:].T)
print(scores.tolist())
# [[0.7620252966880798, 0.14078938961029053], [0.1358368694782257, 0.6013815999031067]]Números que cada publicador informa
Os resultados de cada ficha, com a configuração de cada uma. Publicadores escolhem testes e configurações diferentes, então estes valores nunca são comparados entre publicadores aqui.
BGE-M3 · informado por BAAI
Qwen3-Embedding 0.6B · informado por Alibaba (Qwen)
- Mean (Task)
- 64,33MTEB (Multilingual) · MTEB
- Mean (Type)
- 56,00MTEB (Multilingual) · MTEB
- Bitxt Mining
- 72,22MTEB (Multilingual) · MTEB
- Class.
- 66,83MTEB (Multilingual) · MTEB
- Clust.
- 52,33MTEB (Multilingual) · MTEB
- Inst. Retri.
- 5,09MTEB (Multilingual) · MTEB
- Multi. Class.
- 24,59MTEB (Multilingual) · MTEB
- Pair. Class.
- 80,83MTEB (Multilingual) · MTEB
Todos os resultados informados
- Rerank
- 61,41MTEB (Multilingual) · MTEB
- Retri.
- 64,64MTEB (Multilingual) · MTEB
- STS
- 76,17MTEB (Multilingual) · MTEB
- Mean (Task)
- 70,70MTEB (Eng v2) · MTEB
- Mean (Type)
- 64,88MTEB (Eng v2) · MTEB
- Class.
- 85,76MTEB (Eng v2) · MTEB
- Clust.
- 54,05MTEB (Eng v2) · MTEB
- Pair Class.
- 84,37MTEB (Eng v2) · MTEB
- Rerank.
- 48,18MTEB (Eng v2) · MTEB
- Retri.
- 61,83MTEB (Eng v2) · MTEB
- STS
- 86,57MTEB (Eng v2) · MTEB
- Summ.
- 33,43MTEB (Eng v2) · MTEB
- Mean (Task)
- 66,33C-MTEB (MTEB Chinese) · MTEB
- Mean (Type)
- 67,45C-MTEB (MTEB Chinese) · MTEB
- Class.
- 71,40C-MTEB (MTEB Chinese) · MTEB
- Clust.
- 68,74C-MTEB (MTEB Chinese) · MTEB
- Pair Class.
- 76,42C-MTEB (MTEB Chinese) · MTEB
- Rerank.
- 62,58C-MTEB (MTEB Chinese) · MTEB
- Retr.
- 71,03C-MTEB (MTEB Chinese) · MTEB
- STS
- 54,52C-MTEB (MTEB Chinese) · MTEB
Valores como impressos na ficha, com a configuração do próprio publicador (seção da ficha: Evaluation › MTEB (Multilingual); Evaluation › MTEB (Eng v2)); coluna “Qwen3-Embedding-0.6B”. Não comparáveis entre publicadores e fora de qualquer ranking. Ficha do modelo
Limites e datas
O benchmark de qualidade publicado não testa uma versão local quantizada. Estimativas de memória não medem velocidade nem garantem compatibilidade. Tamanho de repositório, quando disponível, não é VRAM. Fórmulas
Página atualizada em · Catálogo revisado em · MTEB (Multilingual, v2)