Skip to main content

Fine-tune a model with your own data

Fine-tuning trains a general-purpose AI model further on your own examples, so it gets better at your tasks. You build a dataset of examples, launch a fine-tuning run on it, and deploy the result to the AI Model Registry.

What is fine-tuning?

A base model is a general, pretrained AI model (see LLMs) that already knows a lot but nothing about your particular use case. Fine-tuning nudges that base model toward your data by showing it more examples. Those examples live in a dataset: a collection of inputs and the outputs you'd like the model to produce. In Rational AI this is a two-part job: you build a dataset under Datasets, then train on it under Fine-Tuning.

Prerequisites​

Before you start, make sure you have:

  • The Rational BI module in your license: datasets and fine-tunings are refused without it (see License and activation).
  • Permissions: the Datasets and Fine-Tuning rows of your role, with Create to build datasets and launch runs.
  • A base model available: at least one model you can train from, visible in the AI Model Registry.
  • Training examples ready: either a dataset file to upload, or recorded traffic and events you can build a dataset from.

Create a dataset​

A dataset is the training data a fine-tuning run learns from. Go to Settings → Datasets and select New. For every field and format, see Datasets.

The New menu on the Datasets page showing From file and From events options

Creating a dataset: upload a file, or build one from activity Rational AI has already captured.

From a file​

Choose From file when you already have your examples prepared as a dataset file. Upload the file, and Rational AI reads its entries into a new dataset.

From recorded traffic​

Use this option to fine-tune an agent. Each recorded model call is the conversation the model saw, including the system prompt, the tool calls it made, and what those tools returned, so the dataset captures the agent's real behavior.

Select New → From recorded traffic, then filter down to the examples you want:

  • Touchpoints: which agents' traffic. Leave it on All for every touchpoint.
  • Models: which models produced it.
  • From: the period to take traffic from.
  • Successful calls only: exclude the calls the provider refused.
  • Maximum examples and Held out (%): how many examples to keep, and what share to hold out for measuring.

The counts update as you type: how many requests match, how many become training examples, and how many are held out. Select Create dataset.

Dataset entries are copies of the content they were built from, so data retention periods don't remove them.

From events​

From events builds a dataset from conversation messages. It works when no model calls were recorded. Each message carries only the text of a turn, with no system prompt, tool call or tool result, so it can't teach an agent how to use tools. Use recorded traffic where you have it.

Curate a dataset​

A dataset built from real traffic contains examples you don't want to train on. Open the dataset to see its entries as conversations, each with a chip showing whether it's a training or held-out example.

  • To remove an example, select Remove example on it.
  • To correct one, select Edit example. It opens as JSON. A format that can't be edited says so.

The held-out examples are never trained on. The run is scored against them, so the score reflects examples the model hasn't seen. The split is set when the dataset is created and spread across the whole dataset.

Start a fine-tuning run​

With a dataset in place, go to Settings → Fine-Tuning. The table here lists your runs by Name, Base model, Training dataset, and Created at.

Select New to open the New fine-tuning dialog, then fill it in:

  1. Enter a clear Name and a short Description so your team can tell runs apart later.
  2. Pick a Base model (the existing model you want to train further).
  3. Select a Dataset, the training data the model will learn from.
  4. Review the training and adapter parameters (explained below), then select Launch.
  5. Confirm with Start training. You'll see "Fine-tuning launched" and the run appears in the list.

If the training job can't be started, the run is still saved. Check its status, then select Start training on it instead of creating a new run.

The New fine-tuning dialog with base model, dataset, and training parameter fields

Starting a fine-tuning run: pick a Base model and a Dataset, set the training parameters, then Launch.

Training parameters​

These settings control how the training runs:

  • Learning Rate: how big an adjustment the model makes at each step, picked from a list of values from 1e-5 to 5e-4. The default is 2e-4.
  • Batch Size: how many examples the model looks at before each adjustment. The default is 1.
  • Epochs: how many full passes the run makes over the whole dataset. The default is 1.

Adapter settings​

Fine-tuning trains a small adapter (a LoRA adapter) on top of the base model. Three settings, in the collapsible LoRA parameters section, control how much the adapter can learn:

  • Rank: how much capacity the adapter has, 16 by default. Raise it when a run isn't learning enough from your examples or the task is more varied.
  • Alpha: how strongly the adapter's contribution is scaled, 16 by default. It is usually equal to the rank, so while the two are equal, changing Rank changes Alpha with it.
  • Dropout: how much regularization is applied during training, between 0 and 0.99, 0 by default. Raise it if the model starts memorizing your examples instead of learning from them.

Start with the defaults, and change one parameter at a time once you have a first result to compare against.

Watch a run​

Select a run in the list to open its drawer. It refreshes every few seconds while the run is live:

  • Status: Pending, Training, Completed, Failed or Cancelled, along with who created the run and its Duration.
  • Progress: a bar with the percentage, the current step and the latest loss.
  • Learning curves: a chart of Training loss and Evaluation loss step by step. Training loss falling while evaluation loss flattens or rises means the model is overfitting, and is the signal to stop.
  • Error: the failure reason, if the run fails.
  • Parameters: the batch size, epochs, learning rate and LoRA settings the run actually used.

The chart shows the latest 2,000 measurements; the complete history is in the run's training artifacts (see below). If the measurements can't be loaded, the drawer says so and offers Reload measurements to try again.

The drawer's ⋮ menu holds what you can do with the run:

ActionWhen it's offeredWhat it does
Cancel runWhile trainingStops the training job and releases its GPUs. Saved checkpoints are kept.
Retry runFailed or canceledStarts the same run again, from its latest complete checkpoint when there is one.
Start trainingPendingCaptures the dataset as it is now and starts training.
Re-runAlwaysOpens the dialog pre-filled with this run's settings, to launch a new run with different parameters.
Edit detailsAlwaysChanges the name and description only.
Download training artifactsCompleted or failedDownloads everything needed to audit or reproduce the run.
DeleteNot while trainingRemoves the run.

Cancel a run you've already learned from, to free its GPUs.

Resume a run instead of starting over​

While it trains, a run saves a checkpoint every 100 steps, and the first time it starts it captures its training inputs: the dataset entries, the model and the configuration.

Retry run picks up from the latest complete checkpoint, using those same captured inputs. If no checkpoint was saved yet, training starts again from the beginning.

A retry trains on the inputs captured when the run first started, so editing the dataset afterwards doesn't change it. To use different data, a different base model or new parameters, select Re-run to create a new run.

Use your fine-tuned model​

When the run finishes, Deploy in its drawer makes the fine-tuned model available in the AI Model Registry alongside your other models. From there you use it like any other model.

Take the weights with you​

To run the model somewhere else, or keep a copy outside the platform, open the run's ⋮ menu in the list and select Download weights. It is enabled once the run is Completed, and downloads <run name>-weights.tar.gz: the trained LoRA adapter, its configuration and the tokenizer, ready to load on top of the same base model.

Download training artifacts, in the drawer, is the bigger package: <run name>-training.tar.gz with the captured inputs, the resumable checkpoints, the configuration and the full measurement history. It needs read access to both the run and its dataset, since it contains the training data.

Next steps​