Conversational AI with Rasa - PyData Workshop

Tom Bocklisch
Head of Engineering
Proprietary Material.
Any use of this material without specific permission of Rasa is strictly prohibited.
Conversational AI with
Rasa NLU & Rasa Core
Conversational AI will
dramatically change how
your users interact with
you.
Example:
A customer can change her
address via Facebook Messenger
Play demo video
An open source, highly scalable ML
framework to build
conversational software
Rasa the OSS to build conversational software with ML
Introduction
Backend,
database,
API, etc.
Dialogue
Management
“Brain”
Input Modules
“Ears”
NLU, GUI elements,
context, personal
info
Output
Modules
“Mouth”
NLG, GUI elements
Connector
Modules
Connector to any
conversational
platforms
“What’s the weather
like tomorrow?”
(User Request via
text or voice)
“It will be sunny and
20°C.”
(AI response via
text or voice)
Alternatives:
Why Rasa?
Introduction
Runs Locally
● No Network
Overhead
● Control QoS
● Deploy anywhere
Hackable
● Tune models for your
use case
Own Your Data
● Don’t hand data over
to big tech co’s
● Avoid vendor lock-in
About Me
Introduction
● Studied Computer Science in Germany
● Went on to found a consultancy focused on image and text
analysis - https://scalableminds.com
● Joined the Rasa Team http://rasa.com - leading the development
of the open source stack as well as internal tools
If you have any questions about this talk, Rasa or me - I’ll be around.
What we are focusing on today
Introduction
Goal:
build & understand a bot based on machine learning
Roadmap:
1. Natural Language Understanding
i. Theory
ii. Let’s Code
2. Dialogue Handling
i. Theory
ii. Let’s Code
3. Research
4. Questions
Setup
Introduction
1. Jupyther notebook in python 3.6 (2.7 should work as well)
2. Download:
Ipython Notebook: http://tiny.cc/rasa-tut
Repository: https://github.com/tmbo/rasa-demo-pydata18
Under The Hood
Natural Language Understanding
Rasa NLU: Natural Language Understanding
Under the Hood
Goal: create structured data
I have a new address, it’s
709 King St, San Francisco
Rasa NLU: Natural Language Understanding
Under the Hood
Natural Language
Understanding
What’s the
weather like
tomorrow?
Example Intent Classification Pipeline
”What’s the weather like tomorrow?” { “intent”: “request_weather” }
Vectorization Intent Classification
Rasa NLU: Natural Language Understanding
Under the Hood
Bags are your friend
Bag
of
words
SVM
greet
goodbye
thank_you
request_weather
confirm
What’s the
weather like
tomorrow?
Rasa NLU: Natural Language Understanding
Under the Hood
Natural Language
Understanding
What’s the
weather like
tomorrow?
Example Entity Extraction Pipeline
”What’s the weather like tomorrow?” { “date”: “tomorrow” }
Tokenizer
Part of Speech
Tagger
Chunker
Named Entity
Recognition
Entity Extraction
Example Intent Classification Pipeline
”What’s the weather like tomorrow?” { “intent”: “request_weather” }
Vectorization Intent Classification
Rasa NLU: Entity Extraction
Under the Hood
Where can I get a burrito in the 2nd arrondissement ?
cuisine location
1. Binary classifier is_entity & then entity_classifier
2. Direct structured prediction
averaged perceptron
Let’s Code
Natural Language Understanding
Let’s build a fun little bot
Under the Hood
Let’s build a fun little bot
Under the Hood
Under The Hood
Dialogue Handling
Let’s get you awake again!
Everyone get a partner and an arms length of space.
Under The Hood
Dialogue Handling
Why Dialogue Handling with Rasa Core?
Under The Hood
● No more state machines!
● Reinforcement Learning: too much
data, reward functions...
● Need a simple solution for everyone
Why Machine Learning?
Under The Hood
State Machines are infeasible
Under The Hood
Rasa Core: Dialogue Handling
Under The Hood
“What’s the weather
like tomorrow?”
Intent
Entities
next
ActionState
previous
Action
“Thanks.”
after next
Action
updated
State
“It will be sunny
and 20°C.”
SVM
Recurrent NN
...
Rasa Core: Dialogue Handling
Under The Hood
“What’s the weather
like tomorrow?”
“It will be sunny and
20°C.”
Entity
Input
Action Mask
Renormal-
ization
Sample
action
Action
type?
Response
API Call
Recurrent
NN
API Call
Entity
Output
Intent
Classification
Entity
Extraction
Similar to LSTM-dialogue prediction paper: https://arxiv.org/abs/1606.01269
Let’s Code
Dialogue Engine
Rasa Core: Dialogue Training
Under The Hood
Issue: How to get started? Online Learning→
What’s the weather
like tomorrow?
How did you like it?
Correct wrong
behaviour
Retrain model
It will be sunny and
20°C.
Let’s Code
Interactive Learning
Research
Training NLU models without initial word vectors
Research
Goal: Learn an embedding for the intent labels based on the user messages
https://medium.com/rasa-blog/supervised-word-vectors-from-scratch-in-rasa-nlu-6daf794efcd8
● Learns joined embeddings for intents & words at the same time
● Allows multi-intent labels
● Knows about similarity between intent labels
● Based on Starspace Paper
Training NLU models without initial word vectors
Research
Goal: Learn an embedding for the intent labels based on the user messages
Evaluation:
Multi-Intent:
Generalisation across dialogue tasks
Research
Why do we need this complex architecture? For generalisation between domains!
Extensions
Rule Based Models (e.g. Duckling):
● Extract entities with restricted formats using e.g. patterns
● Allow for normalization (e.g. “tomorrow” → 26.05.18)
Pre-Trained Entity Models
Extensions
Reusing Trained ML models (e.g. spaCy builtins):
● Trained on large corpora on common entities (persons, cities)
● Usually restricted to the language they are trained on
Form Filling
Extensions
● Make some form logic deterministic
● Request all fields and then call API
● Simplifies action space
Final Thoughts
Closing The Loop
Final Thoughts
“What’s the weather
like tomorrow?”
(User Request via
text or voice)
New Training
Data
Retrain ML
Models
Correct Training
Data
Relabel
Collected Data
Use Improved
Model
Open challenges
Final Thoughts
● Handling OOV words
● Multi language entity recognition
● Combination of dialogue models
We’re constantly working on improving our models!
For those that are curious:
Current Research
Final Thoughts
Good reads for a rainy day:
● Last Words: Computational Linguistics and Deep Learning (blog)
https://goo.gl/lGSRuj
● Starspace Embeddings (paper)
https://arxiv.org/abs/1709.03856
● End-to-End dialogue system using RNN (paper)
https://arxiv.org/pdf/1604.04562.pdf
● MemN2N in python (github)
https://github.com/vinhkhuc/MemN2N-babi-python
● Sentence Embeddings (blog)
https://medium.com/huggingface/universal-word-sentence-embeddings-ce48ddc8fc3a
● Techniques to handle small data sets are key to get started with
conversational AI
● Deep ML techniques help advance state of the art NLU and
conversational AI
● Combine ML with traditional Programming and Rules where
appropriate
● Abandon flow charts
Summary
Final Thoughts
4 take home thoughts:
Thanks! Tom Bocklisch
Head of Engineering
tom@rasa.com
1 of 41

