Write your own training loop — without managing GPUs — with Amazon SageMaker training session APIs
Amazon SageMaker AI training session APIs let you write your own LLM training loop (SFT, RL, or custom objectives) in a Python script while the service runs the GPUs. This post introduces the programming model and three SDK clients, then walks through a GRPO loop on GSM8K and a reinforcement learning workload on competitive programming.
Amazon SageMaker AI now offers training session APIs that let you create custom training loops without managing GPU infrastructure. These APIs let you control every aspect of the training process, from data and hyperparameters to custom loss functions and RL reward functions. The APIs are organized around three SDK clients: ServiceClient, TrainingClient, and SamplingClient.
The ServiceClient sets up the execution role, model package group, output location, and optional AWS KMS key and VPC configuration. The TrainingClient handles training and checkpointing operations, while the SamplingClient deals with generation and scoring during rollouts and evaluation. Each API call in the loop corresponds to one operation in your training procedure, such as forward_backward(), optim_step(), and sample().
The service handles runtime setup, distributed execution, gradient synchronization, fault recovery, tenant isolation, and GPU management. With the release of the SageMaker training sessions cookbook, users can find ready-to-run SFT and RL recipes as blueprints for their own training loops. Training session APIs are ideal for those who need fast iteration cycles and algorithmic freedom, such as using a custom loss function or a new RL reward signal, but don't want to provision or operate GPU infrastructure themselves. Usage is billed per token processed, so you only pay for the compute your loop consumes.
Written by urgent.news from AWS Machine Learning's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.