Skip to main content
Loops is a training SDK for LoRA fine-tuning and post-training large language models at long sequence lengths. You write a Python training loop that calls a dedicated trainer and sampler for a supported base model. Each forward pass, optimizer step, and sampling call goes through the API. Loops updates LoRA adapters while keeping the base model parameters frozen, for both supervised fine-tuning and reinforcement learning. Use Training Jobs for full-parameter fine-tuning or a custom training framework.

How Loops works

A Loops session pairs a trainer with a sampler. The trainer runs forward, backward, and optimizer steps. The sampler generates output from published adapter weights. Because they scale independently, reinforcement learning (RL) rollouts don’t compete with training for compute. In synchronous RL, your loop waits for the sampler to load the published adapter weights before collecting the next rollouts. Asynchronous RL overlaps training with sampling. Your algorithm controls the allowed lag between their policy versions. This coordination is separate from the SDK’s *_async methods, which let you use the SDK with a Python event loop. Both RL workflows train LoRA adapters. Use Get checkpoint source to determine whether to download checkpoint files through presigned URLs or pull them from a volume. You can also deploy checkpoints to the Baseten Inference Stack through the dashboard, CLI, or API.

Where to go next

The Loops quickstart runs the full session lifecycle: train a step, sample from the tuned weights, list the checkpoint, and shut the trainer and sampler down. To train and evaluate models from your application, follow Programmatic training. The example saves results and checkpoints for each round. The Loops concepts page explains sessions, trainers, samplers, checkpoints, and weight synchronization. Use Training Jobs when you need to bring your own container and training code. Training on Baseten compares Loops and Training Jobs. To migrate an existing Tinker project, see Migrate from Tinker.

Reference