Recommended

Rasa AI: Building clever chatbots by
Rasa AI: Building clever chatbotsRasa AI: Building clever chatbots
Rasa AI: Building clever chatbotsTom Bocklisch
11.7K views20 slides
Build a chatbot using rasa by
Build a chatbot using rasaBuild a chatbot using rasa
Build a chatbot using rasaShwethaThammaiah1
1.7K views14 slides
[VFS 2019] Building chatbot with RASA by
[VFS 2019] Building chatbot with RASA[VFS 2019] Building chatbot with RASA
[VFS 2019] Building chatbot with RASANexus FrontierTech
1.1K views23 slides
Deprecating the state machine: building conversational AI with the Rasa stack... by
Deprecating the state machine: building conversational AI with the Rasa stack...Deprecating the state machine: building conversational AI with the Rasa stack...
Deprecating the state machine: building conversational AI with the Rasa stack...PyData
3.6K views33 slides
Ai chatbot by
Ai chatbotAi chatbot
Ai chatbotBikash Sundaray
462 views12 slides
Build Mandarin AI Conversational Agent with Rasa by
Build Mandarin AI Conversational Agent with RasaBuild Mandarin AI Conversational Agent with Rasa
Build Mandarin AI Conversational Agent with RasaHao-Yuan Chen
1K views41 slides

