# Supercharged Customer Service with Machine Learning

huggingface.co · Patrick von Platen · Apr 25, 2022

**Type:** Tutorial

## Summary

Customer support teams often receive high volumes of messages that cannot all be answered manually. To prioritize urgent inquiries, support workflows can be modeled as a text classification task to identify the most unsatisfied customers. Using the Hugging Face ecosystem, an NLP pipeline is established by selecting the Amazon reviews multi dataset and fine-tuning a DeBERTa model for sentiment classification across five granular categories. Evaluation on test data shows that the model identifies roughly 95% of unsatisfied messages with an 11.7% false-positive rate on satisfied messages, potentially reducing human triage workload by 83%. For production deployment, performance can be optimized through hardware acceleration, lower precision arithmetic, open-source libraries like Optimum and ONNX Runtime, and inference servers.

## Context

Customer support teams receive thousands of messages daily, making it impossible to reply to every feedback, complaint, or question manually. Triage is needed to prioritize and automate replies for the most unsatisfied and urgent customers.

## Approach / What changed

The task is structured as five-category text classification using Hugging Face datasets and transformers. A pretrained DeBERTa model is fine-tuned on the English split of the Amazon reviews multi dataset, evaluated with custom metrics measuring coverage of unsatisfied messages and error rates on satisfied ones, and pushed to the Hub.

## Takeaways

- Selecting the Amazon reviews multi dataset provides 1-5 star ratings that map directly to a five-point customer sentiment scale, unlike binary datasets like Amazon polarity.
- Evaluation on 5,000 test examples achieved a 94.9% capture rate for unsatisfied messages alongside an 11.7% incorrect categorization rate for satisfied messages.
- Post-training optimization strategies mentioned include disabling gradient computation during inference, utilizing float16 precision, using ONNX Runtime or Optimum, and deploying with Triton inference servers.

**Tags:** [Machine Learning](https://yomu.fyi/topic/machine-learning), [Open Source](https://yomu.fyi/topic/open-source), [Python](https://yomu.fyi/topic/python)

[Read original post](https://huggingface.co/blog/supercharge-customer-service-with-machine-learning)
