Downloads · 30 days
11
6% of all-time downloads
Rakushaking/Qwen4b-SFT-d9-merged-after-dpo-d2
Qwen4b-SFT-d9-merged-after-dpo-d2 is a text generation model from Rakushaking. 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 is a fine-tuned version of Rakushaking/Qwen4b-SFT-d9 using Direct Preference Optimization (DPO) via the Unsloth library.
Downloads · 30 days
11
6% of all-time downloads
All-time downloads
196
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 is a fine-tuned version of Rakushaking/Qwen4b-SFT-d9 using Direct Preference Optimization (DPO) via the Unsloth library.
This repository contains the full-merged 16-bit weights. No adapter loading is required.
This model has been optimized using DPO with a general-purpose preference dataset (u-10bei/dpo-dataset-qwen-cot) to improve overall Chain-of-Thought reasoning quality and structured output consistency. This round focuses on broad output quality improvement rather than format-specific corrections.
| Step | Loss | Accuracy | Margin |
|---|---|---|---|
| 50 | 0.685 | 54.9% | 0.022 |
| 100 | 0.643 | 78.9% | 0.108 |
| 150 | 0.591 | 92.8% | 0.223 |
| 200 | 0.543 | 98.6% | 0.336 |
The model successfully learned to distinguish preferred from rejected outputs, reaching 98.6% accuracy by Step 200.
| Format | Baseline (pre-train) | After SFT | After DPO Round 1 (this model) |
|---|---|---|---|
| JSON | 100% | 100% | 100% |
| CSV | 100% | 100% | 100% |
| YAML | 97% | 94% | 94% |
| XML | 80% | 95% | 90% |
| TOML | 72% | 48% | 52% |
| Total | 92.0% | 89.3% | 89.3% |
While the parse success rate remained at 89.3% (same as SFT), this model achieved the highest evaluation score at the time of training. This indicates that the general DPO improved aspects not captured by parse rate alone:
1. CoT reasoning quality improvement General preference optimization refined the model's Chain-of-Thought reasoning, producing more logical and well-structured analysis before generating output.
2. Output structural accuracy Even when outputs parse successfully, their internal structure (correct field mapping, appropriate nesting, data type handling) improved through preference learning.
3. TOML: 48% → 52% (+4pt) Modest improvement in TOML parse rate. Inline table usage remained high (20/25 tasks), indicating that general DPO alone cannot fully resolve format-specific issues.
General DPO data does not contain structured-data-specific preferences (e.g. TOML inline table vs section style). This limitation is addressed in DPO Round 2 with format-specific preference pairs.
Since this is a merged model, you can use it directly with transformers.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Rakushaking/Qwen4b-SFT-d9-merged-after-dpo-d2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = "Convert the following JSON to YAML:\n{\"name\": \"test\", \"value\": 42}"
inputs = tokenizer.apply_chat_template(
[{"role": "system", "content": "You are an expert in YAML format."},
{"role": "user", "content": prompt}],
tokenize=True, add_generation_prompt=True, return_tensors="pt"
).to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))