How to use from
vLLM
Install from pip and serve model
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "MSakae/dpo-qwen-cot-merged"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "MSakae/dpo-qwen-cot-merged",
		"prompt": "Once upon a time,",
		"max_tokens": 512,
		"temperature": 0.5
	}'
Use Docker
docker model run hf.co/MSakae/dpo-qwen-cot-merged
Quick Links

<Qwen3-4B Structured-Output SFT + DPO Aligned Model>

This repository provides a merged 16-bit model derived from Qwen/Qwen3-4B-Instruct-2507. The model was trained using Direct Preference Optimization (DPO) via the Unsloth library, starting from an SFT-initialized LoRA adapter.

Training pipeline: Base model → Structured-output SFT (LoRA) → DPO preference alignment → merged_16bit export

What is included

Full merged 16-bit weights (no adapter loading required)
✅ Tokenizer files
✅ Model card (this README)

Training Pipeline

Step 1 — SFT Initialization (LoRA)

Before DPO, the base model was initialized with an SFT LoRA adapter to improve structured output behavior (JSON / YAML / XML / TOML / CSV style formatting).

SFT initialization adapter: MSakae/qwen3-4b-structured-output-lora_sample_try_L4

Step 2 — DPO Alignment

The SFT-initialized model was further optimized using DPO with a preference dataset.

DPO dataset: u-10bei/dpo-dataset-qwen-cot

DPO aims to improve:

  • Preference alignment between chosen vs rejected responses
  • Response consistency and selection quality
  • Structured response quality under preference constraint

Training Configuration

  • Base model: Qwen/Qwen3-4B-Instruct-2507
  • Method: DPO (Direct Preference Optimization)
  • Epochs: 1
  • Learning rate: 1e-06
  • Beta: 0.1
  • Max sequence length: 1024

Usage

Since this is a merged model, you can use it directly with transformers.

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "your_id/your-repo-name"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.float16,
    device_map="auto"
)

# Test inference
prompt = "Your question here"
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)
print(tokenizer.decode(outputs[0]))

Sources & License (IMPORTANT)

  • Preference dataset: u-10bei/dpo-dataset-qwen-cot
  • Base model terms: Users must comply with the original base model’s license/terms of use.
  • Dataset terms: Users must comply with the dataset license/terms (including any required notices).
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for MSakae/dpo-qwen-cot-merged

Finetuned
(1756)
this model

Dataset used to train MSakae/dpo-qwen-cot-merged