Instructions to use ullahhafeez321/qwen-dpo-lab10 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ullahhafeez321/qwen-dpo-lab10 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Qwen2.5-0.5B DPO Alignment Experiment
This repository contains the artifacts and evaluation evidence for a university Large Language Models lab experiment investigating Direct Preference Optimization (DPO) on Qwen/Qwen2.5-0.5B.
It includes two LoRA adapters trained with different DPO beta values, generated responses from the base and aligned models, comparison CSV files, and training metrics.
Experiment objective
Investigate whether preference alignment using DPO changes the behaviour of a pretrained language model. Compare the base model with two DPO configurations using the same evaluation prompts, and examine the effect of changing beta.
Base model and dataset
- Base model:
Qwen/Qwen2.5-0.5B - Preference dataset:
trl-lib/ultrafeedback_binarized - Alignment method: Direct Preference Optimization (DPO)
- Adapter method: LoRA (PEFT)
- Task: Causal language modelling / text generation
- DPO beta values:
0.1and0.5 - Training duration recorded: 1 epoch for each run
Repository contents
The uploaded experiment archive contains the following artifacts (folder names
may be nested under Lab10_DPO_experiment_evidence/):
| Artifact | Description |
|---|---|
adapter_beta_0_1/ |
LoRA adapter for DPO beta 0.1 |
adapter_beta_0_5/ |
LoRA adapter for DPO beta 0.5 |
base_outputs.csv |
Base model responses for the evaluation prompts |
beta_0_1_outputs.csv |
Responses generated using the beta 0.1 adapter |
beta_0_5_outputs.csv |
Responses generated using the beta 0.5 adapter |
side_by_side_comparison.csv |
Same-prompt comparison of all three model configurations |
training_metrics_beta_0_1.json |
Training metrics for beta 0.1 |
training_metrics_beta_0_5.json |
Training metrics for beta 0.5 |
training_metrics_summary.csv |
Combined training metrics |
training_beta_0_1/ and training_beta_0_5/ |
Trainer state and checkpoint artifacts |
human_ratings_template.csv |
Template for human evaluation ratings |
LoRA adapter configuration
Both adapter configurations identify Qwen/Qwen2.5-0.5B as their base model.
The saved PEFT configuration records:
- LoRA rank (
r): 16 - LoRA alpha: 32
- LoRA dropout: 0.05
- Bias: none
- Target modules:
q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj, anddown_proj - PEFT task type:
CAUSAL_LM
Load an adapter together with its base model. The adapter files alone are not standalone full model weights.
Recorded training metrics
| DPO beta | Training loss | Epoch | Runtime (seconds) |
|---|---|---|---|
| 0.1 | 0.681721 | 1.0 | 383.4160 |
| 0.5 | 0.659785 | 1.0 | 385.7389 |
Training loss measures the training objective. It must not be interpreted by itself as proof of better response quality or better alignment.
Evaluation design
The experiment records 10 prompts across multiple task types, including explanation, advice, summarisation, professional writing, reasoning, and question answering. The same prompts are used to compare:
- The base Qwen2.5-0.5B model
- The DPO LoRA adapter trained with beta 0.1
- The DPO LoRA adapter trained with beta 0.5
The comparison files preserve the generated responses for inspection.
Current limitations and interpretation
The recorded outputs show that the three configurations often produce similar responses. Some outputs contain irrelevant continuations, incomplete answers, or reasoning errors. The available evidence therefore does not establish that either beta value consistently improves helpfulness, relevance, clarity, or instruction following.
A complete quality conclusion requires human ratings using the same rubric for
all three configurations. The included human_ratings_template.csv is a
template; do not report scores until it has been filled with actual ratings.
Generation settings and stopping behaviour should also be checked consistently for all models before drawing a final conclusion.
How to load an adapter
Example using Transformers and PEFT:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "Qwen/Qwen2.5-0.5B"
adapter_id = "YOUR_USERNAME/YOUR_REPOSITORY"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_id,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
For this combined experiment repository, point adapter_id to the specific
adapter subfolder/revision supported by your repository layout, or publish each
adapter in its own model repository for the simplest loading experience.
Do not assume that a folder containing both adapters can be loaded as one
adapter.
Intended use
This repository is an educational experiment artifact. It is intended for reproducing and inspecting a DPO alignment experiment, not as a production-ready chatbot or a benchmarked general-purpose assistant.
Credits
- Base model: Qwen team,
Qwen/Qwen2.5-0.5B - Preference dataset:
trl-lib/ultrafeedback_binarized - Alignment framework: Hugging Face TRL
- Adapter framework: PEFT
- Downloads last month
- -
Model tree for ullahhafeez321/qwen-dpo-lab10
Base model
Qwen/Qwen2.5-0.5B