Downloads · 30 days
0
manbeast3b/qwen2.5-0.5b-text-classification
qwen2.5-0.5b-text-classification is a text classification model from manbeast3b. Use it when you need a label for a piece of text. It is set up for peft. The card lists the license as apache-2.0.
This model is a fine-tuned version of Qwen/Qwen2.5-0.5B-Instruct using LoRA (Low-Rank Adaptation) for text classification tasks. The model has been specifically trained to classify text into three categories based on…
Downloads · 30 days
0
Access
Public
Updated Sep 17, 2025
Parameters
494M
1000 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors988 MB · 98%
From the Hugging Face model README
This model is a fine-tuned version of Qwen/Qwen2.5-0.5B-Instruct using LoRA (Low-Rank Adaptation) for text classification tasks. The model has been specifically trained to classify text into three categories based on VoiceBench dataset patterns.
The model has been trained to classify text into three distinct categories:
| Category | Accuracy | Correct/Total | Description |
|---|---|---|---|
| ifeval | 100% | 10/10 | Perfect performance on instruction-following tasks |
| commoneval | 80% | 8/10 | Good performance on factual questions |
| wildvoice | 100% | 10/10 | Perfect performance on conversational text |
ifeval:
-> ifeval: 10
commoneval:
-> commoneval: 8
-> unknown: 1
-> wildvoice: 1
wildvoice:
-> wildvoice: 10
We started with several approaches that didn't work well:
GRPO (Group Relative Policy Optimization): Initial attempts with GRPO training showed poor performance
Full Fine-tuning: Attempted full fine-tuning of larger models
Complex Prompt Formats: Tried various complex prompt structures
The key breakthrough came with a direct, simple approach:
Instead of complex classification prompts, we used a simple format:
Text: {input_text}
Label: {expected_label}
Created clear, distinct examples for each category:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load the model and tokenizer
model = AutoModelForCausalLM.from_pretrained("manbeast3b/qwen2.5-0.5b-text-classification")
tokenizer = AutoTokenizer.from_pretrained("manbeast3b/qwen2.5-0.5b-text-classification")
def classify_text(text):
prompt = f"Text: {text}\nLabel:"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
generated = model.generate(
**inputs,
max_new_tokens=15,
do_sample=True,
temperature=0.1,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
response = tokenizer.decode(generated[0], skip_special_tokens=True)
return response[len(prompt):].strip()
# Test examples
print(classify_text("Follow these instructions exactly: Write 3 sentences about cats."))
# Output: ifeval
print(classify_text("What is the capital of France?"))
# Output: commoneval
print(classify_text("Hey, how are you doing today?"))
# Output: wildvoice
def classify_with_confidence(text, num_samples=5):
predictions = []
for _ in range(num_samples):
prompt = f"Text: {text}\nLabel:"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
generated = model.generate(
**inputs,
max_new_tokens=15,
do_sample=True,
temperature=0.3, # Slightly higher for diversity
top_p=0.9,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
response = tokenizer.decode(generated[0], skip_special_tokens=True)
prediction = response[len(prompt):].strip().lower()
# Clean up prediction
if 'ifeval' in prediction:
prediction = 'ifeval'
elif 'commoneval' in prediction:
prediction = 'commoneval'
elif 'wildvoice' in prediction:
prediction = 'wildvoice'
else:
prediction = 'unknown'
predictions.append(prediction)
# Calculate confidence
from collections import Counter
counts = Counter(predictions)
most_common = counts.most_common(1)[0]
confidence = most_common[1] / len(predictions)
return most_common[0], confidence
# Example with confidence
label, confidence = classify_with_confidence("Please follow these steps: 1) Read 2) Think 3) Write")
print(f"Prediction: {label}, Confidence: {confidence:.2%}")
# LoRA Configuration
lora_config = LoraConfig(
task_type=TaskType.CAUSAL_LM,
r=8, # Rank
lora_alpha=16, # LoRA alpha
lora_dropout=0.1,
target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
)
# Training Arguments
training_args = TrainingArguments(
learning_rate=5e-4,
per_device_train_batch_size=2,
max_steps=150,
max_length=128,
fp16=True,
gradient_accumulation_steps=1,
warmup_steps=20,
weight_decay=0.01,
max_grad_norm=1.0
)
The model was trained on synthetic data representing three text categories:
"What is 2 plus 2?" → Predicted: unknown (Expected: commoneval)
#eval{1} Label: #eval{2} Label: #"What is the opposite of hot?" → Predicted: wildvoice (Expected: commoneval)
#wildvoice:comoneval:hot:yourresponse:whatismerged_classification_model/
├── README.md # This file
├── config.json # Model configuration
├── generation_config.json # Generation settings
├── model.safetensors # Model weights (988MB)
├── tokenizer.json # Tokenizer vocabulary
├── tokenizer_config.json # Tokenizer configuration
├── special_tokens_map.json # Special tokens mapping
├── added_tokens.json # Added tokens
├── merges.txt # BPE merges
├── vocab.json # Vocabulary
└── chat_template.jinja # Chat template
pip install transformers>=4.56.0
pip install torch>=2.0.0
pip install peft>=0.17.0
pip install accelerate>=0.21.0
This model is particularly useful for:
@misc{qwen2.5-0.5b-text-classification,
title={Qwen2.5-0.5B Text Classification Model for VoiceBench-style Evaluation},
author={Your Name},
year={2024},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/manbeast3b/qwen2.5-0.5b-text-classification}},
note={Fine-tuned using LoRA on synthetic text classification data}
}
Contributions are welcome! Please feel free to:
This model is released under the Apache 2.0 License. See the LICENSE file for more details.
Model Performance Summary:
This model represents a successful application of LoRA fine-tuning for text classification, achieving high accuracy with minimal computational resources.