Views
No views yet
| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen2.5-7B-Instruct |
| Method | Reward modeling with LoRA (r=32, alpha=64) |
| Quantization | None (full bf16 to maximize quality) |
| Dataset | Anthropic/hh-rlhf |
| Training examples | 160,800 preference pairs |
| Eval examples | 8,552 preference pairs |
| Hardware | NVIDIA RTX 5090 (32GB VRAM, 18GB used) |
| Training time | ~9.2 hours |
| Epochs | 1 |
| Effective batch size | 16 (4 per device x 4 gradient accumulation) |
| Learning rate | 1e-5 (cosine schedule, 100 warmup steps) |
| Max sequence length | 512 tokens |
| Precision | bf16 |
| Framework | TRL 0.29.1 + Transformers 5.3.0 |
| Metric | Value |
|---|---|
| Eval accuracy | 71.5% |
| Final training accuracy | 71.4% (avg last 50 steps) |
| Starting accuracy | 50.0% (random) |
| Training loss | 0.677 -> 0.545 |

1from transformers import AutoModelForSequenceClassification, AutoTokenizer
2from peft import PeftModel
3import torch
4
5# Load base model + adapter
6base_model = AutoModelForSequenceClassification.from_pretrained(
7 "Qwen/Qwen2.5-7B-Instruct",
8 num_labels=1,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11)
12model = PeftModel.from_pretrained(base_model, "usama10/qwen-7b-reward-model")
13tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
14
15# Score a response
16text = "Human: What is the best way to learn programming?\n\nAssistant: Start with Python. Build small projects, read documentation, and practice daily."
17inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512).to(model.device)
18
19with torch.no_grad():
20 reward_score = model(**inputs).logits.item()
21
22print(f"Reward score: {reward_score:.4f}")
23# Higher score = more helpful, harmless, and honest