A 1B-parameter instruct model aligned on top of
devwoo/Kybalion-1B (Llama 3.2 1B + CPT + SFT) using
Direct Preference Optimization (DPO). The LoRA adapter has been merged into the base weights so this is a standalone instruct model — no PEFT adapter required at inference.
DPO recipe following Chapter 6 (Direct Alignment Algorithms) of Nathan Lambert's
RLHF book, with
Zephyr hyperparameters.
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "devwoo/Kybalion-1B-DPO"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11)
12
13messages = [
14 {"role": "user", "content": "Explain quantum entanglement in simple terms."},
15]
16input_text = tokenizer.apply_chat_template(
17 messages, tokenize=False, add_generation_prompt=True
18)
19inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
20
21out = model.generate(
22 **inputs,
23 max_new_tokens=400,
24 temperature=0.7,
25 top_p=0.9,
26 do_sample=True,
27 repetition_penalty=1.15,
28 eos_token_id=[tokenizer.eos_token_id, 128009], # explicitly include <|eot_id|>
29 pad_token_id=tokenizer.eos_token_id,
30)
31print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
We compared base vs. trained responses on 10 prompts (helpfulness / reasoning / coding / advice / creative) using identical sampling (T=0.7, top_p=0.9):
→ DPO did not produce the expected uplift.
For proper evaluation, the
Tulu 3 eval suite or
LM Evaluation Harness are recommended.
A single Colab notebook reproducing this model is available separately (BF16, LoRA r=16, A100 40GB, ~3–5h). For a stronger run, we recommend:
1@misc{kybalion-1b-dpo,
2 title = {Kybalion-1B-DPO: DPO-aligned Kybalion-1B},
3 author = {devwoo},
4 year = {2026},
5 url = {https://huggingface.co/devwoo/Kybalion-1B-DPO},
6 note = {DPO recipe following Tunstall et al. (Zephyr) and Rafailov et al. (DPO)},
7}