AWS sagemaker: Document SageMaker AI Training session APIs for model customization
Summary
Adds a Training session APIs section (stateful session operations such as forward_backward/optim_step/sample) with a code sample, a new row in the access-method comparison table, and a mention that SageMaker AI manages infrastructure and tenant isolation.
Security assessment
This is product/API documentation for a new orchestration interface. Tenant isolation is only mentioned as a managed property of the service; no configuration, permission, or vulnerability detail is added, so it is not security documentation.
Evidence
+Use the SageMaker AI Training session APIs when a predefined workflow is too rigid. Instead of submitting a complete training script, you open a stateful session and call training operations — `forward_backward()`, `optim_step()`, `sample()` — as individual API calls, then compose them into whatever procedure your technique requires. The model stays loaded between calls, so you can write custom loss functions, run multi-turn reinforcement learning with elastic rollouts, and chain multiple procedures in one session. SageMaker AI manages the underlying infrastructure and tenant isolation.
Diff
diff --git a/sagemaker/latest/dg/customizing-models-access.md b/sagemaker/latest/dg/customizing-models-access.md index b3a241f..a3d59f1 100644 --- a//sagemaker/latest/dg/customizing-models-access.md +++ b//sagemaker/latest/dg/customizing-models-access.md @@ -7 +7 @@ -Studio UIPython SDK V3Recipes (Training Jobs + HyperPod)HP-CLI +Studio UIPython SDK V3Training session APIsRecipes (Training Jobs + HyperPod)HP-CLI @@ -20,0 +21 @@ Agent (Model customization skills) | [Serverless](./customize-model.html) | Natu +Python SDK (`ServiceClient`) | Serverless ([Training session APIs](./customizing-models-training-sessions.html)) | Custom training loops, multi-turn reinforcement learning (RL), multi-stage pipelines | Operation-level — orchestrate `forward_backward()`, `sample()`, `optim_step()` as API calls @@ -97,0 +99,19 @@ Use `ModelTrainer` for full control over instance selection: +## Training session APIs + +Use the SageMaker AI Training session APIs when a predefined workflow is too rigid. Instead of submitting a complete training script, you open a stateful session and call training operations — `forward_backward()`, `optim_step()`, `sample()` — as individual API calls, then compose them into whatever procedure your technique requires. The model stays loaded between calls, so you can write custom loss functions, run multi-turn reinforcement learning with elastic rollouts, and chain multiple procedures in one session. SageMaker AI manages the underlying infrastructure and tenant isolation. + + + from sagemaker.train.training_session import ServiceClient, AdamParams + + svc = ServiceClient(region="us-west-2", role_arn="arn:aws:iam::111122223333:role/MyRole") + tc = svc.create_lora_training_client(base_model="gpt-oss-20b", rank=32, alpha=64) + + for batch in data_loader: + tc.forward_backward(batch, loss_fn="cross_entropy") + tc.optim_step(AdamParams(learning_rate=5e-5)) + + print(tc.save_state().result().model_package_arn) + tc.stop() + +For more information, see [Training session APIs](./customizing-models-training-sessions.html). +