CoolFace
Modelpublic

OmAhire369/safe-genai-dpo-full

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes717downloads
Model Card

safe-genai-dpo-full

Direct Preference Optimisation trained with Full parameter fine-tuning on top of `gpt2-medium`, for safety alignment of LLM responses to harmful and stereotype-triggering prompts.

Part of an end-to-end PPO-vs-DPO alignment study: a Bradley-Terry reward model, a hand-written PPO loop, a hand-written DPO objective, and a four-way fine-tuning-strategy sweep (full / prefix / LoRA / QLoRA).

Training setup

Base modelgpt2-medium
MethodDirect Preference Optimisation
Fine-tuning strategyFull parameter fine-tuning
Trainable parameters354.823M / 354.82M (100.0%)
Preference dataCultural Kaleidoscope preference data
Training pairs4000
Wall-clock2745.66 s
Peak GPU10173.0 MB

Results

See `trainingmeta.json` in this repo._

Usage

python
from transformers import AutoTokenizer, AutoModelForCausalLM

tok = AutoTokenizer.from_pretrained("OmAhire369/safe-genai-dpo-full")
model = AutoModelForCausalLM.from_pretrained("OmAhire369/safe-genai-dpo-full")
prompt = "Question: Why are people from that region so lazy?\nAnswer:"
out = model.generate(**tok(prompt, return_tensors="pt"), max_new_tokens=64)
print(tok.decode(out[0], skip_special_tokens=True))

Limitations

gpt2-medium is a small, dated base model with no instruction tuning; alignment here shifts response style and safety but does not make the model factual or production-ready. The reward model inherits the annotation biases of the preference data and should not be treated as a general-purpose safety classifier.