Centkun/qwen3-4b-instruct-2507-lora-homework_v12
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
##jp
##また書き直す
##学習率(SFT_LR)を 1e-3 に上げた理由、検証損失(Validation Loss)の最適化と学習効率の向上を目的として標準コードの初期設定(1e-06)では学習が非常に緩やかと考えました。
##1e-04付近まで学習率を上げることで検証損失が低下し、モデルが正解をより正確に学習できると仮説立てて試しに実行しています。
##LoRAの alpha=r=64 とした理由:重み更新のスケーリング安定化と計算リソースの節約
##α=r の設定: LoRAの設計基準(元の論文)において、「α(スケーリング係数)をランク r と同じ値に固定する」ことは、学習時の重み更新の振れ幅を安定させるための標準的な手法と解釈している。
##これにより、ランクを変更してもハイパーパラメータの再調整が容易になると考えている。が今回はαをrの2倍にした。
##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: Qwen/Qwen3-4B-Instruct-2507
- Method: QLoRA (4-bit)
- Max sequence length: 512
- Epochs: 1
- Learning rate: 1e-03
- LoRA: r=64, alpha=64
Usage
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5base = "Qwen/Qwen3-4B-Instruct-2507"
6adapter = "Centkun/qwen3-4b-instruct-2507-lora-homework_v12"
7
8tokenizer = AutoTokenizer.from_pretrained(base)
9model = AutoModelForCausalLM.from_pretrained(
10 base,
11 torch_dtype=torch.float16,
12 device_map="auto",
13)
14model = PeftModel.from_pretrained(model, adapter)
Sources & Terms (IMPORTANT)
Training data: u-10bei/structured_data_with_cot_dataset_512_v2
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.