CoolFace
Modelpublic

ahmetggg/Luck-Qwen3-4b-Code-FineTune

sourceHugging Faceapache-2.0updated 23d agoView on Hugging Face
1likes311downloads
Model Card

Luck-Qwen3-4b-Code-FineTune

A QLoRA fine-tune of unsloth/Qwen3-4B-Instruct-2507 specialized in agentic coding, multi-step reasoning, tool use, and calibrated uncertainty.

TL;DR: This model improves output formatting consistency, tool interaction, and knowledge boundary awareness ("I don't know" responses) without increasing the underlying capability ceiling of the base model.

<p align="center"> <img src="training_loss.png" alt="Training Loss Curve" width="100%"> </p> <p align="center"><em>Training loss convergence from ~1.7 to ~0.55 across 1,267 steps.</em></p>

Model Summary

Parameter / MetricValue
Base Modelunsloth/Qwen3-4B-Instruct-2507 (4.05B params, dense)
MethodQLoRA (4-bit NF4)
LoRA Rank / Alphar=16, alpha=16, dropout=0
Target Modulesq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Trainable Parameters33,030,144 / 4,055,498,240 (0.81%)
Context Length4,096 tokens
Dataset Size10,129 examples
Training Steps / Epochs1,267 steps / 1 epoch
Effective Batch Size8 (2 per-device × 4 gradient accumulation steps)
Optimizer / Scheduleadamw_8bit, learning rate 2e-4, cosine schedule
HardwareSingle T4 GPU (Google Colab / Kaggle)
Final Loss~0.55 (started at ~1.7)
FrameworksUnsloth, TRL (SFTTrainer), PEFT, Transformers

In This Repo

This repository contains:

  • QLoRA LoRA Adapter weights
  • Merged FP16 safetensors weights

Note: Quantized GGUF files are hosted separately at [`ahmetggg/Luck-Qwen3-4b-Code-FineTune-GGUF`](https://huggingface.co/ahmetggg/Luck-Qwen3-4b-Code-FineTune-GGUF).

Intended Use

  • Agentic Coding: Repository-level navigation, issue resolution, and code generation.
  • Multi-Step Reasoning: Step-by-step problem-solving in science and math domains.
  • Tool Use: Structured multi-turn function and tool calling.
  • Calibrated Uncertainty: Refusing to answer ("I don't know") when encountering actual knowledge gaps.

Training Data

SourceFocus AreaDetails / Filtering
`nvidia/Open-SWE-Traces`Agentic codingFiltered exclusively to resolved == 1 trajectories
`open-thoughts/OpenThoughts3-1.2M`Math & science reasoningCode domain excluded (handled by Open-SWE-Traces)
`Agent-Ark/Toucan-1.5M`Tool callingReal multi-turn tool interaction trajectories
Custom R-Tuning SetCalibration~150–300 MMLU items queried on base model; correct outputs retained as normal QA, incorrect outputs relabeled as "I don't know"

Usage

Option 1: Unsloth (LoRA Adapter)

python
from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "ahmetggg/Luck-Qwen3-4b-Code-FineTune",
    max_seq_length = 4096,
    load_in_4bit = True,
)
FastLanguageModel.for_inference(model)

messages = [{"role": "user", "content": "Write a Python function to reverse a linked list."}]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
outputs = model.generate(inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))