Spaces:
Sleeping
Sleeping
Enhance README with detailed agent roles and installation
Browse files
README.md
CHANGED
|
@@ -6,26 +6,27 @@ A demonstration web application that shows how multiple AI agents can overcome d
|
|
| 6 |
|
| 7 |
This demo showcases a three-agent system designed to simulate and overcome common diagnostic biases:
|
| 8 |
|
| 9 |
-
1. **Agent 1 (Diagnostician)**: Provides initial diagnosis (
|
| 10 |
-
2. **Agent 2 (Devil's Advocate)**:
|
| 11 |
-
3. **Agent 3 (Synthesizer)**:
|
| 12 |
|
| 13 |
## π Key Features
|
| 14 |
|
| 15 |
- **Multi-Agent Architecture**: Three specialized AI agents working in sequence
|
| 16 |
-
- **Bias
|
|
|
|
| 17 |
- **Interactive Web Interface**: Clean, intuitive Gradio-based UI
|
| 18 |
- **Sample Medical Cases**: Pre-built cases demonstrating different bias types
|
| 19 |
- **Custom Case Input**: Support for user-defined medical scenarios
|
| 20 |
-
- **
|
| 21 |
|
| 22 |
## ποΈ Architecture
|
| 23 |
|
| 24 |
```
|
| 25 |
User Input β Agent 1 (Diagnostician) β Agent 2 (Devil's Advocate) β Agent 3 (Synthesizer) β Final Output
|
| 26 |
β β β
|
| 27 |
-
|
| 28 |
-
(
|
| 29 |
```
|
| 30 |
|
| 31 |
## π Prerequisites
|
|
@@ -38,7 +39,7 @@ User Input β Agent 1 (Diagnostician) β Agent 2 (Devil's Advocate) β Agent
|
|
| 38 |
|
| 39 |
1. **Clone the repository:**
|
| 40 |
```bash
|
| 41 |
-
git clone
|
| 42 |
cd debias-llm
|
| 43 |
```
|
| 44 |
|
|
@@ -68,7 +69,7 @@ User Input β Agent 1 (Diagnostician) β Agent 2 (Devil's Advocate) β Agent
|
|
| 68 |
|
| 69 |
4. **Click "Run Analysis"** to see the three-agent process in action
|
| 70 |
|
| 71 |
-
5. **Review the results** to see how
|
| 72 |
|
| 73 |
### Sample Cases
|
| 74 |
|
|
@@ -106,9 +107,9 @@ self.generator = pipeline(
|
|
| 106 |
"text-generation",
|
| 107 |
model=self.model,
|
| 108 |
tokenizer=self.tokenizer,
|
| 109 |
-
|
| 110 |
do_sample=True,
|
| 111 |
-
temperature=0.7,
|
| 112 |
pad_token_id=self.tokenizer.eos_token_id
|
| 113 |
)
|
| 114 |
```
|
|
@@ -144,20 +145,21 @@ The application can be deployed on:
|
|
| 144 |
|
| 145 |
## π Understanding the Output
|
| 146 |
|
| 147 |
-
### Agent 1:
|
| 148 |
-
- **Purpose**:
|
| 149 |
-
- **
|
| 150 |
-
- **Output**: Initial diagnosis
|
| 151 |
|
| 152 |
-
### Agent 2: Devil's Advocate
|
| 153 |
-
- **Purpose**:
|
| 154 |
-
- **
|
| 155 |
-
- **
|
|
|
|
| 156 |
|
| 157 |
### Agent 3: Final Synthesis
|
| 158 |
-
- **Purpose**:
|
| 159 |
-
- **Approach**: Evidence-based synthesis
|
| 160 |
-
- **Output**: Final diagnosis
|
| 161 |
|
| 162 |
## π§ Bias Types Demonstrated
|
| 163 |
|
|
@@ -182,7 +184,7 @@ The application can be deployed on:
|
|
| 182 |
|
| 183 |
3. **Performance Issues**
|
| 184 |
- Use smaller models for faster inference
|
| 185 |
-
- Reduce
|
| 186 |
- Consider GPU acceleration if available
|
| 187 |
|
| 188 |
### Error Handling
|
|
|
|
| 6 |
|
| 7 |
This demo showcases a three-agent system designed to simulate and overcome common diagnostic biases:
|
| 8 |
|
| 9 |
+
1. **Agent 1 (Diagnostician)**: Provides initial diagnosis using all available information (HPI + PMH + Physical Exam)
|
| 10 |
+
2. **Agent 2 (Independent Devil's Advocate)**: Diagnoses from symptoms and physical exam only, then evaluates overlap with past medical history
|
| 11 |
+
3. **Agent 3 (Synthesizer)**: Combines both perspectives to create improved final diagnosis with impact analysis
|
| 12 |
|
| 13 |
## π Key Features
|
| 14 |
|
| 15 |
- **Multi-Agent Architecture**: Three specialized AI agents working in sequence
|
| 16 |
+
- **Bias Detection**: Agent 2 independently evaluates symptoms vs. past medical history
|
| 17 |
+
- **Overlap Scoring**: Qualitative assessment (High/Medium/Low) of current symptoms vs. past conditions
|
| 18 |
- **Interactive Web Interface**: Clean, intuitive Gradio-based UI
|
| 19 |
- **Sample Medical Cases**: Pre-built cases demonstrating different bias types
|
| 20 |
- **Custom Case Input**: Support for user-defined medical scenarios
|
| 21 |
+
- **Real LLM Outputs**: All agents generate concrete diagnostic content using Hugging Face models
|
| 22 |
|
| 23 |
## ποΈ Architecture
|
| 24 |
|
| 25 |
```
|
| 26 |
User Input β Agent 1 (Diagnostician) β Agent 2 (Devil's Advocate) β Agent 3 (Synthesizer) β Final Output
|
| 27 |
β β β
|
| 28 |
+
Full-case Diagnosis Symptoms+Exam Dx + Balanced Synthesis +
|
| 29 |
+
(HPI + PMH + Exam) Overlap Score Impact Analysis
|
| 30 |
```
|
| 31 |
|
| 32 |
## π Prerequisites
|
|
|
|
| 39 |
|
| 40 |
1. **Clone the repository:**
|
| 41 |
```bash
|
| 42 |
+
git clone https://github.com/nglebm19/debias-llm.git
|
| 43 |
cd debias-llm
|
| 44 |
```
|
| 45 |
|
|
|
|
| 69 |
|
| 70 |
4. **Click "Run Analysis"** to see the three-agent process in action
|
| 71 |
|
| 72 |
+
5. **Review the results** to see how each agent contributes to the final diagnosis
|
| 73 |
|
| 74 |
### Sample Cases
|
| 75 |
|
|
|
|
| 107 |
"text-generation",
|
| 108 |
model=self.model,
|
| 109 |
tokenizer=self.tokenizer,
|
| 110 |
+
max_new_tokens=200, # Adjust for longer/shorter outputs
|
| 111 |
do_sample=True,
|
| 112 |
+
temperature=0.7, # Lower = more focused, Higher = more creative
|
| 113 |
pad_token_id=self.tokenizer.eos_token_id
|
| 114 |
)
|
| 115 |
```
|
|
|
|
| 145 |
|
| 146 |
## π Understanding the Output
|
| 147 |
|
| 148 |
+
### Agent 1: Full-Case Diagnosis
|
| 149 |
+
- **Purpose**: Comprehensive initial assessment using all available information
|
| 150 |
+
- **Input**: History of Present Illness + Past Medical History + Physical Examination
|
| 151 |
+
- **Output**: Initial diagnosis with clinical reasoning
|
| 152 |
|
| 153 |
+
### Agent 2: Independent Devil's Advocate
|
| 154 |
+
- **Purpose**: Independent evaluation and overlap assessment
|
| 155 |
+
- **Phase 1**: Diagnosis based only on current symptoms and physical exam
|
| 156 |
+
- **Phase 2**: Overlap score (High/Medium/Low) with past medical history
|
| 157 |
+
- **Output**: Independent diagnosis + overlap score + rationale
|
| 158 |
|
| 159 |
### Agent 3: Final Synthesis
|
| 160 |
+
- **Purpose**: Combines both perspectives for balanced final assessment
|
| 161 |
+
- **Approach**: Evidence-based synthesis with impact analysis
|
| 162 |
+
- **Output**: Final diagnosis + differential + impact of past disease + next steps
|
| 163 |
|
| 164 |
## π§ Bias Types Demonstrated
|
| 165 |
|
|
|
|
| 184 |
|
| 185 |
3. **Performance Issues**
|
| 186 |
- Use smaller models for faster inference
|
| 187 |
+
- Reduce max_new_tokens parameter
|
| 188 |
- Consider GPU acceleration if available
|
| 189 |
|
| 190 |
### Error Handling
|