Downloads · 30 days
18
19% of all-time downloads
Shion1124/dapo-dora-qwen-struct
dapo-dora-qwen-struct is a text generation model from Shion1124. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model implements DAPO (Direct Alignment from Preference Optimization), an RLVR (Reinforcement Learning from Verifiable Rewards) approach, combined with DoRA (Weight-Decomposed Low-Rank Adaptation).
Downloads · 30 days
18
19% of all-time downloads
All-time downloads
95
Public
Parameters
4B
8.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8 GB · 100%
From the Hugging Face model README
This model implements DAPO (Direct Alignment from Preference Optimization), an RLVR (Reinforcement Learning from Verifiable Rewards) approach, combined with DoRA (Weight-Decomposed Low-Rank Adaptation).
DAPO extends DPO by incorporating verifiable rewards during training:
DoRA's weight decomposition (magnitude + direction) is ideal for DAPO because:
DAPO Settings:
DoRA Settings:
Optimization:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Shion1124/dapo-dora-qwen-struct"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = "Convert this to JSON: Name: Alice, Age: 30, City: Tokyo"
inputs = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
).to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Compared to base DPO:
SFT Stage:
DAPO Stage:
Verifiable Rewards:
json.loads() success = 1.0 rewardElementTree.fromstring() success = 1.0 rewardyaml.safe_load() success = 1.0 rewardLoss Function:
DAPO_loss = (1 - α) × DPO_loss + α × Verification_penalty
where α = 0.3 (verification weight)
Built with ❤️ using Unsloth + DAPO + DoRA