How to detect user intents we learned about 5 minutes ago

Daniil Tsimerman1 Nov 2022

Problem

A bank support chat must recognise customer intents among thousands, and the set keeps changing as products evolve and sudden events occur. A trained classifier knows only intents seen in training, and following the changes would need retraining every day or hour. A message the bot cannot place goes to an operator. Regexes add intents fast but ignore meaning and become unreadable at scale.

Example from the article: in the T-Bank chat, many people suddenly asked which ATMs still had cash, whether they could buy dollars and what was happening with SWIFT.

Solution in brief

Store each intent as example texts in a nearest-neighbor index instead of in classifier weights. An embedder turns a message into a vector, a decision function judges the top-K neighbors, and a new intent goes live 3 to 5 seconds after an analyst adds examples. The embedder is a bank-pretrained BERT fine-tuned by metric learning with hard negatives from MinHash, and thresholds are re-tuned for every new model.

Questions this case answers
  • How to add new classes to a text classifier within seconds when the class set keeps changing and retraining on every change is not possible
  • How to choose decision thresholds for a retrieval-based classifier so that precision-weighted quality improves while the share of handled requests stays fixed
  • How to add new user intents to a chat bot within seconds, without retraining a classifier?
  • How to validate an intent classifier on intents it has never seen in training?

Tools and methods

  • KNN intent classifier — embedder, index and decision function; adds intents without retraining
  • BERT with MLM pretraining on banking text, mean pooling — the embedder
  • Metric learning on text pairs — same-intent texts close, different-intent texts far
  • MinHash index (Jaccard on n-grams) — finds hard negatives
  • Threshold tuning under a coverage constraint — restores quality after an embedder swap
Continue reading — it's free

Google or a one-time email code. No password.