daichira/structured-3k-mix-sft
Viewer • Updated • 3k • 826
How to use yuk1chan/qwen3-4b-structeval-stage2-cyamljson with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("yuk1chan/qwen3-4b-structeval-stage0-1-merged")
model = PeftModel.from_pretrained(base_model, "yuk1chan/qwen3-4b-structeval-stage2-cyamljson")This repository provides a LoRA adapter fine-tuned from yuk1chan/qwen3-4b-structeval-stage0-1-merged using QLoRA (4-bit, Unsloth).
This repository contains LoRA adapter weights only. The base model must be loaded separately.
This adapter is trained to specialize in CSV / YAML / JSON output while maintaining XML and TOML performance.
Target: 全部100%
Loss is applied only to the final assistant output, while intermediate reasoning (Chain-of-Thought) is masked.
Stage 2 uses CSV/YAML/JSON only (TOML and XML excluded).
All datasets are sampled at 25% rate to prevent overfitting:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Stage 0+1 merged base
base = "yuk1chan/qwen3-4b-structeval-stage0-1-merged"
# Stage 2 adapter (this repository)
adapter = "yuk1chan/qwen3-4b-structeval-stage2-cyamljson"
tokenizer = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(
base,
torch_dtype=torch.float16,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter)
# 推論実行
messages = [
{"role": "system", "content": "You are an expert in structured data output."},
{"role": "user", "content": "Generate CSV output for..."}
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Sources & Terms (IMPORTANT)
Training Data Sources:
- u-10bei/structured_data_with_cot_dataset_512_v2 (25% sampled)
- u-10bei/structured_data_with_cot_dataset_512_v4 (25% sampled)
- u-10bei/structured_data_with_cot_dataset_512_v5 (25% sampled)
- daichira/structured-3k-mix-sft (25% sampled)
- daichira/structured-5k-mix-sft (25% sampled)
Dataset License:
The u-10bei and daichira datasets are provided under MIT License.
Compliance:
Users must comply with the MIT license (including copyright notice) and the base model's original terms of use.
Base Model:
- Qwen/Qwen3-4B-Instruct-2507 (via yuk1chan/qwen3-4b-structeval-stage0-1-merged)
Training Strategy
This adapter is part of a 3-stage sequential fine-tuning strategy:
1. Stage 0: YAML/XML boost (all formats)
2. Stage 1: YAML/XML specialization (TOML excluded)
3. Stage 2: CSV/YAML/JSON specialization (TOML/XML excluded) ← This model
By training Stage 2 on CSV/YAML/JSON only, we improve these formats
while preserving the 100% accuracy achieved for XML and TOML in Stage 0+1.
Expected Results
- CSV: 95%+ (from 80%)
- YAML: 96%+ (from 94.3%)
- JSON: 99%+ (from 98.0%)
- XML: 100% (maintained)
- TOML: 100% (maintained)
- Overall: 0.97+ (from 0.95333, aiming for 1.0)
License
Apache 2.0
Acknowledgments
- Base model: Qwen/Qwen3-4B-Instruct-2507
- Stage 0+1 merged: yuk1chan/qwen3-4b-structeval-stage0-1-merged
- Training framework: Unsloth 2025.12.7
- Datasets: u-10bei, daichira (MIT License)
Base model
yuk1chan/qwen3-4b-structeval-stage0-1-merged