Add comprehensive model card
Browse filesThis PR adds a comprehensive model card for the DoctorAgent-RL model.
It includes:
- Relevant metadata: `pipeline_tag: text-generation` and `library_name: transformers`.
- A detailed description of the model and its key features.
- Links to the research paper ([DoctorAgent-RL: A Multi-Agent Collaborative Reinforcement Learning System for Multi-Turn Clinical Dialogue](https://huggingface.co/papers/2505.19630)) and the GitHub repository ([https://github.com/JarvisUSTC/DoctorAgent-RL](https://github.com/JarvisUSTC/DoctorAgent-RL)).
- An example of how to use the model with the `transformers` library for multi-turn clinical dialogue.
- Citation information.
This will make the model more discoverable and easier to use for the community.
README.md
CHANGED
@@ -1,3 +1,81 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
pipeline_tag: text-generation
|
4 |
+
library_name: transformers
|
5 |
+
tags:
|
6 |
+
- dialogue
|
7 |
+
- medical
|
8 |
+
- reinforcement-learning
|
9 |
+
- multi-agent
|
10 |
+
---
|
11 |
+
|
12 |
+
# DoctorAgent-RL: A Multi-Agent Collaborative Reinforcement Learning System for Multi-Turn Clinical Dialogue
|
13 |
+
|
14 |
+
This repository contains the `DoctorAgent-RL` model, which is a reinforcement learning (RL)-based multi-agent collaborative framework designed to revolutionize clinical dialogue. The model is presented in the paper [DoctorAgent-RL: A Multi-Agent Collaborative Reinforcement Learning System for Multi-Turn Clinical Dialogue](https://huggingface.co/papers/2505.19630).
|
15 |
+
|
16 |
+
**Code**: [https://github.com/JarvisUSTC/DoctorAgent-RL](https://github.com/JarvisUSTC/DoctorAgent-RL)
|
17 |
+
|
18 |
+
<div align="center">
|
19 |
+
<img width="1231" alt="DoctorAgent-RL Framework" src="https://github.com/user-attachments/assets/bd9f676e-01f9-406c-881d-c2b9f45e62f3" />
|
20 |
+
</div>
|
21 |
+
|
22 |
+
## Introduction
|
23 |
+
|
24 |
+
DoctorAgent-RL addresses the critical limitations of static clinical dialogue systems by modeling medical consultations as dynamic decision-making processes under uncertainty. It enables:
|
25 |
+
|
26 |
+
1. **Adaptive Information Gathering**: Intelligent adjustment of dialogue paths based on patient responses.
|
27 |
+
2. **Clinical Reasoning Alignment**: Autonomous development of interaction strategies consistent with medical logic.
|
28 |
+
3. **Overcoming Static Paradigms**: Moving beyond superficial pattern imitation in existing dialogue datasets.
|
29 |
+
|
30 |
+
Through continuous multi-turn interactions between doctor and patient agents, optimized via reinforcement learning, DoctorAgent-RL achieves significant improvements in diagnostic accuracy and interaction efficiency.
|
31 |
+
|
32 |
+
## Key Features
|
33 |
+
|
34 |
+
- ๐ง **Multi-Agent Collaboration**: Doctor and patient agents with distinct roles and objectives.
|
35 |
+
- ๐ **Dynamic Strategy Optimization**: Reinforcement learning-based policy updates for adaptive behavior.
|
36 |
+
- ๐ฏ **Comprehensive Reward Design**: Multi-dimensional consultation evaluation metrics guiding optimal strategies.
|
37 |
+
- ๐ **Medical Knowledge Integration**: Clinical reasoning logic embedded in decision-making processes.
|
38 |
+
- ๐ **MTMedDialog Dataset**: The first English multi-turn medical consultation dataset designed with simulation capabilities.
|
39 |
+
|
40 |
+
## Usage
|
41 |
+
|
42 |
+
You can use the `DoctorAgent-RL` model with the Hugging Face `transformers` library for text generation in a multi-turn dialogue context.
|
43 |
+
|
44 |
+
```python
|
45 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
46 |
+
import torch
|
47 |
+
|
48 |
+
# Load the model and tokenizer
|
49 |
+
model_id = "Jarvis1111/DoctorAgent-RL"
|
50 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
51 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
52 |
+
|
53 |
+
# Prepare a sample conversation
|
54 |
+
messages = [
|
55 |
+
{"role": "user", "content": "Hello Doctor, I have a headache and feel tired."},
|
56 |
+
]
|
57 |
+
|
58 |
+
# Apply the chat template defined in the tokenizer_config.json
|
59 |
+
# This is crucial for proper multi-turn dialogue with Qwen models
|
60 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
61 |
+
|
62 |
+
# Generate response
|
63 |
+
input_ids = tokenizer(text, return_tensors="pt").input_ids.to(model.device)
|
64 |
+
output = model.generate(input_ids, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.9)
|
65 |
+
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
66 |
+
|
67 |
+
print(response)
|
68 |
+
```
|
69 |
+
|
70 |
+
## Citation
|
71 |
+
|
72 |
+
If DoctorAgent-RL contributes to your research, please consider citing our work:
|
73 |
+
|
74 |
+
```latex
|
75 |
+
@article{feng2025doctoragent,
|
76 |
+
title={DoctorAgent-RL: A Multi-Agent Collaborative Reinforcement Learning System for Multi-Turn Clinical Dialogue},
|
77 |
+
author={Feng, Yichun and Wang, Jiawei and Zhou, Lu and Li, Yixue},
|
78 |
+
journal={arXiv preprint arXiv:2505.19630},
|
79 |
+
year={2025}
|
80 |
+
}
|
81 |
+
```
|