More Related Content

What's hot

A Comprehensive Review of Large Language Models for.pptx by
A Comprehensive Review of Large Language Models for.pptxA Comprehensive Review of Large Language Models for.pptx
A Comprehensive Review of Large Language Models for.pptxSaiPragnaKancheti
2.3K views24 slides
Introduction to MLflow by
Introduction to MLflowIntroduction to MLflow
Introduction to MLflowDatabricks
9.7K views25 slides
Deprecating the state machine: building conversational AI with the Rasa stack by
Deprecating the state machine: building conversational AI with the Rasa stackDeprecating the state machine: building conversational AI with the Rasa stack
Deprecating the state machine: building conversational AI with the Rasa stackJustina Petraitytė
664 views33 slides
Natural language processing and transformer models by
Natural language processing and transformer modelsNatural language processing and transformer models
Natural language processing and transformer modelsDing Li
656 views31 slides
Word2Vec by
Word2VecWord2Vec
Word2Vechyunyoung Lee
1.3K views26 slides
Natural Language Processing by
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingVeenaSKumar2
797 views24 slides

What's hot(20)

A Comprehensive Review of Large Language Models for.pptx by SaiPragnaKancheti
A Comprehensive Review of Large Language Models for.pptxA Comprehensive Review of Large Language Models for.pptx
A Comprehensive Review of Large Language Models for.pptx
SaiPragnaKancheti2.3K views
Introduction to MLflow by Databricks
Introduction to MLflowIntroduction to MLflow
Introduction to MLflow
Databricks9.7K views
Deprecating the state machine: building conversational AI with the Rasa stack by Justina Petraitytė
Deprecating the state machine: building conversational AI with the Rasa stackDeprecating the state machine: building conversational AI with the Rasa stack
Deprecating the state machine: building conversational AI with the Rasa stack
Natural language processing and transformer models by Ding Li
Natural language processing and transformer modelsNatural language processing and transformer models
Natural language processing and transformer models
Ding Li656 views
Natural Language Processing by VeenaSKumar2
Natural Language ProcessingNatural Language Processing
Natural Language Processing
VeenaSKumar2797 views
Introduction to ML with Apache Spark MLlib by Taras Matyashovsky
Introduction to ML with Apache Spark MLlibIntroduction to ML with Apache Spark MLlib
Introduction to ML with Apache Spark MLlib
Taras Matyashovsky5.8K views
Natural Language Processing by Yasir Khan
Natural Language ProcessingNatural Language Processing
Natural Language Processing
Yasir Khan4K views
Thomas Wolf "An Introduction to Transfer Learning and Hugging Face" by Fwdays
Thomas Wolf "An Introduction to Transfer Learning and Hugging Face"Thomas Wolf "An Introduction to Transfer Learning and Hugging Face"
Thomas Wolf "An Introduction to Transfer Learning and Hugging Face"
Fwdays649 views
Introduction to Transformers for NLP - Olga Petrova by Alexey Grigorev
Introduction to Transformers for NLP - Olga PetrovaIntroduction to Transformers for NLP - Olga Petrova
Introduction to Transformers for NLP - Olga Petrova
Alexey Grigorev403 views
Productionzing ML Model Using MLflow Model Serving by Databricks
Productionzing ML Model Using MLflow Model ServingProductionzing ML Model Using MLflow Model Serving
Productionzing ML Model Using MLflow Model Serving
Databricks578 views
NLTK - Natural Language Processing in Python by shanbady
NLTK - Natural Language Processing in PythonNLTK - Natural Language Processing in Python
NLTK - Natural Language Processing in Python
shanbady23.2K views
Transformer Introduction (Seminar Material) by Yuta Niki
Transformer Introduction (Seminar Material)Transformer Introduction (Seminar Material)
Transformer Introduction (Seminar Material)
Yuta Niki702 views
Microservices Architecture - Bangkok 2018 by Araf Karsh Hamid
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018
Araf Karsh Hamid2.4K views
MLflow Model Serving by Databricks
MLflow Model ServingMLflow Model Serving
MLflow Model Serving
Databricks1.4K views
Build an LLM-powered application using LangChain.pdf by StephenAmell4
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdf
StephenAmell4964 views
Word Embeddings, why the hype ? by Hady Elsahar
Word Embeddings, why the hype ? Word Embeddings, why the hype ?
Word Embeddings, why the hype ?
Hady Elsahar5.6K views
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ... by Databricks
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
Advanced MLflow: Multi-Step Workflows, Hyperparameter Tuning and Integrating ...
Databricks2.9K views
"Managing the Complete Machine Learning Lifecycle with MLflow" by Databricks
"Managing the Complete Machine Learning Lifecycle with MLflow""Managing the Complete Machine Learning Lifecycle with MLflow"
"Managing the Complete Machine Learning Lifecycle with MLflow"
Databricks2.5K views

