Views
No views yet
| Parameter | Value |
|---|---|
| DPO beta | 0.05 |
| LoRA rank (r) | 16 |
| LoRA alpha | 32 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Learning rate | 5e-5 |
| Batch size | 2 |
| Gradient accumulation | 2 |
| Epochs | 1 |
| Dropout | 0.05 |
| Stage | BLEU | BERTScore F1 |
|---|---|---|
| Base (Qwen3-0.6B) | 9.82 | 0.8803 |
| SFT (best) | 9.47 | 0.8836 |
| DPO (best — this model) | 11.94 | 0.8863 |
pip install --upgrade torchao transformers peft accelerateNote: You may encounterImportError: Found an incompatible version of torchaoif yourtorchaoversion is below 0.16.0. Runpip install --upgrade torchaoto fix this.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-0.6B-Base", torch_dtype="auto", device_map="auto")
5tokenizer = AutoTokenizer.from_pretrained("Abdullah121212/qwen3-0.6b-dpo-best")
6
7model = PeftModel.from_pretrained(base_model, "Abdullah121212/qwen3-0.6b-dpo-best")
8model.eval()
9
10prompt = "Explain the difference between supervised and unsupervised learning in simple terms."
11inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
12outputs = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.7)
13print(tokenizer.decode(outputs[0], skip_special_tokens=True))Baseline (Qwen3-0.6B-Base)
-> SFT (best trial 3 — see Abdullah121212/qwen3-0.6b-sft-best)
-> DPO (5 trials, this is trial 3 = best)