Build Intelligent Conversational Agents with Amazon Neptune and Amazon SageMaker (AMT316) - AWS re:Invent 2018
- 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Build Intelligent Conversational Agents with
Amazon Neptune and Amazon SageMaker
Sam Havens
CTO
CarLabs.ai
A M T 3 1 6
Keji Xu
Solutions Architect
AWS
- 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Motivation, Demo,
Architecture
Amazon Neptune: Slot Filling
and More
Amazon SageMaker: Machine
Learning Instead of Retrieval
Amazon Mechanical Turk:
Does This Look Right To
You?
Discussion
- 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Motivation and demo
- 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Motivation
• Car manufacturers are not used to the increasing customer service demands they face
• Dealers handled customer communication, but that is changing
• We build scalable, one-on-one communication software
• Why not just use Amazon Lex?
• Want to be able to fine tune language model to our domain (automotive)
• Separation of content creation (CMS) and functionality (framework - compare vehicles programmatically, etc.)
• Scope creep is desirable
• We want to handle as much for our clients as possible, so scope creep is good!
• However, the tooling we build and use needs to be useful for unforeseen use cases
• GraphDB (Neptune), Machine Learning (Amazon SageMaker), and human validation (MTurk) are all very
flexible
- 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Architecture
- 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Architecture
• User inputs text/audio/image
• Send to Amazon Lex/LUIS/DialogFlow/custom model to classify as In-Domain or Out Of Domain (ID
or OOD)
• If ID, get intent, entities from same service
• (ID) Based on intent/entities, get template from CMS
• Want tight control over ID content, so use templates
• User requests group of cars + hybrid => return template “Explore_Alt_Fuel”
• (OOD) Get response directly from seq2seq model
• seq2seq model is an RNN architecture used in translation
• Also common in question answering - “translate” question to answer
- 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Neptune CMS Architecture
- 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Neptune: Slot filling and more
- 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Retrieval and more with a graph DB
• Built a CMS (content management system)
• Given an intent, entities, and user state, retrieves and fills in templates
• Good, but couldn’t control flow (slot filling and API fulfillment)
• Chose graph DB for business rule implementation
• Flexibility is the main factor in choosing a graph
• Allows content editors to control content, flow, and data fetching w/o code
• Except the GraphQL queries
• Nodes and edges
• We use ‘hasParameter’ and ‘hasAction’ as our edges
• Nodes can have arbitrary attributes
• GraphQL templated queries to retrieve needed data
• Validation rules
- 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Business rules in the graph
- 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Business rules in the graph
- 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Business rules in the graph
- 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SageMaker NLP architecture
- 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SageMaker: Retrieve Translate
- 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SageMaker
• We use Amazon SageMaker to productionalize notebooks
• It can do more
• Push button training and deploy
• Hosted endpoint
• Provides an HTTPS endpoint
- 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Generate, don’t just retrieve, with ML
• OOD content is infinite and not worth managing
• Hence retrieval methods are not appropriate
• “Hey” => “Hi” - don’t want to store things like this
• CakeChat: Emotional Generative Dialog System (one OSS option)
• Uses end-to-end trained embeddings of 5 different emotions to generate responses conditioned by a
given emotion
• Already Dockerized, so easy to deploy to Amazon SageMaker!
• Gives pretty good responses to the “long tail” questions
• “so sad” => “What happened?”
• “where should we go?” => “I’m in the city”
- 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
MTurk: Does this look right to you?
- 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Send user input / bot response pairs to MTurk
• Format logs and upload subset to MTurk
• Each HIT is a question/answer pair
• Turker is asked if the response is appropriate
• We ask 2 Turkers
• For now, “correct” == “at least one Turker approves”
- 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Discussion
- 21. Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sam Havens
@sam_havens
sam@carlabs.ai
- 22. Please complete the session
survey in the mobile app.
!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
- 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Appendix
- 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Model Architecture