Text Generation
PEFT
Safetensors
lora
reinforcement-learning
grpo
tool-use
chemistry
biology
drug-discovery
prime-intellect
verifiers
Instructions to use poolside-laguna-hackathon/protein-ligand-design with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use poolside-laguna-hackathon/protein-ligand-design with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("poolside/Laguna-XS.2") model = PeftModel.from_pretrained(base_model, "poolside-laguna-hackathon/protein-ligand-design") - Notebooks
- Google Colab
- Kaggle
Add model card (with header) + LoRA adapter config
Browse files- .gitattributes +1 -0
- README.md +123 -0
- adapter_config.json +20 -0
- header.png +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip 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
|
|
|
|
|
|
| 33 |
*.zip 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 |
+
header.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: poolside/Laguna-XS.2
|
| 4 |
+
library_name: peft
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
datasets:
|
| 7 |
+
- poolside-laguna-hackathon/protein-ligand-design
|
| 8 |
+
tags:
|
| 9 |
+
- lora
|
| 10 |
+
- peft
|
| 11 |
+
- reinforcement-learning
|
| 12 |
+
- grpo
|
| 13 |
+
- tool-use
|
| 14 |
+
- chemistry
|
| 15 |
+
- biology
|
| 16 |
+
- drug-discovery
|
| 17 |
+
- prime-intellect
|
| 18 |
+
- verifiers
|
| 19 |
+
pretty_name: "Protein-Ligand Design LoRA (Team JAMMY)"
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
|
| 24 |
+
# 🧪 Protein-Ligand Design — LoRA adapter for `poolside/Laguna-XS.2`
|
| 25 |
+
|
| 26 |
+
> **poolside Laguna Hackathon submission — Team JAMMY.** A LoRA adapter trained
|
| 27 |
+
> with reinforcement learning (GRPO) to make `poolside/Laguna-XS.2` reason like a
|
| 28 |
+
> bench computational chemist / protein engineer: **measure with tools, then
|
| 29 |
+
> commit an answer.**
|
| 30 |
+
|
| 31 |
+
This is the trained adapter that goes with our environment and dataset:
|
| 32 |
+
|
| 33 |
+
➡️ **Gym / dataset:** [`poolside-laguna-hackathon/protein-ligand-design`](https://huggingface.co/datasets/poolside-laguna-hackathon/protein-ligand-design)
|
| 34 |
+
|
| 35 |
+
The gym hands the model a molecule or protein plus a scientist's question, and the
|
| 36 |
+
model must call CPU-only cheminformatics/proteomics tools (RDKit + Biopython) to
|
| 37 |
+
*measure* the answer before committing. The reward is **answer correctness only**,
|
| 38 |
+
and every ground-truth answer is computed by those same tools, so scoring is exact.
|
| 39 |
+
|
| 40 |
+
## What this adapter is
|
| 41 |
+
|
| 42 |
+
| | |
|
| 43 |
+
|---|---|
|
| 44 |
+
| Type | PEFT **LoRA** adapter (not a merged model) |
|
| 45 |
+
| Base model | `poolside/Laguna-XS.2` |
|
| 46 |
+
| Rank `r` | 16 |
|
| 47 |
+
| `lora_alpha` | 32 |
|
| 48 |
+
| `lora_dropout` | 0.0 |
|
| 49 |
+
| Target modules | `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`, `experts` |
|
| 50 |
+
| Dtype | F32 |
|
| 51 |
+
|
| 52 |
+
LoRA is applied to the attention projections **and the MoE expert MLPs**, which is
|
| 53 |
+
why the adapter is large (~4.6 GB) despite being rank-16.
|
| 54 |
+
|
| 55 |
+
## Training
|
| 56 |
+
|
| 57 |
+
Trained on [Prime Intellect](https://app.primeintellect.ai) Hosted Training:
|
| 58 |
+
|
| 59 |
+
- **Algorithm:** GRPO
|
| 60 |
+
- **Reward:** binary final-answer correctness (1.0 correct / 0.0 wrong) — using
|
| 61 |
+
tools is the *means*, never the reward
|
| 62 |
+
- **Learning rate:** 1e-5
|
| 63 |
+
- **Rollouts per example:** 16
|
| 64 |
+
- **Batch size:** 128
|
| 65 |
+
- **Max tokens:** 4096, thinking enabled
|
| 66 |
+
- Stopped early once held-out eval saturated at 100% (≈30 steps).
|
| 67 |
+
|
| 68 |
+
## What training actually changed
|
| 69 |
+
|
| 70 |
+
The base model already *knew how to use the tools* — its failures were almost
|
| 71 |
+
always a behavioural one: it would gather evidence and then **forget to commit a
|
| 72 |
+
final answer**, running out of turns at reward 0.
|
| 73 |
+
|
| 74 |
+
**Concrete before/after.** The single question the base model got wrong in the
|
| 75 |
+
first batch (step 0, before any gradient update) was this Veber-filter problem:
|
| 76 |
+
|
| 77 |
+
> *Among C1–C4, find the single candidate passing Veber (`veber_pass == 1`) with
|
| 78 |
+
> `tpsa ≤ 120` and `rotatable_bonds ≤ 6`.*
|
| 79 |
+
>
|
| 80 |
+
> - C1 `O=C(O)CC(=O)NCC(=O)NCC(=O)O`
|
| 81 |
+
> - C2 `CCCCCCCCCCN`
|
| 82 |
+
> - **C3 `COc1ccc(CCN(C)C)cc1` ← correct answer**
|
| 83 |
+
> - C4 `NCCCCCCCCCCCCNCC(=O)O`
|
| 84 |
+
|
| 85 |
+
The base model made **12 tool calls** (`mol_descriptors`, `veber_pass`) and even
|
| 86 |
+
measured C3 — seeing it clearly passes (TPSA 12.5, 4 rotatable bonds) — but it
|
| 87 |
+
**never called `submit_answer`**. It ran out of turns and scored **0**.
|
| 88 |
+
|
| 89 |
+
After RL, the model reliably does the *measure-then-commit* loop:
|
| 90 |
+
|
| 91 |
+
| | Base model (step 0) | Trained (step 30) |
|
| 92 |
+
|---|---|---|
|
| 93 |
+
| Held-out eval `pass@1` (n=20) | **0.95** (19/20) | **1.00** (20/20) |
|
| 94 |
+
| Sampled training rollouts solved | one Veber question lost to "no answer submitted" | **every** sampled rollout submitted a correct answer (reward mean 0.99) |
|
| 95 |
+
|
| 96 |
+
So the headline effect is not new chemistry knowledge — it's **discipline**: the
|
| 97 |
+
adapter teaches the model to stop dithering with tools and actually commit the
|
| 98 |
+
answer the evidence supports.
|
| 99 |
+
|
| 100 |
+
## Usage
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
import torch
|
| 104 |
+
from peft import PeftModel
|
| 105 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 106 |
+
|
| 107 |
+
base = "poolside/Laguna-XS.2"
|
| 108 |
+
tok = AutoTokenizer.from_pretrained(base)
|
| 109 |
+
model = AutoModelForCausalLM.from_pretrained(base, torch_dtype=torch.bfloat16, device_map="auto")
|
| 110 |
+
model = PeftModel.from_pretrained(model, "poolside-laguna-hackathon/protein-ligand-design")
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
For the full tool-use evaluation loop, install and run the gym:
|
| 114 |
+
|
| 115 |
+
```bash
|
| 116 |
+
prime env install jdthewlis/protein-ligand-design
|
| 117 |
+
prime eval run jdthewlis/protein-ligand-design -m <your-deployment> -n 20 -r 3
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
---
|
| 121 |
+
|
| 122 |
+
*Built by **Team JAMMY** for the poolside Laguna hackathon. Trained with GRPO on
|
| 123 |
+
Prime Intellect Hosted Training; environment questions generated with Claude Opus 4.8.*
|
adapter_config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"peft_type": "LORA",
|
| 3 |
+
"task_type": "CAUSAL_LM",
|
| 4 |
+
"base_model_name_or_path": "poolside/Laguna-XS.2",
|
| 5 |
+
"r": 16,
|
| 6 |
+
"lora_alpha": 32.0,
|
| 7 |
+
"lora_dropout": 0.0,
|
| 8 |
+
"bias": "none",
|
| 9 |
+
"target_modules": [
|
| 10 |
+
"down_proj",
|
| 11 |
+
"experts",
|
| 12 |
+
"gate_proj",
|
| 13 |
+
"k_proj",
|
| 14 |
+
"o_proj",
|
| 15 |
+
"q_proj",
|
| 16 |
+
"up_proj",
|
| 17 |
+
"v_proj"
|
| 18 |
+
],
|
| 19 |
+
"modules_to_save": null
|
| 20 |
+
}
|
header.png
ADDED
|
Git LFS Details
|