Views
No views yet
SivaSai8143/pharma-tinyllama-instruction-merged) on prompt/chosen/rejected triples,
using QLoRA (4-bit, nf4), then merging the LoRA adapter back into the base weights.1TinyLlama-1.1B (base)
2 ↓ Stage 1: Non-Instruction FT
3pharma-tinyllama-non-instruction-merged
4 ↓ Stage 2: Instruction FT / SFT
5pharma-tinyllama-instruction-merged
6 ↓ Stage 3: Preference Tuning / DPO (this model)
7pharma-tinyllama-dpo-merged ← you are here| Parameter | Value |
|---|---|
| Base model | SivaSai8143/pharma-tinyllama-instruction-merged |
| Method | QLoRA (4-bit nf4, double quant) + DPO |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Target modules | q/k/v/o_proj, gate/up/down_proj |
| beta | 0.1 |
| Max length | 512 tokens |
| Max prompt length | 256 tokens |
| Epochs | 3 |
| Max steps | 5 |
| Batch size | 1 (grad accum 8, effective = 8) |
| Learning rate | 5e-5 |
| Warmup steps | 2 |
| Weight decay | 0.01 |
| ref_model | None (TRL handles reference policy internally) |
| Environment | Google Colab T4 GPU |
SivaSai8143/pharma-finetuning-data (config: preference).chosen responses are accurate domain answers; rejected responses are
plausible-sounding but factually wrong or off-target answers.1{
2 "prompt": "### Instruction:\\nExplain the primary mechanism of action of metformin.\\n\\n### Response:\\n",
3 "chosen": "Metformin primarily acts by activating AMP-activated protein kinase (AMPK)...",
4 "rejected": "Metformin mainly works by increasing insulin secretion from the pancreas..."
5}| Artifact | Link |
|---|---|
| Stage 3 merged model | pharma-tinyllama-dpo-merged |
| Stage 2 merged model | pharma-tinyllama-instruction-merged |
| Stage 1 merged model | pharma-tinyllama-non-instruction-merged |
| Training notebook | llm-finetuning-playbook |
| Dataset | pharma-finetuning-data |
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_id = "SivaSai8143/pharma-tinyllama-dpo-merged"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
6
7prompt = \"\"\"### Instruction:
8Explain the primary mechanism of action of metformin.
9
10### Response:
11\"\"\"
12
13inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
14outputs = model.generate(**inputs, max_new_tokens=150, do_sample=True, temperature=0.7)
15print(tokenizer.decode(outputs[0], skip_special_tokens=True))