Safetensors
English
qwen2
custom_code
File size: 6,494 Bytes
4688144
 
 
 
 
 
 
 
 
 
0e96a32
4688144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0e96a32
 
 
 
 
 
 
 
 
4688144
 
 
 
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
102
103
104
105
---
license: apache-2.0
language:
- en
base_model:
- Alibaba-NLP/gte-Qwen2-1.5B-instruct
---
# ToolRAG-T1 Model

[![ProjectPage](https://img.shields.io/badge/ProjectPage-TxAgent-red)](https://zitniklab.hms.harvard.edu/TxAgent)
[![PaperLink](https://img.shields.io/badge/Arxiv-TxAgent-red)](https://arxiv.org/pdf/2503.10970)
[![TxAgent-PIP](https://img.shields.io/badge/Pip-TxAgent-blue)](https://pypi.org/project/txagent/)
[![ToolUniverse-PIP](https://img.shields.io/badge/Pip-ToolUniverse-blue)](https://pypi.org/project/tooluniverse/)
[![TxAgent](https://img.shields.io/badge/Code-TxAgent-purple)](https://github.com/mims-harvard/TxAgent)
[![ToolUniverse](https://img.shields.io/badge/Code-ToolUniverse-purple)](https://github.com/mims-harvard/ToolUniverse)
[![HuggingFace](https://img.shields.io/badge/HuggingFace-TxAgentT1-yellow)](https://huggingface.co/collections/mims-harvard/txagent-67c8e54a9d03a429bb0c622c)


# Model Information
ToolRAG-T1-GTE-Qwen2-1.5B model selects suitable candidates from ToolUniverse based on descriptions provided by TxAgent.
ToolRAG-T1-GTE-Qwen2-1.5B utilizes gte-Qwen2-1.5B-instruct as the base model, and is fine-tuned on pairs
of requirements and tool descriptions using the multiple negatives ranking loss.

![TxAgent](https://cdn-uploads.huggingface.co/production/uploads/6350fc5ba8822aadf571304f/M243gu1YuKbxPvokl96UJ.jpeg)

# Introduction
Precision therapeutics require multimodal adaptive models that generate personalized treatment recommendations. We introduce TxAgent, an AI agent that leverages multi-step reasoning and real-time biomedical knowledge retrieval across a toolbox of 211 tools to analyze drug interactions, contraindications, and patient-specific treatment strategies. 
- TxAgent evaluates how drugs interact at molecular, pharmacokinetic, and clinical levels, identifies contraindications based on patient comorbidities and concurrent medications, and tailors treatment strategies to individual patient characteristics, including age, genetic factors, and disease progression. 
- TxAgent retrieves and synthesizes evidence from multiple biomedical sources, assesses interactions between drugs and patient conditions, and refines treatment recommendations through iterative reasoning. It selects tools based on task objectives and executes structured function calls to solve therapeutic tasks that require clinical reasoning and cross-source validation. 
- The ToolUniverse consolidates 211 tools from trusted sources, including all US FDA-approved drugs since 1939 and validated clinical insights from Open Targets. 

TxAgent outperforms leading LLMs, tool-use models, and reasoning agents across five new benchmarks: DrugPC, BrandPC, GenericPC, TreatmentPC, and DescriptionPC, covering 3,168 drug reasoning tasks and 456 personalized treatment scenarios. 
- It achieves 92.1% accuracy in open-ended drug reasoning tasks, surpassing GPT-4o by up to 25.8% and outperforming DeepSeek-R1 (671B) in structured multi-step reasoning.
- TxAgent generalizes across drug name variants and descriptions, maintaining a variance of < 0.01 between brand, generic, and description-based drug references, exceeding existing tool-use LLMs by over 55%. 

By integrating multi-step inference, real-time knowledge grounding, and tool- assisted decision-making, TxAgent ensures that treatment recommendations align with established clinical guidelines and real-world evidence, reducing the risk of adverse events and improving therapeutic decision-making.

# Model Training and Data
ToolRAG model is used in both TxAgent inference process and the training data collection
phase. It utilizes gte-Qwen2-1.5B-instruct as the base model, which is fine-tuned on pairs
of requirements and tool descriptions using the multiple negatives ranking loss. In the TOOL
PROVIDER module, we use the ToolRAG model to identify tools beyond the initial list retrieved
from the reference information of the question. While the ToolRAG model requires training data
from reasoning traces, we propose an iterative training process for ToolRAG model, where it
is trained on the generated reasoning traces, which in turn helps improve the generation of future
reasoning traces. In the first stage, since the ToolRAG model model is not yet available, we
rely solely on the initial set of tools that are obtained from the reference information of the
question, to generate the reasoning trace. From this trace, we extract pairs of tool requirements
and tool descriptions, which are then used to train the ToolRAG model. In the second stage, after
the initial training of ToolRAG model, we use it to select tools instead of relying exclusively on the initial set of tools. 
This approach allows the reasoning trace to better reflect real-world use cases, as tools are
now retrieved directly by the ToolRAG model agent. Using the data collected from this stage,
we continue to gather new pairs for further training of the ToolRAG model. This process is
repeated iteratively, continually refining both the ToolRAG model and the quality of reasoning
trace generation.

Please refer to our project page for more details: [Project Page](https://zitniklab.hms.harvard.edu/TxAgent).

## How to use

ToolRAG model is used by the TxAgent.

**Install ToolUniverse**:

```
# Install from source code:
git clone https://github.com/mims-harvard/ToolUniverse.git
cd ToolUniverse
python -m pip install . --no-cache-dir

# Install from pypi:
pip install tooluniverse
```

**Install TxAgent**:
```
# Install from source code:
git clone https://github.com/mims-harvard/TxAgent.git

python -m pip install . --no-cache-dir
# Install from pypi:
pip install txagent
```

**Run the example** with the [run_example.py](https://github.com/mims-harvard/TxAgent/run_example.py).

**Run the gradio demo** with the [run_txagent_app.py](https://github.com/mims-harvard/TxAgent/run_example.py).


## Citation
```
@misc{gao2025txagent,
      title={TxAgent: An AI Agent for Therapeutic Reasoning Across a Universe of Tools}, 
      author={Shanghua Gao and Richard Zhu and Zhenglun Kong and Ayush Noori and Xiaorui Su and Curtis Ginder and Theodoros Tsiligkaridis and Marinka Zitnik},
      year={2025},
      eprint={2503.10970},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2503.10970}, 
}
```

## Contact
If you have any questions or suggestions, please email [Shanghua Gao](mailto:[email protected]) and [Marinka Zitnik](mailto:[email protected]).