Skip to main content
Back

Alibaba's gte-small Beats OpenAI's Embedding API at 70MB

A 33M-parameter English embedding model from Alibaba DAMO that beats OpenAI's ada-002 on MTEB while shipping in every major runtime format.

Pro

  • gte-small hits 61.36 MTEB average at 33.4M parameters, beating OpenAI ada-002.
  • Built by Alibaba DAMO Academy using multi-stage contrastive learning on open data.
  • Outputs 384-dim vectors with 512-token context, ideal for RAG and semantic search.
  • Ships under MIT license with PyTorch, ONNX, CoreML, OpenVINO, and safetensors builds.
  • English only and truncates past 512 tokens; consider mGTE for multilingual needs.
  • Paper: Towards General Text Embeddings with Multi-stage Contrastive Learning.

A tiny English embedding model from Alibaba's DAMO Academy keeps climbing the download charts, and the reason is simple math: it fits in 70MB, outputs 384-dimensional vectors, and outscores OpenAI's text-embedding-ada-002 on the standard benchmark used to compare embedding models. gte-small is the smallest member of the General Text Embeddings family, and it has quietly become one of the default choices for retrieval-augmented generation pipelines that need to run cheap and fast.

One row on the leaderboard

The GTE family covers three sizes built on the BERT architecture, trained on a large corpus of relevance text pairs across many domains. That mixed diet is what lets a single checkpoint handle retrieval, semantic similarity, and reranking without task-specific fine-tuning. On the MTEB leaderboard, the numbers tell the whole story:

ModelSize (GB)DimMTEB AvgRetrieval
gte-large0.67102463.1352.22
gte-base0.2276862.3951.14
gte-small0.0738461.3649.46
text-embedding-ada-002-153660.9949.25
all-MiniLM-L6-v20.0938456.2641.95

The small variant packs 33.4M parameters and produces 384-dimensional embeddings with a 512-token context window. That is roughly the same footprint as the widely used all-MiniLM-L6-v2, but with a five-point jump on the MTEB average and an eight-point jump on retrieval specifically.

How it was actually built

The training recipe is the interesting part. GTE uses multi-stage contrastive learning over a unified format that spans a diverse mixture of datasets. Contrastive learning here means the model sees pairs of related and unrelated texts and learns to pull related ones close together in vector space while pushing unrelated ones apart.

The team scaled this aggressively, ballooning the training data during both unsupervised pre-training and supervised fine-tuning to squeeze more quality into a smaller model. Even at 110M parameters, GTE base beats OpenAI's black-box embedding API and matches embedding models roughly ten times its size on MTEB. One side effect worth noting for anyone building code search: with no per-language fine-tuning, the model beats previous best code retrievers of similar size by treating code as text.

Dropping it into a pipeline

The model ships under an MIT license with checkpoints for PyTorch, TensorFlow, ONNX, CoreML, OpenVINO, and safetensors, plus a sentence-transformers loader. Minimum viable usage is three lines:

from sentence_transformers import SentenceTransformer
model = SentenceTransformer("thenlper/gte-small")
embeddings = model.encode(["query text", "document text"])

If you want to skip the sentence-transformers wrapper and go straight to HuggingFace transformers, the model expects average pooling over the last hidden state, followed by L2 normalization for cosine similarity scoring. No instruction prefix is required, unlike E5 or Instructor models, which is one less thing to get wrong when swapping embedders.

Where it fits, and where it breaks

The strengths line up with retrieval-heavy workloads:

  • RAG systems where every millisecond of embedding latency multiplies across millions of chunks
  • Semantic search over document stores where 384-dim vectors keep index size and memory low
  • Clustering and deduplication jobs on CPU-only infrastructure
  • Reranking candidates before a heavier cross-encoder pass
  • Code search, since the training data generalizes to source code without special handling

The limits are equally clear. The model handles only English, and inputs longer than 512 tokens are truncated. That rules out multilingual corpora and long-document embedding without chunking. For those needs, Alibaba has since shipped newer GTE variants including an mGTE line described in a follow-up paper, though those trade the tiny footprint for bigger models.

Why the download counter keeps ticking

Embedding models rarely go viral, but the download counter tells you what practitioners have quietly settled on. gte-small has crossed a million downloads and sits behind more than a hundred public Spaces on Hugging Face, largely because it hits a sweet spot: better than MiniLM on quality, smaller than ada-002 on vector width, and free to run locally. If you built a RAG stack a while back on MiniLM, or are paying per-token fees to an embedding API, this is the drop-in swap worth benchmarking on your own data before reaching for anything larger.