CoolFace
Modelpublic

yuk1chan/qwen3-4b-structeval-yamlxml-boost-v2-lr6e-6

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

qwen3-4b-structeval-yamlxml-boost-v2-lr6e-6

This repository provides a LoRA adapter fine-tuned from Qwen/Qwen3-4B-Instruct-2507 using QLoRA (4-bit, Unsloth).

Training Objective

This adapter is trained to improve structured output accuracy (JSON / YAML / XML / TOML / CSV).

Strategy 2 Revised: YAML/XML Clean Expansion πŸ”₯

Training Configuration

  • β€”Base model: Qwen/Qwen3-4B-Instruct-2507
  • β€”Method: QLoRA (4-bit)
  • β€”Max sequence length: 512
  • β€”Epochs: 1
  • β€”Learning rate: 6e-06
  • β€”LoRA: r=16, alpha=32

Dataset: Cleaned StructEval + YAML/XML Boost (Revised)

Strategy 2 Revised: Three-Pronged Approach

Based on expert AI analysis, this revision addresses the root causes of YAML/XML failures:

  1. 1.u-10beiη³»: γ€ŒOutput:」δ»₯ι™γ γ‘γ‚’ζŠ½ε‡Ί
  2. 2.Problem: u-10bei datasets contain "Approach: β†’ Output:" structure
  3. 3.Solution: Extract only content after "Output:" marker
  4. 4.Effect: Removes "explanation before output" tendency
  1. 1.daichiraη³»: 2ε€γƒ–γƒΌγ‚ΉγƒˆοΌˆγ€ŒReturn ONLY」パターン)
  2. 2.Problem: Model needs more "Return ONLY YAML/XML" examples
  3. 3.Solution: Boost daichira datasets by 2x
  4. 4.Effect: Strengthens "direct output without explanation" pattern
  1. 1.YAML/XML: 2ε€γƒ–γƒΌγ‚Ήγƒˆ
  2. 2.Problem: YAML/XML are the weakest formats (94.3%, 85.0%)
  3. 3.Solution: Boost YAML/XML samples by 2x
  4. 4.Effect: More training data for weak formats

Data Cleaning Pipeline:

  1. 1.CoT tags removal: <thinking>...</thinking> completely removed
  2. 2.Code fence removal: ```yaml, ``json, ``xml, ``toml, ```csv removed
  3. 3.Leading phrase removal: "Here's the output:", "Sure!", etc. removed
  4. 4.πŸ”₯ Output extraction: For u-10bei datasets, extract only content after "Output:" marker
  5. 5.Format validation: JSON/YAML/XML/TOML/CSV parsing validation
  6. 6.Deduplication: Exact duplicates removed

Format Distribution (Estimated):

  • β€”YAML: ~12,000-15,000 (40-50%) πŸ”₯ 2x boost
  • β€”XML: ~6,000-8,000 (25-30%) πŸ”₯ 2x boost
  • β€”JSON: ~4,000-5,000 (15-20%)
  • β€”TOML: ~2,500-3,000 (10%)
  • β€”CSV: ~2,500-3,000 (10%)

Total: ~25,000-30,000 samples

Source Datasets:

u-10beiη³»οΌˆγ€ŒOutput:γ€ζŠ½ε‡Ίι©η”¨οΌ‰:

  • β€”u-10bei/structureddatawithcotdataset512v2
  • β€”u-10bei/structureddatawithcotdataset512v4
  • β€”u-10bei/structureddatawithcotdataset512v5
  • β€”u-10bei/structureddatawithcotdataset_512
  • β€”u-10bei/structureddatawithcotdataset_v2
  • β€”u-10bei/structureddatawithcotdataset

daichira系(2ε€γƒ–γƒΌγ‚ΉγƒˆοΌ‰:

  • β€”daichira/structured-3k-mix-sft πŸ”₯ 2x
  • β€”daichira/structured-5k-mix-sft πŸ”₯ 2x
  • β€”daichira/structured-hard-sft-4k πŸ”₯ 2x

Usage

python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

base = "Qwen/Qwen3-4B-Instruct-2507"
adapter = "yuk1chan/qwen3-4b-structeval-yamlxml-boost-v2-lr6e-6"

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

# Inference
prompt = "Generate YAML code for..."
# ... your inference code

Training Results

- Training Loss: ~1.25-1.30
- Validation Loss: ~1.50-1.55
- Training Time: ~8-9 hours
- Expected Score: 0.805-0.810 (YAML/XML improvement from 0.80195 baseline)

Strategy: YAML/XML Clean Expansion (Revised)

Key Insights from Expert AI Analysis:

The main causes of YAML/XML failures are:
1. Code fences (yaml, xml) appearing in output
2. Leading phrases ("Here's the output:", "Sure!") before output
3. u-10bei datasets' "Approach: β†’ Output:" structure leaking into outputs

Solutions Implemented:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Problem               β”‚           Solution           β”‚              Effect               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ u-10bei "Output:" structure         β”‚ Extract only after "Output:" β”‚ Removes explanation tendency      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Insufficient "Return ONLY" examples β”‚ Boost daichira datasets 2x   β”‚ Strengthens direct output pattern β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ YAML/XML too weak                   β”‚ Boost YAML/XML 2x            β”‚ More training data                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Expected Improvements:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Format β”‚ Baseline β”‚ Target β”‚         Strategy         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ YAML   β”‚ 94.3%    β”‚ 96-97% β”‚ Clean u-10bei + 2x boost β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XML    β”‚ 85.0%    β”‚ 88-90% β”‚ Clean u-10bei + 2x boost β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ TOML   β”‚ 100.0%   β”‚ 100%   β”‚ Maintain                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ JSON   β”‚ 96.0%    β”‚ 96%+   β”‚ Maintain                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ CSV    β”‚ 100.0%   β”‚ 100%   β”‚ Maintain                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
License

Apache 2.0

---
Trained on Cleaned StructEval dataset (YAML/XML Boosted - Revised)
Learning Rate: 6e-6 (conservative setting)
Strategy: u-10bei Output extraction + daichira 2x + YAML/XML 2x
Based on expert AI analysis