Sessions and runs
A session groups the Loops runs, samplers, and checkpoints that oneServiceClient creates. Creating a ServiceClient creates a session, and creating a training client adds a run. Use the run ID, TrainingClient.run_id, to manage the run with the CLI or the Loops API.
Runs and samplers belong to a team: your organization’s default team, unless you name another with the team argument of ServiceClient.
Trainers
A trainer owns a run’s adapter and optimizer state. It applies forward, backward, and optimizer steps and saves checkpoints.create_lora_training_client() returns when the trainer can accept operations. It sets the run’s base model, LoRA rank, sequence length, seed, name, and Weights & Biases logging. Choose what the trainer optimizes with Loss functions and how it steps with Hyperparameters.
In the dedicated mode, you can also scale the trainer with data-parallel replicas, use spot capacity, and reuse a warm run’s trainer and sampler. See Dedicated Loops.
Samplers
A sampler generates completions from a base model or published checkpoint. A paired sampler belongs to a training run and serves the weights that the run publishes. A standalone sampler runs without a trainer. In the serverless mode, a sampling client keeps serving the checkpoint that it was created from, so you create a new client to sample from later weights. In the dedicated mode, the paired sampler loads later weights without restarting. See Sample from a run and Create a standalone sampler.Checkpoints
A checkpoint holds either training state or sampler weights.save_state() saves training state, which a new run can continue from. save_weights_for_sampler() and save_weights_and_get_sampling_client() publish sampler weights, which a sampler serves and you can deploy. To work with checkpoints, see Save a checkpoint, Continue training from a checkpoint, and Deploy a checkpoint.
Next steps
- Loops quickstart: Create a run, train with RL, sample from the tuned weights, and save checkpoints.
- Availability modes: Choose the serverless or dedicated mode for a run.