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tags:
|
| 6 |
+
- chemistry
|
| 7 |
+
- biology
|
| 8 |
+
- toxicology
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
base_model: Qwen/Qwen3-14B
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Blowfish
|
| 14 |
+
|
| 15 |
+
## Introduction
|
| 16 |
+
|
| 17 |
+
**Blowfish๋ **๋ถ์ ๋
์ฑ ์์ธก**์ ์ํํ๊ธฐ ์ํด ๊ฐ๋ฐ๋ ๋ํ ์ธ์ด ๋ชจ๋ธ(LLM)์
๋๋ค.
|
| 18 |
+
|
| 19 |
+
**Qwen3-14B**๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ์ธํ๋(Fine-tuning)๋์์ผ๋ฉฐ, ๋จ์ํ ์ด์ง ๋ถ๋ฅ๋ฅผ ๋์ด **Chain-of-Thought (CoT)** ๋ฐฉ์์ ํตํด ๋
์ฑ ํ์ ์ ํํ์ /์๋ฌผํ์ ๊ทผ๊ฑฐ๋ฅผ ๋
ผ๋ฆฌ์ ์ผ๋ก ์ค๋ช
ํฉ๋๋ค.
|
| 20 |
+
|
| 21 |
+
์ฌ์ฉ์๊ฐ ์
๋ ฅํ **SMILES**, **Cell Line**, **Bio Assay**, ๊ทธ๋ฆฌ๊ณ **์ฃผ์ RDKit Features**์ ์ข
ํฉ์ ์ผ๋ก ๋ถ์ํ์ฌ ์ต์ข
์ ์ผ๋ก ๋
์ฑ ์ฌ๋ถ(`๋
์ฑ` / `๋น๋
์ฑ`)๋ฅผ ํ๋จํฉ๋๋ค.
|
| 22 |
+
|
| 23 |
+
### ์ฃผ์ ํน์ง
|
| 24 |
+
* **Base Model:** Qwen3-14B
|
| 25 |
+
* **Task:** ์ด์ง ๋
์ฑ ์์ธก (Binary Toxicity Prediction) ๋ฐ ๋ถ์ ๊ตฌ์กฐ ๋ถ์
|
| 26 |
+
* **Language:** ํ๊ตญ์ด (์์คํ
์ง์๋ฌธ), ์์ด (ํํ์ ์ถ๋ก ๋ฐ ๋ต๋ณ)
|
| 27 |
+
* **Input Data:**
|
| 28 |
+
- SMILES Code
|
| 29 |
+
- Cell Line / Cell Type
|
| 30 |
+
- Bio Assay Name
|
| 31 |
+
- RDKit Features (SHAP Value ๊ธฐ์ค ์/ํ์ Feature ๊ฐ 3๊ฐ)
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## ํ๋กฌํํธ ํ์
|
| 36 |
+
|
| 37 |
+
๋ชจ๋ธ์ ์ฑ๋ฅ์ ์ต์ ํํ๊ธฐ ์ํด ํ์ต ์ ์ฌ์ฉ๋ ํ๋กฌํํธ ํ์์ ์ค์ํด์ผ ํฉ๋๋ค.
|
| 38 |
+
|
| 39 |
+
### ์์คํ
ํ๋กฌํํธ (System Prompt)
|
| 40 |
+
> "๋น์ ์ ๋ถ์ ๋
์ฑ ์์ธก์ ํนํ๋ ํํ์ ๋ณดํ/๋
์ฑํ ์ ๋ฌธ๊ฐ์
๋๋ค. ์ฌ์ฉ์๋ ๋
์ฑ/๋น๋
์ฑ์ ์ํฅ์ ๋ง์ด ๋ผ์น๋ Feature 3๊ฐ์ฉ์ ์ ๊ณตํฉ๋๋ค... (์ค๋ต) ... tool call์ ์ฌ์ฉํ์ง ๋ง์ธ์."
|
| 41 |
+
|
| 42 |
+
### ์ฌ์ฉ์ ์
๋ ฅ ํ
ํ๋ฆฟ (User Input Template)
|
| 43 |
+
|
| 44 |
+
```
|
| 45 |
+
SMILES: {smiles_code}
|
| 46 |
+
Cell Line: {cell_line}
|
| 47 |
+
Bio Assay Name: {endpoint_category}
|
| 48 |
+
Feature NL: {feature_NL_description}
|
| 49 |
+
Feature Descript: {feature_detailed_description}
|
| 50 |
+
|
| 51 |
+
{cot_instruction}
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
# Inference
|
| 57 |
+
|
| 58 |
+
## requirements
|
| 59 |
+
```bash
|
| 60 |
+
pip install transformers torch accelerate
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Usage with transformers
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
import torch
|
| 67 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 68 |
+
|
| 69 |
+
# 1. ๋ชจ๋ธ ๋ฐ ํ ํฌ๋์ด์ ๋ก๋
|
| 70 |
+
model_id = "TeamUNIVA/Blowfish"
|
| 71 |
+
|
| 72 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 73 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 74 |
+
model_id,
|
| 75 |
+
torch_dtype=torch.bfloat16,
|
| 76 |
+
device_map="auto"
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
# 2. ์์คํ
ํ๋กฌํํธ ์ ์
|
| 80 |
+
system_prompt = (
|
| 81 |
+
"๋น์ ์ ๋ถ์ ๋
์ฑ ์์ธก์ ํนํ๋ ํํ์ ๋ณดํ/๋
์ฑํ ์ ๋ฌธ๊ฐ์
๋๋ค.\n"
|
| 82 |
+
"์ฌ์ฉ์๋ ๋
์ฑ/๋น๋
์ฑ์ ์ํฅ์ ๋ง์ด ๋ผ์น๋ Feature 3๊ฐ์ฉ์ ์ ๊ณตํฉ๋๋ค.\n\n"
|
| 83 |
+
"์
๋ ฅ(์ฌ์ฉ์๊ฐ ์ ๊ณต):\n"
|
| 84 |
+
"- SMILES\n- Cell Type\n- Cell Line\n- Bio Assay Name\n"
|
| 85 |
+
"- ๋
์ฑ์ ๋ผ์น๋ ์ํฅ์ด ํฐ ์์ 3๊ฐ RDKit Feature\n"
|
| 86 |
+
"- ๋น๋
์ฑ์ ๋ผ์น๋ ์ํฅ์ด ํฐ ์์ 3๊ฐ RDKit Feature\n\n"
|
| 87 |
+
"์ํ ๊ณผ์
(Tasks):\n"
|
| 88 |
+
"SMILES ๊ตฌ์กฐ ๋ถ์\n"
|
| 89 |
+
"- ๊ณ ๋ฆฌ(๋ฐฉํฅ์กฑ/์ง๋ฐฉ์กฑ), ํคํ
๋ก์์, ์ ํ ์ค์ฌ, ๋ฐ์์ฑ ๋ชจํฐํ, H-๊ฒฐํฉ ๊ณต์ฌ/์์ฉ๊ธฐ ๋ฑ์\n"
|
| 90 |
+
" SMILES์์ ์ง์ ๊ด์ฐฐ ๊ฐ๋ฅํ ๋ฒ์๋ก๋ง ๊ธฐ์ .\n\n"
|
| 91 |
+
"Cell Type, Cell Line, Assay Name ํน์ง ๋ถ์ ๋ฐ SMILES์ ์ฐ๊ฒฐ\n\n"
|
| 92 |
+
"RDKit feature ๋ถ์\n"
|
| 93 |
+
"- ๊ฐ feature๊ฐ ์๋ฏธํ๋ ๋ฐ์ ์ผ๋ฐ์ ๋
์ฑ ๋ฆฌ์คํฌ์ ์ฃผ๋ ์ํฅ ์์ฝ.\n"
|
| 94 |
+
"- ๊ฐ๋ฅํ ๊ฒฝ์ฐ Assay ๋งฅ๋ฝ(์: ARE ์ฐํ์คํธ๋ ์ค)๊ณผ ์ฐ๊ฒฐ.\n\n"
|
| 95 |
+
"์ข
ํฉ ํ๋จ(์ต์ข
๊ฒฐ๋ก )\n"
|
| 96 |
+
"- (1) SMILES ๋ชจํฐํ, (2) Cell line/Cell type + Assay ๋งฅ๋ฝ, (3) RDKit feature๋ฅผ ํตํฉํด\n"
|
| 97 |
+
" ๋
์ฑ ์ฌ๋ถ๋ฅผ ์ด์ง์ผ๋ก ํ๋จ.\n\n"
|
| 98 |
+
"์ถ๋ ฅ ๊ท์น:\n"
|
| 99 |
+
"- ๋ณธ๋ฌธ์ ์์ด๋ก ์์ฑ.\n"
|
| 100 |
+
"- ๋ง์ง๋ง ์ค์ ์๋ ์ค ํ๋๋ง ๋จ๋
ํ๊ธฐ:\n"
|
| 101 |
+
"<answer>toxic</answer>\n"
|
| 102 |
+
"<answer>nontoxic</answer>\n\n"
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
# 3. ์
๋ ฅ ๋ฐ์ดํฐ ์์
|
| 106 |
+
smiles_code = "O=C(O)/C=C/C(=O)O.O=C(O)/C=C/C(=O)O.O=C(O)/C=C/C(=O)O.CN(C)CCN(Cc1cccs1)c2ccccn2.CN(C)CCN(Cc1cccs1)c2ccccn2"
|
| 107 |
+
cell_line = "HepG2 (Liver)"
|
| 108 |
+
feature_NL = "Top toxic features: ... / Top non-toxic features: ...",
|
| 109 |
+
feature_descript = "Detailed feature descriptions"
|
| 110 |
+
bio_assay = "AhR"
|
| 111 |
+
instruction = "ํํฉ๋ฌผ O=C(O)/C=C/C(=O)O.O=C(O)/C=C/C(=O)O.O=C(O)/C=C/C(=O)O.CN(C)CCN(Cc1cccs1)c2ccccn2.CN(C)CCN(Cc1cccs1)c2ccccn2์ ๋
์ฑ/๋น๋
์ฑ ์ฌ๋ถ๋ฅผ ํ๋จํ์์ค."
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
# 4. ํ๋กฌํํธ ๊ตฌ์ฑ
|
| 115 |
+
user_content = (
|
| 116 |
+
f"SMILES: {smiles_code}\n"
|
| 117 |
+
f"Cell Line: {cell_line}\n"
|
| 118 |
+
f"Bio Assay Name: {bio_assay}\n"
|
| 119 |
+
f"Feature NL: {feature_NL}\n"
|
| 120 |
+
f"Feature Descript: {feature_descript}\n\n"
|
| 121 |
+
f"{instruction}"
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
# 5. ์ฑํ
ํ
ํ๋ฆฟ ์ ์ฉ ๋ฐ ์์ฑ
|
| 125 |
+
messages = [
|
| 126 |
+
{"role": "system", "content": system_prompt},
|
| 127 |
+
{"role": "user", "content": user_content}
|
| 128 |
+
]
|
| 129 |
+
|
| 130 |
+
text = tokenizer.apply_chat_template(
|
| 131 |
+
messages,
|
| 132 |
+
tokenize=False,
|
| 133 |
+
add_generation_prompt=True
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 137 |
+
|
| 138 |
+
outputs = model.generate(
|
| 139 |
+
**inputs,
|
| 140 |
+
max_new_tokens=8192,
|
| 141 |
+
temperature=0.7,
|
| 142 |
+
top_p=0.8,
|
| 143 |
+
do_sample=True
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
# 6. ๊ฒฐ๊ณผ ๋์ฝ๋ฉ
|
| 147 |
+
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 148 |
+
print(response)
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
## Acknowledgements
|
| 152 |
+
๋ณธ ๊ฒฐ๊ณผ๋ฌผ์ ๊ณผํ๊ธฐ์ ์ ๋ณดํต์ ๋ถ์ ํ๊ตญ์ง๋ฅ์ ๋ณด์ฌํ์งํฅ์์ ์ง์์ ๋ฐ์ ์ํ๋
|
| 153 |
+
ใ2025๋
์ด๊ฑฐ๋AI ํ์ฐ ์ํ๊ณ ์กฐ์ฑ์ฌ์
ใ์ ์ฐ๊ตฌ ์ฑ๊ณผ์ ์ผ๋ถ์
๋๋ค.
|