<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akhilesh Sudhakar on Medium]]></title>
        <description><![CDATA[Stories by Akhilesh Sudhakar on Medium]]></description>
        <link>https://medium.com/@akhileshs.s4?source=rss-763e4c5e2ef3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*NUBUxLOk0zAjV0IT6L1t1g.jpeg</url>
            <title>Stories by Akhilesh Sudhakar on Medium</title>
            <link>https://medium.com/@akhileshs.s4?source=rss-763e4c5e2ef3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:43:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akhileshs.s4/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Is a voicebot just a chatbot with voice processing capabilities?]]></title>
            <link>https://medium.com/agara-labs/voicebot-asr-chatbot-tts-4e7be52fdd8d?source=rss-763e4c5e2ef3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e7be52fdd8d</guid>
            <category><![CDATA[voice-assistant]]></category>
            <category><![CDATA[conversational-ai]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[voicebots]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Akhilesh Sudhakar]]></dc:creator>
            <pubDate>Thu, 08 Oct 2020 05:49:33 GMT</pubDate>
            <atom:updated>2020-10-08T06:32:35.620Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Is A Voicebot Just A Chatbot With Voice Processing Capabilities?</strong></h3><p>Agara is an autonomous virtual voice agent and can carry out end to end voice conversations with customers over the phone.</p><p>Given the multitude of text-based chatbots that we interact with daily and the attention they have received, I often come across the question:</p><p>Doesn’t building such a voicebot amount to using a chatbot, which additionally <br>a) works on the text transcript of the customer’s speech, obtained using an Automatic Speech Recognition (ASR) engine, and <br>b) converts its own text response to voice using a Text-to-speech (TTS) engine?”</p><p>However, saying that a voicebot tantamounts to a chatbot — with an ASR on the way in, and a TTS on the way out — is essentially saying the way you text is also the way you speak. A rather basic thought experiment in this regard would be telling.</p><p>Let’s imagine you ‘converted’ one of your old text chats with a friend into a voice call. Let’s say you read out your part of the text, and your voice assistant — an Alexa or a Google Assistant — reads out your friend’s parts. Alternatively, imagine having the same conversation with your friend over a phone call. Would both these scenarios sound the same? Most likely not.</p><p>The dissimilarity in the basic nature of conversation is a fundamental aspect, but this does not scratch the surface of the technical challenges of processing real-time audio. Some of these challenges include latency and transcription errors, and the fact that even state-of-art artificial speech synthesis systems can sound robotic.</p><p><strong>On the topic of voice assistants, it must be prefaced that Agara is not a command-and-control voice assistant like Alexa and Siri. Agara carries out complete and goal-oriented conversations with customers. Throughout this article, we use the term ‘voicebot’ to refer to an AI-powered voice agent of this nature, that aims to have as human-like conversations as possible.</strong></p><p>This article is an attempt at highlighting some of the challenges and considerations involved in designing and building such a voicebot. Since chatbots are rather ubiquitous these days, this article also tries to contrast them with voicebots and, in the process, shed light on the oft-asked “Isn’t Voicebot = ASR + Chatbot + TTS?”</p><h3>The continuum of speech</h3><p>Text chat is, by its very nature, designed to be turn-based. For the most part, we send a text and wait for a reply, and then we text again. We only see the other person’s text in units of more complete text messages. We formulate a response, type it out, and also make multiple edits along the way, during which time, the person at the other end will only see the ubiquitous ‘Typing…’. What they receive finally is merely the product of our ‘turn’ of a text conversation.</p><p>On the other hand, in a spoken conversation, we frequently interrupt each other and provide verbal cues of acknowledgment, (dis)agreement, empathy, etc. All this happens while the other person is still speaking their ‘turn’ of the conversation. Spoken conversation between two people must be thought of as two separate continuous streams of audio. Each stream is a continuum of spoken words, non-word verbal cues (such as oh’s, ah’s, and hmm’s) as well as background noise of any form.</p><p>Interestingly, many customer support desks enable their live chat agents (advisors) to see what customers type, as they type it. They can see each letter as the customer types it, including all their messy deletions and to-be-edited autocorrects. This, of course, is to allow them to pre-empt queries and fetch information quickly. There are also concept apps like the <a href="https://www.dailymail.co.uk/sciencetech/article-2832990/The-texting-app-land-lot-trouble-Messenger-lets-person-types-hit-send.html">Beam Messenger</a> that allow people on either side to see what the other person is texting in real-time. However, they haven’t gotten much traction lately. One set of user reviews seem to indicate that people would still like to retain the luxury of articulating better and editing when it comes to text-based chats. Another set of reviews alludes to the fact that real-time texting of this fashion isn’t quite ‘natural’ as compared to, say, a voice or a video call.</p><h4>What do humans do?</h4><p>Since we are in the business of building voicebots that talk to customers over the phone, looking at this question from a customer support standpoint might be a good start, without losing generality. It might be insightful to compare how similar situations are handled in text and voice conversations.</p><p>Let’s say you were a customer support advisor, chatting with a customer over text chat. You see a text from them and start typing a response; when you notice them ‘Typing…’ again, as you are typing out your response. You stop typing (possibly even delete what you started typing), let the customer finish, and then respond, now factoring in their new text.</p><p>In contrast, let’s say you are talking to a customer over the phone. The following possibilities (and more) can take place:</p><ul><li>While you are saying something, the customer might interject to correct you, or already pre-empt the rest of your statement.</li><li>If they are in a hurry, they would like you to get straight to the point. You might choose to stop speaking mid-way in such cases and let them ‘take over’ the ‘turn.’ The conversation might then proceed along a new path.</li><li>You might hear noise from their end while you’re speaking, and choose to repeat yourself just in case the customer missed hearing what you said.</li><li>They might be using ‘fillers’ like hmm’s, ah’s, and okay’s to let you know they’re acknowledging what you’re saying without meaning to interrupt your speech. In such cases, you listen to them but continue speaking.</li></ul><p>Of course, there are times when you, as the advisor, might need to interrupt the customer’s speech. Maybe they are reading out a wrong piece of information, and you’d like to save them time by letting them know before they read out its entirety. Or maybe you’d like to interrupt a verbally abusive customer and politely let them know that profanity will not be accepted.</p><p><strong>In our analysis of customer support calls, we found that 22% of the turns of agents’ conversation had overlapping customer-side speech. Some of these were interrupts, and others were filler words that weren’t intended to interrupt.</strong></p><h4>Implications</h4><p>A voicebot that strives to be human-like should account for all these artifacts or possibilities that come with the real-time nature of voice-based conversations.</p><p>Let’s look at an example here to highlight some of these considerations.</p><p><strong><em>Bot:</em></strong><em> May I have your reference number, John?</em></p><p><strong><em>Customer:</em></strong><em> Yes, its ACB432</em></p><p><strong><em>Bot:</em></strong><em> I heard that as ACP4.. (Bot hears the customer’s interrupt here)</em></p><p><strong><em>Customer:</em></strong><em> No, that’s a B.</em></p><p>In this case, the ASR mistranscribed ‘ACB432’ to ‘ACP432’. The response to this should be along the lines of “Sorry, is your reference number ACB432 ?”. This involves the bot understanding that:</p><ol><li>Firstly, the customer is attempting to correct one of the letters, and hence this is a case where the bot should stop speaking and change course</li><li>‘B’ and ‘P’ sound similar and are often confused with each other, and hence the customer is likely trying to correct the ‘B’ to a ‘P.’</li><li>The customer interrupted it around the time when it said ‘P,’ even though there is no guarantee on how much time had passed since ‘P’ when the interrupt happened — there is also a latency added in sending the customer’s audio over the network, as well as in transcription using ASR</li></ol><p>While all of these are intuitive to a human, they need to be explicitly taught to the AI models powering this conversation. Further, there are considerations of UX, which are described later. If the bot stops abruptly when it hears an interrupt, the user experience is unnatural. For instance, halting our speech mid-word is something that we humans rarely do, even upon hearing overlapping talk.</p><h3>The gaffes of ASR</h3><p>ASR systems (also referred to as speech-to-text systems) are used to transcribe speech to text. Publicly available ASR systems (such as those on Google Cloud Platform — GCP, and Amazon Web Services — AWS) are notoriously bad at transcribing speech that 1) is noisy, 2) is of an accent for which the ASR has not seen many examples of during training, and 3) contains words or phrases that are not often used in general language.</p><h4>Noise</h4><p>In the context of an ASR that is meant to transcribe the customer’s speech, pretty much any other sound in the audio is considered noise. A few frequent sources of noise include other people speaking in the background, audio degradation during transmission through phone lines (the infamous crackling and muffling of phone audio), traffic sounds, public transport announcement systems, and even a fan or a loud air conditioner. These types of noise pose a transcription challenge and cause the transcripts to have missing, incorrectly transcribed or partially transcribed portions of customer speech.</p><h4>Accents</h4><p>Publicly available ASRs perform well on ‘mainstream’ accents while struggling with ‘accented speech’. To give perspective, GCP’s ASR has only <a href="https://cloud.google.com/speech-to-text/docs/languages">16 accents</a> of English at the time of writing this article. These accents are listed under the countries they are mainly spoken in, but this ignores the sub-dialects and English accents within those countries. For instance, the United States alone has at least <a href="https://www.thrillist.com/lifestyle/nation/american-accents-ranked">20 distinguishable accents</a>. Further, as a <a href="https://arxiv.org/abs/2006.13519">recent work</a> of research points out, there is a huge disparity even across mainstream English accents, with the Word Error Rates (WERs) being “23% or higher on datasets in Australian and Indian accents, as opposed to a WER of 13.2% on US accents.” WER is roughly the percentage of mistranscribed words.</p><h4>Domain-specific words</h4><p>Words that are not spoken often as part of mainstream or general vocabulary are out-of-vocabulary words for the ASR. Since spoken samples of these words are not available in large numbers in standard ASR datasets, public ASRs perform poorly while transcribing them. These domain-specific ‘entities’ include arbitrary sequences of letters and digits (such as a reference number), all types of proper nouns (names, places, organizations, brands), and most sequences of words and numbers that make up information such as email addresses and physical addresses. Accurately extracting and processing these entities is an important task.</p><h4>Magnitude of errors</h4><p>The Word Error Rate of an ASR, in general, is a good indicator of how ‘off’ its transcripts are. However, most <a href="https://blog.timbunce.org/2018/05/15/a-comparison-of-automatic-speech-recognition-asr-systems/">publicly reported</a> WER numbers are not indicative of the true magnitude of errors made by off-the-shelf ASRs when used in domain-specific contexts such as in customer support calls. For instance, <a href="https://venturebeat.com/2019/05/10/probeat-has-googles-word-error-rate-progress-stalled/#:~:text=Back%20in%202013%2C%20Google&#39;s%20speech,transcribes%20every%2025th%20word%20incorrectly.">this report </a>from last year pegs GCP’s WER at 4.9%, indicating that over 95% of the words are transcribed correctly.</p><p><strong>However, even the best real-time GCP ASR gave us a WER of over 33% on phone call recordings of customer support calls — it could only transcribe two-thirds of the words correctly.</strong> To put this in perspective, imagine talking to a person whose every third word, you mis-hear.</p><p>More significantly, the words that are disproportionately highly mistranscribed are, in fact, the words that are most crucial to goal-oriented conversations. These are the ‘entities’ or domain-specific words mentioned before. If you call a banking voicebot to block your credit card, the call is a no-go if it can’t get your credit card number and bank account information transcribed correctly. If it is unable to get your name or date of birth correctly, it cannot verify that you are indeed the legitimate holder of the card. The ASR is most likely to get exactly these pieces of information wrong simply because it has not been trained to transcribe many hours of audio containing entities of these sorts conveyed over a phone line. As Figure 1 shows, GCP’s real-time ASR mistranscribed email addresses around 90% of the time, mailing addresses 36% of the time, and zip codes 29% of the time in these calls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/0*hUJ6ZYnE7T2TPvE_" /></figure><p>Figure 1</p><h4>Conversational Design accounting for ASR errors</h4><p>The possibility that information might be mistranscribed is unique to voicebots. While it is possible that one could make spelling errors while interacting with a text-based chatbot, these errors are far fewer and more deterministic than ASR mistranscriptions. Most notably, in the case of text-based chatbots, the text of the information that the bot receives is the same as that typed in by the customer. ASR errors mean that this is not true in the case of voicebots — what is said by the customer might not be what is read by the bot.</p><p>This makes designing conversations tricky. If the bot were to verify everything the ASR transcribed by repeating it back to the customer, that would make for a long and onerous conversation. However, it is crucial that it gets certain entities right, for security reasons and otherwise. These trade-offs made during conversation design form the core of the user experience offered by the bot.</p><h3>VAD</h3><p>Not only are ASR errors a challenge, but it turns out merely knowing whether the customer has finished speaking itself is not a trivial task. While Voice Activity Detection (VAD) has come a long way since its early days, state-of-art VAD models (simply VADs, hereon) still find it hard to confidently say whether a customer is still speaking. VADs are particularly sensitive to background noise and are easily confused by other people talking in the background.</p><p>I highlight just two fundamental issues with VAD — false positives and false negatives — in the interest of brevity. False positives occur if the VAD believes that the customer is still speaking when, in reality, they are not. This can cause the bot to wait for longer than it should, leading to awkward pauses. On the other hand, false negatives occur if the VAD falsely concludes the customer is not speaking, even before they stop talking. Consequently, the bot might start talking over the customer, responding to an incomplete customer utterance.</p><h3>UX</h3><p>While seamless user experience (UX) is a key consideration throughout this article, this section focuses on three illustrative but not limiting aspects — latency, speech characteristics and voice persona.</p><h4>Latency</h4><p>A salient aspect by which voice conversation differs from chat is its ‘blocking’ nature. Being on a phone call demands more dedicated attention from the customer because of its real-time nature, distinguishing it from texting, where texts can be read or re-visited intermittently. This places the responsibility of keeping the time it takes to respond to a minimum, on a voicebot. A slight delay in a chatbot’s response might be pardonable to customers who are free to perform other tasks while also texting. By contrast, a voicebot that is slow on the uptake can be quite annoying to talk to. Further, if a voicebot treats customers to a bout of silence while its cogs of comprehension turn slowly, chances are they will assume that it hasn’t understood them, and will end up repeating themselves. These considerations notwithstanding, speaking with a droid that’s making you wait around for a few seconds after everything you say, is just unnatural.</p><h4>Challenges</h4><p>Let’s for a moment assume a very rudimentary voicebot that was indeed an ASR + chatbot + TTS. There are now two extra modules added to a chatbot, both of which involve real-time processing of audio, but the voicebot must also have much lower latency than is acceptable with a standalone chatbot. Sending audio over the network, converting it to text, converting text back to speech, and sending it back over the network together can be quite time-consuming. Figure 2 and Figure 3 show respectively the latency incurred by GCP in converting speech to text (ASR) and text to speech (TTS) as a function of the number of words in the text.</p><p>A customer speaks about 16 words per turn, and an agent speaks about 23 words per turn, both on an average. Even assuming our rudimentary voicebot instantaneously generated text responses from ASR transcripts, it would still have to a) wait for the ASR to finish transcribing the customer’s turn, and b) wait while the TTS converted all of its own text response to speech.</p><p><strong>This combined latency alone is close to five seconds (factoring in network latency in moving audio in receiving and sending audio). Five seconds is a substantially long time if you consider that a good part of this time is just silence while you wait for the bot to reply.</strong></p><p>This, of course, does not include the extra time taken by the bot to understand what the customer has said and to generate a text response in a real-world scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/0*OuDPocJhCvItJLd0" /></figure><p>Figure 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*wQ0i0mr_0L22t9lU" /></figure><p>Figure 3</p><p>Owing to these high latencies, a rudimentary chaining of an ASR, a chatbot and a TTS, cannot make for a voicebot that offers smooth UX.</p><h4>Speech Characteristics</h4><p>As a medium of communication, speech is richer than text in that it carries ‘prosody’. Prosody is used to describe the set of features such as intonation, tone, emphasis, and acoustic features such as pitch and loudness. Together, these ‘prosodic features’ convey context about a speaker that goes beyond just the words of their speech. Humans rely on prosody when communicating with each other to establish a shared context comprising elements such as emotion, urgency, assuredness, and empathy. <a href="http://www.kaaj.com/psych/smorder.html">Landmark studies</a> by the psychologist Albert Mehrabian have led to the now-famous ‘7–38–55 rule’: the total impact of a message is a) about 7 percent verbal (words only), b) 38 percent vocal (including tone of voice, inflection, and other sounds) and c) 55 percent nonverbal (body language).</p><p>Hence, because humans innately rely on voice prosody as a significant part of their communication, it is natural for customers to expect a voicebot to understand their emotions and context, through their voice. The urgency of an issue, the exasperation of a bot possibly not understanding them, the need to be transferred to a human agent immediately are all cases in point. These would be expressed explicitly in words while interacting with a text-chat bot, making it easier for text-based models to pick up on such cues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P9b80NEGwyJFLY7N" /></figure><p>Figure 4</p><p><a href="https://www.aclweb.org/anthology/P19-1050/">Source</a></p><h4>Challenges</h4><p>Detecting emotion and other cues from speech is a nascent field of research. <a href="https://www.aclweb.org/anthology/P19-1050/">Recent work</a> performed emotion detection on a clean dataset of dialogues from <em>Friends</em>. This is a high-quality audio dataset (unlike phone calls), and the task was to extract a few high-level emotions (such as happiness, sadness, anger, etc.).</p><p><strong>Even in this experimental setting, the reported emotion detection accuracies (F1-scores, for the more technically inclined) were only in the range of 7% to 55% depending on the emotion detected.</strong></p><p>Figure 4 shows these numbers. Research has just scratched the surface of using prosodic features to extract meaningful context from speech.</p><h4>Voice Persona</h4><p>Depending on their context, customers calling into a phone line might need to be reassured, empathized with, and even placated sometimes. A seasoned customer support agent recognizes this and adapts their voice persona to the customer’s demographic and calling context. Similarly, the voice element brings a bot closer to life, affording it the possibility of a more distinct and adaptive persona than a text chatbot. However, this also comes with the flipside. A robotic-sounding voicebot that fails to capitalize on the possibilities offered by voice lends a markedly more monotonous overtone to the conversation than a text chatbot does, for instance.</p><p>These are a few challenges and considerations while building virtual voice AI agents. We continue to address each of them, enabling Agara to push the boundaries of conversational voice AI. Read our <a href="https://agara.ai/conversational-ai-blog/technology/achieving-high-accuracy-in-speech-recognition/">blog post</a> on how Agara achieves high accuracy in speech recognition to know about how we’re exceeding the performance of state-of-art ASR models. Look out for more such under-the-hood details as well as insights in our future blog posts!</p><p><em>This article is also published in the </em><a href="https://agara.ai/conversational-ai-blog/technology/voicebot-asr-chatbot-tts/"><em>blog section</em></a><em> of Agara’s website.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e7be52fdd8d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/agara-labs/voicebot-asr-chatbot-tts-4e7be52fdd8d">Is a voicebot just a chatbot with voice processing capabilities?</a> was originally published in <a href="https://medium.com/agara-labs">Agara</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Generative Style Transformer]]></title>
            <link>https://medium.com/agara-labs/the-generative-style-transformer-3564bce04d04?source=rss-763e4c5e2ef3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3564bce04d04</guid>
            <category><![CDATA[agara]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[style-transfer]]></category>
            <category><![CDATA[emnlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Akhilesh Sudhakar]]></dc:creator>
            <pubDate>Thu, 19 Dec 2019 11:41:52 GMT</pubDate>
            <atom:updated>2020-01-06T14:14:32.888Z</atom:updated>
            <content:encoded><![CDATA[<p>This post explains our paper on style transfer, “Transforming Delete, Retrieve, Generate Approach for Controlled Text Style Transfer” (presented at EMNLP 2019) in a more accessible manner.</p><p>The paper can be found <a href="https://www.aclweb.org/anthology/D19-1322/">here</a>. Our Github <a href="https://github.com/agaralabs/transformer-drg-style-transfer">repo</a> contains code and instructions for replicability.</p><p><strong>The What</strong></p><p>Our paper proposes a method to perform text style transfer. ‘Style’ of text is a term that the Natural Language Processing (NLP) community has borrowed from socio-linguistics, and uses rather loosely. Style transfer involves re-writing text of a certain style into a new target style, such that only the style of the text is changed while retaining its core meaning (or style-independent content). We show the following types of style transfer in the paper: a) re-writing reviews from positive to negative sentiment and vice versa (YELP and AMAZON datasets), b) re-writing factual sentences to humorous and romantic ones (CAPTIONS dataset), c) re-writing democrat-written political social media posts to republican-written ones and vice versa (POLITICAL dataset), and d) re-writing reviews written by females to male-written ones and vice versa (GENDER dataset). Thus, in our work, the notion of style varies from sentiment to humor and romance, to political slant and to gendered-ness.</p><p><strong>The Why (Research POV)</strong></p><p><em>Why is the NLP community interested in style transfer?</em></p><p>The NLP research community is interested in style transfer methods for a variety of applications. One set of these is targeted at anonymizing identity online, for instance, by obfuscating the author’s gender in social media posts. Doing so could prevent targeted gender-based advertising, abuse of privacy, and discrimination. The same approach can be extended to other attributes of the user — age, race, geography, etc. Another set of applications are in dialogue generation for conversations. To convey the same message during a conversation, humans introduce variations based on the context. This is modeled as style transfer from a message to its appropriate variation. Other works use style transfer to generate poetry and to re-write formal texts to informal and vice-versa.</p><p><strong>The Why (Agara POV)</strong></p><p><em>Why are we at </em><a href="https://agara.ai/"><em>Agara</em></a><em> interested in style transfer?</em></p><p>We build conversational systems that hold conversations in different customer support related topics, across diverse call contexts. Style transfer is important to us for two reasons.</p><p>One of them is that Natural Language Generation (NLG) itself is a hard problem, and state-of-art NLG systems (such as those for summarization and dialogue generation) are nowhere close to the human-level when they attempt to generate text from scratch. Given that these systems are data-hungry deep learning models (hello, big Transformers), data sparsity is one of the main reasons, if not THE main reason, that these models perform poorly.</p><p>The question we ask is: <em>do our conversation models really need to generate utterances from scratch?</em> What if we could a) <strong>‘retrieve’ </strong>an utterance spoken in a similar context by a human agent, similar to what we intend to generate, and b) <strong>re-write</strong> (a.k.a. style transfer!) the retrieved utterance to the desired utterance?</p><p>This would result in better quality generated utterances since the model now has to learn the easier task of only making edits over the retrieved utterance vs. generating it from scratch. Also, since a good part of the retrieved human utterance will be retained as is, there is a lesser scope for generating malformed utterances.</p><p>The second reason style transfer is useful to us is that it allows us to control <strong>how</strong> our conversational agent conveys the same message, according to the <strong>context</strong> of the call. <em>Does the customer sound vexed about a problem they have been facing for a while, and need to be reassured that a solution will be arrived at? Are they in a situation where they need to be spoken to empathetically? Or do they need to be informed politely that their request cannot be fulfilled at the moment? </em>The same message to be conveyed can be adapted to these different cases using style transfer.</p><p><strong>The Data</strong></p><p><em>Back to the paper.</em></p><p>Since there isn’t any dataset available that pairs the same sentences but of different styles with each other, i.e., a parallel corpus, we approach this task in an unsupervised fashion in our paper. What we do have though, are datasets that contain a set of example sentences for each style. We leverage these datasets.</p><p><strong>The How</strong></p><p>First, we note that the style of a sentence is localized to a small subset of words of a sentence. We call these words <strong>attributes</strong> and the rest of the words, <strong>content</strong>. Let’s take an example from here onwards just to make things simpler.</p><ul><li>Source sentence: <em>the pizza was tasty</em></li><li>Content: <em>the pizza was.</em></li><li>Attribute(s): <em>tasty</em></li></ul><p>We model style transfer in the Delete-Retrieve-Generate framework <a href="https://www.aclweb.org/anthology/N18-1169/">(Li et al., 2018)</a>. This framework:</p><ol><li><strong>Deletes </strong>only the set of attribute words from the source sentence to give the content (<em>the pizza was ̶t̶a̶s̶t̶y̶)</em></li><li><strong>Retrieves</strong> attributes from the target style corpus (<em>horrible)</em>, and</li><li><strong>Generates </strong>the output sentence from the content and retrieved attributes (<em>the pizza was horrible)</em></li></ol><p>For 1., we train a <strong>Delete Transformer</strong> (<strong>DT</strong>), which is a <a href="https://arxiv.org/abs/1810.04805">BERT</a> classifier that is trained to predict the style of a given sentence. This training is possible because of the datasets we have. For a given source sentence (<em>the pizza was tasty</em>), we use the attention weights of the classifier to decide which words are attribute words. Since attribute words contribute to deciding the style of the sentence, the trained classifier pays higher attention to them. Hence, words that receive high attention weights when fed to the classifier, can be treated as attributes (<em>tasty</em>). These attributes are removed from the source sentence to give the content (<em>the pizza was</em>).</p><p>For 2., we find the closest sentence in the target style’s dataset (<em>the sushi was horrible</em>), based on how similar its content (<em>the sushi was</em>)<em> </em>is to the source’s content (<em>the pizza was</em>). The attributes of this closest sentence from the target corpus, are our retrieved attributes (<em>horrible</em>).</p><p>For 3., we propose and train the <strong>Generative Style Transformer (GST)</strong>. GST initially has the same architecture and pre-training as the <a href="https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf">GPT</a> and is thus, initially a powerful decoder-only language model.</p><p><strong>The Models</strong></p><p>GST is then trained in 2 variants — <strong>B-GST (Blind GST) </strong>and <strong>G-GST (Guided GST) — </strong>2 separate models that are independently trained and whose outputs are compared with each other. Both take as input the source sentence’s content (<em>the pizza was</em>) and generate style-transferred output (<em>the pizza was horrible)</em>. They differ in the additional inputs each of them takes, apart from the source’s content:</p><ol><li>B-GST additionally takes as input: the target style (&lt;<em>negative&gt;)</em>.</li><li>G-GST additionally takes as input: the retrieved attributes (<em>horrible</em>).</li></ol><p>The figure below shows the generation using G-GST. B-GST is similar except that it does not have a retrieve component. [ATTRS] is a special token representing the start of the attributes section, [CONT_START] represents the start of the content section, and [START] indicates to the model that it has to start generating the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Dg1tLXmZyYrFHxtDkaLMw.png" /><figcaption>Figure 1 from our paper. Generation using G-GST, with an example of sentiment transfer.</figcaption></figure><p><strong><em>Why These Variants?</em></strong></p><p>B-GST is a model that generates output by placing the most appropriate target attributes in the given content, which it learns on its own from the distribution of the dataset. This variant is useful when there aren’t enough examples or enough attribute-coverage in the target style to find the closest match to ‘retrieve’ attributes from.</p><p>G-GST, on the other hand, is a model that generates output by placing the given attributes in the given content. This variant is useful when explicit control is required over the attributes to be used in the output, and when a good ‘retrieval’ mechanism can make it simpler for GST to generate good outputs.</p><p><strong><em>How are the GSTs trained if there’s no parallel corpus?</em></strong></p><p>By reconstruction. Since there’s no parallel corpus to train the GSTs on, they are simply trained to reconstruct the input. This method is possible, it works and it generalizes well to inference time because both GSTs take the source content as input and not the entire source sentence as is.</p><p><strong>Sample Outputs</strong></p><p>Below are sample outputs from the paper. SRC is the source sentence. SE, D, and D&amp;R are previous state-of-art models explained in the paper. B-GST and G-GST are our models. YELP, AMAZON, CAPTIONS, POLITICAL, and GENDER are the datasets, each used for a different style transfer task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*Y8XnIQtJV0PjTXmLIRoKxg.png" /><figcaption>Table 6 from our paper. Sample outputs of our models compared with previous state-of-art models.</figcaption></figure><p>From these examples, you can see that our models perform style transfer better than the previous state-of-art models do (the paper provides metrics to justify this quantitatively too). Our models’ output sentences are more fluent and natural-sounding, retain the content of the input sentence better and match the target style better.</p><p><strong>What makes the GSTs produce better outputs than previous models?</strong></p><p><em>Learnings and takeaways.</em></p><p>For one, using the architecture and pre-training of the GPT, which combines the power of both the transformer and massively pre-trained language models. Previous models that used LSTMs (for instance) fail at generating longer and more complex sentences.</p><p>Second, using BERT’s attention weights to delete attribute words works better than previous methods that attempted to use a deletion-based approach. This could be because BERT also combines the power of transformers and massive pre-training (as a Masked Language Model).</p><p>Lastly, the datasets that we used all required only localized edits on input sentences to transform them into the output. Most previous works don’t leverage this observation while we do so in using the delete-retrieve-generate framework.</p><p><strong>What next?</strong></p><p><em>Where are we at </em><a href="https://agara.ai/"><em>Agara</em></a><em> headed with this line of work?</em></p><p>To improve the quality of style transfer itself, we’re working on using reinforcement learning. We’re also looking at shaping the attention weights of the Delete Transformer such that the shaped attention weights are better indicators of attributes. Further, we will adopt the delete-retrieve-generate mechanism in our conversational agents, as mentioned earlier on in this blog.</p><p>More updates on all of the above will follow in our future blog posts.</p><p><em>Do check out our </em><a href="https://www.aclweb.org/anthology/D19-1322/"><em>paper</em></a><em> for more detailed explanations of our work!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3564bce04d04" width="1" height="1" alt=""><hr><p><a href="https://medium.com/agara-labs/the-generative-style-transformer-3564bce04d04">The Generative Style Transformer</a> was originally published in <a href="https://medium.com/agara-labs">Agara</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>