CoolFace
Modelpublic

kabuizuchi-trading/qwen3-4b-instruct-2507-lora001

sourceHugging Faceapache-2.0updated 8mo agoView on Hugging Face
0likes10downloads
Model Card

<# Qwen3-4B-Instruct-2507-lora001>

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.

Training Configuration

  • —Base model: Qwen/Qwen3-4B-Instruct-2507
  • —Method: QLoRA (4-bit)
  • —Max sequence length: 1536
  • —Epochs: 2
  • —Learning rate: 5e-05
  • —LoRA: r=128, alpha=256

Data / Split

  • —Dataset: u-10bei/structureddatawithcotdataset512v2
  • —Validation split: 0.03
  • —Seed: 3407

Batch / Steps

  • —Train batch size (per device): 4
  • —Eval batch size (per device): 4
  • —Gradient accumulation steps: 6
  • —Effective batch size: 24 × (numberofgpus) (effective = perdevicetrainbs × gradaccum × num_gpus)
  • —Max steps: -1 (epoch-based if -1)
  • —Logging steps: 20
  • —Eval strategy: steps (eval_steps=200)
  • —Save strategy: steps (savesteps=200, savetotal_limit=6)

Optimization

  • —LR scheduler: cosine
  • —Warmup ratio: 0.03
  • —Weight decay: 0.01

CoT masking (Output-only supervision)

  • —maskcot: enabled (SFTMASK_COT=1)
  • —output_markers: Output:, OUTPUT:, Final:, Answer:, Result:, Response:
  • —outputlearnmode: after_marker
  • —upsampling: disabled (SFTUSEUPSAMPLING=0)

Usage

python
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/structureddatawithcotdataset512v2

Dataset License: MIT License. This dataset is used and distributed under the terms of the MIT License. Compliance: Users must comply with the MIT license (including copyright notice) and the base model's original terms of use.