Downloads · 30 days
78
14% of all-time downloads
aliRafik/Qwen2.5_7B_Thinking_alpaca_Clean_16bit
Qwen2.5_7B_Thinking_alpaca_Clean_16bit is a text generation model from aliRafik. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
- Developed by: aliRafik - License: apache-2.0 - Finetuned from model : unsloth/qwen2.5-7b-unsloth-bnb-4bit
Downloads · 30 days
78
14% of all-time downloads
All-time downloads
547
Public
Parameters
7.6B
15.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15.2 GB · 100%
From the Hugging Face model README
This qwen2 model was trained 2x faster with Unsloth and Huggingface's TRL library.
A fine-tuned Qwen2.5-7B model trained on the cleaned Alpaca instruction-following dataset to improve instruction following, structured responses, and reasoning-oriented task completion.
The model is released in 16-bit precision and was fine-tuned using LoRA with Unsloth.
unsloth/Qwen2.5-7Byahma/alpaca-cleanedaliRafik/Qwen2.5_7B_Thinking_alpaca_Clean_16bitThe main objective of this fine-tuning run was to improve the model's ability to follow instructions and produce clear, structured, and logically organized responses.
The training focuses particularly on:
Instruction Following → Reasoning → Structure → Clarity
The model was fine-tuned on:
yahma/alpaca-cleaned
This is a cleaned version of the original Alpaca instruction-following dataset containing approximately 52K examples.
The dataset provides instruction/input/output pairs covering a broad range of tasks, helping the model improve its ability to understand an instruction and generate an appropriate response.
The model was fine-tuned using LoRA through Unsloth.
r = 16
lora_alpha = 16
lora_dropout = 0
bias = "none"
Target modules:
[
"q_proj",
"k_proj",
"v_proj",
"o_proj",
"gate_proj",
"up_proj",
"down_proj",
]
per_device_train_batch_size = 8
gradient_accumulation_steps = 4
num_train_epochs = 1
learning_rate = 2e-5
weight_decay = 0.01
optimizer = adamw_8bit
lr_scheduler = linear
seed = 3407
Gradient checkpointing was enabled using the Unsloth implementation to improve memory efficiency during training.
One of the clearest examples of the effect of fine-tuning comes from a simple work-rate problem.
If 6 workers can build a wall in 12 days, how many days would it take 9 workers to build the same wall, assuming they work at the same rate? Also, if the wall needs to be built in 4 days, how many workers are needed?
The correct results are:
$$ 9\text{ workers} \rightarrow 8\text{ days} $$
and
$$ 4\text{ days} \rightarrow 18\text{ workers} $$
The base Qwen2.5-7B model produced a mathematically reasonable approach, but the response contained a notable issue:
First, let's find out the work rate of one worker.
1 wall / (6 workers × 12 days)
= 1/72 wall per worker per day
It then attempted to calculate the solution using individual worker rates.
However, the generated response also contained an incorrect intermediate phrase:
"how many days it would take for 92 workers..."
and the response became incomplete near the second calculation.
The model was able to identify the underlying work-rate concept, but the solution was less robust and contained an inconsistency during generation.
After fine-tuning on Alpaca-cleaned, the same model produced a much cleaner solution based on worker-days.
The model first establishes:
$$ 6 \times 12 = 72 $$
Therefore, the wall requires:
$$ 72\text{ worker-days} $$
For 9 workers:
$$ 72 \div 9 = 8 $$
So:
$$ \boxed{8\text{ days}} $$
For a 4-day deadline:
$$ 72 \div 4 = 18 $$
So:
$$ \boxed{18\text{ workers}} $$
The final response is direct, consistent, and mathematically complete.
| Aspect | Before Fine-Tuning | After Fine-Tuning |
|---|---|---|
| Correct approach | ✅ | ✅ |
| Final result | Partially generated | ✅ Complete |
| Reasoning structure | Moderate | ✅ Clear |
| Intermediate consistency | ❌ Contains an inconsistency | ✅ Consistent |
| Work-rate explanation | ✅ | ✅ |
| Worker-days method | ❌ Not used directly | ✅ |
| Second calculation completed | ❌ Incomplete | ✅ |
| Overall clarity | Moderate | ⭐⭐⭐⭐⭐ |
| Instruction following | Good | ✅ Improved |
The most noticeable improvement is not simply the final numerical answer.
The fine-tuned model provides a more stable, structured, and complete solution, using a simpler formulation of the problem.
This illustrates one of the goals of instruction fine-tuning:
Turn a generally capable language model into a model that follows the requested task more consistently and produces more useful outputs.
The same prompt can be used to compare the base and fine-tuned models.
inputs = tokenizer(
[
alpaca_prompt.format(
"Explain and solve the following problem in detail.",
"If 6 workers can build a wall in 12 days, how many days would it take 9 workers to build the same wall, assuming they work at the same rate? Also, if the wall needs to be built in 4 days, how many workers are needed?",
""
)
],
return_tensors="pt"
).to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=300,
use_cache=True
)
print(tokenizer.batch_decode(outputs)[0])
The same model can also be used for simpler instruction-following tasks.
messages = [
{
"role": "user",
"content": "Continue the Fibonacci sequence: 1, 1, 2, 3, 5, 8"
}
]
The fine-tuned model is intended to produce a direct continuation while following the requested format.
The fine-tuning was intended to strengthen several areas:
Better alignment between the requested task and the generated response.
More organized progression from the problem statement to the solution.
Greater tendency to finish all parts of a multi-part instruction.
Reduced likelihood of introducing inconsistent intermediate statements within a solution.
More readable and practically useful explanations.
The before/after example above is qualitative evidence from a single inference example, not a formal benchmark.
A proper evaluation should compare both models over a larger set of mathematical and instruction-following tasks using metrics such as:
| Metric | Purpose |
|---|---|
| Exact Answer Accuracy | Measures final correctness |
| Reasoning Accuracy | Measures validity of intermediate steps |
| Completion Rate | Measures whether all requested parts are answered |
| Instruction Following | Measures adherence to the prompt |
| Consistency | Measures stability across similar prompts |
| Response Quality | Measures clarity and usefulness |
The final model was exported as a merged 16-bit model:
aliRafik/Qwen2.5_7B_Thinking_alpaca_Clean_16bit
This repository contains the merged model suitable for standard Transformer-based inference.
LoRA enables efficient fine-tuning by updating a relatively small set of trainable parameters instead of the entire model.
Unsloth was used to make the training process more memory-efficient and practical on consumer and cloud GPUs.
This combination makes it possible to fine-tune a 7B-parameter model with significantly lower resource requirements than full-parameter fine-tuning.
This model builds upon:
This model can still produce:
The model should therefore be evaluated on a broader benchmark before being used in production or high-stakes applications.
Qwen2.5-7B Thinking — Alpaca Clean is a fine-tuned Qwen2.5-7B model trained on approximately 52K cleaned Alpaca instruction-following examples.
The goal of this project was to improve:
Instruction Following + Reasoning + Structure + Completeness
The before/after inference example demonstrates a practical improvement: the fine-tuned model produces a more consistent and complete solution to a multi-step mathematical problem, while using a simpler and clearer reasoning strategy.
Fine-tuning is not only about changing what a model knows — it can also change how effectively the model applies what it already knows.