SAVRN
Search Contact SAVRN

Open-weight model · Text ranking

ms-marco-TinyBERT-L2-v2

by Sentence Transformers - Cross-Encoders cross-encoder/ms-marco-TinyBERT-L2-v2

This model was trained on the MS Marco Passage Ranking task. The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order.

Parameters4M
Context512
Weights171.9 MB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads456k

Runs On

What it takes to serve ms-marco-TinyBERT-L2-v2 (4M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

SAVRN's Notes on ms-marco-TinyBERT-L2-v2

The memory column rounds to zero at every precision, which says where this runs: anywhere. A two-layer BERT cross-encoder with 4M parameters, 128 hidden size and two attention heads, it was trained on the MS MARCO passage ranking task to score a query against each candidate passage and sort them. The cheapest GPU we price is one MI300X with 192 GB at $1.85 an hour on-demand, and it belongs on CPU beside your search index, which is why the onnx and openvino formats matter.

Apache 2.0 clears commercial use, modification and redistribution with notice obligations, so a re-ranking stage in a customer-facing product is fine. Check the 512 token context first: query and passage share that window, so long documents need chunking before scoring. The weights derive from nreimers/BERT-Tiny_L-2_H-128_A-2 and were trained on sentence-transformers/msmarco, so test it on your own retrieval domain before committing.

Model Card

By Sentence Transformers - Cross-Encoders, published under apache-2.0, revision 81d1926f67cb.

Cross-Encoder for MS Marco

This model was trained on the MS Marco Passage Ranking task.

The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See SBERT.net Retrieve & Re-rank for more details. The training code is available here: SBERT.net Training MS Marco

Usage with Transformers

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model = AutoModelForSequenceClassification.from_pretrained('cross-encoder/ms-marco-TinyBERT-L2-v2')
tokenizer = AutoTokenizer.from_pretrained('cross-encoder/ms-marco-TinyBERT-L2-v2')

features = tokenizer(['How many people live in Berlin?', 'How many people live in Berlin?'], ['Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'],  padding=True, truncation=True, return_tensors="pt")

model.eval()
with torch.no_grad():
    scores = model(**features).logits
    print(scores)

Usage with SentenceTransformers

The usage becomes easier when you have SentenceTransformers installed. Then, you can use the pre-trained models like this:

Read the full model card (282 words)

Configuration

Architecture
BertForSequenceClassification
Context length (tokens)
512
Layers
2
Hidden size
128
Feed-forward size
512
Attention heads
2
Vocabulary size
30,522
Model type
bert

Identity and Version

Repository
cross-encoder/ms-marco-TinyBERT-L2-v2
Publisher
Sentence Transformers - Cross-Encoders
Task
Text ranking
Modality
Other
Library
sentence-transformers
Parameters
4M parameters
Languages
en
Revision
81d1926f67cb8eee2c2be17ca9f793c7c3bd20cc
First published
2022-03-02
Last updated
2025-08-29

Files and Weights

23 files, 173.1 MB in total. The weights are 14 files totalling 171.9 MB in bin, msgpack, onnx, safetensors.

Weights14 files · 171.9 MB
Configuration2 files · 919 B
Tokenizer3 files · 944.2 KB
Documentation1 file · 3.5 KB
Other2 files · 239.3 KB
Repository1 file · 790 B
Every file
FileTypeSizeSHA-256
flax_model.msgpackWeights17.5 MB 482a0ae7c5c9
model.safetensorsWeights17.6 MB a0e7364ddf91
onnx/model.onnxWeights17.6 MB 0eac39ee56a3
onnx/model_O1.onnxWeights17.6 MB c55f8084e97c
onnx/model_O2.onnxWeights17.6 MB 2ff01de1c589
onnx/model_O3.onnxWeights17.6 MB 00bac066699a
onnx/model_O4.onnxWeights8.8 MB 766442bb6bbf
onnx/model_qint8_arm64.onnxWeights4.5 MB 7497b40504d4
onnx/model_qint8_avx512.onnxWeights4.5 MB 7497b40504d4
onnx/model_qint8_avx512_vnni.onnxWeights4.5 MB 7497b40504d4
onnx/model_quint8_avx2.onnxWeights4.5 MB a1ebdfe09dc8
openvino/openvino_model.binWeights17.5 MB 3d8e9b82bb01
openvino/openvino_model_qint8_quantized.binWeights4.5 MB b11ce34bd1f5
pytorch_model.binWeights17.6 MB 17110c74b1e6
config.jsonConfiguration787 B
special_tokens_map.jsonConfiguration132 B
README.mdDocumentation3.5 KB
openvino/openvino_model.xmlOther87.4 KB
openvino/openvino_model_qint8_quantized.xmlOther151.9 KB
.gitattributesRepository790 B
tokenizer.jsonTokenizer711.4 KB
tokenizer_config.jsonTokenizer1.3 KB
vocab.txtTokenizer231.5 KB

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
171.9 MB
Download from Sentence Transformers - Cross-Encoders

Released by Sentence Transformers - Cross-Encoders through its official repository on Hugging Face. Read the license.

Built From

  • Derived from nreimers/BERT-Tiny_L-2_H-128_A-2
  • Quantized from nreimers/BERT-Tiny_L-2_H-128_A-2
  • Trained on (disclosed) sentence-transformers/msmarco

Memory Requirements

PrecisionWeights in memory
As published171.9 MB
16-bit0.0 GB
8-bit0.0 GB
4-bit0.0 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About ms-marco-TinyBERT-L2-v2

How much GPU memory does ms-marco-TinyBERT-L2-v2 need?

About 0 GB at 16-bit and 0 GB at 4-bit: the weights (4M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run ms-marco-TinyBERT-L2-v2 on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use ms-marco-TinyBERT-L2-v2 commercially?

Yes. ms-marco-TinyBERT-L2-v2 is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

What is ms-marco-TinyBERT-L2-v2's context length?

512 tokens, from the maximum position embeddings in its published configuration.

Similar Models

This model was converted to GGUF format from madebyaris/rerank-indonesia using llama.cpp via the ggml.ai's GGUF-my-repo space. Refer to the original model card for more details on the model. Install llama.cpp through brew (works on Mac and Linux) Invoke the llama.cpp server or the CLI. Note: You can also use this checkpoint directly through the usage steps listed in the Llama.cpp repo as well. Step 2: Move into the llama.cpp folder and build it with LLAMACURL=1 flag along with other hardware-specific flags (for ex: LLAMACUDA=1 for Nvidia GPUs on Linux).

Open weights apache-2.0 sentence-transformers

This model was trained on the MS Marco Passage Ranking task. The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See SBERT.net Retrieve & Re-rank for more details. The training code is available here: SBERT.net Training MS Marco The usage is easy when you have SentenceTransformers installed. Then you can use the pre-trained models like this: In the following table, we provide various pre-trained Cross-Encoders together with their performance on the TREC Deep Learning 2019 and the MS Marco Passage Reranking dataset.

Open weights apache-2.0 16M parameters 512 tokens sentence-transformers

This model was trained on the MS Marco Passage Ranking task. The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See SBERT.net Retrieve & Re-rank for more details. The training code is available here: SBERT.net Training MS Marco The usage is easy when you have SentenceTransformers installed. Then you can use the pre-trained models like this: In the following table, we provide various pre-trained Cross-Encoders together with their performance on the TREC Deep Learning 2019 and the MS Marco Passage Reranking dataset.

Open weights apache-2.0 19M parameters 512 tokens sentence-transformers

This model was trained on the MS Marco Passage Ranking task. The model can be used for Information Retrieval: Given a query, encode the query with all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See SBERT.net Retrieve & Re-rank for more details. The training code is available here: SBERT.net Training MS Marco The usage is easy when you have SentenceTransformers installed. Then you can use the pre-trained models like this: In the following table, we provide various pre-trained Cross-Encoders together with their performance on the TREC Deep Learning 2019 and the MS Marco Passage Reranking dataset.

Open weights apache-2.0 23M parameters 512 tokens sentence-transformers

This model was trained on the MS Marco Passage Ranking task. The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See SBERT.net Retrieve & Re-rank for more details. The training code is available here: SBERT.net Training MS Marco The usage is easy when you have SentenceTransformers installed. Then you can use the pre-trained models like this: In the following table, we provide various pre-trained Cross-Encoders together with their performance on the TREC Deep Learning 2019 and the MS Marco Passage Reranking dataset.

Open weights apache-2.0 33M parameters 512 tokens sentence-transformers

Model · Text ranking

mxbai-rerank-xsmall-v1

Mixedbread

This is the smallest model in our family of powerful reranker models. You can learn more about the models in our blog post. Currently, the best way to use our models is with the most recent version of sentence-transformers. pip install -U sentence-transformers Let's say you have a query, and you want to rerank a set of documents. You can do that with only one line of code: Install transformers.js npm i @xenova/transformers Let's say you have a query, and you want to rerank a set of documents. In JavaScript, you need to add a function: You can use the large model via our API as follows: The API comes with additional features, such as a continous trained reranker! Check out the docs for more…

Open weights apache-2.0 71M parameters 512 tokens transformers