Zero-Shot Intent Classification via HuggingFace🤗

Currently everyone is trying to work out how to use LLM implementations in Conversational AI Frameworks…but there are other options with very similar functionality for this specific use-case.

🤗 Zero-Shot Intent Classification

A single user sentence is submitted:

"I want to close my savings account"
'Accounts', 'Savings', 'Cheque', 'Credit Card', 'Mortgage', 'Close', 'Open'
pip install transformers

from transformers import pipeline
classifier = pipeline("zero-shot-classification",
model="facebook/bart-large-mnli")

sequence_to_classify = "I want to close my savings account"
candidate_labels = ['Accounts', 'Savings', 'Cheque', 'Credit Card', 'Mortgage', 'Close', 'Open']
classifier(sequence_to_classify, candidate_labels)
{'sequence': 'I want to close my savings account',
'labels': ['Savings',
'Close',
'Accounts',
'Cheque',
'Open',
'Mortgage',
'Credit Card'],
'scores': [0.5641598701477051,
0.29538941383361816,
0.12247426807880402,
0.007701361086219549,
0.005368147511035204,
0.0025286851450800896,
0.0023782942444086075]

In Closing, My Objections To This Approach Are:

How is the initial list of intent labels defined in the first place?

https://www.linkedin.com/in/cobusgreyling
https://www.linkedin.com/in/cobusgreyling

--

--

Chief Evangelist @ HumanFirst. I explore and write about all things at the intersection of AI and language; NLP/NLU/LLM, Chat/Voicebots, CCAI. www.humanfirst.ai

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cobus Greyling

Chief Evangelist @ HumanFirst. I explore and write about all things at the intersection of AI and language; NLP/NLU/LLM, Chat/Voicebots, CCAI. www.humanfirst.ai