Views
No views yet
SearchQwen2.5-3B 是基于 EasyDistill 2.0 环境对齐轨迹蒸馏链路训练的 Search Agent 小模型,支持结构化search/browse工具调用。
| Item | Value |
|---|---|
| Base model | Qwen/Qwen2.5-3B-Instruct |
| Parameters | 3.09B |
| Context length | 32,768 |
| Recommended interface | Structured Tool-Call |
| Training data | SynSearch-Data |
| Interaction | Model | Multi-hop QA | Deep Search | Overall |
|---|---|---|---|---|
| Search-R1 style | Qwen2.5-3B-Instruct | 30.12 | 14.95 | 22.54 |
| Search-R1 style | SearchQwen2.5-3B | 39.55 | 21.15 | 30.35 |
| Tool-Call | Qwen2.5-3B-Instruct | 36.10 | 7.05 | 21.60 |
| Tool-Call | SearchQwen2.5-3B | 48.58 | 21.40 | 35.00 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "alibaba-pai/SearchQwen2.5-3B"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(
7 model_id,
8 torch_dtype=torch.bfloat16,
9 device_map="auto",
10).eval()
11
12messages = [
13 {"role": "system", "content": "You are a search agent. Use tools before answering."},
14 {"role": "user", "content": "Which city is the birthplace of the author of The Old Man and the Sea?"},
15]
16tools = [
17 {
18 "type": "function",
19 "function": {
20 "name": "search",
21 "description": "Search the web.",
22 "parameters": {
23 "type": "object",
24 "properties": {"query": {"type": "string"}},
25 "required": ["query"],
26 },
27 },
28 }
29]
30
31inputs = tokenizer.apply_chat_template(
32 messages,
33 tools=tools,
34 add_generation_prompt=True,
35 tokenize=True,
36 return_tensors="pt",
37 return_dict=True,
38).to(model.device)
39
40output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
41print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=False))<tool_call>; execute the tool, append its response, and continue until a final answer is produced. An external search/browse backend is required.SHA256SUMS.