ModelHub XC b94bddf0e4 初始化项目,由ModelHub XC社区提供模型
Model: masachika/qwen3-4b-dpo-cot-merged
Source: Original Platform
2026-08-22 02:21:18 +08:00

base_model, datasets, language, license, library_name, pipeline_tag, tags
base_model datasets language license library_name pipeline_tag tags
Qwen/Qwen3-4B-Instruct-2507
u-10bei/dpo-dataset-qwen-cot
en
apache-2.0 transformers text-generation
dpo
unsloth
qwen
alignment
two-stage-training

qwen3-4b-2507-dpo-cot-merged

This model is the result of two-stage fine-tuning:

  1. SFT (Supervised Fine-Tuning): Training on structured output datasets
  2. DPO (Direct Preference Optimization): Alignment using preference data

This repository contains the full-merged 16-bit weights. No adapter loading is required.

Training Pipeline

Stage 1: SFT

  • Base model: Qwen/Qwen3-4B-Instruct-2507
  • SFT adapter: masachika/qwen3-4b-Instruct-2507-structured-output-lora
  • Objective: Learn to generate structured outputs (JSON, YAML, XML, TOML, CSV)

Stage 2: DPO (This model)

  • Starting point: SFT-trained model (merged)
  • Method: Direct Preference Optimization
  • Dataset: u-10bei/dpo-dataset-qwen-cot
  • Objective: Align responses with preferred outputs, improve reasoning quality

Training Configuration (DPO Stage)

  • Epochs: 2
  • Learning rate: 3e-07
  • Beta: 0.2
  • Max sequence length: 2048
  • LoRA Config: r=64, alpha=128 (merged into base)

Usage

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

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "masachika/qwen3-4b-dpo-cot-merged"

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)

  • SFT Base: masachika/qwen3-4b-Instruct-2507-structured-output-lora
  • DPO Training Data: u-10bei/dpo-dataset-qwen-cot
  • License: MIT License (as per dataset terms)
  • Compliance: Users must follow the original base model's license terms
Description
Model synced from source: masachika/qwen3-4b-dpo-cot-merged
Readme 13 MiB
Languages
Jinja 100%