Similar to Conversational AI with Rasa - PyData Workshop

Brownfield Domain Driven Design by
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven DesignNicolò Pignatelli
3.5K views42 slides
Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us... by
Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us...Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us...
Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us...Justina Petraitytė
277 views29 slides
ExperTwin: An Alter Ego in Cyberspace for Knowledge Workers by
ExperTwin: An Alter Ego in Cyberspace for Knowledge WorkersExperTwin: An Alter Ego in Cyberspace for Knowledge Workers
ExperTwin: An Alter Ego in Cyberspace for Knowledge WorkersCarlos Toxtli
359 views28 slides
Kaz Sato, Evangelist, Google at MLconf ATL 2016 by
Kaz Sato, Evangelist, Google at MLconf ATL 2016Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016MLconf
1.1K views76 slides
ODSC East: Effective Transfer Learning for NLP by
ODSC East: Effective Transfer Learning for NLPODSC East: Effective Transfer Learning for NLP
ODSC East: Effective Transfer Learning for NLPindico data
417 views50 slides
Evolving as a professional software developer by
Evolving as a professional software developerEvolving as a professional software developer
Evolving as a professional software developerAnton Kirillov
985 views44 slides

Similar to Conversational AI with Rasa - PyData Workshop(20)

Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us... by Justina Petraitytė
Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us...Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us...
Going beyond ‘Sorry, I didn’t get that’: building AI assistants that scale us...
ExperTwin: An Alter Ego in Cyberspace for Knowledge Workers by Carlos Toxtli
ExperTwin: An Alter Ego in Cyberspace for Knowledge WorkersExperTwin: An Alter Ego in Cyberspace for Knowledge Workers
ExperTwin: An Alter Ego in Cyberspace for Knowledge Workers
Carlos Toxtli359 views
Kaz Sato, Evangelist, Google at MLconf ATL 2016 by MLconf
Kaz Sato, Evangelist, Google at MLconf ATL 2016Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016
MLconf1.1K views
ODSC East: Effective Transfer Learning for NLP by indico data
ODSC East: Effective Transfer Learning for NLPODSC East: Effective Transfer Learning for NLP
ODSC East: Effective Transfer Learning for NLP
indico data417 views
Evolving as a professional software developer by Anton Kirillov
Evolving as a professional software developerEvolving as a professional software developer
Evolving as a professional software developer
Anton Kirillov985 views
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ... by Bill Buchan
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Bill Buchan470 views
Breaking Through The Challenges of Scalable Deep Learning for Video Analytics by Jason Anderson
Breaking Through The Challenges of Scalable Deep Learning for Video AnalyticsBreaking Through The Challenges of Scalable Deep Learning for Video Analytics
Breaking Through The Challenges of Scalable Deep Learning for Video Analytics
Jason Anderson389 views
On being a professional software developer by Anton Kirillov
On being a professional software developerOn being a professional software developer
On being a professional software developer
Anton Kirillov3.1K views
Cloud Study Jam[1st OCT] gdscgtbit.pptx by GDSCGTBIT
Cloud Study Jam[1st OCT] gdscgtbit.pptxCloud Study Jam[1st OCT] gdscgtbit.pptx
Cloud Study Jam[1st OCT] gdscgtbit.pptx
GDSCGTBIT12 views
Антон Кириллов, ZeptoLab by Diana Dymolazova
Антон Кириллов, ZeptoLabАнтон Кириллов, ZeptoLab
Антон Кириллов, ZeptoLab
Diana Dymolazova1.5K views
Themes for graduation projects 2010 by mohamedsamyali
Themes for graduation projects   2010Themes for graduation projects   2010
Themes for graduation projects 2010
mohamedsamyali1.5K views
GATE, HLT and Machine Learning, Sheffield, July 2003 by butest
GATE, HLT and Machine Learning, Sheffield, July 2003GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003
butest521 views
Ai meetup Neural machine translation updated by 2040.io
Ai meetup Neural machine translation updatedAi meetup Neural machine translation updated
Ai meetup Neural machine translation updated
2040.io316 views
The Semantic Knowledge Graph by Trey Grainger
The Semantic Knowledge GraphThe Semantic Knowledge Graph
The Semantic Knowledge Graph
Trey Grainger12.3K views
Recent Advances in Natural Language Processing by Seth Grimes
Recent Advances in Natural Language ProcessingRecent Advances in Natural Language Processing
Recent Advances in Natural Language Processing
Seth Grimes199 views
Deep dive into Conversational Ai development by Marco Parenzan
Deep dive into Conversational Ai developmentDeep dive into Conversational Ai development
Deep dive into Conversational Ai development
Marco Parenzan123 views

