Views
No views yet

| Property | Value |
|---|---|
| Base Model | arcee-ai/Trinity-Mini |
| Architecture | Sparse MoE (26B total / 3B active) |
| Fine-tuning Method | LoRA (Low-Rank Adaptation) |
| Training Method | GRPO (Reinforcement Learning) |
| Training Data | maziyar/OpenMed_DrugProt |
| Task | Drug-protein relation extraction (13-way classification) |
| Trainable Parameters | LoRA rank=16, all projection layers |
| License | Apache 2.0 |
| Parameter | Value |
|---|---|
| LoRA Alpha (α) | 64 |
| LoRA Rank | 16 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj + experts |
| Learning Rate | 3e-6 |
| Batch Size | 128 |
| Rollouts per Example | 8 |
| Max Generation Tokens | 2048 |
| Temperature | 0.7 |
pip install transformers peft torch accelerate1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3import torch
4
5base_model_id = "arcee-ai/Trinity-Mini"
6adapter_id = "lokahq/Trinity-Mini-DrugProt-Think"
7
8tokenizer = AutoTokenizer.from_pretrained(base_model_id)
9model = AutoModelForCausalLM.from_pretrained(
10 base_model_id,
11 torch_dtype=torch.bfloat16,
12 device_map="auto",
13 trust_remote_code=True
14)
15model = PeftModel.from_pretrained(model, adapter_id)
16
17messages = [
18 {
19 "role": "system",
20 "content": (
21 "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"
22 "For each question:\n"
23 "1. First, wrap your detailed biomedical reasoning inside <think></think> tags\n"
24 "2. Analyze the context around both entities to understand their relationship\n"
25 "3. Consider the pharmacological and molecular mechanisms involved\n"
26 "4. Then provide your final answer inside \\boxed{} using exactly one letter (A-M)\n\n"
27 "The 13 DrugProt relation types are:\n"
28 "A. INDIRECT-DOWNREGULATOR - Chemical indirectly decreases protein activity/expression\n"
29 "B. INDIRECT-UPREGULATOR - Chemical indirectly increases protein activity/expression\n"
30 "C. DIRECT-REGULATOR - Chemical directly regulates protein (mechanism unspecified)\n"
31 "D. ACTIVATOR - Chemical activates the protein\n"
32 "E. INHIBITOR - Chemical inhibits the protein\n"
33 "F. AGONIST - Chemical acts as an agonist of the receptor/protein\n"
34 "G. AGONIST-ACTIVATOR - Chemical is both agonist and activator\n"
35 "H. AGONIST-INHIBITOR - Chemical is agonist but inhibits downstream effects\n"
36 "I. ANTAGONIST - Chemical acts as an antagonist of the receptor/protein\n"
37 "J. PRODUCT-OF - Chemical is a product of the enzyme\n"
38 "K. SUBSTRATE - Chemical is a substrate of the enzyme\n"
39 "L. SUBSTRATE_PRODUCT-OF - Chemical is both substrate and product\n"
40 "M. PART-OF - Chemical is part of the protein complex\n\n"
41 "Example format:\n"
42 "<think>\n"
43 "The text describes [chemical] and [protein]. Based on the context...\n"
44 "- The phrase \"[relevant text]\" indicates that...\n"
45 "- This suggests a [type] relationship because...\n"
46 "</think>\n"
47 "\\boxed{A}"
48 )
49 },
50 {
51 "role": "user",
52 "content": (
53 "Abstract: [PASTE PUBMED ABSTRACT HERE]\n\n"
54 "Chemical entity: [DRUG NAME]\n"
55 "Protein entity: [PROTEIN NAME]\n\n"
56 "What is the relationship between the chemical and protein entities? "
57 "Choose from: A) INHIBITOR B) SUBSTRATE C) INDIRECT-DOWNREGULATOR "
58 "D) INDIRECT-UPREGULATOR E) AGONIST F) ANTAGONIST G) ACTIVATOR "
59 "H) PRODUCT-OF I) AGONIST-ACTIVATOR J) INDIRECT-UPREGULATOR "
60 "K) PART-OF L) SUBSTRATE_PRODUCT-OF M) NOT\n\n"
61 "Think step by step, then provide your answer in \\boxed{} format."
62 )
63 }
64]
65
66text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
67inputs = tokenizer(text, return_tensors="pt").to(model.device)
68outputs = model.generate(**inputs, max_new_tokens=2048, temperature=0.7, top_p=0.75)
69print(tokenizer.decode(outputs[0], skip_special_tokens=True))@misc{jakimovski2026drugprotrl,
title = {Post-Training an Open MoE Model to Extract Drug-Protein Relations: Trinity-Mini-DrugProt-Think},
author = {Jakimovski, Bojan and Kalinovski, Petar},
year = {2026},
month = feb,
howpublished = {Blog post},
url = {https://github.com/LokaHQ/Trinity-Mini-DrugProt-Think}
}