Run this model with HF Jobs
Run tencent/Tencent-Yuanbao-Reranker-v1.5-2B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/tencent/Tencent-Yuanbao-Reranker-v1.5-2B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/tencent/Tencent-Yuanbao-Reranker-v1.5-2B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use tencent/Tencent-Yuanbao-Reranker-v1.5-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Tencent-Yuanbao-Reranker-v1.5-2B with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Tencent-Yuanbao-Reranker-v1.5-2B") model = AutoModelForCausalLM.from_pretrained("tencent/Tencent-Yuanbao-Reranker-v1.5-2B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Yuanbao-Reranker v1.5 โ 2B
A compact dense pointwise reranker obtained by structurally pruning a trained Yuanbao-Reranker v1 checkpoint along all three axes โ FFN width, GQA head groups, and depth โ then recovering ranking quality with a ranking-aware objective at full source depth.
| Parameters | 2.370B (tied embedding counted once) |
| Source | Yuanbao-Reranker v1, 4.022B, 36 layers |
| FFN intermediate size | 9728 โ 8192 |
| Attention heads | Q32/KV8 โ Q24/KV6 (G = 4 preserved) |
| Layers | 36 โ 24 (contiguous prefix, suffix dropped) |
| Hidden size / head dim | 2560 / 128 (unchanged) |
| Vocabulary | 151,669 |
| Precision | bfloat16 |
| Weight file | 4.41 GiB |
Parameters retain 58.93% of the source, linear FLOPs 54.55%, and decoder FLOPs at T = 2048
54.20%. Relative to the same model's FFN-and-layer-only target (2.527B), head pruning removes a
further 6.2% of parameters for 0.55 average points.
The model is a plain dense Qwen3 architecture โ no mask, no sparse kernel, no custom code โ so it
loads through the standard transformers path and serves on any Qwen3-compatible stack.
Quick start
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "tencent/Tencent-Yuanbao-Reranker-v1.5-2B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="cuda").eval()
SYSTEM = (
"Judge whether the Document meets the requirements based on the Query and the Instruct "
'provided. Note that the answer can only be "yes" or "no".'
)
DEFAULT_INSTRUCT = "Given a web search query, retrieve relevant passages that answer the query"
YES_ID, NO_ID = 9693, 2152 # "yes" and "no" are single tokens
CUE = "\n" * 4
def build_prompt(query: str, document: str, instruction: str = DEFAULT_INSTRUCT) -> str:
"""Yuanbao v1 layout.
``CUE`` is the answer cue the model was trained to emit. The assistant header already ends
with a newline, so the token sequence ends with five newlines in total.
"""
return (
f"<|im_start|>system\n{SYSTEM}<|im_end|>\n"
f"<|im_start|>user\n: {instruction}\n: {query}\n: {document}<|im_end|>\n"
f"<|im_start|>assistant\n" + CUE
)
@torch.no_grad()
def score(query: str, documents: list[str], instruction: str = DEFAULT_INSTRUCT) -> list[float]:
scores = []
for document in documents:
batch = tokenizer(
build_prompt(query, document, instruction),
add_special_tokens=False,
return_tensors="pt",
).to(model.device)
logits = model(**batch, use_cache=False).logits[0, -1].float()
scores.append(torch.sigmoid(logits[YES_ID] - logits[NO_ID]).item())
return scores
docs = ["Beijing is the capital of China.", "Gravity attracts two bodies."]
print(score("what is the capital of china", docs))
# [0.9908, 8.4e-09]
Scoring is pointwise, so one candidate per forward pass is the reference path. If you batch,
pad on the left (tokenizer.padding_side = "left") so index -1 stays the decision position;
right padding silently reads the logits of a pad token.
The margin z_yes - z_no and the two-token probability softmax([z_no, z_yes])[yes] rank
identically, because the probability is monotone in the margin.
Prompt template
This checkpoint uses the Yuanbao-Reranker v1 layout, not the Qwen3 layout. The difference is the
assistant prefix: v1 emits the newline block as part of the answer, so the serving prompt ends with
the four-newline cue (five newline tokens counting the header's own) and the relevance logits are
read from that last position. Scoring with the Qwen3
template (<think>\n\n</think>\n\n) silently changes the token sequence and therefore the score.
Fields are colon-prefixed and the instruction defaults to the string above when omitted.
Evaluation
Five-panel protocol from Yuanbao-Reranker v1: rerank the Top-100 candidates retrieved by Qwen3-Embedding-0.6B, MTEB v1.38.9, FP16 inference, nDCG@10 ร 100.
| Model | Params | CMTEB-R | MMTEB-R | BEIR | MLDR | MTEB-Code | Avg. | ฮ vs this |
|---|---|---|---|---|---|---|---|---|
| Yuanbao-Reranker v1.5 2B (this model, reference) | 2.370 | 77.05 | 72.27 | 62.73 | 67.61 | 78.28 | 71.59 | โ |
| Yuanbao-Reranker v1 4B (published) | 4.022 | 78.31 | 74.08 | 64.74 | 70.04 | 80.98 | 73.63 | +2.04 |
| Yuanbao-Reranker v1.5, I+L only | 2.527 | 77.23 | 72.54 | 62.91 | 68.86 | 79.15 | 72.14 | +0.55 |
| Qwen3-Reranker-4B (published) | 4.022 | 76.05 | 71.29 | 63.66 | 69.35 | 80.33 | 72.13 | +0.54 |
| Qwen3-Reranker-4B I+L, same 2.527B shape | 2.527 | 77.28 | 72.13 | 62.72 | 68.27 | 79.41 | 71.96 | +0.37 |
| Qwen3-Reranker-4B I+H+L, same 2.370B shape | 2.370 | 75.70 | 70.84 | 61.82 | 68.02 | 76.95 | 70.67 | โ0.92 |
Every ฮ is measured against this model, so a positive value means a row scores higher than the
2.370B checkpoint on this page. Three rows carry the argument:
- At equal parameters this model wins. Against the Qwen3-derived target pruned to the identical 2.370B architecture it is 0.92 points higher.
- Head pruning buys 6.2% of parameters for 0.55 points. The I+L-only sibling keeps all 32 query and 8 KV heads at 2.527B and scores 0.55 above this model, which is the measured cost of moving to Q24/KV6.
- Against its own predecessor it gives up 2.04 points for 41% fewer parameters. Yuanbao v1 4B is 1.652B larger (4.022B vs 2.370B) and 2.04 points ahead.
Any ฮ that crosses a parameter boundary has to be read with the Params column: a row above this model is usually also larger. Only the two rows at 2.527B and 2.370B are like-for-like comparisons.
Limitations
- One recovery run per target; no seed variability or significance estimate, so differences of a few tenths of a point are within run-to-run variation.
- The five-panel average is a summary, not a per-panel bound: the largest panel loss here is on MTEB-Code (โ2.70 versus the source).
- Trained for ranking with a two-token
yes/noreadout. Not a chat model;generate()is not the intended path, which is why nogeneration_config.jsonis shipped. - Latency was measured on the Qwen3 target of the same shape (1.49ร median end-to-end speedup on 100-candidate FiQA2018 queries at candidate batch 1, single accelerator, eager PyTorch), not on this checkpoint.
- No data or teacher checkpoint is released; see the repository below for the pipeline that produced this file.
License
Released under the Tencent Yuanbao-Reranker license; see LICENSE. The architecture and tokenizer derive from Qwen3, Copyright 2025 Alibaba Group Holding Limited, licensed under Apache-2.0.
Citation
@techreport{yuanbao_reranker_v15_2026,
title={Yuanbao-Reranker v1.5: Joint Pruning of FFN Width, Attention Heads, and Layers},
author={Cao, Jiahao and Ye, Dezhi and Xu, Hongyuan and Liu, Jie and Liang, Haijin and Shi, Haibo and Ma, Jin},
institution={Yuanbao Search, Tencent Inc.},
type={Technical Report},
year={2026}
}
- Downloads last month
- 256