Skip to content
Shakthivel Arumugam

MLOps platform for support-ticket triage

Classifies banking support messages into 77 intents on a CPU-only Kubernetes cluster, with five promotion gates, a 10% canary rollout and six tested alerts.

Role
Personal project
Stack
  • Kubernetes
  • Kubeflow Pipelines
  • MLflow
  • KServe
  • Katib
  • Envoy Gateway
  • ONNX Runtime
  • Prometheus
  • Grafana
  • Python

Problem

The model is the easy part of a classifier. What decides whether it can be trusted is everything around it: how it is trained, who may promote it, how a new version reaches users, and how I find out when it misbehaves. I built that lifecycle end to end on one laptop, using a public dataset: Banking77, 77 intents of banking customer-support messages. It is not real customer data.

The service also has to say when it does not know. The model has no "none of the above" class, so a message with low confidence is flagged needs_human_review instead of being routed on a guess.

Constraints

  • One machine. A single-node kind cluster on a laptop with 13 GB of RAM, and no GPU.
  • Memory budget. Every extra component had to earn its footprint. The whole monitoring stack uses 282 MiB, and the Envoy Gateway about 166 MiB.
  • Small tuning budget. Training a 22M-parameter model on CPU takes about 27 minutes for a full run, so hyperparameter search used 8 trials on 2,000 of the 9,002 training rows.
  • Not a production deployment. This is a learning and portfolio project. Nothing here has served real traffic.

Approach

  • Pipeline. A Kubeflow pipeline runs prepare data → TF-IDF baseline → fine-tune MiniLM-L6 → ONNX INT8 export → quality gates → register. Every run is logged to MLflow, so the registry doubles as an audit trail.
  • Serving. FastAPI and ONNX Runtime in a 198 MB compressed image with no PyTorch. It runs non-root with a read-only filesystem, as a KServe InferenceService in Standard mode (a plain Deployment and Service, with no Knative or Istio). It loads models:/ticket-classifier@champion at startup and reports the model version in every response.
  • Rollout. A stable service and a canary service differ only in the MODEL_URI they load. An Envoy Gateway HTTPRoute splits traffic 90 / 10.
  • Tuning. Katib runs the real training script as 8 random-search trials and picks the best by validation macro-F1.
  • Monitoring. Prometheus scrapes every stable and canary pod. Grafana shows traffic, errors, time per message and model-health signals. Alertmanager receives six alert rules.

Key decisions and trade-offs

Five gates decide a promotion

A candidate becomes @champion only if all five checks pass:

  1. It beats the TF-IDF baseline by at least 0.01 validation macro-F1.
  2. It is at least as good as the current champion.
  3. INT8 loses at most 0.01 F1 against FP32 and is at least 1.2x faster.
  4. p95 latency is at most 50 ms.
  5. The model loads and returns the serving contract (label_id, label, score).

The gates have already refused a model: a retrained version that scored slightly below the champion (v6) was not promoted. The manual promote_canary.sh bypasses the gates, and the docs say so.

INT8 ONNX instead of PyTorch for serving

The served model is 23 MB, 4x smaller than FP32. In the exports I measured it ran 1.85x to 1.97x faster on one CPU thread, and the serving image needs no PyTorch. The cost was 0.001 to 0.007 macro-F1 in those exports, and gate 3 caps it.

Gateway API instead of KServe's built-in canary

KServe's canaryTrafficPercent is documented for Serverless mode, which needs Knative. Installing Knative for one feature was not worth the memory on a laptop. ingress-nginx was ruled out because it has been retired. Envoy Gateway weights gave the same 90 / 10 split with fewer moving parts.

Paired testing instead of comparing traffic slices

Comparing versions by sending different messages to each is too noisy: a gap of 0.003 on 1,000 messages is invisible. compare_paired.py sends the same messages to both versions and applies McNemar's exact test and a bootstrap interval on the macro-F1 difference. The paired test is the subject of a blog post.

Alerts calibrated on measured baselines

About 10% of real messages are normally flagged for review, so the review-rate alert sits at 25%. Normal server time is 14 ms per message, so the latency alert sits at 50 ms per message. My first latency alert used request p95 and fired on healthy traffic, because request latency grows with the number of messages in a request. I replaced it with a per-message alert.

Random search at a small budget

With 8 trials, Bayesian optimization would still be in its random warm-up, so I used random search and a log-scale learning rate.

Results

ModelVal macro-F1Test macro-F1
TF-IDF + logistic regression0.8820.907
MiniLM-L6 fine-tuned (PyTorch FP32)0.9130.918 to 0.922
MiniLM INT8 (ONNX), served as @champion v30.90740.9185
  • Latency and size. The served model is 23 MB, with a p95 of about 21 ms for a single message on CPU.
  • Canary. 900 of 1,000 requests went to stable and 100 to the canary. A live promote sent 90 requests during the switchover, and all returned HTTP 200.
  • Alerts. Six alert rules are unit-tested with promtool, each with a case that must fire and a control that must stay quiet. Three were proven with real failure drills:
DrillWhat I brokeAlertFired after
Input shift80% of messages replaced by gibberishTicketApiHumanReviewSpikeabout 12 min
Pod downcanary image set to a tag that does not existTicketApiDown60 s
No modelcanary pointed at a model version that does not existTicketApiModelNotLoaded3 min

In the pod and model drills, the readiness probe kept the broken pod out of traffic, and six test requests during each returned 200.

  • Tuning. The best Katib settings scored 0.9172 validation macro-F1 on all data, against 0.9125 for the old defaults. That gap is about the size of run-to-run noise. The resulting model (v7) went through the gates and a paired test against the champion: validation p = 0.53 and test p = 1.0. I did not promote it.
  • Tests. 52 unit tests cover the API, the rollout statistics and the Katib helpers.

Known gaps

  • A pod that disappears does not alert. TicketApiDown needs a scrape target that exists and fails. Deleting a pod or scaling it to zero removes its up series, and nothing fires. Fixing that needs kube-state-metrics, which I left out to save memory.
  • Failures before the app are invisible to its metrics. A gateway 503 for an unreachable backend never reaches the app's request counter, and Envoy's own metrics are not scraped yet.
  • Short history. Prometheus keeps two days on a single replica, and Grafana has no persistence.
  • No logs or traces collected. The API writes JSON logs without message text, but nothing collects them.
  • Katib is deprecated. v0.19.0 works, but a new project should evaluate Kubeflow Trainer's OptimizationJob instead.

What I would do differently

  • Install kube-state-metrics and scrape Envoy first. Both known alerting gaps come from leaving them out, and a pod that vanishes silently is the failure I most want to hear about.
  • Run each tuning setting with more than one seed. One seed per setting meant I could not tell the best-found parameters from noise until I ran the full-data comparison.
  • Widen the learning-rate range. The best value, 1.5e-4, sat close to the upper bound of 2e-4.