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 Transformers and Generative Models

The Transformer, released by Google in 2017, is the corner stone architecture of many advanced AI models. Thanks to the Transformer, accuracy of AI models has improved dramatically. However this improvement comes at a cost: neural networks based on the Transformer are extremely computation intensive.

Hugging Face is a central repository regrouping many open-source Natural Language Processing Transformer-based models. One of them, Bart Large CNN SamSum, is perfectly suited for text classification in many languages. %}

For more advanced results, it is also possible to perform text classification with generative models like LLaMA 2, Dolphin, and ChatDolphin. These models give great results, even when no input labels are provided.

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 Bart Large CNN SamSum, LLaMA 2, Dolphin, and ChatDolphin, with excellent performances. 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 text summarization here. For advanced usage, see the text generation API endpoint here. And easily test text summarization on our playground.

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