Success with fine-tuning

For readers in a hurry

  • AI models such as GPT from OpenAI can be optimized with company data by means of fine-tuning. This increases the recognition rate for difficult cases to over 90%, sometimes even over 95% - great values.
  • Fine-tuning involves training a pre-trained AI model with specific data in order to make it more sensitive to specific tasks. It is therefore trained with data from specific and relevant business transactions.
  • In the case of GPT, fine-tuning is carried out using prepared prompts in which the answers sought to the questions asked are also transferred. The data set to be analyzed with company data is also transferred so that the prompt can be applied to it.
  • Fine-tuning is no substitute for a clean database and prior optimization of the queries in order to achieve an excellent basic quality as a starting point. Fine-tuning is particularly suitable for optimizing an LLM model.

Fine-tuning is based on the same mechanisms that are used for prompting in relation to the Large Language Models (LLM). This means that a question or request is formulated (prompt) and the expected answer is given (completion). We are therefore dealing with prompt-completion pairs, which are loaded into the GPT model via an interface.

However, since the AI model is to be optimized for specific data and not for the broad database used for basic training, the underlying (company) data must also be transferred for these prompt-completion pairs. Consequently, fine-tuning is carried out using many prompt completion pairs and the corresponding data set for each pair.

Once the training is complete, the fine-tuned AI model is available to the user. In the case of OpenAI, a new API (link) is created that can be used both programmatically and via the ChatGPT visual front end. Technically speaking, we have created a way to use our own parameterization of the model for our use case with the algorithm of the AI model.

Tip to try out

If you want to create multilingual, professional explanatory or sales videos, you should take a look at the two platforms synthesia.io and HeyGen should take a closer look. While synthesia.io offers numerous different human avatars that present the desired texts with or without PowerPoint background, HeyGen is used for individual, personalized multilingual videos. Both solutions are ideal for professional videos and are highly innovative.

Fine-tuning - advanced AI training

Today, we find two types of AI models: Pre-trained and non-pre-trained. While pre-trained models, the most prominent example of which is OpenAI GPT, have been trained using an almost immeasurable amount of text and multimedia content from the Internet, see Applied AI for managers - explained clearly, non-pre-trained or "empty" models rely on the professional user to calibrate or train them for the type of data for which they want to use the model.

But there is an intermediate solution that combines the advantages of both approaches: fine-tuning.

Fine-tuning is based on a pre-trained model such as OpenAI GPT, which is then optimized with the data relevant to the use case. This data can be documents (PDF, Word, Excel from Sharepoint or a cloud storage such as Box.com etc.), but also data from an ERP system such as SAP, Netsuite, Xentral, MS Dynamics or any other proprietary company database.

The fine-tuning method explained

Fine-tuning is based on the same mechanisms that are used for prompting in relation to the Large Language Models (LLM). This means that a question or request is formulated (prompt) and the expected answer is given (completion). We are therefore dealing with prompt-completion pairs, which are loaded into the GPT model via an interface.

However, since the AI model is to be optimized for specific data and not for the broad database used for basic training, the underlying (company) data must also be transferred for these prompt-completion pairs. Consequently, fine-tuning is carried out using many prompt completion pairs and the corresponding data set for each pair.

Once the training is complete, the fine-tuned AI model is available to the user. In the case of OpenAI, a new API (link) is created that can be used both programmatically and via the ChatGPT visual front end. Technically speaking, we have created a way to use our own parameterization of the model for our use case with the algorithm of the AI model.

The success of the optimization

Fine-tuning is particularly effective when well-developed prompts and perfectly tuned AI platforms are to be extended to business-specific use cases. In one of our cases, we used order data of a specific content type for fine-tuning, whose information was completely unstructured and scattered in PDF documents.

We used fine-tuning to tell the AI model what answers we would expect based on the data and wove this data into the fine-tuning.

We have increased the basic quality of these very heterogeneous fields from a 63% recognition rate to 91% for the correct assignment of goods item descriptions - and that with just 4 fine-tuning data records!

When recognizing multi-stop addresses as part of a delivery, a 78% recognition rate at field level was increased to 96%. In both cases, the slightly older GPT-3.5 Turbo from OpenAI was used because GPT-4 does not yet support fine-tuning. We expect the recognition rates of GPT-4 Turbo to be even higher, as we can deduce from other use cases. Fine-tuning in GPT-4 is only a matter of time and has been announced for the end of 2024.

Fine-tuning is therefore a worthwhile task in order to calibrate the AI to the company's own data. This can take place in a training phase before the go-live of a project, e.g. by the helpdesk, customer service or specialists, but also during the productive phase if the accuracy needs to be improved.

Is fine-tuning the miracle cure?

No! Even in the course of fine-tuning, the prompts, the data sets selected for fine-tuning, the model selection and supplementary measures such as interactive contextual prompting ("few-shots", "one-shots") must be carefully and precisely executed or used. If the basic quality of the model operation is not right, any fine-tuning is a game of chance.

Retrieval Augmented Generation (RAG) is generally used in addition to fine-tuning. It is used to dynamically transfer large volumes of company data presented as an embedding (number) to a GPT model for utilization with the help of vector databases.

Results validation with discrete methods (e.g. RegEx) or lookups (e.g. plausibility checks) or using other specialized AI models is also used as required.

Well thought out, expertly tested and carefully implemented, fine-tuned AI models are perfect for automating complex business processes. From order entry to order planning and invoicing. There are no limits to creativity.

The "machine" takes over the repetitive tasks of humans.

About Business Automatica GmbH:

Business Automatica reduces process costs by automating manual activities, increases the quality of data exchange in complex system architectures and connects on-premise systems with modern cloud and SaaS architectures. Applied artificial intelligence in the company is an integral part of this. Business Automatica also offers automation solutions from the cloud that are geared towards cyber security.