Photo by Matthew Henry on Unsplash

Fine-Tuning co:here Natural Language Generation

And How NLG Is Vital To Truly Conversational Agents

Cobus Greyling
8 min readMay 18, 2022

--

Introduction

A short recap for starters…co:here is a natural language platform. It can be used for both natural language understanding and generation.

In the conclusion the output from two NLG models are compared, one model trained on ambiguous, overlapping and contradictory data. The second model on clean, domain specific data with short sentences.

co:here is an easy avenue to access large language models, for use cases like:

  • Classification,
  • Semantic Search,
  • Paraphrasing,
  • Summarisation, and
  • Content Generation.

The speed and ease with which you can enter your own data, experiment fast and export API details from the playground for use in more production ready environments is very attractive.

Clustering related customer utterances in a visual manner.

👇🏼 Read more on clustering here:

Impediments to NLP Access

Generally Impediments to NLP access are:

  • Requirements for large datasets for training
  • Long training times
  • Specialised hardware
  • Specific knowledge

All of these are negated with the help of a playground. Leveraging pre-trained large language models, small amounts of own data can be used to rapidly achieve results.

The playground can act as an incubation area for projects to evolve into API’s, notebooks and general collaboration.

As seen above, the playground can act as an incubation area for projects to evolve into API’s, notebooks and general collaboration, eventually culminating in a product or application.

All co:here playground activity can be exported in various formats.

Above, all co:here playground activity can be exported in various formats.

Something to keep in mind with the co:here playground is that you will soon outgrow the playground in terms of:

  • Size of datasets
  • Customisation of results
  • Pre and Post Processing
  • Collaboration
  • and Obviously Integration

Hence the next step is notebooks and or API’s for collaboration and adding complexity, and finally productionising the functionality.

But what if the play can continue, and the playground can expand into a full-fledged no-code workbench…absorbing all the iterations from play to production in one cohesive no-code interface?

“The master in the art of living makes little distinction between his work and his play, his labor and his leisure, his mind and his body, his information and his recreation, his love and his religion. He hardly knows which is which. He simply pursues his vision of excellence at whatever he does, leaving others to decide whether he is working or playing. To him he’s always doing both. ”

― James A. Michener

Fine-Tuning co:here NLG

There are various options for NLG in the co:here playground, and we have seen quite a bit of NLG is used for automated copy writing, add creation and sumarization.

Below a sentence is given and co:here NLG completes the sentence. No fine-tuning was involved, and when running the routine, disparate and different results are given.

co:here text completion, the marked green text was entered, and the bold subsequent text was generated. This was on the fly with no fine-tuning.

Below, is the notebook view of the playground example, execution speed is quick.

The same code executed within a notebook.

As seen below, fine-tuning models are listed here, and the fine-tuning can be launched with the click of button.

Fine-tuning models are listed here, and the fine-tuning can be launched with the click of button.

The separator needs to be defined and the text file can be uploaded. There is a minimum and ideal size for the test file.

The separator needs to be defined and the text file can be uploaded. There is a minimum and ideal size for the test file.

Prior to the launching of the fine-tuning process, samples of the txt file can be viewed.

Prior to the launching of the fine-tuning process, samples of the txt file can be viewed.

The initial status is queued, and from here the steps are: Processing data, Finetuning, Exporting Model, Deploying API and lastly Ready.

The initial status is queued, and from here the steps are: Processing data, Finetuning, Exporting Model, Exporting Model, Deploying API and lastly Ready.

Progress can be tracked and an email is sent when the model is ready to be used.

Progress can be tracked and an email is sent when the model is ready to be used.

Fully trained model and ready to be tested in the playground.

Fully trained model and ready to be tested in the playground.

The fine-tuned model is listed with the other baseline models.

The fine-tuned model is listed with the other baseline models.

Why Natural Language Generation?

There is much talk about moving from a messaging bot to a truly conversational agent. In general we have progressed down the line from a click to navigate chatbot to more conversational interfaces. A few steps are required to get to a truly conversational interface.

These might include:

  • Merging or blurring the lines between the four pillars of conversational frameworks, intents, entities, dialog flows and messages.
  • Structure being added to intents and augmented intent management.
  • Intents and Entities are merging
  • More flexible dialog state management
  • And NLG

Read more about this here

Many of these elements are already evident in the Garner Conversational AI leaders.

Updated: As chatbot functionality moves towards a truly flexible conversational agent, with virtually unrestricted compound natural language employed, certain changes need to take place. These are all listed on the left. Mass adoption of these new technologies will always lag behind availability.

As seen above, while chatbot functionality moves towards a truly flexible conversational agent, with virtually unrestricted compound natural language employed, certain changes need to take place. These are all listed on the left. Mass adoption of these new technologies will always lag behind availability.

Moving to a true conversational agent is also dependant on

  • The AI tools being available, and
  • Adoption of these tools.

Control & Flexibility

One of the biggest apprehensions around NLG is the danger of unpredictable, unwanted and unplanned response language being generated by the NLG.

The ultimate control is having a fixed and finite piece of text for every conceivable response to the user. Here values are often inserted within the text, very IVR like. (maximum control & minimum flexibility)

The ultimate freedom is to generate the conversational agent responses on the fly in realtime with no predefined script. All based on the context of the conversation. (maximum flexibility & minimum control)

Creating a conversational framework is a process of creating an abstract of conversational elements, and orchestrating it in a framework where a user can re-create natural conversations. NLG also requires this environment where NLG can be orchestrated and finetuned for reliable implementations.

Control and flexibility; these two need to be in balance:

  • Control without Flexibility negates key conversational elements like digression, disambiguation, clarification, domain/relevance, compound intents & entities.
  • Flexibility without Control definitely has a certain allure, but this gives rise to the lack of affordances for fine-tuning conversations. This is very much the case with OpenAI’s Language API. Immense flexibility which is enticing, but limited fine-tuning.

Conclusion

The process of fine-tuning is time-consuming and a large amount of data is required for the process. Key contributors to adoption will be:

  • Prepared domain specific data sets which can be edited and used for training.
  • Shorter training time for rapid iterations of training, testing & editing training data would be ideal.
  • Regarding raining time, for generation, using a small model type, 3 to 5 hours. For representation it was significantly faster…going through iterations to tweak the NLG will be extremely time consuming. Especially in cases where a few iterations are required, or if the domain grows.
  • Having an improved interface for guided crafting of training data.
  • What might be convenient is an option to partial train on a sample of data for a more incremental approach.
  • The two examples below indicates the importance of clean, coherent and related data. This first example is text generated using a model trained on very ambiguous, unordered data. The training data also have no distinct or specific domain or area of relevance. There was also much overlap in topics and sequence of words.
  • The example below is based on a model trained on a banking / commerce customer utterances. And it generates questions a customer might ask pertaining to a specific topic or product listed as the source text to generate. The result is very accurate. A relevant implementation of this would be for a disambiguation menu. The user enters the words “termination fee” and four suggested intents are surfaced.

--

--