ML — Classification Models

Text Classification for Support Ticket Routing

Direct answer

For support ticket routing, start with a TF-IDF + linear classifier baseline — it trains in seconds, routes with predictable latency, and often reaches strong accuracy on a few thousand labeled tickets. Add an LLM only where the baseline is weak: low-confidence tickets, rare categories, or when you have almost no labeled data. Route automatically above a confidence threshold and send the rest to a human queue — the threshold, not the model, is what makes the system trustworthy.

Ticket routing is the highest-ROI text classification problem in most support organizations: every misrouted ticket adds a bounce between teams and hours to resolution. It's also a solved problem if you resist over-engineering it. Here's the architecture I ship, from baseline to LLM fallback.

Key facts, with sources

  • Financial fraud losses reached about 54.2 billion US dollars in 2024 and are projected to exceed 68.7 billion by 2026, driving adoption of ML classification for fraud detection. (HyperVerge)
  • A 2025 study in Frontiers in Artificial Intelligence showed Random Forest models combined with class imbalance mitigation achieved accuracy above 99.95% on credit card fraud detection while keeping false positives low enough for real-world operations. (Frontiers in Artificial Intelligence)
  • A 2025 Scientific Reports telecom churn study reported a Random Forest classifier reaching 95.13% accuracy with an AUC of 0.89 after applying SMOTE and class weighting to a dataset where only 14.6% of customers churned. (Scientific Reports (Nature))
  • A 2024 adaptive ensemble learning approach achieved 99.28% accuracy on a large telecom churn classification dataset, illustrating how ensembling and imbalance handling push benchmark performance. (arXiv)
  • A 2024 study in Engineering, Technology and Applied Science Research comparing Random Forest, LightGBM, XGBoost, logistic regression, decision trees, and a custom ANN found an ensemble averaging method reached 0.79 accuracy and 0.72 recall on telecom churn test data, showing realistic performance on harder real-world datasets. (Engineering, Technology and Applied Science Research)

The baseline that's hard to beat

Classic machine learning is unreasonably effective on ticket routing because support tickets are full of strong lexical signals — product names, error strings, billing vocabulary. A TF-IDF vectorizer feeding a linear model trains in seconds on a laptop, serves in single-digit milliseconds, costs nothing per prediction, and is fully explainable: you can print exactly which words drove a routing decision.

Build this first even if you intend to use LLMs, because it becomes your benchmark. In my experience, teams that skip the baseline can't answer the only question that matters later: is the expensive model actually better than the cheap one on our data?

baseline router with scikit-learn
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import Pipeline
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report

pipeline = Pipeline([
    ("tfidf", TfidfVectorizer(
        ngram_range=(1, 2),   # unigrams + bigrams: "refund request", "login error"
        min_df=3,
        sublinear_tf=True,
    )),
    ("clf", LogisticRegression(max_iter=1000, class_weight="balanced")),
])

X_train, X_test, y_train, y_test = train_test_split(
    tickets, labels, test_size=0.2, stratify=labels, random_state=42
)
pipeline.fit(X_train, y_train)
print(classification_report(y_test, pipeline.predict(X_test)))

The confidence threshold is the real product decision

No router should route everything. predict_proba gives you a confidence per ticket; the operating policy is: auto-route above the threshold, human queue below it. That threshold trades automation rate against misroute rate, and it's a business decision — a misrouted enterprise ticket costs more than a triager's thirty seconds.

Set it empirically: on the test set, plot automation rate against accuracy at each threshold and let the support lead pick the point. Publishing this as an explicit dial ('we auto-route 78% of tickets at 96% accuracy') builds more organizational trust than any accuracy headline, because it's honest about what happens to the hard 22%.

threshold routing policy
import numpy as np

def route(ticket_text: str, threshold: float = 0.80) -> dict:
    proba = pipeline.predict_proba([ticket_text])[0]
    best = int(np.argmax(proba))
    if proba[best] >= threshold:
        return {"queue": pipeline.classes_[best], "auto": True,
                "confidence": round(float(proba[best]), 3)}
    return {"queue": "triage", "auto": False,
            "confidence": round(float(proba[best]), 3)}

Where an LLM actually earns its cost

