Model reference · open weights

gte-multilingual

Embeddings Alibaba-NLP Embeddings 1 build Open weights 1.4M dl/mo

gte-multilingual is an open-weight embedding model from Alibaba. gte-multilingual-base (FP16) weighs 611 MB; the smallest configuration that runs it is RTX 3060 12 GB.

What it is

Released byAlibaba
Released2024-07-20
Parameters305M
VRAM611 MB for the weights

What it runs on

Memory and cards for gte-multilingual-base (FP16)

611 MBweights, file size
1.1 GBruntime overhead
CardRunsMemory
RTX 3060 12 GBfits11.6 GB
RTX 4060 Ti 16 GBfits15.4 GB
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

From the model card

What Alibaba says about gte-multilingual

gte-multilingual-base

The gte-multilingual-base model is the latest in the GTE (General Text Embedding) family of models, featuring several key attributes:

Read the full model card
  • High Performance: Achieves state-of-the-art (SOTA) results in multilingual retrieval tasks and multi-task representation model evaluations when compared to models of similar size.
  • Training Architecture: Trained using an encoder-only transformers architecture, resulting in a smaller model size. Unlike previous models based on decode-only LLM architecture (e.g., gte-qwen2-1.5b-instruct), this model has lower hardware requirements for inference, offering a 10x increase in inference speed.
  • Long Context: Supports text lengths up to 8192 tokens.
  • Multilingual Capability: Supports over 70 languages.
  • Elastic Dense Embedding: Support elastic output dense representation while maintaining the effectiveness of downstream tasks, which significantly reduces storage costs and improves execution efficiency.
  • Sparse Vectors: In addition to dense representations, it can also generate sparse vectors.

Paper: mGTE: Generalized Long-Context Text Representation and Reranking Models for Multilingual Text Retrieval

Model Information

  • Model Size: 305M
  • Embedding Dimension: 768
  • Max Input Tokens: 8192

Usage

Get Dense Embeddings with Transformers

# Requires transformers>=4.36.0

import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer

input_texts = [
    "what is the capital of China?",
    "how to implement quick sort in python?",
    "北京",
    "快排算法介绍"
]

model_name_or_path = 'Alibaba-NLP/gte-multilingual-base'
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True)

# Tokenize the input texts
batch_dict = tokenizer(input_texts, max_length=8192, padding=True, truncation=True, return_tensors='pt')

outputs = model(**batch_dict)

dimension=768 # The output dimension of the output embedding, should be in [128, 768]
embeddings = outputs.last_hidden_state[:, 0][:dimension]

embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:1] @ embeddings[1:].T) * 100
print(scores.tolist())

# [[0.3016996383666992, 0.7503870129585266, 0.3203084468841553]]

Use with sentence-transformers

# Requires sentence-transformers>=3.0.0

from sentence_transformers import SentenceTransformer

input_texts = [
    "what is the capital of China?",
    "how to implement quick sort in python?",
    "北京",
    "快排算法介绍"
]

model_name_or_path="Alibaba-NLP/gte-multilingual-base"
model = SentenceTransformer(model_name_or_path, trust_remote_code=True)
embeddings = model.encode(input_texts, normalize_embeddings=True) # embeddings.shape (4, 768)

# sim scores
scores = model.similarity(embeddings[:1], embeddings[1:])

print(scores.tolist())
# [[0.301699697971344, 0.7503870129585266, 0.32030850648880005]]

Use with infinity

Usage via docker and infinity, MIT Licensed.

docker run --gpus all -v $PWD/data:/app/.cache -p "7997":"7997" \
michaelf34/infinity:0.0.69 \
v2 --model-id Alibaba-NLP/gte-multilingual-base --revision "main" --dtype float16 --batch-size 32 --device cuda --engine torch --port 7997

Use with Text Embeddings Inference (TEI)

Usage via Docker and Text Embeddings Inference (TEI):

  • CPU:
docker run --platform linux/amd64 \
  -p 8080:80 \
  -v $PWD/data:/data \
  --pull always \
  ghcr.io/huggingface/text-embeddings-inference:cpu-1.7 \
  --model-id Alibaba-NLP/gte-multilingual-base \
  --dtype float16
  • GPU:
docker run --gpus all \
  -p 8080:80 \
  -v $PWD/data:/data \
  --pull always \
  ghcr.io/huggingface/text-embeddings-inference:1.7 \
  --model-id Alibaba-NLP/gte-multilingual-base \
  --dtype float16

Then you can send requests to the deployed API via the OpenAI-compatible v1/embeddings route (more information about the OpenAI Embeddings API):

curl https://0.0.0.0:8080/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{
    "input": [
      "what is the capital of China?",
      "how to implement quick sort in python?",
      "北京",
      "快排算法介绍"
    ],
    "model": "Alibaba-NLP/gte-multilingual-base",
    "encoding_format": "float"
  }'

Use with custom code to get dense embeddings and sparse token weights

# You can find the script gte_embedding.py in https://huggingface.co/Alibaba-NLP/gte-multilingual-base/blob/main/scripts/gte_embedding.py

from gte_embedding import GTEEmbeddidng

model_name_or_path = 'Alibaba-NLP/gte-multilingual-base'
model = GTEEmbeddidng(model_name_or_path)
query = "中国的首都在哪儿"

docs = [
    "what is the capital of China?",
    "how to implement quick sort in python?",
    "北京",
    "快排算法介绍"
]

embs = model.encode(docs, return_dense=True,return_sparse=True)
print('dense_embeddings vecs', embs['dense_embeddings'])
print('token_weights', embs['token_weights'])
pairs = [(query, doc) for doc in docs]
dense_scores = model.compute_scores(pairs, dense_weight=1.0, sparse_weight=0.0)
sparse_scores = model.compute_scores(pairs, dense

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
ClusteringMTEB 8TagsClusteringv_measure33.667
STSMTEB AFQMCcos_sim_spearman43.548
STSMTEB ATECcos_sim_spearman48.912
ClassificationMTEB AllegroReviewsaccuracy41.690
ClusteringMTEB AlloProfClusteringP2Pv_measure54.202
ClusteringMTEB AlloProfClusteringS2Sv_measure44.341
RerankingMTEB AlloprofRerankingmap64.915
RetrievalMTEB AlloprofRetrievalndcg_at_1053.638
ClassificationMTEB AmazonCounterfactualClassification (en)accuracy75.955
ClassificationMTEB AmazonPolarityClassificationaccuracy80.718
ClassificationMTEB AmazonReviewsClassification (en)accuracy43.642
ClassificationMTEB AmazonReviewsClassification (de)accuracy40.108
ClassificationMTEB AmazonReviewsClassification (es)accuracy40.170
ClassificationMTEB AmazonReviewsClassification (fr)accuracy39.568
ClassificationMTEB AmazonReviewsClassification (ja)accuracy35.750
ClassificationMTEB AmazonReviewsClassification (zh)accuracy33.342
RetrievalMTEB ArguAnandcg_at_1058.231
RetrievalMTEB ArguAna-PLndcg_at_1053.166
ClusteringMTEB ArxivClusteringP2Pv_measure46.019
ClusteringMTEB ArxivClusteringS2Sv_measure41.066
RerankingMTEB AskUbuntuDupQuestionsmap61.875
STSMTEB BIOSSEScos_sim_spearman81.215
STSMTEB BQcos_sim_spearman51.716
RetrievalMTEB BSARDRetrievalndcg_at_1026.115
© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms