Improve model card: Add pipeline tag, library name, and usage example
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
@@ -1,28 +1,105 @@
|
|
1 |
---
|
2 |
-
|
|
|
3 |
language:
|
4 |
- en
|
5 |
- zh
|
6 |
-
|
7 |
-
- Qwen/Qwen2.5-7B-Instruct
|
8 |
tags:
|
9 |
- biology
|
10 |
- finance
|
11 |
- text-generation-inference
|
|
|
|
|
12 |
---
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
</p>
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
🌹 If you use this model, please ✨star our **[GitHub repository](https://github.com/plageon/HierSearch)** or upvote our **[paper](https://huggingface.co/papers/2508.08088)** to support us. Your star means a lot!
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
base_model:
|
3 |
+
- Qwen/Qwen2.5-7B-Instruct
|
4 |
language:
|
5 |
- en
|
6 |
- zh
|
7 |
+
license: mit
|
|
|
8 |
tags:
|
9 |
- biology
|
10 |
- finance
|
11 |
- text-generation-inference
|
12 |
+
pipeline_tag: question-answering
|
13 |
+
library_name: transformers
|
14 |
---
|
15 |
|
16 |
+
# HierSearch: A Hierarchical Enterprise Deep Search Framework Integrating Local and Web Searches
|
17 |
|
18 |
+
HierSearch is a novel hierarchical agentic deep search framework presented in the paper [HierSearch: A Hierarchical Enterprise Deep Search Framework Integrating Local and Web Searches](https://huggingface.co/papers/2508.08088). It is designed for private deep search systems that can leverage search tools over both local and web corpora.
|
19 |
|
20 |
+
This framework addresses limitations of existing deep search works that are generally restricted to a single knowledge source. Unlike simply training an agent with multiple search tools using flat reinforcement learning (RL), HierSearch proposes a hierarchical RL approach to mitigate issues like low training data efficiency and poor mastery of complex tools. At the low level, specialized local and web deep search agents retrieve evidence from their respective domains. At the high level, a planner agent (this model) coordinates these low-level agents and provides the final answer. Furthermore, to prevent direct answer copying and error propagation, HierSearch incorporates a knowledge refiner that filters out hallucinations and irrelevant evidence.
|
21 |
+
|
22 |
+
Experiments demonstrate that HierSearch achieves superior performance compared to flat RL and outperforms various deep search and multi-source retrieval-augmented generation baselines across six benchmarks in general, finance, and medical domains.
|
23 |
+
|
24 |
+
<p align="center">
|
25 |
+
<img src="https://github.com/plageon/HierSearch/raw/main/figures/pipeline0730.png" alt="HierSearch Pipeline" width="80%">
|
26 |
</p>
|
27 |
|
28 |
+
## Useful Links
|
29 |
+
|
30 |
+
* 📝 [Paper on arXiv](https://arxiv.org/abs/2508.08088)
|
31 |
+
* 🤗 [Paper on Hugging Face](https://huggingface.co/papers/2508.08088)
|
32 |
+
* 🧩 [GitHub Repository](https://github.com/plageon/HierSearch)
|
33 |
|
34 |
+
## Key Features
|
35 |
+
|
36 |
+
* **Hierarchical Agentic Paradigm**: Employs a high-level planner agent to coordinate low-level local and web search agents, trained with hierarchical reinforcement learning.
|
37 |
+
* **Knowledge Refiner**: Designed to filter out hallucinations and irrelevant evidence, ensuring more reliable outputs.
|
38 |
+
* **Multi-Source Integration**: Capable of leveraging search tools over both local and web corpora.
|
39 |
+
* **Robust Performance**: Outperforms existing deep search and multi-source RAG baselines across diverse domains including general, finance, and medical.
|
40 |
|
41 |
🌹 If you use this model, please ✨star our **[GitHub repository](https://github.com/plageon/HierSearch)** or upvote our **[paper](https://huggingface.co/papers/2508.08088)** to support us. Your star means a lot!
|
42 |
|
43 |
+
## Usage
|
44 |
+
|
45 |
+
This model is a Qwen2-based language model and can be loaded using the Hugging Face `transformers` library. The example below demonstrates how to use the model for a basic question-answering task, leveraging its underlying chat template.
|
46 |
+
|
47 |
+
```python
|
48 |
+
import torch
|
49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
50 |
+
|
51 |
+
# Load the model and tokenizer
|
52 |
+
model_id = "zstanjj/HierSearch-Planner-Agent"
|
53 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
54 |
+
model = AutoModelForCausalLM.from_pretrained(
|
55 |
+
model_id,
|
56 |
+
torch_dtype=torch.bfloat16, # or torch.float16, depending on your hardware/preference
|
57 |
+
device_map="auto",
|
58 |
+
trust_remote_code=True
|
59 |
+
)
|
60 |
+
|
61 |
+
# Define a conversation for a question-answering task, suitable for the planner agent
|
62 |
+
messages = [
|
63 |
+
{"role": "system", "content": "You are a helpful assistant that can answer questions using search tools."},
|
64 |
+
{"role": "user", "content": "Who is the sibling of the author of Kapalkundala?"}
|
65 |
+
]
|
66 |
+
|
67 |
+
# Apply the chat template and prepare inputs
|
68 |
+
input_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
69 |
+
inputs = tokenizer(input_prompt, return_tensors="pt").to(model.device)
|
70 |
+
|
71 |
+
# Generate response
|
72 |
+
outputs = model.generate(
|
73 |
+
**inputs,
|
74 |
+
max_new_tokens=256, # Adjust as needed
|
75 |
+
do_sample=True,
|
76 |
+
temperature=0.7,
|
77 |
+
top_p=0.9,
|
78 |
+
eos_token_id=tokenizer.eos_token_id,
|
79 |
+
pad_token_id=tokenizer.pad_token_id,
|
80 |
+
)
|
81 |
+
|
82 |
+
# Decode and print the generated text, excluding the input prompt
|
83 |
+
response = tokenizer.decode(outputs[0, inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
84 |
+
print(f"Assistant: {response}")
|
85 |
+
|
86 |
+
# For more advanced usage, including setting up local and web search servers and agents,
|
87 |
+
# please refer to the comprehensive instructions in the project's
|
88 |
+
# [GitHub repository](https://github.com/plageon/HierSearch).
|
89 |
+
```
|
90 |
+
|
91 |
+
## Citation
|
92 |
+
|
93 |
+
If you find this work helpful, please cite the original paper:
|
94 |
+
|
95 |
+
```bibtex
|
96 |
+
@misc{tan2025hiersearchhierarchicalenterprisedeep,
|
97 |
+
title={HierSearch: A Hierarchical Enterprise Deep Search Framework Integrating Local and Web Searches},
|
98 |
+
author={Jiejun Tan and Zhicheng Dou and Yan Yu and Jiehan Cheng and Qiang Ju and Jian Xie and Ji-Rong Wen},
|
99 |
+
year={2025},
|
100 |
+
eprint={2508.08088},
|
101 |
+
archivePrefix={arXiv},
|
102 |
+
primaryClass={cs.IR},
|
103 |
+
url={https://arxiv.org/abs/2508.08088},
|
104 |
+
}
|
105 |
+
```
|