Text Generation
Transformers
Safetensors
English
qwen2
search-agent
tool-use
function-calling
deep-search
qwen
conversational
text-generation-inference
Instructions to use alibaba-pai/SearchQwen2.5-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use alibaba-pai/SearchQwen2.5-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="alibaba-pai/SearchQwen2.5-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("alibaba-pai/SearchQwen2.5-7B") model = AutoModelForCausalLM.from_pretrained("alibaba-pai/SearchQwen2.5-7B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use alibaba-pai/SearchQwen2.5-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "alibaba-pai/SearchQwen2.5-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alibaba-pai/SearchQwen2.5-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/alibaba-pai/SearchQwen2.5-7B
- SGLang
How to use alibaba-pai/SearchQwen2.5-7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "alibaba-pai/SearchQwen2.5-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alibaba-pai/SearchQwen2.5-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "alibaba-pai/SearchQwen2.5-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alibaba-pai/SearchQwen2.5-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use alibaba-pai/SearchQwen2.5-7B with Docker Model Runner:
docker model run hf.co/alibaba-pai/SearchQwen2.5-7B
Improve model card with usage, evaluation and limitations
Browse files
README.md
CHANGED
|
@@ -2,86 +2,196 @@
|
|
| 2 |
library_name: transformers
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
| 5 |
base_model: Qwen/Qwen2.5-7B-Instruct
|
|
|
|
| 6 |
tags:
|
| 7 |
- search-agent
|
| 8 |
- tool-use
|
| 9 |
- function-calling
|
| 10 |
- react
|
| 11 |
- deep-search
|
|
|
|
| 12 |
- qwen
|
| 13 |
---
|
| 14 |
|
| 15 |
# SearchQwen2.5-7B
|
| 16 |
|
| 17 |
-
SearchQwen2.5-7B is a
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
## Model details
|
| 20 |
|
| 21 |
-
|
| 22 |
-
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
## Evaluation results
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
### Search-R1-style text interaction
|
| 32 |
|
| 33 |
| Model | Multi-hop QA Avg. | Deep Search Avg. | Overall Avg. |
|
| 34 |
|---|---:|---:|---:|
|
| 35 |
-
| Qwen2.5-7B-Instruct
|
| 36 |
| **SearchQwen2.5-7B** | **52.95** | **26.23** | **39.59** |
|
| 37 |
-
| Qwen2.5-3B-Instruct (Base) | 30.12 | 14.95 | 22.54 |
|
| 38 |
-
| **SearchQwen2.5-3B** | **39.55** | **21.15** | **30.35** |
|
| 39 |
|
| 40 |
### Structured Tool-Call interaction
|
| 41 |
|
| 42 |
| Model | Multi-hop QA Avg. | Deep Search Avg. | Overall Avg. |
|
| 43 |
|---|---:|---:|---:|
|
| 44 |
-
| Qwen2.5-7B-Instruct
|
| 45 |
| **SearchQwen2.5-7B** | **55.90** | **33.33** | **44.61** |
|
| 46 |
-
| Qwen2.5-3B-Instruct (Base) | 36.10 | 7.05 | 21.60 |
|
| 47 |
-
| **SearchQwen2.5-3B** | **48.58** | **21.40** | **35.00** |
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|---|---:|---:|
|
| 53 |
-
| Qwen3-8B (Base) | 24.50 | 40.31 |
|
| 54 |
-
| **SearchQwen3-8B** | **35.42** | **50.31** |
|
| 55 |
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
##
|
| 58 |
|
| 59 |
```python
|
|
|
|
| 60 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 61 |
|
| 62 |
model_id = "alibaba-pai/SearchQwen2.5-7B"
|
| 63 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 64 |
model = AutoModelForCausalLM.from_pretrained(
|
| 65 |
model_id,
|
| 66 |
-
torch_dtype=
|
| 67 |
device_map="auto",
|
| 68 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
-
For
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
##
|
| 74 |
|
| 75 |
-
The
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
-
|
| 78 |
-
2. loading the full model on an NVIDIA L20 GPU;
|
| 79 |
-
3. serving it with vLLM's OpenAI-compatible API;
|
| 80 |
-
4. emitting a structured `search` tool call;
|
| 81 |
-
5. consuming the tool response and producing the final answer.
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
## License
|
| 86 |
|
| 87 |
-
This derivative model
|
|
|
|
| 2 |
library_name: transformers
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
license: apache-2.0
|
| 5 |
+
license_link: https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
base_model: Qwen/Qwen2.5-7B-Instruct
|
| 9 |
+
base_model_relation: finetune
|
| 10 |
tags:
|
| 11 |
- search-agent
|
| 12 |
- tool-use
|
| 13 |
- function-calling
|
| 14 |
- react
|
| 15 |
- deep-search
|
| 16 |
+
- multi-hop-qa
|
| 17 |
- qwen
|
| 18 |
---
|
| 19 |
|
| 20 |
# SearchQwen2.5-7B
|
| 21 |
|
| 22 |
+
**SearchQwen2.5-7B** is a compact Search Agent model from the Alibaba Cloud PAI team. It is post-trained on environment-aligned multi-hop search tasks and solver-verified ReAct trajectories generated with the EasyDistill2 pipeline.
|
| 23 |
+
|
| 24 |
+
The model is optimized for iterative **search → browse → evidence integration → answer** behavior. It supports both structured Tool-Call interaction and Search-R1-style text interaction (Qwen2.5 variants).
|
| 25 |
+
|
| 26 |
+
> 中文简介:SearchQwen2.5-7B 是面向多跳问答与深度搜索任务训练的 Search Agent 小模型,重点增强结构化工具调用、网页浏览和跨来源信息整合能力。
|
| 27 |
|
| 28 |
## Model details
|
| 29 |
|
| 30 |
+
| Item | Value |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Base model | [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) |
|
| 33 |
+
| Parameters | 7.62B |
|
| 34 |
+
| Architecture | Qwen2, 28 layers |
|
| 35 |
+
| Context length | 32,768 tokens in the released config |
|
| 36 |
+
| Primary interface | Structured `search` / `browse` Tool-Call |
|
| 37 |
+
| Training | Environment-aligned trajectories, Solver-in-the-Loop verification, and process-aware post-training |
|
| 38 |
+
| Companion dataset | [alibaba-pai/SynSearch-Data](https://huggingface.co/datasets/alibaba-pai/SynSearch-Data) |
|
| 39 |
+
|
| 40 |
|
|
|
|
| 41 |
|
| 42 |
+
## Evaluation
|
| 43 |
+
|
| 44 |
+
We report LLM-judge accuracy (%) over two benchmark groups:
|
| 45 |
+
|
| 46 |
+
- **Multi-hop QA:** 2WikiMultiHopQA, Bamboogle, HotpotQA, MuSiQue.
|
| 47 |
+
- **Deep Search:** GAIA, WebWalkerQA, xbench-deepsearch, BrowseComp-ZH.
|
| 48 |
|
| 49 |
### Search-R1-style text interaction
|
| 50 |
|
| 51 |
| Model | Multi-hop QA Avg. | Deep Search Avg. | Overall Avg. |
|
| 52 |
|---|---:|---:|---:|
|
| 53 |
+
| Qwen2.5-7B-Instruct | 45.28 | 18.65 | 31.96 |
|
| 54 |
| **SearchQwen2.5-7B** | **52.95** | **26.23** | **39.59** |
|
|
|
|
|
|
|
| 55 |
|
| 56 |
### Structured Tool-Call interaction
|
| 57 |
|
| 58 |
| Model | Multi-hop QA Avg. | Deep Search Avg. | Overall Avg. |
|
| 59 |
|---|---:|---:|---:|
|
| 60 |
+
| Qwen2.5-7B-Instruct | 45.23 | 24.35 | 33.33 |
|
| 61 |
| **SearchQwen2.5-7B** | **55.90** | **33.33** | **44.61** |
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
Deep Search gains are consistently larger than the gains on conventional multi-hop QA, indicating improved search, browsing, and evidence-integration behavior rather than answer memorization alone.
|
| 64 |
|
| 65 |
+
## Requirements
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
```bash
|
| 68 |
+
pip install -U transformers accelerate torch
|
| 69 |
+
```
|
| 70 |
|
| 71 |
+
## Transformers quickstart
|
| 72 |
|
| 73 |
```python
|
| 74 |
+
import torch
|
| 75 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 76 |
|
| 77 |
model_id = "alibaba-pai/SearchQwen2.5-7B"
|
| 78 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 79 |
model = AutoModelForCausalLM.from_pretrained(
|
| 80 |
model_id,
|
| 81 |
+
torch_dtype=torch.bfloat16,
|
| 82 |
device_map="auto",
|
| 83 |
+
).eval()
|
| 84 |
+
|
| 85 |
+
tools = [
|
| 86 |
+
{
|
| 87 |
+
"type": "function",
|
| 88 |
+
"function": {
|
| 89 |
+
"name": "search",
|
| 90 |
+
"description": "Search the web for relevant pages.",
|
| 91 |
+
"parameters": {
|
| 92 |
+
"type": "object",
|
| 93 |
+
"properties": {"query": {"type": "string"}},
|
| 94 |
+
"required": ["query"],
|
| 95 |
+
},
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"type": "function",
|
| 100 |
+
"function": {
|
| 101 |
+
"name": "browse",
|
| 102 |
+
"description": "Read the content of a web page.",
|
| 103 |
+
"parameters": {
|
| 104 |
+
"type": "object",
|
| 105 |
+
"properties": {"url": {"type": "string"}},
|
| 106 |
+
"required": ["url"],
|
| 107 |
+
},
|
| 108 |
+
},
|
| 109 |
+
},
|
| 110 |
+
]
|
| 111 |
+
|
| 112 |
+
messages = [
|
| 113 |
+
{"role": "system", "content": "You are a search agent. Use tools before answering."},
|
| 114 |
+
{"role": "user", "content": "Which city is the birthplace of the author of The Old Man and the Sea?"},
|
| 115 |
+
]
|
| 116 |
+
|
| 117 |
+
inputs = tokenizer.apply_chat_template(
|
| 118 |
+
messages,
|
| 119 |
+
tools=tools,
|
| 120 |
+
add_generation_prompt=True,
|
| 121 |
+
tokenize=True,
|
| 122 |
+
return_tensors="pt",
|
| 123 |
+
return_dict=True,
|
| 124 |
+
).to(model.device)
|
| 125 |
+
|
| 126 |
+
with torch.inference_mode():
|
| 127 |
+
output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
|
| 128 |
+
|
| 129 |
+
new_tokens = output[0, inputs["input_ids"].shape[-1]:]
|
| 130 |
+
print(tokenizer.decode(new_tokens, skip_special_tokens=False))
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
A typical first response is a structured call:
|
| 134 |
+
|
| 135 |
+
```xml
|
| 136 |
+
<tool_call>
|
| 137 |
+
{"name": "search", "arguments": {"query": "..."}}
|
| 138 |
+
</tool_call>
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
Execute the requested tool, append the tool response to the conversation, and call the model again until it returns a final answer.
|
| 142 |
+
|
| 143 |
+
## vLLM deployment
|
| 144 |
+
|
| 145 |
+
```bash
|
| 146 |
+
vllm serve alibaba-pai/SearchQwen2.5-7B \
|
| 147 |
+
--served-model-name SearchQwen2.5-7B \
|
| 148 |
+
--enable-auto-tool-choice \
|
| 149 |
+
--tool-call-parser hermes \
|
| 150 |
+
--max-model-len 8192
|
| 151 |
```
|
| 152 |
|
| 153 |
+
For `SearchQwen2.5-7B`, the release was validated with Transformers and an OpenAI-compatible vLLM endpoint on NVIDIA L20 GPUs. The test covered checkpoint loading, structured `search` emission, tool-result consumption, and final-answer generation.
|
| 154 |
+
|
| 155 |
+
## Training data
|
| 156 |
+
|
| 157 |
+
The released companion dataset contains 5,000 audited multi-hop ReAct trajectories covering 4,182 unique tasks. Each example includes a complete `messages` history and metadata for seed provenance, hop count, difficulty, rollout statistics, and answer-equivalence auditing.
|
| 158 |
+
|
| 159 |
+
## Intended use
|
| 160 |
+
|
| 161 |
+
- Research on search agents and retrieval-augmented reasoning.
|
| 162 |
+
- Search/browse tool-use experiments.
|
| 163 |
+
- Fine-tuning, evaluation, and deployment of compact agent models.
|
| 164 |
|
| 165 |
+
## Limitations
|
| 166 |
|
| 167 |
+
- The model requires an external search/browse runtime; it does not provide a search index itself.
|
| 168 |
+
- Final-answer quality depends on tool availability and retrieved evidence quality.
|
| 169 |
+
- Tool schemas and prompt templates should remain compatible with the released chat template.
|
| 170 |
+
- LLM-judge scores may vary with evaluator model, decoding settings, and search backend.
|
| 171 |
+
- Do not use the model as the sole authority for safety-critical, legal, medical, or financial decisions.
|
| 172 |
|
| 173 |
+
## Artifact integrity
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
+
`SHA256SUMS` contains checksums for all weight shards, the weight index, configuration, and tokenizer.
|
| 176 |
+
|
| 177 |
+
## Related releases
|
| 178 |
+
|
| 179 |
+
- [SearchQwen2.5-7B](https://huggingface.co/alibaba-pai/SearchQwen2.5-7B)
|
| 180 |
+
- [SearchQwen2.5-3B](https://huggingface.co/alibaba-pai/SearchQwen2.5-3B)
|
| 181 |
+
- [SearchQwen3-8B](https://huggingface.co/alibaba-pai/SearchQwen3-8B)
|
| 182 |
+
- [SynSearch-Data](https://huggingface.co/datasets/alibaba-pai/SynSearch-Data)
|
| 183 |
+
|
| 184 |
+
## Citation
|
| 185 |
+
|
| 186 |
+
```bibtex
|
| 187 |
+
@misc{searchqwen2026,
|
| 188 |
+
title = {Fake It Till You Make It: Training Deep Search Agents on Synthetic Reality},
|
| 189 |
+
author = {Alibaba Cloud PAI Team},
|
| 190 |
+
year = {2026},
|
| 191 |
+
note = {SearchQwen model family and SynSearch-Data}
|
| 192 |
+
}
|
| 193 |
+
```
|
| 194 |
|
| 195 |
## License
|
| 196 |
|
| 197 |
+
This derivative model is released under the license file included in this repository and remains subject to the terms of its base model.
|