Recently uploaded

VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueShapeBlue
203 views54 slides
NTGapps NTG LowCode Platform by
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform Mustafa Kuğu
423 views30 slides
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueShapeBlue
135 views13 slides
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...ShapeBlue
159 views25 slides
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...James Anderson
160 views32 slides
Kyo - Functional Scala 2023.pdf by
Kyo - Functional Scala 2023.pdfKyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdfFlavio W. Brasil
457 views92 slides

Recently uploaded(20)

VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue203 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu423 views
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
ShapeBlue135 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue159 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson160 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue126 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue119 views
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10123 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue252 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue145 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue222 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10139 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue180 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue139 views
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue221 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays56 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue132 views

Conversational AI with Rasa - PyData Workshop

  • 1. Tom Bocklisch Head of Engineering Proprietary Material. Any use of this material without specific permission of Rasa is strictly prohibited. Conversational AI with Rasa NLU & Rasa Core
  • 2. Conversational AI will dramatically change how your users interact with you. Example: A customer can change her address via Facebook Messenger Play demo video
  • 3. An open source, highly scalable ML framework to build conversational software
  • 4. Rasa the OSS to build conversational software with ML Introduction Backend, database, API, etc. Dialogue Management “Brain” Input Modules “Ears” NLU, GUI elements, context, personal info Output Modules “Mouth” NLG, GUI elements Connector Modules Connector to any conversational platforms “What’s the weather like tomorrow?” (User Request via text or voice) “It will be sunny and 20°C.” (AI response via text or voice) Alternatives:
  • 5. Why Rasa? Introduction Runs Locally ● No Network Overhead ● Control QoS ● Deploy anywhere Hackable ● Tune models for your use case Own Your Data ● Don’t hand data over to big tech co’s ● Avoid vendor lock-in
  • 6. About Me Introduction ● Studied Computer Science in Germany ● Went on to found a consultancy focused on image and text analysis - https://scalableminds.com ● Joined the Rasa Team http://rasa.com - leading the development of the open source stack as well as internal tools If you have any questions about this talk, Rasa or me - I’ll be around.
  • 7. What we are focusing on today Introduction Goal: build & understand a bot based on machine learning Roadmap: 1. Natural Language Understanding i. Theory ii. Let’s Code 2. Dialogue Handling i. Theory ii. Let’s Code 3. Research 4. Questions
  • 8. Setup Introduction 1. Jupyther notebook in python 3.6 (2.7 should work as well) 2. Download: Ipython Notebook: http://tiny.cc/rasa-tut Repository: https://github.com/tmbo/rasa-demo-pydata18
  • 9. Under The Hood Natural Language Understanding
  • 10. Rasa NLU: Natural Language Understanding Under the Hood Goal: create structured data I have a new address, it’s 709 King St, San Francisco
  • 11. Rasa NLU: Natural Language Understanding Under the Hood Natural Language Understanding What’s the weather like tomorrow? Example Intent Classification Pipeline ”What’s the weather like tomorrow?” { “intent”: “request_weather” } Vectorization Intent Classification
  • 12. Rasa NLU: Natural Language Understanding Under the Hood Bags are your friend Bag of words SVM greet goodbye thank_you request_weather confirm What’s the weather like tomorrow?
  • 13. Rasa NLU: Natural Language Understanding Under the Hood Natural Language Understanding What’s the weather like tomorrow? Example Entity Extraction Pipeline ”What’s the weather like tomorrow?” { “date”: “tomorrow” } Tokenizer Part of Speech Tagger Chunker Named Entity Recognition Entity Extraction Example Intent Classification Pipeline ”What’s the weather like tomorrow?” { “intent”: “request_weather” } Vectorization Intent Classification
  • 14. Rasa NLU: Entity Extraction Under the Hood Where can I get a burrito in the 2nd arrondissement ? cuisine location 1. Binary classifier is_entity & then entity_classifier 2. Direct structured prediction averaged perceptron
  • 16. Let’s build a fun little bot Under the Hood
  • 17. Let’s build a fun little bot Under the Hood
  • 19. Let’s get you awake again! Everyone get a partner and an arms length of space.
  • 21. Why Dialogue Handling with Rasa Core? Under The Hood ● No more state machines! ● Reinforcement Learning: too much data, reward functions... ● Need a simple solution for everyone
  • 23. State Machines are infeasible Under The Hood
  • 24. Rasa Core: Dialogue Handling Under The Hood “What’s the weather like tomorrow?” Intent Entities next ActionState previous Action “Thanks.” after next Action updated State “It will be sunny and 20°C.” SVM Recurrent NN ...
  • 25. Rasa Core: Dialogue Handling Under The Hood “What’s the weather like tomorrow?” “It will be sunny and 20°C.” Entity Input Action Mask Renormal- ization Sample action Action type? Response API Call Recurrent NN API Call Entity Output Intent Classification Entity Extraction Similar to LSTM-dialogue prediction paper: https://arxiv.org/abs/1606.01269
  • 27. Rasa Core: Dialogue Training Under The Hood Issue: How to get started? Online Learning→ What’s the weather like tomorrow? How did you like it? Correct wrong behaviour Retrain model It will be sunny and 20°C.
  • 30. Training NLU models without initial word vectors Research Goal: Learn an embedding for the intent labels based on the user messages https://medium.com/rasa-blog/supervised-word-vectors-from-scratch-in-rasa-nlu-6daf794efcd8 ● Learns joined embeddings for intents & words at the same time ● Allows multi-intent labels ● Knows about similarity between intent labels ● Based on Starspace Paper
  • 31. Training NLU models without initial word vectors Research Goal: Learn an embedding for the intent labels based on the user messages Evaluation: Multi-Intent:
  • 32. Generalisation across dialogue tasks Research Why do we need this complex architecture? For generalisation between domains!
  • 34. Rule Based Models (e.g. Duckling): ● Extract entities with restricted formats using e.g. patterns ● Allow for normalization (e.g. “tomorrow” → 26.05.18) Pre-Trained Entity Models Extensions Reusing Trained ML models (e.g. spaCy builtins): ● Trained on large corpora on common entities (persons, cities) ● Usually restricted to the language they are trained on
  • 35. Form Filling Extensions ● Make some form logic deterministic ● Request all fields and then call API ● Simplifies action space
  • 37. Closing The Loop Final Thoughts “What’s the weather like tomorrow?” (User Request via text or voice) New Training Data Retrain ML Models Correct Training Data Relabel Collected Data Use Improved Model
  • 38. Open challenges Final Thoughts ● Handling OOV words ● Multi language entity recognition ● Combination of dialogue models We’re constantly working on improving our models! For those that are curious:
  • 39. Current Research Final Thoughts Good reads for a rainy day: ● Last Words: Computational Linguistics and Deep Learning (blog) https://goo.gl/lGSRuj ● Starspace Embeddings (paper) https://arxiv.org/abs/1709.03856 ● End-to-End dialogue system using RNN (paper) https://arxiv.org/pdf/1604.04562.pdf ● MemN2N in python (github) https://github.com/vinhkhuc/MemN2N-babi-python ● Sentence Embeddings (blog) https://medium.com/huggingface/universal-word-sentence-embeddings-ce48ddc8fc3a
  • 40. ● Techniques to handle small data sets are key to get started with conversational AI ● Deep ML techniques help advance state of the art NLU and conversational AI ● Combine ML with traditional Programming and Rules where appropriate ● Abandon flow charts Summary Final Thoughts 4 take home thoughts:
  • 41. Thanks! Tom Bocklisch Head of Engineering tom@rasa.com