Problem
Business Context
ShopFlow, an e-commerce operations platform processing 2M support tickets per year, wants to automatically route incoming tickets to the correct queue (billing, shipping, returns, technical issue, or account access). The team wants an applied ML solution using Hugging Face libraries that can be trained quickly, evaluated rigorously, and deployed for low-latency inference.
Dataset
You are given a historical dataset of customer support tickets labeled by the operations team.
| Feature Group | Count | Examples |
|---|---|---|
| Text | 2 | subject, message_body |
| Categorical | 3 | channel, customer_tier, region |
| Numeric | 4 | account_age_days, prior_ticket_count, order_value, attachment_count |
| Metadata | 2 | created_at, language |
- Size: 120K tickets collected over 18 months, 11 raw features
- Target: Multi-class classification —
billing,shipping,returns,technical,account_access - Class balance: Moderately imbalanced — shipping 34%, returns 24%, billing 18%, technical 16%, account_access 8%
- Missing data: 9% missing
subject, 6% missing numeric fields, and occasional empty message bodies after redaction
Success Criteria
A production-ready solution should achieve macro F1 >= 0.84 on a held-out test set and p95 inference latency < 120 ms per ticket on CPU batch inference. The routing team also wants per-class precision/recall so they can understand failure modes for minority classes.
Constraints
- Use Hugging Face libraries in a practical workflow, not just raw PyTorch
- The model must support weekly retraining on newly labeled tickets
- The solution should handle missing text fields and class imbalance without excessive manual feature engineering
- Predictions should be exportable to a downstream ticket-routing service
Deliverables
- Build a text classification pipeline using Hugging Face
datasets,transformers, andevaluate - Explain model choice, preprocessing, and how you handle imbalance and missing fields
- Train and evaluate the model with a proper train/validation/test strategy
- Report macro F1, weighted F1, and per-class recall
- Show how you would package the model for batch or API inference in production
You are practicing as a guest. Sign up free to get your answer graded with AI feedback. Your draft stays right here.

