Qwen 2.5 3B Git AI Commit

Qwen 2.5 3B Git AI Commit is a domain-adapted language model fine-tuned specifically to convert staged unified Git diffs (git diff --staged) into standardized Conventional Commit titles and structured PR summaries without conversational preamble.

It is quantized to 4-bit group-wise INT4 precision and optimized for native local execution on Apple Silicon via Apple's MLX framework.

📊 Model Details

Model Description

  • Developed by: Kartik Raktate (KarRak007)
  • Shared by: Kartik Raktate (KarRak007)
  • Model type: Causal Language Model (LoRA Fine-tuned / 4-bit Quantized)
  • Language(s) (NLP): English, Source Code Diffs (Unified Diff Format)
  • License: qwen-research
  • Fine-tuned from model: mlx-community/Qwen2.5-3B-Instruct-4bit

Model Sources

💡 Uses

Direct Use

  • Analyzing staged code changes (git diff --staged) and auto-generating clean Conventional Commit headers (feat:, fix:, refactor:, docs:, etc.).
  • Producing concise, bulleted summaries of file modifications for pull requests.
  • Enabling local, privacy-conscious execution when source code must not be transmitted to external cloud APIs.

Downstream Use

  • Integration into custom CLI developer tools (git-ai).
  • Local Git hooks (prepare-commit-msg) to pre-fill commit messages in terminal editors.
  • Local CI/CD pipelines and automated PR generation scripts running on Apple Silicon nodes.

Out-of-Scope Use

  • General-purpose chat, open-domain question answering, or general reasoning tasks.
  • Parsing non-diff text files or unstructured plain-text documents.
  • Execution on non-Apple Silicon environments without standard PyTorch/Transformers adapters.

⚡ How to Get Started with the Model

1. Installation

Install the required MLX language model library:

pip install mlx-lm

2. Python Inference Script
The following script loads the model directly from Hugging Face, processes a sample Git diff, and generates a Conventional Commit message with a PR summary.
from mlx_lm import load, generate

# Load directly from Hugging Face Hub
model, tokenizer = load("KarRak007/qwen2.5-3b-git-ai-commit")

# Sample unified Git diff
sample_diff = """
--- a/src/auth.py
+++ b/src/auth.py
@@ -10,3 +10,5 @@ def verify_jwt(token: str):
+    if not token:
+        raise ValueError("Token cannot be empty")
"""

# Construct ChatML prompt
prompt = (
    f"<|im_start|>system\nYou are a Git commit generator. "
    f"Analyze the git diff and output a Conventional Commit title "
    f"followed by a bulleted PR summary.<|im_end|>\n"
    f"<|im_start|>user\n{sample_diff}<|im_end|>\n"
    f"<|im_start|>assistant\n"
)

# Generate commit message
output = generate(
    model,
    tokenizer,
    prompt=prompt,
    max_tokens=200,
    verbose=False
)

print(output.strip())

## 📈 Training Details

### Training Procedure

#### a. Preprocessing

Loss masking was applied to prompt tokens (system and user diff inputs) so gradient backpropagation concentrated specifically on predicting the completion tokens (assistant commit outputs).

#### b. Training Hyperparameters

1. **Training Method:** Parameter-Efficient Fine-Tuning (PEFT) via LoRA
2. **LoRA Target Layers:** 16 projection layers (`q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`)
3. **Trainable Parameters:** ~6.65M (~0.21% of 3B base parameters)
4. **Quantization Scheme:** 4-bit Group-Wise INT4
5. **Speeds, Sizes, Times:**
   - **Peak VRAM Memory:** 1.97 GB
   - **Inference Speed:** ~15 tokens/sec
6. **Fused Weight Checkpoint Size:** 1.74 GB (`model.safetensors`)

🧪 Evaluation & Results

| Stage | Metric Value |
|---|---:|
| Initial Loss | 2.73 |
| Final Training Loss | 0.804 |
| Validation Loss | 0.453 |

⚙️ Model Examination
Weight fusion was performed post-training using Apple MLX tools to fold LoRA adapter matrices directly into base model weights ($W_{fused} = W_{base} + \Delta W$). This eliminated dual-matrix computation latency during inference.

🌐 Environmental Impact
Hardware Type: Apple Silicon M-series (Unified Memory Architecture)
Cloud Provider: None (Trained and evaluated 100% locally)
Carbon Footprint: Minimal due to low-power edge execution on Apple Silicon (<20W peak draw).

👤 Author & Contact

Developer: Kartik Raktate (KarRak007 on Hugging Face)
Downloads last month
57
Safetensors
Model size
3B params
Tensor type
U32
·
F16
·
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for KarRak007/qwen2.5-3b-git-ai-commit

Base model

Qwen/Qwen2.5-3B
Quantized
(4)
this model

Evaluation results