Run an SFT experiment

Train a supervised fine-tune in an Advanced Training project: attach an SFT dataset and pick algorithm SFT.

Prerequisites

1. Open the project

On Experiments, open your Advanced Training project.

Advanced Training project experiments table

The Advanced Training project page.

2. New experiment

Click New experiment, name it, and save to open the wizard.

New experiment dialog in advanced project

Creating a new experiment.

3. Environment step

On Environment, select your SFT dataset. The preview shows Prompt and Target.

Wizard dataset selection step with SFT dataset

Selecting an SFT dataset in the wizard.

4. Agent

Choose SFT and a pretrained model. Tune hyperparameters if you need to. Click Next.

Wizard agent step with SFT selected

The Agent step with SFT.

5. Training

Set training steps and related options, then continue to HPO or Summary.

Wizard training step

The Training step.

6. Summary

Review the configuration on Summary.

Wizard summary before train

Summary before starting the run.

7. Running experiment

Click Train. The experiment row shows status while the job runs.

Experiments table with running status

An experiment with an active training status.

From the terminal

Save a default spec from Python as run-spec.json, then submit. Copy a resource id from arena resources list.

Install the CLI and sign in (Authentication):

pip install "agilerl[arena]"
arena login
# or: export ARENA_API_KEY=arena_pat_…
import json
from pathlib import Path

from agilerl.arena import ArenaClient

with ArenaClient() as client:
    spec = client.get_default_run_spec(
        algorithm="SFT",
        dataset_name="support-tickets-sft",
    )
    Path("run-spec.json").write_text(json.dumps(spec, indent=2))
arena resources list

arena experiments submit ./run-spec.json --project llm-work --experiment-name sft-run --resource-id a2-highgpu-1g --num-nodes 2

Python

from agilerl.arena import ArenaClient

with ArenaClient() as client:
    spec = client.get_default_run_spec(
        algorithm="SFT",
        dataset_name="support-tickets-sft",
    )
    client.submit_experiment(
        manifest=spec,
        project="llm-work",
        resource_id="a2-highgpu-1g",
        experiment_name="sft-run",
        num_nodes=2,
    )
    print(client.list_experiments(project="llm-work"))