CoolFace
Modelpublic

Centkun/unsro_test1_qwen3-4b-instruct-2507-lora-homework_v3

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

Centkun/unsrotest1qwen3-4b-instruct-2507-lora-homework_v3

This repository provides a LoRA adapter fine-tuned from unsloth/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

##en ##The reason for increasing the learning rate (SFT_LR) to 1e-03 was to optimize validation loss and improve training efficiency. ##I considered that training proceeded extremely slowly with the default setting (1e-06) in the standard code. ##I hypothesize that raising the learning rate to around 1e-03 will reduce validation loss and enable the model to learn the ##correct answers more accurately. ##I currently testing this hypothesis through trial runs. ##Reason for setting LoRA's alpha=r=64: Stabilizing weight update scaling and conserving computational resources ##α=r setting: In LoRA's design criteria (original paper), “fixing α (scaling factor) to the same value as rank r” ##is considered a standard method for stabilizing the amplitude of weight updates during training. ##This makes it easier to readjust hyperparameters even when changing the rank. ##Choosing r=64: For specific task adaptations like structured data output, rank r can achieve sufficient performance ##with small values like 2, 4, or 8. ##This time, I deliberately reduced it from the default64. The intent is to maintain the model's expressiveness ##while reducing memory usage and making training lighter and faster.

##jp ##学習率(SFT_LR)を 1e-03 に上げた理由、検証損失(Validation Loss)の最適化と学習効率の向上を目的として標準コードの初期設定(1e-06)では学習が非常に緩やかと考えました。 ##1e-03付近まで学習率を上げることで検証損失が低下し、モデルが正解をより正確に学習できると仮説立てて試しに実行しています。 ##LoRAの alpha=r=64 とした理由:重み更新のスケーリング安定化と計算リソースの節約 ##α=r の設定: LoRAの設計基準(元の論文)において、「α(スケーリング係数)をランク r と同じ値に固定する」ことは、学習時の重み更新の振れ幅を安定させるための標準的な手法と解釈している。 ##これにより、ランクを変更してもハイパーパラメータの再調整が容易になると考えている。 ##r=64 の選択: 構造化データ出力のような特定のタスク適応には、ランク r は2, 4, 8といった小さな値で十分な性能を発揮すると解釈。 ##今回は初期値64にすることで、モデルの表現力を維持しつつ、メモリ使用量を抑え、学習をより軽量化・高速化する意図がある。

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: unsloth/Qwen3-4B-Instruct-2507
  • —Method: QLoRA (4-bit)
  • —Max sequence length: 1024
  • —Epochs: 1
  • —Learning rate: 1e-03
  • —LoRA: r=64, alpha=64

Usage

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

base = "unsloth/Qwen3-4B-Instruct-2507"
adapter = "Centkun/unsro_test1_qwen3-4b-instruct-2507-lora-homework_v3"

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.