This workflow demonstrates how to improve a chat model's performance by applying fine-tuning.
Ultimately, we compare the output of the 'Just KNIME it!' challenge descriptions, designed to test chat models' accuracy, based on our input: Title: UEFA Euro 2024 Winner Prediction and Level: Hard.
You can download and run the workflow locally. For optimal performance, please use the latest version of the KNIME Analytics Platform.
Workflow Step-by-Step
Prepare Fine-Tuning Data
Parse PDF Files: Extract the challenge descriptions and levels of difficulty from the PDF files containing all challenges from the first two seasons of "Just KNIME it!" (see the output of the "Extract Challenges" metanode).
Format Data: Prepare the data for the Fine-Tuning input port as the OpenAI Chat Model Fine-Tuner requires. The data should be presented across three columns:
A column specifying a conversation ID.
A column representing the role of a message (system, assistant, and user).
A column for the content of the message.
Ensure the table includes at least ten conversations, each containing at least one system message (see the Prepare Conversations metanode output).
Fine-Tune the Chat Model
Pass the fine-tuning data to the OpenAI Chat Model Fine-Tuner node and execute it. This process can take some time.
Generate Challenge Descriptions
Use two Chat Model Prompter nodes: one connected directly to the OpenAI Chat Model Connector node and the other to the OpenAI Chat Model Fine-Tuner node.
Use the same system message for both nodes: "You are a Just KNIME it challenge generator. As input, you receive a difficulty level and a title for the challenge, and your task is to create a description for the challenge."
Provide the same input message: "Title: UEFA Euro 2024 Winner Prediction Level: Hard."
Visualize and Compare Outputs
Click the lens icon in the component to open the visualization and compare the responses from the untuned vs. fine-tuned chat model prompters. The fine-tuned Chat Model Prompter response should be very close to the real "Just KNIME it!" challenge descriptions.