Text Generation
PEFT
Safetensors
English
qlora
lora
structured-output

This repository provides a LoRA adapter fine-tuned from Qwen/Qwen3-4B-Instruct-2507 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 improve structured output accuracy (JSON / YAML / XML / TOML / CSV).

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

Improvements over Standard Code

  • Combined 3 datasets (~11k rows) with diverse structured output tasks
  • Higher learning rate (5e-5) optimized for LoRA fine-tuning
  • 2 epochs for better convergence
  • Increased max_seq_len to 1024 for longer conversions
  • Memory-efficient optimizer (paged_adamw_8bit)
  • Gradient clipping (max_grad_norm=1.0) for training stability
  • Light regularization (LoRA dropout=0.05, weight_decay=0.01)

Training Configuration

  • Base model: Qwen/Qwen3-4B-Instruct-2507
  • Method: QLoRA (4-bit)
  • Max sequence length: 1024
  • Epochs: 2
  • Learning rate: 5e-05
  • Optimizer: paged_adamw_8bit
  • LoRA: r=64, alpha=128, dropout=0.05
  • Gradient clipping: max_grad_norm=1.0
  • CoT mask: enabled (Output: marker)

Usage

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

base = "Qwen/Qwen3-4B-Instruct-2507"
adapter = "your_id/your-repo"

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

Sources & Terms (IMPORTANT)

Training data:

  • u-10bei/structured_data_with_cot_dataset_512_v5
  • daichira/structured-3k-mix-sft
  • daichira/structured-hard-sft-4k

Dataset License:

This dataset contains materials licensed under both the MIT License and the Creative Commons Attribution 4.0 International License (CC BY 4.0).

MIT-licensed portions are distributed under the terms of the MIT License. A copy of the license is included in the distribution.

CC BY 4.0-licensed portions are used in accordance with the Creative Commons Attribution 4.0 International License. Proper attribution to the original authors is provided, and modifications (if any) are indicated. See https://creativecommons.org/licenses/by/4.0/ for details.

Users are responsible for complying with all applicable license terms, including attribution requirements and preservation of license notices, as well as the base model’s original terms of use.

Downloads last month
24
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for anyai/llm-comp-2025-subject

Adapter
(5259)
this model

Datasets used to train anyai/llm-comp-2025-subject