CoolFace
Modelpublic

yuk1chan/qwen3-4b-structeval-stage2-cyamljson

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
0likes11downloads
Model Card

qwen3-4b-structeval-stage2-cyamljson-lora

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.

Training Objective

This adapter is trained to specialize in CSV / YAML / JSON output while maintaining XML and TOML performance.

Target: 全部100%

  • —CSV: 80% → 95%+ (aiming for 100%)
  • —YAML: 94.3% → 96%+ (aiming for 100%)
  • —JSON: 98.0% → 99%+ (aiming for 100%)
  • —XML: 100% → 100% (maintain)
  • —TOML: 100% → 100% (maintain)

Loss is applied only to the final assistant output, while intermediate reasoning (Chain-of-Thought) is masked.

Training Configuration

  • —Base model: yuk1chan/qwen3-4b-structeval-stage0-1-merged (Stage 0+1 merged)
  • —Method: QLoRA (4-bit, Unsloth)
  • —Max sequence length: 1024
  • —Epochs: 1
  • —Learning rate: 5e-6
  • —Max steps: 120
  • —LoRA: r=16, alpha=32, dropout=0
  • —Batch size: 2 (effective: 16 with gradaccum=8)
  • —Training time: ~40-60 minutes

Dataset

Stage 2 uses CSV/YAML/JSON only (TOML and XML excluded).

Format Distribution

  • —CSV: 598 samples (30.8%)
  • —YAML: 623 samples (32.0%)
  • —JSON: 723 samples (37.2%)
  • —TOML: 0 samples (excluded)
  • —XML: 0 samples (excluded)
  • —Total: 1,944 samples (25% sampled from source)

Data Sources

All datasets are sampled at 25% rate to prevent overfitting:

  • —u-10bei/structureddatawithcotdataset512v2
  • —u-10bei/structureddatawithcotdataset512v4
  • —u-10bei/structureddatawithcotdataset512v5
  • —daichira/structured-3k-mix-sft
  • —daichira/structured-5k-mix-sft

Usage

python
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)