Upload 3 files
Browse files- .gitattributes +1 -0
- README.md +45 -20
- assets/github_logo.png +0 -0
- assets/logo.png +3 -0
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/logo.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -17,7 +17,7 @@ language:
|
|
| 17 |
---
|
| 18 |
|
| 19 |
<p align="center">
|
| 20 |
-
<img src="assets/logo.png" alt="Trinity-Mini-DrugProt-Think" width="350" />
|
| 21 |
</p>
|
| 22 |
|
| 23 |
<p align="center">
|
|
@@ -27,7 +27,7 @@ language:
|
|
| 27 |
|
| 28 |
<p align="center">
|
| 29 |
<a href="index.html">📝 <strong>Report</strong></a> |
|
| 30 |
-
<a href="https://medium.com/@jakimovski_bojan/9e1c1c430ce9"><img src="https://www.sysgroup.com/wp-content/uploads/2025/02/Amazon_Web_Services-Logo.wine_.png" height="
|
| 31 |
<a href="https://github.com/LokaHQ/Trinity-Mini-DrugProt-Think" aria-label="GitHub"><svg viewBox="0 0 16 16" fill="currentColor" width="20" height="20" style="vertical-align:middle;"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> <strong>GitHub</strong></a>
|
| 32 |
</p>
|
| 33 |
|
|
@@ -36,8 +36,6 @@ language:
|
|
| 36 |
|
| 37 |
A LoRA adapter fine-tuned on [Arcee Trinity Mini](https://huggingface.co/arcee-ai/Trinity-Mini) using GRPO (Group Relative Policy Optimization) for **drug-protein relation extraction** on the [DrugProt (BioCreative VII)](https://huggingface.co/datasets/OpenMed/drugprot-parquet) benchmark. The model classifies 13 types of drug-protein interactions from PubMed abstracts, producing structured pharmacological reasoning traces before giving its answer.
|
| 38 |
|
| 39 |
-
📄 **Blog post:** [Post-Training an Open MoE to Extract Drug-Protein Relations](https://github.com/Shekswess/drugprotrelrl)
|
| 40 |
-
💻 **Code & configs:** [github.com/Shekswess/drugprotrelrl](https://github.com/Shekswess/drugprotrelrl)
|
| 41 |
|
| 42 |
## Model Details
|
| 43 |
|
|
@@ -93,6 +91,38 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 93 |
model = PeftModel.from_pretrained(model, adapter_id)
|
| 94 |
|
| 95 |
messages = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
{
|
| 97 |
"role": "user",
|
| 98 |
"content": (
|
|
@@ -117,15 +147,7 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 117 |
|
| 118 |
## Training Progress
|
| 119 |
|
| 120 |
-
Training ran for ~
|
| 121 |
-
|
| 122 |
-
| Step | Accuracy Reward | Composite Reward |
|
| 123 |
-
|---|---|---|
|
| 124 |
-
| 0 | ~0.68 | ~0.72 |
|
| 125 |
-
| 25 | ~0.71 | ~0.74 |
|
| 126 |
-
| 50 | ~0.74 | ~0.77 |
|
| 127 |
-
| 75 | ~0.77 | ~0.80 |
|
| 128 |
-
| 100 | ~0.80 | ~0.83 |
|
| 129 |
|
| 130 |
## Limitations
|
| 131 |
|
|
@@ -135,13 +157,16 @@ Training ran for ~130 steps on Prime Intellect infrastructure. Best accuracy rew
|
|
| 135 |
|
| 136 |
## Citation
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
title
|
| 141 |
-
author
|
| 142 |
-
year
|
| 143 |
-
|
| 144 |
-
}
|
|
|
|
|
|
|
|
|
|
| 145 |
```
|
| 146 |
|
| 147 |
## Acknowledgements
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
<p align="center">
|
| 20 |
+
<img src="https://huggingface.co/lokahq/Trinity-Mini-DrugProt-Think/resolve/main/assets/logo.png" alt="Trinity-Mini-DrugProt-Think" width="350" />
|
| 21 |
</p>
|
| 22 |
|
| 23 |
<p align="center">
|
|
|
|
| 27 |
|
| 28 |
<p align="center">
|
| 29 |
<a href="index.html">📝 <strong>Report</strong></a> |
|
| 30 |
+
<a href="https://medium.com/@jakimovski_bojan/9e1c1c430ce9"><img src="https://www.sysgroup.com/wp-content/uploads/2025/02/Amazon_Web_Services-Logo.wine_.png" height="14" style="vertical-align:middle;"/> <strong>AWS deployment guide</strong></a> |
|
| 31 |
<a href="https://github.com/LokaHQ/Trinity-Mini-DrugProt-Think" aria-label="GitHub"><svg viewBox="0 0 16 16" fill="currentColor" width="20" height="20" style="vertical-align:middle;"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> <strong>GitHub</strong></a>
|
| 32 |
</p>
|
| 33 |
|
|
|
|
| 36 |
|
| 37 |
A LoRA adapter fine-tuned on [Arcee Trinity Mini](https://huggingface.co/arcee-ai/Trinity-Mini) using GRPO (Group Relative Policy Optimization) for **drug-protein relation extraction** on the [DrugProt (BioCreative VII)](https://huggingface.co/datasets/OpenMed/drugprot-parquet) benchmark. The model classifies 13 types of drug-protein interactions from PubMed abstracts, producing structured pharmacological reasoning traces before giving its answer.
|
| 38 |
|
|
|
|
|
|
|
| 39 |
|
| 40 |
## Model Details
|
| 41 |
|
|
|
|
| 91 |
model = PeftModel.from_pretrained(model, adapter_id)
|
| 92 |
|
| 93 |
messages = [
|
| 94 |
+
{
|
| 95 |
+
"role": "system",
|
| 96 |
+
"content": (
|
| 97 |
+
"You are an expert biomedical relation extraction assistant. Your task is to identify the type of interaction between a drug/chemical and a gene/protein in biomedical text.\n\n"
|
| 98 |
+
"For each question:\n"
|
| 99 |
+
"1. First, wrap your detailed biomedical reasoning inside <think></think> tags\n"
|
| 100 |
+
"2. Analyze the context around both entities to understand their relationship\n"
|
| 101 |
+
"3. Consider the pharmacological and molecular mechanisms involved\n"
|
| 102 |
+
"4. Then provide your final answer inside \\boxed{} using exactly one letter (A-M)\n\n"
|
| 103 |
+
"The 13 DrugProt relation types are:\n"
|
| 104 |
+
"A. INDIRECT-DOWNREGULATOR - Chemical indirectly decreases protein activity/expression\n"
|
| 105 |
+
"B. INDIRECT-UPREGULATOR - Chemical indirectly increases protein activity/expression\n"
|
| 106 |
+
"C. DIRECT-REGULATOR - Chemical directly regulates protein (mechanism unspecified)\n"
|
| 107 |
+
"D. ACTIVATOR - Chemical activates the protein\n"
|
| 108 |
+
"E. INHIBITOR - Chemical inhibits the protein\n"
|
| 109 |
+
"F. AGONIST - Chemical acts as an agonist of the receptor/protein\n"
|
| 110 |
+
"G. AGONIST-ACTIVATOR - Chemical is both agonist and activator\n"
|
| 111 |
+
"H. AGONIST-INHIBITOR - Chemical is agonist but inhibits downstream effects\n"
|
| 112 |
+
"I. ANTAGONIST - Chemical acts as an antagonist of the receptor/protein\n"
|
| 113 |
+
"J. PRODUCT-OF - Chemical is a product of the enzyme\n"
|
| 114 |
+
"K. SUBSTRATE - Chemical is a substrate of the enzyme\n"
|
| 115 |
+
"L. SUBSTRATE_PRODUCT-OF - Chemical is both substrate and product\n"
|
| 116 |
+
"M. PART-OF - Chemical is part of the protein complex\n\n"
|
| 117 |
+
"Example format:\n"
|
| 118 |
+
"<think>\n"
|
| 119 |
+
"The text describes [chemical] and [protein]. Based on the context...\n"
|
| 120 |
+
"- The phrase \"[relevant text]\" indicates that...\n"
|
| 121 |
+
"- This suggests a [type] relationship because...\n"
|
| 122 |
+
"</think>\n"
|
| 123 |
+
"\\boxed{A}"
|
| 124 |
+
)
|
| 125 |
+
},
|
| 126 |
{
|
| 127 |
"role": "user",
|
| 128 |
"content": (
|
|
|
|
| 147 |
|
| 148 |
## Training Progress
|
| 149 |
|
| 150 |
+
Training ran for ~100 steps on Prime Intellect infrastructure. Best accuracy reward reached ~0.83 during training.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
## Limitations
|
| 153 |
|
|
|
|
| 157 |
|
| 158 |
## Citation
|
| 159 |
|
| 160 |
+
<div class="citation-block">
|
| 161 |
+
<pre><code>@misc{jakimovski2026drugprotrl,
|
| 162 |
+
title = {Post-Training an Open MoE Model to Extract Drug-Protein Relations: Trinity-Mini-DrugProt-Think},
|
| 163 |
+
author = {Jakimovski, Bojan and Kalinovski, Petar},
|
| 164 |
+
year = {2026},
|
| 165 |
+
month = feb,
|
| 166 |
+
howpublished = {Blog post},
|
| 167 |
+
url = {https://github.com/LokaHQ/Trinity-Mini-DrugProt-Think}
|
| 168 |
+
}</code></pre>
|
| 169 |
+
</div>
|
| 170 |
```
|
| 171 |
|
| 172 |
## Acknowledgements
|
assets/github_logo.png
ADDED
|
assets/logo.png
ADDED
|
Git LFS Details
|