Instructions to use Okada0311/okada0311 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Okada0311/okada0311 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Okada0311/okada0311") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
lora_structeval_t_qwen3_4b-20
This repository provides a LoRA adapter fine-tuned from 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 specifically trained to improve structured output accuracy (JSON / YAML / XML / TOML / CSV).
Training Data
This model was fine-tuned on a curated dataset of 600 high-quality samples, strictly filtered for syntactic correctness and structural complexity. To prevent truncation of critical structural elements (e.g., closing tags), all training samples were limited to a maximum length of 1,024 tokens.
Dataset Composition:
- JSON (70 samples): Validated via
json.loads. - YAML (180 samples): Reinforced with complex nested structures.
- XML (100 samples): Focused on deep nesting and tag consistency.
- TOML (180 samples): Reinforced with diverse key-value mapping patterns.
- CSV (70 samples): Standard tabular data validated for consistency.
Masked Reasoning Strategy
To ensure high-fidelity structural generation, we employed a specific loss masking strategy:
- Loss Application: Applied only to the final assistant output (configured as
after_marker). - Reasoning Masking: Intermediate reasoning (Chain-of-Thought) is masked during training to focus the model's gradient updates on the final structured syntax. This logic targets content following specific markers:
Output:,OUTPUT:,Final:,Answer:,Result:, orResponse:.
Training Hyperparameters
The fine-tuning was performed with the following technical configuration:
| Parameter | Value |
|---|---|
| LoRA Rank (r) | 64 |
| LoRA Alpha | 128 |
| LoRA Dropout | 0 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Learning Rate | 5e-5 |
| Batch Size | 2 (Gradient Accumulation: 8) |
| Epochs | 2 |
| Warmup Ratio | 0.1 |
| Weight Decay | 0.05 |
| Seed | 3407 |
Usage
You can use this adapter with the peft library. Ensure you have transformers and peft installed.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Configuration
base_model_id = "Qwen/Qwen3-4B-Instruct-2507"
adapter_model_id = "okada0311/okada0311"
# Load Tokenizer and Base Model
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto",
)
# Load Adapter
model = PeftModel.from_pretrained(model, adapter_model_id)
- Downloads last month
- 38