heidloff.net - Building is my Passion
Post
Cancel

LoRA Fine-tuning without Code in Watsonx.ai

Watsonx.ai is IBM’s next generation enterprise studio for AI builders to train, validate, tune and deploy AI models. This post describes how to do LoRA-based fine-tuning with the Tuning Studio without having to write code.

In one of my previous posts I explained LoRA Fine-Tuning. In summary fine-tuning with LoRA requires far less resources and is much faster than classic fine-tuning which changes all weights.

To make fine-tuning more efficient, LoRA’s approach is to represent the weight updates with two smaller matrices […] These new matrices can be trained to adapt to the new data while keeping the overall number of changes low. The original weight matrix remains frozen and doesn’t receive any further adjustments. To produce the final results, both the original and the adapted weights are combined.

Let’s look how the example in my earlier post can be fine-tuned with Watsonx.ai. The dataset is the same one: samsum. The goal is to improve FLAN-T5 XL (3b) to summarize chat dialogues.

Prepare Data

The training set has 14.7k rows. You can download it from Hugging Face. To provide the structure Watsonx.ai expects, change ‘dialogue’ to ‘input’ and ‘summary’ to ‘output’. Furthermore, remove the lines with ids. Tools like Visual Studio Code are your friend. To remove the id lines, Find and Replace can handle regular expressions like “id”: “(.+?)”,.

In Watsonx.ai choose ‘Summarization’:

image

Upload the data:

image

Fine-tuning

Define the parameters:

image

Start the fine-tuning. For only 5 epochs it took less than one hour.

image

Try the new Model

The additional parameters can be download:

image

Let’s look at a sample dialogue which was not part of the training data.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Max: Know any good sites to buy clothes from?
Payton: Sure :) <file_other> <file_other> <file_other> <file_other> <file_other> <file_other> <file_other>
Max: That's a lot of them!
Payton: Yeah, but they have different things so I usually buy things from 2 or 3 of them.
Max: I'll check them out. Thanks.
Payton: No problem :)
Max: How about u?
Payton: What about me?
Max: Do u like shopping?
Payton: Yes and no.
Max: How come?
Payton: I like browsing, trying on, looking in the mirror and seeing how I look, but not always buying.
Max: Y not?
Payton: Isn't it obvious? ;)
Max: Sry ;)
Payton: If I bought everything I liked, I'd have nothing left to live on ;)
Max: Same here, but probably different category ;)
Payton: Lol
Max: So what do u usually buy?
Payton: Well, I have 2 things I must struggle to resist!
Max: Which are?
Payton: Clothes, ofc ;)
Max: Right. And the second one?
Payton: Books. I absolutely love reading!
Max: Gr8! What books do u read?
Payton: Everything I can get my hands on :)

The original FLAN-T5 XL model returns this:

1
Max will check out the sites Payton recommended.

image

The fine-tuned FLAN-T5 XL model returns this:

1
2
3
Payton recommends Max some good sites to buy clothes from. 
Payton likes shopping but doesn't always buy. 
Payton likes reading books.

image

Next Steps

To learn more, check out the Watsonx.ai documentation and the Watsonx.ai landing page.

Featured Blog Posts
Disclaimer
The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.
Contents
Trending Tags