Three places, in priority order. Cold start: with under a few hundred labeled tickets, a zero-shot LLM prompt with your category definitions outperforms anything you can train — use it on day one while the baseline's training data accumulates from its decisions. Low-confidence fallback: instead of sending every below-threshold ticket to humans, let the LLM take a second pass with category descriptions in the prompt; it rescues a meaningful share. Rare categories: classes with a handful of examples are where linear models fail and few-shot prompting shines.

What I don't recommend: LLM-routing every ticket. At real support volume you'd be paying per-token prices and hundreds of milliseconds of latency for tickets the baseline routes correctly for free.

The feedback loop that keeps it accurate

Routing accuracy decays: products ship, new failure modes appear, category definitions drift. The loop that fixes this is already in your data — when a support agent re-assigns a misrouted ticket, that reassignment is a fresh training label. Capture it, and retrain on a schedule (weekly or monthly) with evaluation against a held-out set before promoting the new model.

Monitor two numbers in production: the reassignment rate (your live error rate, no labeling required) and the class distribution of incoming tickets (a sudden shift means something changed upstream — a new product launch, an incident — and the model is now partially blind). Alert on both; they're leading indicators of decay.

When to hire senior help

Senior help matters most when the classifier's errors carry asymmetric costs, such as fraud, credit, or medical triage decisions, because threshold tuning, leakage detection, and imbalance handling are exactly where self-taught implementations quietly fail. A short expert review of the evaluation setup before launch is much cheaper than discovering leakage or an untuned threshold after customer-facing decisions have been made. If your stack includes React Native + Python + AI, a senior engineer who owns the full product beats coordinating multiple juniors.

Bottom line

Dhairya Senjaliya ships ML — Classification Models projects worldwide — book a scoping call to discuss your specific situation.

Common pitfalls to avoid

  • Reporting plain accuracy on imbalanced data, where predicting the majority class every time already scores 99%, instead of precision, recall, and AUC-PR
  • Leaking the label into features, such as including fields that are only populated after the outcome occurs, which inflates offline metrics and collapses in production
  • Leaving the decision threshold at the 0.5 default rather than tuning it to the asymmetric business cost of false positives versus false negatives
  • Evaluating with random train-test splits instead of time-based splits, which hides temporal drift and overstates real-world performance

Frequently asked questions

Do I need an LLM for support ticket classification?

Usually not for the core router. With a few thousand labeled tickets, TF-IDF plus logistic regression typically routes the bulk of traffic accurately at near-zero cost and millisecond latency. LLMs earn their cost in three spots: day-one cold start before you have labels, second-pass handling of low-confidence tickets, and rare categories with too few examples to train on.

How many labeled tickets do I need to train a router?

A useful baseline typically emerges around a few hundred examples per category, and gets solid in the low thousands overall. If you have less, start with a zero-shot LLM using written category definitions, auto-route conservatively, and treat every human correction as a new training label — most teams accumulate enough data for a trained model within weeks.

How do I measure whether ticket routing is working?

Track three: automation rate (share of tickets routed without human triage), reassignment rate (tickets an agent moved to a different queue — your live error rate), and time-to-first-correct-team. Report accuracy per category, not just overall — a router that's 95% accurate overall but wrong on your enterprise queue is a liability hiding in an average.

How much labeled data do we need to train a useful classifier?

Gradient-boosted tree models often perform well from a few thousand labeled examples on tabular data, though rare-event problems like fraud need enough positive cases, typically hundreds at minimum, for the minority class. Label quality matters as much as volume; noisy or inconsistent labels put a hard ceiling on any model.

Should we use deep learning or gradient boosting for our classification problem?

For tabular business data, gradient-boosted trees such as XGBoost and LightGBM remain the standard baseline and frequently match or beat neural networks at far lower cost, as recent churn benchmark studies show. Deep learning earns its complexity mainly on text, image, and audio inputs or very large datasets.

How do we handle heavily imbalanced classes like fraud or churn?

Standard techniques include class weighting, resampling methods like SMOTE, and threshold tuning, which published 2024-2025 studies show can maintain high recall without flooding operations with false positives. Equally important is choosing evaluation metrics such as precision-recall AUC that reflect performance on the minority class.

Bottom line: Dhairya Senjaliya ships ML — Classification Models projects worldwide. Book a scoping call at https://dhairyasenjaliya.com/#book-call.

Sources

Related guides

Keep up with new guides

New deep-dive guides on React Native, Python, and AI ship regularly. Subscribe via RSS or follow on LinkedIn.

Want help implementing this?

30-minute scoping call · Clear milestones · Senior engineer ownership