Downloads · 30 days
0
Blaqadonis/Qwen2.5-0.5B-Nigerian-News-Headlines-adapters
Qwen2.5-0.5B-Nigerian-News-Headlines-adapters is a machine learning model from Blaqadonis. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
yaml basemodel: Qwen/Qwen2.5-0.5B-Instruct sequencelength: 512 quantization: 4-bit NF4 lorar: 8 loraalpha: 16 loradropout: 0.05 targetmodules: [qproj, vproj] numepochs: 2 maxsteps: 300 batchsize: 16 gradientaccumulati…
Downloads · 30 days
0
Access
Public
Updated May 25, 2026
Repo size
4.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors4.3 MB · 100%
From the Hugging Face model README
---
library_name: transformers
license: mit
datasets:
- okite97/news-data
language:
- en
metrics:
- rouge
base_model:
- Qwen/Qwen2.5-0.5B-Instruct
tags:
- text-generation
- headline-generation
- nigerian-news
- qlora
- peft
---
# Qwen2.5-0.5B-Nigerian-News-Headlines
Fine-tuned **Qwen 2.5 0.5B Instruct** model for generating compelling headlines from Nigerian news articles using **QLoRA** (Quantized Low-Rank Adaptation).
## Model Description
This model adapts the lightweight Qwen 2.5 0.5B Instruct base model to generate concise, informative headlines specifically for Nigerian news content. It was fine-tuned using parameter-efficient QLoRA on over 4,000 Nigerian news articles from AriseTv.
- **Base Model:** [Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct)
- **Model Type:** Causal Language Model (Headline Generation)
- **Fine-tuning Method:** QLoRA (4-bit NF4 quantization + LoRA rank-8 adapters)
- **Language:** English (Nigerian news context)
- **License:** MIT
- **Deployment:** [Production deployment repo](https://github.com/Blaqadonis/nigerian-news-headlines-qlora)
---
## Intended Use
### Primary Use Cases
- **News Headline Generation**: Generate engaging headlines from Nigerian news excerpts
- **Content Summarization**: Create concise summaries of news articles
- **Media Applications**: Assist journalists and content creators in headline writing
### Out-of-Scope Use
- General-purpose text generation outside Nigerian news context
- Non-English language headline generation (no Yoruba, Igbo, Hausa support)
- Real-time news processing without human editorial review
---
## Training Data
- **Source:** [okite97/news-data](https://huggingface.co/datasets/okite97/news-data)
- **Description:** Nigerian news articles from AriseTv
- **Size:** 4,686 articles
- **Split:** 4,286 train / 200 validation / 200 test
Each sample: `Excerpt` (news article body) → `Title` (target headline)
---
## Training Procedure
**Hardware:** 1× NVIDIA T4 (16 GB VRAM), Google Colab
**Training time:** ~18 minutes
```yaml
base_model: Qwen/Qwen2.5-0.5B-Instruct
sequence_length: 512
quantization: 4-bit NF4
lora_r: 8
lora_alpha: 16
lora_dropout: 0.05
target_modules: [q_proj, v_proj]
num_epochs: 2
max_steps: 300
batch_size: 16
gradient_accumulation_steps: 2
learning_rate: 2e-4
lr_scheduler: cosine
warmup_steps: 50
optimizer: paged_adamw_8bit
bf16: true
Trainable parameters: 1.08M of 494M total (0.22%)
| Metric | Initial (Step 25) | Final (Step 300) |
|---|---|---|
| Training Loss | 2.917 | 2.418 |
| Validation Loss | 2.868 | 2.553 |
No overfitting observed — both losses decreased consistently throughout training.
Evaluated on 200 held-out Nigerian news samples:
| Metric | Baseline (Zero-shot) | Fine-tuned | Improvement |
|---|---|---|---|
| ROUGE-1 | 27.16% | 31.81% | +17.13% |
| ROUGE-2 | 8.23% | 11.59% | +40.78% |
| ROUGE-L | 22.26% | 28.46% | +27.88% |
Excerpt: "Lewis Hamilton was gracious in defeat after Red Bull rival Max Verstappen ended the Briton's quest for an unprecedented eighth..."
Excerpt: "Following improved corporate earnings by companies, low yield in fixed income market, among other factors, the stock market segment of..."
Excerpt: "Amidst the worsening insecurity in the country, governors elected on the platform of the Peoples Democratic Party (PDP) on Wednesday..."
pip install transformers peft torch bitsandbytes accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
import torch
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
# Configure 4-bit quantization
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16
)
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-0.5B-Instruct",
quantization_config=bnb_config,
device_map="auto",
torch_dtype=torch.bfloat16
)
# Load LoRA adapters
model = PeftModel.from_pretrained(
base_model,
"Blaqadonis/Qwen2.5-0.5B-Nigerian-News-Headlines"
)
model.eval()
def generate_headline(news_excerpt):
prompt = f"""Generate a concise and engaging headline for the following Nigerian news excerpt.
## News Excerpt:
{news_excerpt}
## Headline:"""
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=50,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
headline = response.split("## Headline:")[-1].strip()
return headline
# Example
excerpt = """
Nigeria's inflation rate has risen to 33.40% in July 2024,
according to the National Bureau of Statistics...
"""
print(generate_headline(excerpt))
# Output: "Nigeria's Inflation Rate Rises to 33.40% in July 2024"
For a production-ready FastAPI server with streaming, Docker containerisation, and latency benchmarking, see the deployment repository.
@misc{qwen25-nigerian-headlines,
author = {Blaqadonis},
title = {Qwen2.5-0.5B-Nigerian-News-Headlines},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/Blaqadonis/Qwen2.5-0.5B-Nigerian-News-Headlines}}
}
Model Version: 1.0 | Last Updated: May 2026 | Author: Blaqadonis