Instructions to use Anshrajsingh/qwen2.5-1.5b-ticket-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Anshrajsingh/qwen2.5-1.5b-ticket-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Anshrajsingh/qwen2.5-1.5b-ticket-classifier") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Anshrajsingh/qwen2.5-1.5b-ticket-classifier") model = AutoModelForCausalLM.from_pretrained("Anshrajsingh/qwen2.5-1.5b-ticket-classifier") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Anshrajsingh/qwen2.5-1.5b-ticket-classifier with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Anshrajsingh/qwen2.5-1.5b-ticket-classifier" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anshrajsingh/qwen2.5-1.5b-ticket-classifier", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Anshrajsingh/qwen2.5-1.5b-ticket-classifier
- SGLang
How to use Anshrajsingh/qwen2.5-1.5b-ticket-classifier with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Anshrajsingh/qwen2.5-1.5b-ticket-classifier" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anshrajsingh/qwen2.5-1.5b-ticket-classifier", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Anshrajsingh/qwen2.5-1.5b-ticket-classifier" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anshrajsingh/qwen2.5-1.5b-ticket-classifier", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Anshrajsingh/qwen2.5-1.5b-ticket-classifier with Docker Model Runner:
docker model run hf.co/Anshrajsingh/qwen2.5-1.5b-ticket-classifier
Model Card for Model ID
๐ Production-Grade SLM Structured Data Extractor
Fine-Tuned Qwen-1.5B-Instruct for Zero-Yapping Strict JSON Schema Compliance
๐ Business Case & Problem Statement
In enterprise production environments, unstructured text (customer support tickets, invoices, logs) must be mapped to structured databases (SQL/NoSQL) with 100% deterministic reliability.
While massive commercial LLMs (like GPT-4o) achieve high accuracy, they introduce major bottlenecks for high-throughput narrow tasks:
- High API Costs: Processing millions of tokens daily is economically unsustainable.
- High Latency: Cloud API round-trips slow down real-time automated routing workflows.
- Data Privacy Risks: Transmitting sensitive client information (PII) to third-party APIs violates data compliance laws (GDPR/HIPAA).
- Formatting Violations ("Yapping"): General-purpose base models frequently violate strict formatting constraints by adding conversational filler (e.g., "Here is the JSON you requested...").
The Solution
This project demonstrates Cost-Conscious AI Engineering by fine-tuning a 1.5 Billion parameter Small Language Model (SLM) to perform production-grade, schema-bound classification with near-zero latency and fraction of a cent compute cost, making it entirely deployable on the edge or low-cost commodity GPUs.
๐ Performance & ROI Benchmark
We evaluated the model on a hidden test dataset of customer support tickets across 4 categorical schema keys: category, urgency, sentiment, and action_required.
| Metric | Base Model (Qwen2.5-1.5B-Instruct) | Fine-Tuned SLM (LoRA Adapted) |
|---|---|---|
| Valid JSON Generation Rate | 100% (Wrapped in Markdown) | 100% (Pure Strict JSON) |
| Schema Compliance | 0.0% (Generated arbitrary tags) | 95.6% (Strictly adheres to enum keys) |
| Exact Match Accuracy | 0.0% | 91.3% |
| Formatting Filler (Yapping) | High | 0.0% (Starts with { ends with }) |
| Deployment Suitability | General Chat | Production-Ready Automated API |
๐ฐ Estimated Cost Breakdown (At Scale)
Assumed volume: 1 Million Tickets/Month (~300M Tokens processed)
- Commercial LLM API (e.g., GPT-4o Class): ~$750 - $1,500 / month
- This Fine-Tuned SLM (Hosted on Single Low-End Instance / Serverless GPU): <$25 / month
- Net Business Savings: ~96.5% Cost Reduction with 100% data privacy.
๐ ๏ธ Technical Implementation & Architecture
1. Technology Stack
- Base Model:
Qwen/Qwen2.5-1.5B-Instruct - Fine-Tuning Technique: Parameter-Efficient Fine-Tuning (PEFT) using QLoRA (4-bit quantization)
- Infrastructure: Trained via PyTorch and Hugging Face
Trainerpipeline on a single consumer-grade T4 GPU. - Inference UI: Gradio application deployed seamlessly on Hugging Face Spaces.
2. Target Features & Schema Constraints
The model was fine-tuned using custom-engineered synthetic dataset structures following the ChatML format to map arbitrary inputs directly into this immutable JSON schema:
{
"category": "billing | technical | refund | account | general",
"urgency": "low | medium | high",
"sentiment": "positive | negative | neutral",
"action_required": "auto_reply | escalate | close"
}
- Downloads last month
- 173