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
File size: 3,466 Bytes
9d5fe96 98ffb7d 9d5fe96 98ffb7d 9d5fe96 50f82ec 98ffb7d 50f82ec 98ffb7d 50f82ec 9d5fe96 98ffb7d 50f82ec 9d5fe96 50f82ec 9d5fe96 50f82ec 9d5fe96 50f82ec 9d5fe96 50f82ec 9d5fe96 98ffb7d 9d5fe96 98ffb7d 9d5fe96 98ffb7d 50f82ec 98ffb7d 50f82ec 98ffb7d 50f82ec 98ffb7d 50f82ec 9d5fe96 50f82ec 98ffb7d 50f82ec 98ffb7d 50f82ec 9d5fe96 50f82ec | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | ---
library_name: transformers
pipeline_tag: text-generation
license: apache-2.0
license_link: https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE
language:
- en
base_model: Qwen/Qwen2.5-7B-Instruct
base_model_relation: finetune
tags:
- search-agent
- tool-use
- function-calling
- deep-search
- qwen
---
# SearchQwen2.5-7B
**SearchQwen2.5-7B** is a compact Search Agent model from the Alibaba Cloud PAI team. It is trained with environment-aligned, solver-verified search trajectories generated by [EasyDistill 2.0](https://github.com/modelscope/easydistill/tree/v2.0.0), and is designed for multi-hop search, browsing, and evidence integration.
> SearchQwen2.5-7B 是基于 EasyDistill 2.0 环境对齐轨迹蒸馏链路训练的 Search Agent 小模型,支持结构化 `search` / `browse` 工具调用。
## Model overview
| Item | Value |
|---|---|
| Base model | [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) |
| Parameters | 7.62B |
| Context length | 32,768 |
| Recommended interface | Structured Tool-Call |
| Training data | [SynSearch-Data](https://huggingface.co/datasets/alibaba-pai/SynSearch-Data) |
## Results
LLM-judge accuracy (%). Multi-hop QA averages 2WikiMultiHopQA, Bamboogle, HotpotQA, and MuSiQue; Deep Search averages GAIA, WebWalkerQA, xbench-deepsearch, and BrowseComp-ZH.
| Interaction | Model | Multi-hop QA | Deep Search | Overall |
|---|---|---:|---:|---:|
| Search-R1 style | Qwen2.5-7B-Instruct | 45.28 | 18.65 | 31.96 |
| Search-R1 style | **SearchQwen2.5-7B** | **52.95** | **26.23** | **39.59** |
| Tool-Call | Qwen2.5-7B-Instruct | 45.23 | 24.35 | 33.33 |
| Tool-Call | **SearchQwen2.5-7B** | **55.90** | **33.33** | **44.61** |
## Quickstart
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "alibaba-pai/SearchQwen2.5-7B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
).eval()
messages = [
{"role": "system", "content": "You are a search agent. Use tools before answering."},
{"role": "user", "content": "Which city is the birthplace of the author of The Old Man and the Sea?"},
]
tools = [
{
"type": "function",
"function": {
"name": "search",
"description": "Search the web.",
"parameters": {
"type": "object",
"properties": {"query": {"type": "string"}},
"required": ["query"],
},
},
}
]
inputs = tokenizer.apply_chat_template(
messages,
tools=tools,
add_generation_prompt=True,
tokenize=True,
return_tensors="pt",
return_dict=True,
).to(model.device)
output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=False))
```
The model returns a structured `<tool_call>`; execute the tool, append its response, and continue until a final answer is produced. An external search/browse backend is required.
## Related resources
- Framework: [EasyDistill 2.0](https://github.com/modelscope/easydistill/tree/v2.0.0)
- Data: [SynSearch-Data](https://huggingface.co/datasets/alibaba-pai/SynSearch-Data)
## License
This model follows the license included in this repository and the terms of its base model. Checksums are provided in `SHA256SUMS`.
|