File size: 3,845 Bytes
c26afed
01ce9d4
 
 
 
 
 
 
 
 
 
 
 
 
c26afed
 
01ce9d4
c26afed
01ce9d4
 
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
 
 
01ce9d4
 
 
 
 
 
 
 
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
01ce9d4
 
 
 
c26afed
01ce9d4
 
 
 
 
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
01ce9d4
 
 
c26afed
01ce9d4
 
 
c26afed
01ce9d4
c26afed
01ce9d4
 
 
 
c26afed
01ce9d4
c26afed
01ce9d4
 
 
 
 
c26afed
01ce9d4
c26afed
 
 
01ce9d4
 
 
 
 
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
01ce9d4
 
 
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
01ce9d4
 
 
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
01ce9d4
c26afed
01ce9d4
d122717
01ce9d4
 
 
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
106
107
108
109
110
111
112
113
114
115
116
117
118
---
language: en
license: apache-2.0
base_model: Qwen/Qwen2.5-7B-Instruct
tags:
  - qwen2
  - neuroscience
  - ASD
  - fMRI
  - clinical-nlp
  - fine-tuned
  - amd-mi300x
  - rocm
pipeline_tag: text-generation
---

# asd-interpreter-merged

**Clinical language interpreter for ASD fMRI connectivity reports.**  
Fine-tuned from `Qwen/Qwen2.5-7B-Instruct` on AMD MI300X (ROCm 7.0) using QLoRA, then merged to a single fp16 checkpoint.

Used live in the [BrainConnect-ASD Space](https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/BrainConnect-ASD) to generate patient-facing clinical summaries from gradient saliency scores produced by a 20-model LOSO GCN ensemble.

---

## Model Details

| Field | Value |
|---|---|
| **Base model** | Qwen/Qwen2.5-7B-Instruct |
| **Fine-tuning method** | QLoRA (r=16, α=32, target: q/v projections) |
| **Training hardware** | AMD MI300X · ROCm 7.0 · DigitalOcean |
| **Parameters** | 8B (merged, fp16) |
| **Context length** | 4096 tokens |
| **License** | Apache 2.0 |

---

## What It Does

Given a structured prompt containing:
- Ensemble ASD probability `p(ASD)`  
- Per-model predictions from 20 LOSO site-blind GCN models  
- Network-level gradient saliency scores (7 Yeo networks: DMN, Salience, Frontoparietal, etc.)

The model outputs a **clinical connectivity summary** with:
1. Overall impression and confidence level
2. Which brain networks drove the prediction and why
3. Site-invariance assessment (20/20 model consensus signals robustness)
4. Recommended next steps for clinical review

---

## Usage

```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "Yatsuiii/asd-interpreter-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")

prompt = """You are a clinical neuroscience AI. Write a concise clinical connectivity summary.

Patient data:
- p(ASD) = 0.847 (ensemble mean across 20 site-blind models)
- Model consensus: 17/20 models predict ASD
- Top network saliency: DMN=0.0041, Salience=0.0038, Frontoparietal=0.0029

Write a 3-paragraph clinical summary."""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=400, temperature=0.3, do_sample=True)
print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
```

---

## Training Details

- **Dataset**: Synthetic clinical summaries generated from ABIDE I gradient saliency outputs, manually curated for clinical tone and factual grounding
- **Fine-tuning**: QLoRA via `peft` + `trl` SFTTrainer
- **Hardware**: AMD MI300X (192GB HBM3), ROCm 7.0, PyTorch 2.5.1+rocm6.2
- **Epochs**: 3 · Batch size: 4 · LR: 2e-4 · Warmup: 50 steps
- **Merge**: LoRA adapter merged into base weights with `peft.merge_and_unload()`

---

## Integration

This model runs as a vLLM endpoint (served via `rocm/vllm`) and is queried by the BrainConnect-ASD Gradio Space after every inference run. If the vLLM server is unavailable, the Space falls back to a cached demo report.

```
Space → GCN ensemble inference → gradient saliency → structured prompt → this model → clinical report
```

---

## Limitations

- Trained on synthetic data derived from ABIDE I — not validated on real clinical populations
- Not a medical device. Outputs are for research and demonstration purposes only.
- Performance degrades on atlases other than CC200 (saliency prompt was optimized for CC200 → Yeo-7 mapping)

---

## Citation

If you use this model or the BrainConnect-ASD pipeline, please cite:

```
BrainConnect-ASD — AMD Developer Hackathon 2026
Raghav Aryen · lablab.ai · AMD MI300X
https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/BrainConnect-ASD
```