Model reference · open weights
gte-en is an open-weight embedding model from Alibaba. gte-base-en-v1.5 (FP32) weighs 274 MB; the smallest configuration that runs it is RTX 3060 12 GB.
Summary of the Alibaba-NLP/gte-base-en-v1.5 model card, 2026-10-01
What it is
| Released by | Alibaba |
|---|---|
| Released | 2024-04-20 |
| Parameters | 137M |
| VRAM | 274 MB for the weights |
What it runs on
| Card | Runs | Memory |
|---|---|---|
| RTX 3060 12 GB | fits | 11.6 GB |
| RTX 4060 Ti 16 GB | fits | 15.4 GB |
| RTX 3090 24 GB | fits | 23.4 GB |
| RTX 4090 24 GB | fits | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
From the model card
We introduce gte-v1.5 series, upgraded gte embeddings that support the context length of up to 8192, while further enhancing model performance.
The models are built upon the transformer++ encoder backbone (BERT + RoPE + GLU).
The gte-v1.5 series achieve state-of-the-art scores on the MTEB benchmark within the same model size category and prodvide competitive on the LoCo long-context retrieval tests (refer to Evaluation).
We also present the gte-Qwen1.5-7B-instruct,
a SOTA instruction-tuned multi-lingual embedding model that ranked 2nd in MTEB and 1st in C-MTEB.
| Models | Language | Model Size | Max Seq. Length | Dimension | MTEB-en | LoCo |
|---|---|---|---|---|---|---|
gte-Qwen1.5-7B-instruct | Multiple | 7720 | 32768 | 4096 | 67.34 | 87.57 |
gte-large-en-v1.5 | English | 434 | 8192 | 1024 | 65.39 | 86.71 |
gte-base-en-v1.5 | English | 137 | 8192 | 768 | 64.11 | 87.44 |
Use the code below to get started with the model.
# 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?",
"Beijing",
"sorting algorithms"
]
model_path = 'Alibaba-NLP/gte-base-en-v1.5'
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModel.from_pretrained(model_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)
embeddings = outputs.last_hidden_state[:, 0]
# (Optionally) normalize embeddings
embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:1] @ embeddings[1:].T) * 100
print(scores.tolist())
It is recommended to install xformers and enable unpadding for acceleration, refer to enable-unpadding-and-xformers.
Use with sentence-transformers:
# Requires sentence_transformers>=2.7.0
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim
sentences = ['That is a happy person', 'That is a very happy person']
model = SentenceTransformer('Alibaba-NLP/gte-base-en-v1.5', trust_remote_code=True)
embeddings = model.encode(sentences)
print(cos_sim(embeddings[0], embeddings[1]))
Use with transformers.js:
// npm i @xenova/transformers
import { pipeline, dot } from '@xenova/transformers';
// Create feature extraction pipeline
const extractor = await pipeline('feature-extraction', 'Alibaba-NLP/gte-base-en-v1.5', {
quantized: false, // Comment out this line to use the quantized version
});
// Generate sentence embeddings
const sentences = [
"what is the capital of China?",
"how to implement quick sort in python?",
"Beijing",
"sorting algorithms"
]
const output = await extractor(sentences, { normalize: true, pooling: 'cls' });
// Compute similarity scores
const [source_embeddings, ...document_embeddings ] = output.tolist();
const similarities = document_embeddings.map(x => 100 * dot(source_embeddings, x));
console.log(similarities); // [34.504930869007296, 64.03973265120138, 19.520042686034362]
Use with infinity: Infinity is a MIT licensed server for OpenAI-compatible deployment.
docker run --gpus all -v $PWD/data:/app/.cache -p "7997":"7997" \
michaelf34/infinity:0.0.68 \
v2 --model-id Alibaba-NLP/gte-base-en-v1.5 --revision "4c742dc2b781e4ab062a4a77f4f7cbad4bdee970" --dtype bfloat16 --batch-size 32 --device cuda --engine torch --port 7997
c4-enTo enable the backbone model to support a context length of 8192, we adopted a multi-stage training strategy. The model first undergoes preliminary MLM pre-training on shorter lengths. And then, we resample the data, reducing the proportion of short texts, and continue the MLM pre-training.
The entire training process is as follows:
The results of other models are retrieved from MTEB leaderboard.
The gte evaluation setting: mteb==1.2.0, fp16 auto mix precision, max_length=8192, and set ntk scaling factor to 2 (equivalent to rope_base * 2).
| Model Name | Param Size (M) | Dimension | Sequence Length | Average (56) | Class. (12) | Clust. (11) | Pair Class. (3) | Reran. (4) | Retr. (15) | STS (10) | Summ. (1) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| gte-large-en-v1.5 | 434 | 1024 | 8192 | 65.39 | 77.75 | 47.95 | 84.6 |
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.
Benchmarks
As published on the model card: the maker's own numbers, not measured by AxForge.
| Task | Dataset | Metric | Score |
|---|---|---|---|
| Classification | MTEB AmazonCounterfactualClassification (en) | accuracy | 74.791 |
| Classification | MTEB AmazonCounterfactualClassification (en) | ap | 37.054 |
| Classification | MTEB AmazonCounterfactualClassification (en) | f1 | 68.511 |
| Classification | MTEB AmazonPolarityClassification | accuracy | 93.017 |
| Classification | MTEB AmazonPolarityClassification | ap | 89.178 |
| Classification | MTEB AmazonPolarityClassification | f1 | 92.997 |
| Classification | MTEB AmazonReviewsClassification (en) | accuracy | 53.312 |
| Classification | MTEB AmazonReviewsClassification (en) | f1 | 52.982 |
| Retrieval | MTEB ArguAna | map_at_1 | 38.193 |
| Retrieval | MTEB ArguAna | map_at_10 | 54.848 |
| Retrieval | MTEB ArguAna | map_at_100 | 55.388 |
| Retrieval | MTEB ArguAna | map_at_1000 | 55.389 |
| Retrieval | MTEB ArguAna | map_at_3 | 50.427 |
| Retrieval | MTEB ArguAna | map_at_5 | 53.105 |
| Retrieval | MTEB ArguAna | mrr_at_1 | 39.047 |
| Retrieval | MTEB ArguAna | mrr_at_10 | 55.153 |
| Retrieval | MTEB ArguAna | mrr_at_100 | 55.686 |
| Retrieval | MTEB ArguAna | mrr_at_1000 | 55.688 |
| Retrieval | MTEB ArguAna | mrr_at_3 | 50.676 |
| Retrieval | MTEB ArguAna | mrr_at_5 | 53.417 |
| Retrieval | MTEB ArguAna | ndcg_at_1 | 38.193 |
| Retrieval | MTEB ArguAna | ndcg_at_10 | 63.486 |
| Retrieval | MTEB ArguAna | ndcg_at_100 | 65.580 |
| Retrieval | MTEB ArguAna | ndcg_at_1000 | 65.610 |