Model reference · open weights

gte-Qwen2

Embeddings Alibaba-NLP Embeddings 2 builds Open weights 882k dl/mo

gte-Qwen2 is an open-weight embedding model from Alibaba. gte-Qwen2-7B-instruct (FP32) weighs 15.2 GB; the smallest configuration that runs it is RTX 4090 24 GB.

  • gte-Qwen2-1.5B-instruct is a multilingual sentence-similarity model developed by Alibaba, built on the Qwen2-1.5B LLM architecture.
  • It features 1.8B parameters, a 1536-dimensional embedding space, and supports a maximum input length of 32,000 tokens.
  • The model is trained on a vast multilingual corpus using bidirectional attention and instruction tuning, and it is released under the Apache-2.0 license.

Summary of the Alibaba-NLP/gte-Qwen2-1.5B-instruct model card, 2026-10-01. The estimate below is for another build of the family.

What it is

Released byAlibaba
Released2024-06-29
Parameters1.8B
VRAM15.2 GB for the weights

What it runs on

Memory and cards for gte-Qwen2-7B-instruct (FP32)

15.2 GBweights, file size
1.1 GBruntime overhead
CardRunsMemory
RTX 3060 12 GB … RTX 4060 Ti 16 GBdoes not fit
RTX 3090 24 GBfits23.4 GB
RTX 4090 24 GBfits23.4 GB
RTX 5090 32 GBfits31.0 GB
L40S 48 GBfits44.0 GB
A100 80 GBfits78.2 GB
H100 80 GBfits78.1 GB
RTX PRO 6000 Blackwell 96 GBfits93.8 GB
DGX Spark (GB10) 128 GB unifiedfits107 GB
H200 141 GBfits138 GB
B200 180 GBfits176 GB

Builds

Sizes, precisions & builds

BuildParamsPrecisionWeightsSmallest setup
gte-Qwen2-1.5B-instruct ↗ 1.8BFP32 3.6 GBRTX 3060 12 GB
gte-Qwen2-7B-instruct (above) ↗ 7.6BFP32 15.2 GBRTX 4090 24 GB

From the model card

What Alibaba says about gte-Qwen2

Read the model card

gte-Qwen2-1.5B-instruct

gte-Qwen2-1.5B-instruct is the latest model in the gte (General Text Embedding) model family. The model is built on Qwen2-1.5B LLM model and use the same training data and strategies as the gte-Qwen2-7B-instruct model.

The model incorporates several key advancements:

  • Integration of bidirectional attention mechanisms, enriching its contextual understanding.
  • Instruction tuning, applied solely on the query side for streamlined efficiency
  • Comprehensive training across a vast, multilingual text corpus spanning diverse domains and scenarios. This training leverages both weakly supervised and supervised data, ensuring the model's applicability across numerous languages and a wide array of downstream tasks.

Model Information

  • Model Size: 1.5B
  • Embedding Dimension: 1536
  • Max Input Tokens: 32k

Requirements

transformers>=4.39.2
flash_attn>=2.5.6

Usage

Sentence Transformers

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("Alibaba-NLP/gte-Qwen2-1.5B-instruct", trust_remote_code=True)
# In case you want to reduce the maximum length:
model.max_seq_length = 8192

queries = [
    "how much protein should a female eat",
    "summit define",
]
documents = [
    "As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
    "Definition of summit for English Language Learners. : 1  the highest point of a mountain : the top of a mountain. : 2  the highest level. : 3  a meeting or series of meetings between the leaders of two or more governments.",
]

query_embeddings = model.encode(queries, prompt_name="query")
document_embeddings = model.encode(documents)

scores = (query_embeddings @ document_embeddings.T) * 100
print(scores.tolist())

Observe the config_sentence_transformers.json to see all pre-built prompt names. Otherwise, you can use model.encode(queries, prompt="Instruct: ...\nQuery: " to use a custom prompt of your choice.

Transformers

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, 'how much protein should a female eat'),
    get_detailed_instruct(task, 'summit define')
]
# No need to add instruction for retrieval documents
documents = [
    "As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
    "Definition of summit for English Language Learners. : 1  the highest point of a mountain : the top of a mountain. : 2  the highest level. : 3  a meeting or series of meetings between the leaders of two or more governments."
]
input_texts = queries + documents

tokenizer = AutoTokenizer.from_pretrained('Alibaba-NLP/gte-Qwen2-1.5B-instruct', trust_remote_code=True)
model = AutoModel.from_pretrained('Alibaba-NLP/gte-Qwen2-1.5B-instruct', trust_remote_code=True)

max_length = 8192

# Tokenize the input texts
batch_dict = tokenizer(input_texts, max_length=max_length, padding=True, truncation=True, return_tensors='pt')
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) * 100
print(scores.tolist())

infinity_emb

Usage via infinity, MIT Licensed.

docker run \
--gpus "0" -p "7997":"7997" \
michaelf34/infinity:0.0.68-trt-onnx \
v2 --model-id Alibaba-NLP/gte-Qwen2-1.5B-instruct --revision "refs/pr/20" --dtype bfloat16 --batch-size 16 --device cuda --engine torch --port 7997 --no-bettertransformer

Evaluation

MTEB & C-MTEB

You can use the scripts/eval_mteb.py to reproduce the following result of gte-Qwen2-1.5B-instruct on MTEB(English)/C-MTEB(Chinese):

Model NameMTEB(56)C-MTEB(35)MTEB-fr(26)MTEB-pl(26)
bge-base-en-1.564.23---
bge-large-en-1.563.55---
gte-large-en-v1.565.39---
gte-base-en-v1.564.11---
mxbai-embed-large-v164.68---
[acge_text_embedding](https://hug

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

Benchmarks

Reported results

As published on the model card: the maker's own numbers, not measured by AxForge.

TaskDatasetMetricScore
ClassificationMTEB AmazonCounterfactualClassification (en)accuracy83.985
ClassificationMTEB AmazonCounterfactualClassification (en)ap50.930
ClassificationMTEB AmazonCounterfactualClassification (en)f178.504
ClassificationMTEB AmazonPolarityClassificationaccuracy96.611
ClassificationMTEB AmazonPolarityClassificationap94.892
ClassificationMTEB AmazonPolarityClassificationf196.609
ClassificationMTEB AmazonReviewsClassification (en)accuracy55.614
ClassificationMTEB AmazonReviewsClassification (en)f154.906
RetrievalMTEB ArguAnamap_at_145.164
RetrievalMTEB ArguAnamap_at_1061.519
RetrievalMTEB ArguAnamap_at_10061.769
RetrievalMTEB ArguAnamap_at_100061.769
RetrievalMTEB ArguAnamap_at_357.444
RetrievalMTEB ArguAnamap_at_560.058
RetrievalMTEB ArguAnamrr_at_146.088
RetrievalMTEB ArguAnamrr_at_1061.861
RetrievalMTEB ArguAnamrr_at_10062.118
RetrievalMTEB ArguAnamrr_at_100062.118
RetrievalMTEB ArguAnamrr_at_357.729
RetrievalMTEB ArguAnamrr_at_560.392
RetrievalMTEB ArguAnandcg_at_145.164
RetrievalMTEB ArguAnandcg_at_1069.720
RetrievalMTEB ArguAnandcg_at_10070.719
RetrievalMTEB ArguAnandcg_at_100070.719
© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms