Dialogue Summarization API

What is Dialogue Summarization?

Dialogue summarization simply is the process of summarizing a dialogue in order to immediately have a good grasp of the conversation.

Let's say you have the following dialogue:

Jules: Hey kids! How you boys doin’?
Jules: (Speaking to the guy laying on the couch) Hey, keep chillin’. You know who we are? We’re associates of your business partner Marsellus Wallace. You do remember your business partner don’t you? Let me take a wild guess here. You’re Brett, right?
Brett: Yeah.
Jules: I thought so. You remember your business partner Marsellus Wallace, don’t you, Brett?
Brett: Yeah, yeah, I remember him.
Jules: Good. Looks like me an Vincent caught you boys at breakfast. Sorry about that. Whatcha havin’?
Brett: Hamburgers.
Jules: Hamburgers! The cornerstone of any nutritious breakfast. What kind of hamburgers?
Brett: Ch-cheeseburgers.
Jules: No, no no, where’d you get ’em? McDonalds? Wendy’s? Jack in the Box? Where?
Brett: Big Kahuna Burger.
Jules: Big Kahuna Burger. That’s that Hawaiian burger joint. I hear they got some tasty burgers. I ain’t never had one myself. How are they?
Brett: They’re good.
Jules: Mind if I try one of yours? This is yours here, right?
Jules: (Picks up burger and takes a bite) Mmm-mmmm. That is a tasty burger. Vincent, ever have a Big Kahuna Burger?
(Vincent shakes his head)
Jules: Wanna bite? They’re real tasty.
Vincent: Ain’t hungry.

This dialogue is quite long and maybe you want to automatically make it shorter while keeping the main idea? So you now want to leverage machine learning in order to automatically summarize this conversation.

A dialogue summarization model would return something like this:

Jules and Vincent are associates of Brett's business partner Marsellus Wallace. They are at Brett's place and they're eating burgers. Jules takes a bite from Brett's burger. Vincent doesn't want to try it.

Interesting isn't it? As you can see, the general idea is still there, but tons of details were stripped. The summary is properly rephrased so that it is easy to read.

Why Use Dialogue Summarization?

Dialogue summarization can be leveraged in many situations. Let's give you a couple of examples.

Medical Consultation

Doctors - especially psychiatrists - often need to summarize the conversation they just had with their patient so that a peer can potentially read it and help. Doing this manually is extremely tedious and time consuming. But AI can now take care of it!

Customer Interviews

It is quite common for companies to interview their customers in order to better understand their needs. But analyzing these interviews is very long and it is quite common to see marketing teams just abandon this overwhelming task... Thanks to dialogue summarization, it is now possible to automatically process these reports so that a marketing specialist can analyze them in the blink of an eye!

Police Reports

After typing a conversation with a suspect or a witness, it can be very useful for police to automatically summarize this conversation and then make team work easier.

Job Interviews

Job interviews reports often need to be shared within the rest of the team in order to make a decision. Automatically summarizing these conversations helps speed up recruitment!

Dialogue Summarization with Hugging Face Transformers

Hugging Face transformers is an amazing library that has been recently released. It is based on either PyTorch or TensorFlow, depending on the model you're using. Transformers have clearly helped deep learning Natural Language Processing make great progress in terms of accuracy. However this accuracy improvement comes at a cost: transformers are extremely demanding in terms of resources.

Hugging Face is a central repository regrouping all the newest open-source Natural Language Processing transformer-based models. One of them, Bart Large CNN SamSum is perfectly suited for dialogue summarization.

Dialogue Summarization Inference API

Building an inference API for dialogue summarization is a necessary step as soon a you want to use dialogue summarization in production. But keep in mind that building such an API is not necessarily easy. First because you need to code the API (easy part) but also because you need to build a highly available, fast, and scalable infrastructure to serve your models behind the hood (hardest part). Machine learning models consume a lot of resources (memory, disk space, CPU, GPU...) which makes it hard to achieve high-availability and low latency at the same time.

Leveraging such an API is very interesting because it is completely decoupled from the rest of your stack (microservice architecture), so you can easily scale it independently and ensure high-availability of your models through redundancy. But an API is also the way to go in terms of language interoperability. Most machine learning frameworks are developed in Python, but it's likely that you want to access them from other languages like Javascript, Go, Ruby... In such situation, an API is a great solution.

NLP Cloud's Dialogue Summarization API

NLP Cloud proposes a dialogue summarization API that gives you the opportunity to perform dialogue summarization out of the box, based on Hugging Face transformers' Bart Large CNN SamSum model, with a good accuracy. Due to the complex computations needed for such a task, the response time (latency) is pretty high though. You can either use the pre-trained model, train your own models, or upload your own custom models!

For more details, see our documentation about dialogue summarization here.

Testing dialogue summarization locally is one thing, but using it reliably in production is another thing. With NLP Cloud you can just do both!