Downloads · 30 days
7
6% of all-time downloads
MohamedQiqa/Llama-3.2-1B-QLoRA-Summarizer
Llama-3.2-1B-QLoRA-Summarizer is a summarization model from MohamedQiqa. Use it when you need a shorter version of a longer text. It is set up for transformers. The card lists the license as llama3.2.
A merged fine-tune of Llama-3.2-1B trained with QLoRA (4-bit) on the SAMSum dialogue summarization dataset. This is the full merged model (base weights + LoRA adapter), so it can be loaded and used directly without peft.
Downloads · 30 days
7
6% of all-time downloads
All-time downloads
118
Public
Parameters
1.3B
1.6 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.6 GB · 99%
How the weights are stored.
U81B · 79%
From the Hugging Face model README
A merged fine-tune of Llama-3.2-1B trained with QLoRA (4-bit) on the SAMSum dialogue summarization dataset. This is the full merged model (base weights + LoRA adapter), so it can be loaded and used directly without peft.
meta-llama/Llama-3.2-1BBest hyperparameters (selected via systematic HPT):
| Hyperparameter | Value |
|---|---|
| LoRA rank (r) | 16 |
| LoRA alpha | 32 |
| Learning rate | 2e-4 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Training steps | 300 (~1 epoch) |
| Batch size | 4 (grad accumulation = 4) |
| Model | ROUGE-1 | ROUGE-2 | ROUGE-L |
|---|---|---|---|
| Llama-3.2-1B (base) | 34.18% | 11.52% | 27.24% |
| This model | 47.41% | 24.06% | 39.55% |
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "MohamedQiqa/Llama-3.2-1B-QLoRA-Summarizer"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
dialogue = """
Amanda: I baked cookies. Do you want some?
Jerry: Sure! Bring them over.
Amanda: I'll be there in 10 minutes.
"""
messages = [
{"role": "system", "content": "Summarize the following dialogue in one or two sentences."},
{"role": "user", "content": dialogue},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
output = model.generate(inputs, max_new_tokens=64, do_sample=False)
summary = tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True)
print(summary)
from transformers import BitsAndBytesConfig
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=bnb_config,
device_map="auto",
)
Fine-tuned using QLoRA (4-bit quantization + LoRA adapters) on a single GPU, with hyperparameters selected through a one-at-a-time sensitivity sweep over LoRA rank, learning rate, and target modules, tracked in Weights & Biases.
We optimized 1B model now outperforms the base GPT-4o-mini | Model | Type | ROUGE-1 | ROUGE-2 | ROUGE-L | | --- | --- | --- | --- | --- | | Llama 3.2 1B (base) | Open-weight baseline | 34.18% | 11.52% | 27.24% | | GPT-4o-mini (base) | Frontier baseline | 40.76% | 16.15% | 32.91% | | Llama 3.2 1B (Lesson 4) | First fine-tune (r8, q+v) | 46.74% | 23.17% | 38.88% | | Llama 3.2 1B (optimized) | Best HPT config 🏆 | 47.41% | 24.06% | 39.55% | | GPT-4o-mini (fine-tuned) | Managed fine-tuned | 53.68% | 30.73% | 45.96% |


| Target Modules | ROUGE-1 | ROUGE-2 | ROUGE-L | Δ vs Baseline |
|---|---|---|---|---|
| q + v | 46.74% | 23.17% | 38.88% | baseline |
| Full attention | 47.41% | 24.06% | 39.55% | +0.67% ✅🏆 |
| Attention + MLP | 47.62% | 23.73% | 39.23% | +0.35% |

Putting it all together, the best setup for Llama 3.2 1B on SAMSum is:
Hyperparameters: