File size: 3,252 Bytes
24e1e03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
119
120
121
122
123
124
125
126
---
library_name: transformers
tags:
- biology
- medical
license: mit
language:
- en
base_model:
- deepseek-ai/deepseek-moe-16b-chat
pipeline_tag: text-generation
datasets:
- pubmed_qa
- medmcqa
- ccdv/pubmed-summarization
- ohsumed
---



# 🩺 DeepSeek 16B Medical GPT (QLoRA Fine-Tuned)

**`darkknight25/deepseek-16b-medical-GPT`** is a fine-tuned version of [deepseek-ai/deepseek-l6b-moe-chat](https://huggingface.co/deepseek-ai/deepseek-llm-16b-chat), optimized for **medical question answering, reasoning, and clinical summarization** 
using **QLoRA** and **open-access healthcare datasets**.

This model uses **Mixture-of-Experts (MoE)** architecture with **QLoRA-based adaptation**, unlocking medical domain performance with efficient training.

---

## 🧠 Model Details

- **Base Model:** [`deepseek-16b-moe-chat`](https://huggingface.co/deepseek-ai/deepseek-16b-moe-chat)
- **Fine-Tuning Method:** QLoRA (4-bit quantized)
- **Adapter Method:** LoRA via `peft`
- **Trainable Parameters:** ~85M
- **Quantization:** 4-bit NF4 using `bitsandbytes`

---


## 🧬 Base Model: `deepseek-ai/deepseek-moe-16b-chat`

- 16B parameter MoE with 2-of-8 experts active per token
- Low inference cost (~6B active)
- Strong reasoning, multi-domain instruction-tuned
- Trained on 2T tokens, multilingual support


## 🧪 Medical Fine-Tuning Setup

- **Technique:** QLoRA (4-bit quantization) + LoRA adapters
- **Target Modules:** `q_proj`, `k_proj`, `v_proj`, `o_proj`
- **Trainable Params:** ~85M
- **Batch Size:** 4
- **Epochs:** 2
- **Optim:** `paged_adamw_8bit`

## 📚 Training Datasets

Fine-tuned using a diverse set of public medical datasets:

| Dataset | Description |
|---------|-------------|
| `pubmed_qa` | Biomedical QA pairs |
| `medmcqa` | Indian medical entrance exam questions |
| `ccdv/pubmed-summarization` | Clinical note → abstract summaries |
| `ohsumed` | Medical literature abstracts |

---

## 🏥 Use Cases

This model is best suited for:

- Clinical decision support
- Biomedical Q&A
- Medical reasoning
- Summarizing clinical notes
- Patient education bots

---

## 🔁 Inference Example
```python
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "darkknight25/deepseek-16b-medical-GPT"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")

prompt = "Q: What is the treatment for bacterial meningitis?\nA:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=150)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

🧪 Evaluation (coming soon)

Evaluation on:

    MedMCQA (Accuracy %)

    PubMedQA (MCQ performance)

    USMLE-style clinical cases

Want to contribute eval scripts? PRs welcome.

🔐 License

MIT License (same as base model). Use for research and commercial purposes freely, with proper attribution.
🙏 Acknowledgements

    Base model: DeepSeek LLM 16B Chat

    Hugging Face PEFT, Datasets, Transformers

    Medical datasets: PubMedQA, MedMCQA, PubMed, OHSUMED

🤖 Author

@darkknight25 – Security Researcher | ML Engineer | Medical AI 

    Want to collaborate on more medical AI projects or build a chatbot? Ping me.