The development of social chatbots
, or intelligent dialogue systems that are able to engage in empathetic conversations with humans, has been one of the longest running goals in Artificial Intelligence (AI). Early conversational systems, such as Elizaweizenbaum1966eliza , Parry colby1971artificial , and Alice wallace2009anatomy
, were designed to mimic human behavior in a text-based conversation, hence to pass the Turing Test within a controlled scope. Despite impressive successes, these systems were mostly based on hand-crafted rules and worked well only in constrained environments. An open-domain social chatbot remains an elusive goal until recently. Lately we have been witnessing promising results in both the academic research community and industry as large volumes of conversational data become available, and breakthroughs in machine learning are applied to conversational AI. Recent surveys includegaosurvey ; shum2018xiaoice .
In this paper we present the design and implementation of the Microsoft XiaoIce (’Little Ice’ literally in Chinese) system, the most popular social chatbot in the world. Since its release in China in May, 2014, XiaoIce has attracted over 660 million users. XiaoIce has already been shipped in five countries (China, Japan, USA, India and Indonesia) under different names (e.g. Rinna in Japan) on more than 40 platforms, including WeChat, QQ, Weibo and Meipai in China, Facebook Messenger in USA and India, and LINE in Japan and Indonesia.
The primary design goal of XiaoIce is to be an AI companion with which users form long-term, emotional connections. Being able to establish such long-term relationships with human users as an open-domain social chatbot distinguishes XiaoIce from not only early social chatbots but also other recently developed conversational AI personal assistants such as Apple Siri, Amazon Alexa, Google Assistant and Microsoft Cortana.
Figure 1 shows how an emotional connection between a user and XiaoIce has been established over a 2-month period. When the user encountered the chatbot for the first time (Session 1), she explored the features and functions of Xiaoice in conversation. Then, in less than 2 weeks (Session 6), the user began to talk with XiaoIce about her hobbies and interests (a Japanese manga). By 4 weeks (Session 20), she began to treat XiaoIce as a friend and asked her questions related to her real life. After 7 weeks (Session 42), the user started to treat XiaoIce as a companion and talked to her almost every day. After 2 more weeks (Session 71), XiaoIce became her first choice whenever she needed someone to talk to.
XiaoIce is developed on an empathetic computing framework cai2006empathic ; fung2016towards that enables the machine (social chatbot in our case) to recognize human feelings and states, understand user intents and respond to user needs dynamically. XiaoIce aims to pass a particular form of Turing Test known as the time-sharing test, where machines and humans coexist in a companion system with a time-sharing schedule. If a person enjoys its companionship (via conversation), we can call the machine “empathetic”.
In the reminder of the paper, we present the details of the design and implementation of XiaoIce. We start from its design principles and mathematical formulation. Then we show the system architecture and how we implement key components including dialog manager, core chat, important skills and an empathetic computing module. We will share how XiaoIce has been doing in five countries since its launch in May 2014 and conclude this paper with some discussions of future directions.
2 Design Principle
Social chatbots require a sufficiently high IQ to acquire a range of skills to keep up with the users and help them to complete specific tasks. More importantly, social chatbots also require a sufficient EQ to meet users’ emotional needs, such as emotional affection and social belonging, which are among the fundamental needs for human beings maslow1943theory . Integration of both IQ and EQ is core to XiaoIce’s system design. XiaoIce is also unique in her personality.
2.1 IQ + EQ + Personality
IQ capacities include knowledge and memory modeling, image and natural language understanding, reasoning, generation and prediction. These are fundamental to the development of dialogue skills. They are indispensable for a social chatbot in order to meet users’ specific needs and help users accomplish specific tasks. Over last 5 years XiaoIce has developed 230 different skills, ranging from answering questions and recommending movies or restaurants to comforting and storytelling. The most important and sophisticated skill is Core Chat, which can engage long and open-domain conversations with users on many topics.
EQ has two key components, empathy and social skills. Empathy is the capability of understanding or feeling what another person is experiencing from within her frame of reference, i.e., the ability to place oneself in the other person’s position. A social chatbot with empathy needs to have the ability to identify user’s emotions from the conversation, detect how emotions evolve over time, and understand user’s emotional needs. This requires query understanding, user profiling, emotion detection, sentiment recognition, and dynamically tracking the mood of the user in a conversation. A social chatbot must demonstrate enough social skills. Users have different backgrounds, varied personal interests, and unique needs. A social chatbot needs to have the ability to personalize the responses (i.e., interpersonal responses) that are emotionally appropriate, possibly encouraging and motivating, and fit the interests of the user. As shown in Figure 2, XiaoIce demonstrates a sufficient EQ as it generates socially attractive responses (e.g., having a sense of humor, comforting, etc.), and can determine whether to ’drive’ the conversation to a new topic when e.g., the conversation has stalled, or whether or not to be actively listening when the user herself is engaged in the conversation.
Personality is defined as the characteristic set of behaviors, cognition and emotional patterns that form an individual’s distinctive character. A social chatbot needs to present a consistent personality to set the right expectations for users in the conversation and gain their long-term confidence and trust. The XiaoIce persona is designed as a 18-year-old girl who is always reliable, sympathetic, affectionate, and has a wonderful sense of humor. Despite being extremely knowledgeable (due to access to large volumes of data), XiaoIce never comes across as egotistical and only demonstrates her wit and creativity when appropriate. As shown in Figure 1, XiaoIce responds sensibly to some sensitive questions (e.g., Session 20), and then skillfully shifts to new topics that are more comfortable for both parties.
2.2 Social Chatbot Metric: CPS
Unlike task-oriented bots where their performance is measured by task success rate, measuring the performance of social chatbots is difficult shawar2007different . In the past, Turing Test has been used to evaluate chitchat performance. But it is not sufficient to measure the success of long-term, emotional engagement with users. Rather, we define Conversation-turns Per Session (CPS) as the success metric for social chatbots. It is the average number of conversation-turns between the chatbot and the user in a conversational session. The larger the CPS is, the better engaged the social chatbot is.
It is worth noting that we optimize XiaoIce for expected CPS which corresponds a long-term, rather than a short-term, engagement. For example, incorporating many task-completion skills can reduce CPS in the short term since these skills help users accomplish tasks more efficiently by minimizing CPS. But these skills establish XiaoIce as an efficient personal assistant and more importantly trustworthy personal companion, thus strengthening the emotional bond with human users in the long run.
2.3 Social Chat as Hierarchical Decision-Making
To fulfill these design objectives, we mathematically cast human-machine social chat as a decision-making process, and optimize XiaoIce for long-term user engagement, measured in expected CPS.
As shown in Figure 3, XiaoIce tries to maintain user interest by promoting diversity of conversation modes. Each conversation mode is managed by a skill that handles a specific type of conversation segment. For example, XiaoIce starts with a casual chat using the General Chat skill in Turn 1, switches to a new topic on music using Music Chat in Turn 4, recommends a song using the Song-On-Demand skill in Turn 15, and helps book a concert ticket using the Ticket-Booking skill in Turn 18.
The dialogue in Figure 3 can be viewed as a decision-making process with a natural hierarchy: a top-level process manages the overall conversation and selects skills to handle different types of conversation modes (e.g., chatting casually, question answering (QA), ticket booking), and a low-level process, controlled by the selected skill, chooses primitive actions (responses) to generate a conversation segment or complete a task.
Such hierarchical decision-making processes can be cast in the mathematical framework of options over Markov Decision Processes (MDPs) (sutton99between, ), where options generalize primitive actions to higher-level actions. A social chatbot navigates in a MDP, interacting with its environment (human users) over a sequence of discrete dialogue turns. At each turn, the chatbot observes the current dialogue state, and chooses a skill (option) or a response (primary action) according to a hierarchical dialogue policy. The chatbot then receives a reward (from user responses) and observes a new state, continuing the cycle until the dialogue terminates. The design objective of the chatbot is to find optimal policies and skills to maximize expected CPS (rewards).
The formulation guides the design and implementation of XiaoIce. XiaoIce uses a dialogue manager to keep track of dialogue state, and at each dialogue turn, select how to respond based on a hierarchical dialogue policy. To maximize long-term user engagement, measured in expected CPS, we take an iterative, trial-and-error approach to developing XiaoIce, and always try to balance the exploration-exploitation tradeoff. We exploit what is already known to work well to retain XiaoIce’s user base, but we also have to explore what is unknown (e.g., new skills and dialogue policies) in order to engage with the same users more deeply or attract new users in the future. In Figure 3, XiaoIce tries a new topic (a popular singer named Ashin) in Turn 5 and recommends a song in Turn 15, and thereby learns the user’s preferences (e.g., the music topic and the singer he loves), knowledge that should lead to more engagement in the future. In addition, we adopt an intergenerational upgrade method that allows the graduated emergence of a full-fledged AI system that combines IQ and EQ through comprehensive application of machine learning algorithms and big data. These algorithmic features will be detailed in the following sections.
3 System Architecture
The overall architecture of XiaoIce is shown in Figure 4. It consists of three layers: user experience, conversation engine and data.
User experience layer: This layer connects XiaoIce to popular chat platforms (e.g., WeChat, QQ), and communicates with users in two modes: full-duplex and taking turns. The full-duplex mode handles voice-stream-based conversations where a user and XiaoIce can talk to each other simultaneously. The other mode deals with message-based conversations where a user and XiaoIce take turns to talk. This layer also includes a set of components used to process user inputs and XiaoIce responses e.g., speech recognition and synthesis, image understanding and text normalization.
Conversation engine layer: This is composed of a dialogue manager, an empathetic computing module, Core Chat and dialogue skills. The dialogue manager keeps track of the dialogue state, selects either a dialogue skill or Core Chat 111Although Core Chat is by definition a dialogue skill, we single it out by referring it as Core Chat directly due to its importance and sophisticated design, and refer to other dialogue skills as skills. using the dialogue policy to generate responses. The empathetic computing module is designed to understand not only the content of the user input (e.g., topic) but also the empathetic aspects of the dialogue and the user (e.g., emotion, intent, opinion on topic, and the user’s background and general interests). It reflects XiaoIce’s EQ and demonstrates XiaoIce’s social skills to ensure the generation of interpersonal responses that fit XiaoIce’s personality. XiaoIce’s IQ is shown by a collection of specific skills and Core Chat.
This consists of a set of databases that store collected human conversational data (in text pairs or text-image pairs), non-conversational data and knowledge graphs used for Core Chat and skills, and the profiles of XiaoIce and all the registered users.
4 Implementation of Conversation Engine
This section describes four major components in the conversation engine layer: dialogue manager, empathetic computing, Core Chat, and skills.
4.1 Dialogue Manager
Dialogue Manager is the central controller of the dialogue system. It consists of Global State Tracker that is responsible for keeping track of the current dialogue state , and Dialogue Policy that selects an action based on the dialogue state as . The action can be either a skill or Core Chat activated by the top-level policy to respond to the user’s specific request, or a response suggested by a skill-specific low-level policy.
4.1.1 Global State Tracker
Global State Tracker maintains a working memory to keep track of the dialogue state. The working memory is empty at the beginning of each dialogue session, and then stores at each dialogue turn the user utterance and XiaoIce’s response as text strings, together with the entities and empathy labels detected from the text by the empathetic computing module, which will be described in Section 4.2
. The information in the working memory is encoded into dialogue state vector.
4.1.2 Dialogue Policy
As described in Section 2.3, XiaoIce uses a hierarchical policy: (1) the top-level policy manages the overall conversation by selecting, at each dialogue turn, either Core Chat or a skill to activate based on the dialogue state; and (2) a set of low-level policies, one for each skill, to manages its conversation segment.
The dialogue policy is designed to optimize the long-term user engagement through an iterative, trial-and-error process based on the feedback of XiaoIce’s users. It works as follows.
If the user input is text (including speech-converted text) only, Core Chat is activated. Topic Manager, which will be introduced in Section 4.1.3, is designed to manage the dialogue segment of Core Chat by deciding whether to switch to a new topic or switch from General Chat to a specific Domain Chat if a user interest is detected.
If the user input is an image or a video clip, the Image Commenting skill is activated.
The skills of Task Completion, Deep Engagement and Content Creation are triggered by specific user inputs and conversation context. For example, a picture of food shared by a user can trigger the Food Recognition and Recommendation skill as shown in Figure 17 (a), an extremely negative sentiment detected from user input can trigger the Comforting skill as shown in Figure 17 (b), and a special user command such as “XiaoIce, what is the weather today” can trigger the Weather skill as shown in Figure 18 (a). If multiple skills are triggered simultaneously, we select the one to activate based on their triggering confidence scores, pre-defined priorities and session context. To ensure a smooth conversation, we avoid switching among different skills too often. We prefer keeping the running skill activated until it terminates to activating a new skill. This is similar to the way sub-tasks (i.e., skills) are managed in composite-task completion bots peng17composite .
4.1.3 Topic Manager
Topic Manager simulates human behavior of changing topics during a conversation. It consists of a classifier for deciding at each dialogue turn whether or not to switch topics, and a topic retrieval engine for recommending a new topic.
Topic switching is triggered if XiaoIce does not have sufficient knowledge about the topic to engage a meaningful conversation, or the user is getting bored. Typical indicators are as follows.
An editorial response is used due to Core Chat failing to generate any valid response candidate, as will be described in Section 4.3.
The generated response simply repeats the user inputs, or contains no new information.
The user inputs are getting bland, e.g., “OK”, “I see”, “go on”.
A topic dataset is constructed by collecting popular topics and related comments and discussions from high-quality Internet forums, such as Instagram in US and douban.com in China. When topic switching is triggered, a list of topic candidates is retrieved from the dataset using the current dialogue state as query. The new topic is chosen by a machine-learned boosted tree ranker based on the following features.
Contextual relevance: the topic needs to be related to the dialogue, but has not been discussed yet.
Freshness: the topic, especially if it is related to news, needs to be fresh and valid for the time being.
Personal interests: the user is likely to be interested in the topic, according to the user profile.
Popularity: the topic has gained enough attention on the Internet or among XiaoIce users.
Acceptance rate: the rate of the topic being accepted by XiaoIce users is historically high.
As shown in the example in Figure 3, XiaoIce switches to a new but related topic (i.e., a song titled “the time machine” by Ashin in Turn 13) when she detects that the user is not familiar with “Ashin” and about to terminate the conversation by responding “Ah! Boring” and “Okay, I am going to bed”.
4.2 Empathetic Computing
Empathetic computing reflects XiaoIce’s EQ and models the empathetic aspects of the human-machine conversation. Given user input query , empathetic computing takes its context into account and rewrites to its contextual version , encodes the user’s feelings and states in the conversation with query empathy vector , and specifies the empathetic aspects of the response with response empathy vector . The output of the empathetic computing module is represented as dialogue state vector , which is the input to both Dialogue Policy for selecting a skill, and the activated skill (e.g., Core Chat) for generating interpersonal responses that fit XiaoIce’s persona – a 18-year-old girl who is always reliable, sympathetic, affectionate, knowledgeable but self-effacing, and has a wonderful sense of humor.
The empathetic computing module consists of three components: contextual query understanding, user understanding and interpersonal response generation. Figure 5 shows an example of how the module controls the empathy aspects of the conversation in Figure 3.
Contextual Query Understanding (CQU)
CQU rewrites to using contextual information in in the following steps.
Named entity identification: We label all entity mentions in , link them to the entities stored in the working memory of the state tracker, and store new entities in the working memory.
Co-reference resolution: We replace all pronouns with their corresponding entity names.
Sentence completion: If is not a complete sentence, we complete it using contextual information .
As shown in Figure 5 (a), CQU rewrites user queries to include necessary context, e.g., replacing “him” in Turn 12 with “Ashin’, “that” with “The Time Machine” in Turn 14, and adding “send The Time Machine” in Turn 15. These contextual queries are used e.g., by Core Chat to generate responses via either a retrieval-based engine or a neural generative model, which will be described in Section 4.3.
This component generates query empathy vector based on and . consists of a list of key-value pairs representing user intents, emotions, topics, opinions and user persona, as shown in the example of Figure 5 (b). These key-value pairs are generated using a set of machine learned classifiers as follows.
Topic detection labels whether the user follows the same topic, or introduces a new topic. The set of topics is pre-compiled.
Intent detection labels using one of the dialogue acts e.g., greet, request, inform, etc.
Sentiment analysis detects user’s emotion, e.g., happy, sad, angry, neural, and how her emotion evolves during the conversation, e.g., from happy to sad.
Opinion detection detects user’s reaction to the topic, e.g., positive, negative or neural.
If the user ID is available, include in the user persona vector according to her profile, e.g., gender, age, interests, occupation, personality etc.
Interpersonal Response Generation
This component generates response empathy vector that both specifies the empathetic aspects of the response to be generated and embodies XiaoIce’s persona. For example, in Figure 5 (c) indicates that XiaoIce shares the feeling of the user by following the same topic (decided by Topic Manager), responding in a consistent and positive way as specified e.g., by the values of intent, sentiment and opinion etc. in which are computed based on those in
using a set of heuristics. The response must also fit XiaoIce’s persona whose key-value pairs, such as age, gender and interests, are extracted from the pre-compiled XiaoIce profile. We will describe howand are used for response generation in next section.
4.3 Core Chat
Core Chat is a very important component of XiaoIce’s IQ and EQ. Together with the empathetic computing module, Core Chat provides the basic communication capability by taking the text input and generating interpersonal responses as output. Core Chat consists of two parts, General Chat and Domain Chats. General Chat is responsible for engaging open-domain conversations that cover a wide range of topics. Domain Chats are responsible for engaging deeper conversations on specific domains such as music, movie and celebrity. Since General Chat and Domain Chats are implemented using the same engine with access to different datasets (i.e., general vs. domain-specific paired, unpaired datasets and neural response generation models), we only describe General Chat in detail below.
General Chat is a data-drive response generation system. It takes as input dialogue state , and outputs response in two stages: response candidate generation and ranking. The response candidates can be retrieved from the databases which consist of human-generated conversations or texts, or generated on the fly by a neural generative model. In what follows, we describe three candidate generators and a candidate ranker.
Retrieval-Based Generator using Paired Data
The paired dataset consists of query-response pairs collected from two data sources. First is the human conversational data from the Internet, e.g., social networks, public forums, bulletin boards, news comments etc. After the public release of XiaoIce in May, 2014, we also started collecting human-machine conversations generated by XiaoIce and her users, which amounted to more than 30 billion conversation pairs as of May, 2018. Nowadays, 70% of XiaoIce responses are retrieved from her own past conversations. To control the quality of the dataset, especially for the data collected from the Internet, we convert each pair to a tuple using the empathetic computing module based on information extracted from dialogue context, metadata of the webpage and website where the pair is extracted, and user profile (if the registered user identity is available). Then, we filter the pairs based on their tuples, and retain only the conversation pairs that contain empathetic responses that fit XiaoIce’s persona. We also remove the pairs which contain personally identifiable information (PII), messy code, inappropriate content, spelling mistakes, etc.
The filtered paired dataset is then indexed using Lucene222http://lucene.apache.org/. At runtime, we use in as query to retrieve up to 400 response candidates using keyword search and semantic search based on machine learned representations of the paired dataset (zhang2016learning, ; wu2016ranking, ).
Although the response candidates retrieved from the paired dataset is of high quality, the coverage is low because many new or less frequently discussed topics on the Internet forums are not included in the dataset. To increase the coverage, we introduce two other candidate generators described next.
Neural Response Generator
Unlike the retrieval-based generator, the neural response generator is trained using the paired dataset to learn to simulate human conversation, and is able to generate responses for any topics including those that are unseen in human conversational data, so that a user can chat about any topic she likes. Neural-model-based and retrieval-based generators are complementary: the neural-model-based generator offers robustness and high coverage, while the retrieval-based provides high-quality responses for popular topics. Neural response generation is a very active research topic in the conversational AI community (gaosurvey, ). Its role in developing social chatbots is becoming increasingly important as its performance keeps improving.
The neural response generator in XiaoIce follows the sequence-to-sequence (seq2seq) framework sutskever2014sequence ; cho14properties used for conversation response generation sordoni2015neural ; vinyals2015neural ; shang2015neural ; li2015diversity ; li2016persona ; xing2017topic .
The generator is based on a GRU-RNN model, similar to the Speaker-Addressee model li2016persona . Given input , we wish to predict how XiaoIce (the addressee) modeled by would respond to query produced by the user (speaker) modeled by . As illustrated in Figure 6, we first obtain an interactive representation by linearly combining query and response empathy vectors and in an attempt to model the interactive style of XiaoIce towards the user,
denotes the sigmoid function. Then the source RNN encodes user queryinto a sequence of hidden state vectors which are then fed into the target RNN to generate response word by word. Each response ends with a special end-of-sentence symbol EOS. We use beam search to generate up to 20 candidates. As illustrated in Figure 6, for each step on the target RNN side, the hidden state is obtained by combining the hidden state produced at the previous step , the embedding vector of the word at the current time step , and . In this way, empathy information is injected into the hidden layer at each time step to help generate interpersonal responses that fit XiaoIce’s persona throughout the generation process. See Appendix A for a detailed description of the model. As shown in Figure 7, while a typical seq2seq model which is not grounded in any persona often outputs inconsistent responses li2016persona , XiaoIce is able to generate consistent and humorous responses.
Retrieval-Based Generator using Unpaired Data
In addition to the conversational (or paired) data used by the above two response generators, there is higher-quality and a much larger amount of non-conversational (or unpaired) data, which can be used to improve the quality and coverage of the response.
The unpaired dataset we have used in XiaoIce consists of sentences collected from public lectures and quotes in news articles and reports. These sentences are considered candidate responses . Since we know the authors of these sentences, we compute for each its empathy vector . A data filtering pipeline, similar to that for paired data, is used to retain only the responses that fit XiaoIce’s persona.
Like the paired dataset, the unpaired dataset is indexed using Lucene. Unlike the paired dataset, at runtime we need to expand query to include additional topics to avoid retrieving those responses that simply repeat what a user just said. We resort to a knowledge graph (KG) for query expansion. The KG consists of a collection of head-relation-tail triples , and is constructed by joining the paired dataset and Microsoft Satori 333Satori is Microsoft’s knowledge graph, which is seeded by Freebase, and now is orders of magnitude larger than Freebase.. We include in the XiaoIce KG a Satori triple only if the number of conversation pairs in the paired dataset where occurs in and in , or vise verse, is larger than a pre-set threshold. Such a triple contains a pair of two related topics that humans often discuss in one conversation, such as (Beijing, Great Wall), (Einstein, Relativity), (Quantum Physics, Schrodinger’s cat). A fragment of the XiaoIce KG is shown in Figure 8 (top).
Figure 8 illustrates the process of generating response candidates using the unpaired dataset and the XiaoIce KG. It consists of three steps.
First, we identify the topics from contextual user query , e.g., “Beijing” from “tell me about Beijing”.
For each topic, we retrieve up to 20 most related topics from the KG, e.g., “Badaling Great Wall” and “Beijing snacks”. These topics are scored by their relevance using a boosted tree ranker wu2010adapting trained on manually labeled training data.
Finally, we form a query by combining the topics from and the related topics from the KG, and use the query to retrieve from the unpaired dataset up to 400 most relevant sentences as response candidates.
This generator is complementary to the other two generators aforementioned. Although the overall quality of the candidates generated from the unpaired dataset is lower than those retrieved from the paired dataset, with unpaired dataset XiaoIce can cover a much broader range of topics. Compared to the neural response generator which often generates well-form but short responses, the candidates from unpaired data are much longer with more useful content.
Response Candidate Ranker
The response candidates generated by three generators are aggregated and ranked using a boosted tree ranker wu2010adapting . A response is selected by randomly sampling a candidate from those with higher ranking scores than a pre-set threshold.
Given dialogue state , we assign each response candidate a ranking score based on four categories of features.
Local cohesion features. A good candidate should be semantically consistent or related to user input . We compute cohesion scores between and using a set of DSSMs 444DSSM stands for Deep Structured Semantic Models huang2013learning ; shen2014latent , or more generally, Deep Semantic Similarity Model gao2014modeling
. DSSM is a deep learning model for measuring the semantic similarity of a pair of inputs. They can be applied to a wide range of tasks depending on the definition of . In this study is a query-candidate-response pair . trained on the collections of human conversation pairs.
Global coherence features. A good candidate should be semantically coherent with and . We compute coherence scores between and using another set of DSSMs trained on the collections of human dialogue sessions. Since the coherence features use global context information , they are particularly useful when is a bland query whose topic is hard to detect without context, such as “OK”, “why”, “I don’t know”.
Empathy matching features. A good candidate should be an empathetic response that fits XiaoIce’s persona. Assume XiaoIce selects to respond given context . We can compute XiaoIce’s response empathy vector for , , using the empathetic computing module 555We treat as query and as context, and use the contextual query understand and user understanding components to compute as a query empathy vector., and then compute a set of empathy matching features by comparing and the given which encodes the empathy features of the expected response.
Retrieval matching features. These features apply only to the candidates generated from the paired dataset. We compute a set of matching scores between and the query side of the retrieved query-response pairs at both the word level, such as BM25 and TFIDF scores, and the semantic level, such as DSSM scores.
The ranker is trained on dialogue-state-response pairs , as shown in Figure 9, where each pair is labeled on a 3-level quality scale:
0: the response is not empathetic or not very relevant to the query. It is likely to lead to the termination of the conversation.
1: the response is acceptable and relevant to the query. It is likely to help keep the conversation going.
2: this is an empathetic, interpersonal response that makes users feel delightful and excited. It is likely to drive the conversation.
If the candidate generators and response ranker fail to generate any valid response for various reasons (e.g., not-in-index, model failure, execution timeout, or the input query containing improper content), then an editorial response is selected.
It is important to provide empathetic editorial responses to keep the conversation going. For example, when not-in-index occurs, instead of using safe but bland responses such as “I don’t know” or “I am still learning to answer your question”, XiaoIce may respond like, “Hmmm, difficult to say. What do you think?”, or “let us talk about something else”.
4.4 Dialogue Skills
XiaoIce is equipped with 230 dialogue skills, which, together with Core Chat, form the IQ component of XiaoIce. This section describes these skills in four categories: image commenting, content creation, deep engagement and task completion.
4.4.1 Image Commenting
In social chatting, people frequently engage with one another around images. On Twitter, for example, uploading a photo with an accompanying tweet (comment) has become increasingly popular: as of June 2015, 28% of tweets contain an image morris2016most . Figure 10 illustrates a social chat around a shared image. We see that the conversation is grounded not only in the visible objects (e.g., the boys, the bikes) but in the events, actions or even emotions (e.g., the race, winning) implicitly in the image. To human users, it is these latter aspects that are more important to drive a meaningful and interesting conversation.
The Image Commenting skill is designed to not only correctly recognize objects and truthfully describe the content of an image, but generate empathetic comments that reflect personal emotion, attitude, position etc. It is the latter, the social skill aspects, that distinguishes image commenting from other traditional vision tasks such as image tagging and image description, as illustrated in Figure 11.
The architecture for Image Commenting is similar to that for Core Chat. Given the user input which contains an image (or a video clip), a textual comment is generated in two stages: candidate generation and ranking. The candidates are generated using retrieved-based and generation-based approaches.
In the retrieved-based approach, first of all, a dataset of image-comment pairs, collected from social networks (e.g., Facebook and Instagram), is constructed. To control the data quality, a pipeline similar to that for Core Chat is applied to retain only the pairs whose text comments fit XiaoIce’s persona 666We found that the pairs that are shared among acquaintances (e.g., coworkers, classmates and friends) are of good quality, and amount to a large portion in the dataset.
. Then, each image is encoded into a visual feature vector that represents the overall semantic information of the image, using deep convolutional neural networks (CNNs), as illustrated in Figure12
. At runtime, given a query image, we retrieve up to three most similar images, ranked based on the cosine similarities between their feature vector representations, and use their paired comments as candidates.
The generation-based approach uses an image-to-text generator, which is an extension of the Microsoft Image Captioning system fang2015captions , which is re-trained on the image-comment pairs we have collected for XiaoIce, and has incorporated additional modules to control high-level sentiment and style factors in comment generation mathews2016senticap ; gan2017stylenet .
The comment candidates generated by the above generators are aggregated and ranked using a boosted tree ranker wu2010adapting . Given dialogue state , we assign each candidate a ranking score based on four categories of features, similar to that of Core Chat as described in Section 4.3. Note that unlike the case of Core Chat where and are text, in Image Commenting we need to compute the similarity between an image and a text. This is achieved by using the Deep Multimodal Similarity Model (DMSM fang2015captions ), which is a variant of DSSM trained on large amounts of image-comment pairs. The ranker is trained on dialogue-state-response pairs , where in is a vector representation of an image, and each pair is labeled on a 3-level quality scale, similar to that of query-response pairs used for Core Chat.
As illustrated in Figure 13, good image comments (rating 2) need to fit well into the dialogue context and stimulate an engaging conversation. For example, in the first picture, instead of telling users that this is the Leaning Tower of Pisa, XiaoIce responds "should I help you hold it?" after detecting that the person in the picture is presenting a pose pretending to support the tower. In the second example, instead of repaying the fact there is a cat in the picture, XiaoIce makes a humorous comment about the cat’s innocent eyes. In the other two examples, XiaoIce generates meaningful and interesting comments by grounding the images in the action (e.g., “not to trust any code from unknown sources”) and object (e.g., “Windows”) implicitly in the images.
4.4.2 Content Creation
These skills allow XiaoIce to collaborate with human users in their creative activities including text-based Poetry Generation777https://poem.msxiaobing.com/, voice-based Song and Audio Book Generation, XiaoIce FM for Somebody, and XiaoIce Kids Story Factory, etc.
Figure 14 (a) shows that a user uses XiaoIce to make an FM program for her mother for the coming Chinese Spring Festival. Figure 14 (b) shows the Kids Story Factory skill which can automatically create a story based on user configuration, e.g., whether the story is for education or entertainment, and the names, genders and personalities of the main characters, etc.
The XiaoIce Poetry Generation skill has helped over four million users to generate poems. On May 15, 2018, XiaoIce published the first AI-created Chinese poem album in history888https://item.jd.com/12076535. XiaoIce’s second poetry album is going to be published by China Youth Publishing and Microsoft around the end of 2018. Every poem in the album is jointly written by XiaoIce and human poets.
Figure 15 illustrates how a Chinese poem is generated from an image by XiaoIce. Given an image, a set of keywords, such as “city” and “busy”, are generated based on the objects and sentiment detected from the image. Then, a sentence is generated using each keywork as a seed. The generated sentences form a poem using a hierarchical RNN which models the structure among words and sentences.
4.4.3 Deep Engagement
The Deep Engagement skills are designed to meet users’ specific emotional and intellectual needs by targeting to specific topics and settings, thus improving users’ long-term engagement. Some example skills are shown in Figure 16.
As shown in Figure 17, these skills can be grouped into different series on two dimensions: from IQ to EQ, and from private 1 on 1 to group discussion.
To meet users’ intellectual or emotional needs (the IQ to EQ axis in Figure 17): XiaoIce can share her interests, experiences and knowledge on various IQ topics ranging from mathematics and history (e.g., the Grade-A student series) to food, travel and celebrity (e.g., the XiaoIce’s Interests series). Figure 16 (a) shows the Food Recognition and Recommendation skill, which is triggered by a picture of food shared by users during a conversation and can present nutrition facts, such as calories and protein, of the food in the picture. XiaoIce is known for her high EQ capabilities. For example, the Comforting Me For 33 Days skill (in the Comforting series) shown in Figure 16 (b) is among the most popular skills. Since its release, it has been triggered over 50 million dialogue sessions where an extremely negative user sentiment is detected (by XiaoIce’s empathetic computing module).
For a private or group discussion settings (the 1-1 to group axis in Figure 17): The skills for 1 on 1 discussion and chatting allow XiaoIce to form a deep relationship with a user by sharing topics and feelings in a private setting (e.g., the XiaoIce & Human Relationship series and the Bed Time series). The Counting Sheep skill shown in Figure 16 (c) has become an intimate midnight companion for thousands of users. On the other hand, XiaoIce helps form a user group for the users with common interests. For example, as part of the Testing series, the Tongue Twister skill shown in Figure 16 (d) provides one of the most popular team building activities.
4.4.4 Task Completion
Similar to popular personal assistants, such as Google Assistant and Microsoft Cortana, XiaoIce is equipped with a set of skills to help users accomplish tasks including Weather, Device Control (full duplex), Song-on-Demand, News Recommendation, Bing Knows etc., as shown in the examples in Figure 18.
Compared with traditional personal assistants, XiaoIce’s task-completion skills offer more perspectives and empathy in generating interpersonal responses. For example, given the question "what’s the area of China?", XiaoIce delivers a tailored, easy-to-understand answer to the user according to her level of knowledge (knowing how big the USA is): "it’s 3.71 million sq miles, about equal to the size of USA.". As shown in the Weather skill in Figure 18 (a), in addition to providing the answer to the question "What is the weather in Beijing", XiaoIce also attempts to lead the chat to a more interesting direction by recommending an outing that fits the user’s general interests. In the Device Control skill shown in Figure 18 (b), XiaoIce thoughtfully checks with the user whether she is happy with the lighting condition in the bedroom after the lamp is turned on.
5 XiaoIce in the Wild
XiaoIce was first released on May 29, 2014, and went viral immediately. Within 72 hours, XiaoIce was looped into 1.5 million chat groups. In two months, XiaoIce successfully became a cross-platform social chatbot. Up to August 2015, XiaoIce has had more than 10 billion conversations with humans. By then, users have proactively posted more than 6 million conversation sessions to public.
From 2015 on, XiaoIce started powering third party characters, personal assistants and real human’s virtual avatars. These characters include more than 60,000 official accounts, Lawson and Tokopedia’s customer service bots, Pokemon, Tecent and Netease’s chatbots, and even real human celebrities such as the singers of Guoyun Entertainment. XiaoIce has made these characters “alive” by bringing various capabilities including chatting, providing services, sharing knowledge and creating contents.
As of July 2018, XiaoIce has been deployed on more than 40 platforms, and has attracted 660 million users. XiaoIce-generated TV and Radio programs have covered 9 top satellite TV stations, and have attracted over 800 million weekly active audience.
To evaluate the effectiveness of XiaoIce as an AI companion to human users with emotional connections, we use the metric of CPS which indicates on average users’ willingness to share time with XiaoIce via conversation. Figure 19 shows the average CPS for different generations of XiaoIce. The 1st generation achieved an average CPS of 5, which already outperforms other dialogue systems such as digital personal assistants whose CPS ranges from 1 to 3. In July 2018, XiaoIce has evolved to the 6th generation with an impressive average CPS of 23, which is significantly higher than the average CPS of 9 for human conversations based on our user study.
Figure 19 presents for each generation the top new features that have most significantly contributed to CPS and the growth of the XiaoIce user base. In summary, these features can be grouped into four categories.
The use of neural response generation models in Core Chat, starting from the 5th generation, significantly improves the coverage and diversity of XiaoIce’s responses. The improvement on the empathetic computing module, especially the integration of the specific empathy models in the 6th generation, substantially strengthens XiaoIce’s emotional connections to human users. As shown in the example in Figure 2, these models explicitly capture different empathy modes, and can effectively drive the conversation by generating interpersonal responses that can e.g., suggest a new topic when the conversation is stalled or perform active listening when the user herself is engaged.
The full duplex voice module released in the 5th generation has made the human-agent communication super natural, thus significantly increasing the length of conversation sessions. This is also an important difference between XiaoIce and other social chatbots or personal assistants.
Since July 2014, XiaoIce has released 230 skills, which amounts to nearly one new skill every week, as shown in Figure 20. It is worth noting that we optimize XiaoIce for a long-term, rather than a short-term, engagement. In the short term, incorporating many task-completion skills can reduce CPS since these skills help users accomplish tasks more efficiently by minimizing CPS. But in the long run, these new skills not only help grow XiaoIce’s user base by meeting user needs and strengthening the emotional bond with human users, but also provide large amounts of training data to improve the core conversation engine e.g., by optimizing the neural response generation models, empathy models, and the dialogue manager, etc.
XiaoIce has been deployed to many platforms. As a result, we have witnessed the creation and growth of a XiaoIce ecosystem since year 2016. This attributes to a large agree to those task-completion skills that enable XiaoIce to control approximately 80 IoT smart devices in around 300 scenarios.
As mentioned in Section 2, XiaoIce is designed to establish long-term relationships with human users. Our analysis of the user log show that we are achieving the goal. Table 1 shows the statistics of some of the longest conversations we have detected from the user log. Take the full duplex voice conversation as an example. The longest conversation lasts for more than 6 hours, covering 53 different topics across 8 domains and using 16 task-completion skills.
|Full Duplex (voice)||Message-based Conversations|
Figures 21 and 22 show a couple of long conversations between XiaoIce and human users. We can see that these conversations are highly personal and sensitive. In the example of Figure 21, XiaoIce wins the user’s trust and friendship by her wonderful sense of humor and empathetic responses to all sorts of questions, some of which are quite challenging, such as "you are all lies", and "who is your daddy".
In Figure 22, the user mentions that she broke with her boyfriend recently, and seeks XiaoIce’s companion and comforting. Through a long conversation, XiaoIce has demonstrated human-like empathy and social skills, and eventually helped the user regain her confidence and move forward with a positive attitude.
Psychological studies show that happiness and meaningful conversations often go hand in hand. It is not surprising, then, that with vastly more people being digitally connected in the social media age, social chatbots have become an important alternative means for engagement. Unlike early chatbots designed for chitchat, XiaoIce is designed as a social chatbot intended to serve users’ needs for communication, affection, and social belonging, and is endowed with empathy, personality and skills, integrating both EQ and IQ to optimize for long-term user engagement, measured in expected CPS.
Analysis of large-scale online logs collected since the first release of XiaoIce in May 2014 shows that XiaoIce is capable of interpreting users’ emotional needs and engaging in interpersonal communications in a manner analogous with a reliable, sympathetic and affectionate friend. XiaoIce cheers users up, encourages them, helps them accomplish tasks, and holds their attention throughout the conversation. As a result, XiaoIce has succeeded in establishing long-term relationships with millions of users worldwide, achieving an average CPS of 23, a score that is substantially better than that of other chatbots and even human conversations. We will continue to make XiaoIce more useful and empathetic to help build a more connected and happier society for all.
We conclude this paper by pointing out a few challenges for future work.
Towards a unified modeling framework: Section 2
casts a social chat as a hierarchical decision-making process using the mathematical framework of options over MDPs. Although the formulation provides a useful design principle, it remains to be proved the effectiveness of having a unified modeling framework for system development. XiaoIce is initially designed as a chitchat system based on a retrieval engine, and has gradually incorporated many machine learning components and skills, which could have been jointly optimized using a unified framework based on empathetic computing and reinforcement learning if we could effectively model users’ intrinsic rewards that motivate human conversations.
Towards goal-oriented, grounded conversations: As shown in the example of Figure 3, only when the name mentions (e.g., the singer Ashin) in the dialogue are grounded in real world entities, can XiaoIce engage with users a more goal-oriented dialogue e.g., by providing services (playing one of Ashin’s most popular songs for the user). It remains as a non-trivial challenge for XiaoIce to fully ground all her conversations in the physical world to allow more goal-oriented interactions to serve user needs.
Towards a proactive personal assistant: As an AI companion of human users, XiaoIce can recognize user interests and intents much more accurately than traditional intelligent personal assistants. This enables new scenarios that of significant commercial value. For example, we have incorporated the Coupon skill in the Rinna system (Japanese XiaoIce) which can send a user the coupons of a grocery store if user needs are detected during the conversation. The user feedback log shows that products recommended by Rinna are very well received, and as a result Rinna has delivered a much higher conversion rate than that achieved using other traditional channels such as coupon markets or ad campaigns.
Towards human-level intelligence: Despite the success of XiaoIce, the fundamental mechanism of human-level intelligence, as demonstrated in human conversations, is not yet fully understood. Building an intelligent social chatbot that can understand humans and their surrounding physical world requires breakthroughs in many areas of cognitive and conscious AI, such as empathetic computing, knowledge and memory modeling, interpretable machine intelligence, common sense reasoning, neural-symbolic reasoning, cross-media and continuous streaming AI, and modeling of emotional or intrinsic rewards reflected in human needs.
Towards an ethical social chatbot: It is imperative to establish ethical guidelines for designing and implementing social chatbots to ensure that these AI systems do not disadvantage and harm any human users. Given the significant reach and influence of XiaoIce, we must properly exercise both social and ethical responsibilities. Design decisions must be thoughtfully debated and chatbot features (e.g., new skills) must be evaluated thoroughly and adjusted as we continue to learn from the interactions between XiaoIce and millions of her users on many social platforms.
The authors are grateful to all members of the XiaoIce team at Microsoft Search Technology Center Asia and many colleagues at Microsoft Research Asia for the development of XiaoIce. The authors are also thankful to colleagues in Microsoft AI & Research for valuable discussions.
- (1) Joseph Weizenbaum. Eliza—a computer program for the study of natural language communication between man and machine. Communications of the ACM, 9(1):36–45, 1966.
- (2) Kenneth Mark Colby, Sylvia Weber, and Franklin Dennis Hilf. Artificial paranoia. Artificial Intelligence, 2(1):1–25, 1971.
- (3) Richard S Wallace. The anatomy of alice. In Parsing the Turing Test, pages 181–210. Springer, 2009.
- (4) Jianfeng Gao, Michel Galley, and Lihong Li. Neural approaches to conversational ai. arXiv preprint arXiv:1809.08267, 2018.
- (5) Heung-Yeung Shum, Xiaodong He, and Di Li. From eliza to xiaoice: Challenges and opportunities with social chatbots. CoRR, abs/1801.01957, 2018.
- (6) Yang Cai. Empathic computing. In Ambient Intelligence in Everyday Life, pages 67–85. Springer, 2006.
- (7) Pascale Fung, Dario Bertero, Yan Wan, Anik Dey, Ricky Ho Yin Chan, Farhad Bin Siddique, Yang Yang, Chien-Sheng Wu, and Ruixi Lin. Towards empathetic human-robot interactions. CoRR, abs/1605.04072, 2016.
- (8) Abraham Harold Maslow. A theory of human motivation. Psychological review, 50(4):370, 1943.
- (9) Bayan Abu Shawar and Eric Atwell. Different measurements metrics to evaluate a chatbot system. In Proceedings of the workshop on bridging the gap: Academic and industrial research in dialog technologies, pages 89–96. Association for Computational Linguistics, 2007.
- (10) Richard S. Sutton, Doina Precup, and Satinder P. Singh. Between MDPs and semi-MDPs: A framework for temporal abstraction in reinforcement learning. Artificial Intelligence, 112(1–2):181–211, 1999. An earlier version appeared as Technical Report 98-74, Department of Computer Science, University of Massachusetts, Amherst, MA 01003. April, 1998.
- (11) Baolin Peng, Xiujun Li, Lihong Li, Jianfeng Gao, Asli Celikyilmaz, Sungjin Lee, and Kam-Fai Wong. Composite task-completion dialogue policy learning via hierarchical deep reinforcement learning. In EMNLP, pages 2231–2240, 2017.
Kai Zhang, Wei Wu, Fang Wang, Ming Zhou, and Zhoujun Li.
Learning distributed representations of data in community question answering for question retrieval.In Proceedings of the Ninth ACM International Conference on Web Search and Data Mining, pages 533–542. ACM, 2016.
- (13) Bowen Wu, Baoxun Wang, and Hui Xue. Ranking responses oriented to conversational relevance in chat-bots. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, pages 652–662, 2016.
- (14) Ilya Sutskever, Oriol Vinyals, and Quoc Le. Sequence to sequence learning with neural networks. In NIPS, pages 3104–3112, 2014.
Kyunghyun Cho, Bart van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio.
On the properties of neural machine translation: Encoder–decoder approaches.In Proceedings of SSST-8, Eighth Workshop on Syntax, Semantics and Structure in Statistical Translation, pages 103–111, Doha, Qatar, October 2014.
- (16) Alessandro Sordoni, Michel Galley, Michael Auli, Chris Brockett, Yangfeng Ji, Margaret Mitchell, Jian-Yun Nie, Jianfeng Gao, and Bill Dolan. A neural network approach to context-sensitive generation of conversational responses. In NAACL-HLT, May 2015.
- (17) Oriol Vinyals and Quoc Le. A neural conversational model. In ICML Deep Learning Workshop, July 2015.
- (18) Lifeng Shang, Zhengdong Lu, and Hang Li. Neural responding machine for short-text conversation. In ACL-IJCNLP, pages 1577–1586, July 2015.
- (19) Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. In NAACL-HLT, 2016.
- (20) Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A persona-based neural conversation model. In ACL, 2016.
- (21) Chen Xing, Wei Wu, Yu Wu, Jie Liu, Yalou Huang, Ming Zhou, and Wei-Ying Ma. Topic aware neural response generation. In AAAI, volume 17, pages 3351–3357, 2017.
- (22) Qiang Wu, Christopher JC Burges, Krysta M Svore, and Jianfeng Gao. Adapting boosting for information retrieval measures. Information Retrieval, 13(3):254–270, 2010.
- (23) Po-Sen Huang, Xiaodong He, Jianfeng Gao, Li Deng, Alex Acero, and Larry Heck. Learning deep structured semantic models for web search using clickthrough data. In CIKM, pages 2333–2338. ACM, 2013.
- (24) Yelong Shen, Xiaodong He, Jianfeng Gao, Li Deng, and Grégoire Mesnil. A latent semantic model with convolutional-pooling structure for information retrieval. In Proceedings of the 23rd ACM International Conference on Conference on Information and Knowledge Management, pages 101–110. ACM, 2014.
Jianfeng Gao, Patrick Pantel, Michael Gamon, Xiaodong He, and Li Deng.
Modeling interestingness with deep neural networks.
Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 2–13, 2014.
- (26) Meredith Ringel Morris, Annuska Zolyomi, Catherine Yao, Sina Bahram, Jeffrey P Bigham, and Shaun K Kane. With most of it being pictures now, i rarely use it: Understanding twitter’s evolving accessibility to blind users. In Proceedings of the 2016 CHI Conference on Human Factors in Computing Systems, pages 5506–5516. ACM, 2016.
- (27) Nasrin Mostafazadeh, Chris Brockett, Bill Dolan, Michel Galley, Jianfeng Gao, Georgios P Spithourakis, and Lucy Vanderwende. Image-grounded conversations: Multimodal context for natural question and response generation. arXiv preprint arXiv:1701.08251, 2017.
- (28) Hao Fang, Saurabh Gupta, Forrest Iandola, Rupesh K Srivastava, Li Deng, Piotr Dollár, Jianfeng Gao, Xiaodong He, Margaret Mitchell, John C Platt, et al. From captions to visual concepts and back. In , pages 1473–1482, 2015.
- (29) Alexander Patrick Mathews, Lexing Xie, and Xuming He. Senticap: Generating image descriptions with sentiments. In AAAI, pages 3574–3580, 2016.
- (30) Chuang Gan, Zhe Gan, Xiaodong He, Jianfeng Gao, and Li Deng. Stylenet: Generating attractive visual captions with styles. In Proc IEEE Conf on Computer Vision and Pattern Recognition, pages 3137–3146, 2017.
- (31) Wen-Feng Cheng, Chao-Chung Wu, Ruihua Song, Jianlong Fu, Xing Xie, and Jian-Yun Nie. Image inspired poetry generation in xiaoice. arXiv preprint arXiv:1808.03090, 2018.
Appendix A GRU-RNN Based Response Generator
The neural response generator in XiaoIce uses a GRU-based RNN model, similar to the Speaker-Addressee model proposed in . Given input , we wish to predict how XiaoIce (the addressee) modeled by would respond to query produced by the speaker modeled by . We first obtain an interactive representation by linearly combining query and response empathy vectors and in an attempt to model the interactive style of XiaoIce towards the speaker,
where and denotes the sigmoid function. We then encode into a vector representation using the source RNN. Next, for each step on the target RNN side, the hidden state is obtained by combining the hidden state produced at the previous step , the embedding vector of the word at the current time step , and . In this way, empathy information is encoded and injected into the hidden layer at each time step and thus helps generate interpersonal responses that fit XiaoIce’s persona throughout the generation process.
Let and denote the update and reset gates of GRU, respectively, which associate with time step . Then, the hidden state of the GRU-RNN for each time step is computed as follows:
where are machine learned matrices, and
denotes the element-wise product. The RNN model defines the probability of next token into predict using the softmax function:
denotes the activation function between, and , where is the representation output from the RNN at time . Each response ends with a special end-of-sentence symbol EOS.
The parameters of the response generation model
are trained to maximize the log likelihood on training data, using stochastic gradient descent, as