View a markdown version of this page

How to access model customization - Amazon SageMaker AI

How to access model customization

Amazon SageMaker AI provides multiple interfaces for model customization. The following table summarizes your options — choose the interface that best fits your workflow and level of control.

Interface Infrastructure Best for Control level
Studio UI Serverless Quick experimentation, no-code users Guided — select model, technique, upload data
Python SDK (SFTTrainer, etc.) Serverless Reproducible pipelines, automation Programmatic — specify all params in code
Python SDK (ModelTrainer) SageMaker AI Training Jobs Custom instances, advanced configs Full — choose instance type, count, image
Recipes Training Jobs + HyperPod Pre-configured best practices Recipe-driven — modify YAML config
HP-CLI HyperPod (EKS) Kubernetes-native teams Full — Kubernetes job submission
Agent (Model customization skills) Serverless Natural language workflow, guided experience Conversational — describe what you need
Python SDK (ServiceClient) Serverless (Training session APIs) Custom training loops, multi-turn reinforcement learning (RL), multi-stage pipelines Operation-level — orchestrate forward_backward(), sample(), optim_step() as API calls

Studio UI

The SageMaker AI Studio console provides visual workflows for model customization without writing code.

Customize with UI

The primary entry point for serverless model customization. Walk through a guided workflow:

  1. Select a foundation model from the catalog

  2. Choose a customization technique (SFT, DPO, RLVR, RLAIF)

  3. Select a training type (LoRA or FFT)

  4. Upload or specify your training dataset (S3 path)

  5. Configure hyperparameters

  6. Launch the training job

Monitor progress in real time with live metrics and logs.

JumpStart model hub

Browse and discover foundation models available for customization. Filter by provider, task, or model size. From a model detail card, you can launch customization directly.

Agent-Guided experience

Use Amazon SageMaker AI Skills for a conversational approach to model customization. Describe what you want to achieve in natural language, and the agent guides you through model selection, dataset preparation, and job configuration. For more information, see Model customization agent skills.

Python SDK V3

Programmatic access for serverless and SageMaker AI Training Jobs workflows using the SageMaker AI Python SDK.

Serverless trainers

Use technique-specific trainer classes for fully managed customization:

from sagemaker.modules.train import SFTTrainer, DPOTrainer, RLVRTrainer, RLAIFTrainer # Example: Serverless SFT trainer = SFTTrainer( model_id="meta-textgeneration-llama-3-1-8b-instruct", train_data="s3://my-bucket/train.jsonl", hyperparameters={ "max_epochs": 3, "learning_rate": 5e-5, "lora_rank": 16, } ) trainer.train()

SageMaker AI Training Jobs

Use ModelTrainer for full control over instance selection:

from sagemaker.modules.train import ModelTrainer from sagemaker.modules.configs import Compute, InputData trainer = ModelTrainer( training_image="my-training-image", role="arn:aws:iam::123456789012:role/SageMakerRole", compute=Compute(instance_type="ml.p4d.24xlarge", instance_count=2) ) trainer.train(input_data_config=[ InputData(channel_name="training", data_source="s3://my-bucket/train") ])

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="openai/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.

Recipes (Training Jobs + HyperPod)

Run pre-configured training recipes on SageMaker AI Training Jobs or HyperPod clusters. Recipes handle distributed training configuration, dataset loading, and checkpoint management automatically.

Recipes are available for all supported models and techniques. See SageMaker AI HyperPod recipes for the full catalog.

git clone --recursive https://github.com/aws/sagemaker-hyperpod-recipes.git cd sagemaker-hyperpod-recipes pip3 install -r requirements.txt # Launch a fine-tuning recipe python3 launcher/launch.py --recipe recipes_collection/recipes/fine-tuning/llama/sft_lora.yaml

HP-CLI

Command-line interface for submitting training jobs to HyperPod EKS clusters. HP-CLI integrates with Kubernetes-based workload orchestration for containerized training on persistent clusters.

For setup and usage, see HyperPod with Amazon EKS.