Repository for training and deploying Generative AI models, including text-text, text-to-image generation and prompt engineering playground using SageMaker Studio.
Jupyter Notebook
218
456 commits
updated Sep 10, 2026
A comprehensive repository showcasing Generative AI workflows on Amazon SageMaker AI. This collection provides end-to-end implementations spanning the complete ML lifecycle, from foundational concepts to enterprise-scale deployments, covering model training, fine-tuning, inference optimization, MLOps automation, distributed training, RAG systems, intelligent agents, and real-world industry applications.
New to Generative AI on SageMaker? Start here:
Config-driven fine-tuning recipes for 20+ foundation models β Pick a model, choose a strategy (QLoRA, Spectrum, or Full Fine-tuning), and launch a SageMaker Training Job. The recipe generator handles everything from dataset formatting to adapter merging and evaluation.
β Get Started | β Available Models | β Instance Guide
Hands-on notebooks for specific models, frameworks, and training strategies β While the Recipes above offer a config-driven approach, the Distributed Training folder provides deep-dive implementations where you control every aspect: distributed strategies (DDP, FSDP, DeepSpeed ZeRO-3), reinforcement learning (DPO, GRPO), specialized frameworks (NVIDIA NeMo, veRL, Unsloth), and more.
This repository supports a comprehensive range of foundation models with various training methodologies. The table below shows model compatibility with different fine-tuning techniques, training frameworks, and deployment options.
| Models - Size | Use Case / Strategy | Notebook | Service | Frameworks & Libs |
|---|---|---|---|---|
| Qwen 3 0.6B | Function Calling, Agentic AI (FSDP, SFT, QLoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Qwen 3 0.6B | Function Calling, Agentic AI (DDP, SFT, QLoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Gemma 3 4B-IT | Reasoning (DeepSpeed ZeRO-3, SFT, LoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, DeepSpeed, SageMaker Model Trainer |
| Qwen 3 0.6B | Function Calling, Agentic AI (LoRA, DPO) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Arcee-Lite | Reasoning (FSDP, QLoRA, GRPO) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Qwen 3 0.6B | Reasoning (FSDP, SFT, LoRA) | Notebook | SageMaker AI Training Jobs | Ray, Grafana, Prometheus, Transformers, SageMaker Model Trainer |
| Qwen 3 0.6B | Reasoning (FSDP, SFT, LoRA) | Notebook | SageMaker AI Training Jobs | Heterogeneous Cluster, Ray, Grafana, Prometheus, SageMaker Estimator |
| DeepSeek-R1-Distill-Llama-8B | Reasoning (SFT, QLoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow |
| GTE-Base-En-V1.5 | Embeddings | Notebook | SageMaker AI Training Jobs | Sentence Transformers, Accelerate, SageMaker Estimator |
| Qwen 2 0.5B Instruct | Summarization (GRPO) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL, Weights & Biases |
| Gemma 3 4B-It | Conversations, Reasoning (LoRA) | Notebook | SageMaker AI Training Jobs | Torch, TorchVision, TorchAudio, Unsloth, Psutil |
| Qwen 2 7B | Reasoning (GRPO) | Notebook | SageMaker AI Training Jobs | Verl, Torch, vLLM, FlashAttention |
| Qwen 3 8B | Conversations (Spectrum) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, Spectrum |
| Meta LLaMA 3.2 3B | Function Calling, Agentic AI (SFT, LoRA, DPO) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL, Weights & Biases |
| Qwen 2.5 0.5B Instruct | Reasoning (GRPO) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL |
| LLaMA 3 8B Instruct | Reasoning, Conversation (SFT, LoRA, QLoRA, KD) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL, TorchRun, Weights & Biases |
| LLaMA 3 / LLaMA 2 / Mistral | Text Generation (FSDP) | Notebook | SageMaker HyperPod (Slurm/EKS) | PyTorch, SMHP Training Operator |
| GPT on NeMo | Text Generation (Spectrum) | Notebook | SageMaker HyperPod (Slurm/EKS) | NVIDIA NeMo |
| SMoLM 1.7B on Picotron | Text Generation (FSDP) | Notebook | SageMaker HyperPod (Slurm/EKS) | Hugging Face Picotron |
| LLaMA 3.1 on TorchTitan | Text Generation (FSDP, Spectrum) | Notebook | SageMaker HyperPod (Slurm/EKS) | PyTorch, TorchTitan |
| Qwen 2.5 72B w/ HF TRL | Preference Alignment, Reasoning (GRPO) | Notebook | SageMaker HyperPod (Slurm/EKS) | PyTorch, Hugging Face TRL |
| Qwen 2.5 VL | Multimodality (SFT, QLoRA) | Notebook | SageMaker Training Jobs | SWIFT |
| Meta LLaMA 3 8B RLHF | Preference Alignment (FSDP, DPO, QLoRA) | Notebook | SageMaker Training Jobs | Hugging Face TRL |
| GPT-OSS 20B | Reasoning (Accelerate, DeepSpeed ZeRO-3, SFT, MXFP4, vLLM) | Notebook | SageMaker Training Jobs | Hugging Face Trainer, MXFP4 |
| GPT-OSS 20B | Reasoning (FSDP, SFT, MXFP4, vLLM) | Notebook | SageMaker Training Jobs | Hugging Face Trainer, MXFP4 |
| GPT-OSS 20B | Reasoning (SMDDP, SFT, MXFP4) | Notebook | SageMaker HyperPods (EKS) | HyperPod Recipes |
| GPT-OSS 20B | Reasoning (SMDDP, SFT, MXFP4) | Notebook | SageMaker TrainingJobs | HyperPod Recipes |
| LLaMA 3.1 8B Instruct | Reasoning (FSDP, SFT, QLoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| Mistral 7B v0.3 Instruct | Reasoning (DDP, SFT, QLoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| Mistral 7B v0.3 Instruct | Reasoning (FSDP, SFT, QLoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| Mistral 7B v0.3 Instruct | Reasoning (Accelerate, DeepSpeed ZeRO-3, SFT, LoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| DeepSeek R1 Distill Qwen 7B | Programming (GRPO, Ray) | Notebook | SageMaker TrainingJobs | Verl, Ray, TRL, Weights & Biases |
| Qwen 2.5 1.5B Instruct | Reasoning (GRPO, NeMo RL) | Notebook | SageMaker TrainingJobs | NVIDIA NeMo RL, Ray, vLLM, DTensor, EFA |
| Mistral 7B v0.1 | Text Generation (SFT, LoRA, FSDP2) | Notebook | SageMaker TrainingJobs | NVIDIA NeMo AutoModel, DTensor, FSDP2 |
| FLUX.1-dev | Image Generation (DreamBooth LoRA) | Notebook | SageMaker TrainingJobs | Hugging Face Diffusers, Accelerate, Prodigy, Weights & Biases |
Complete production workflows covering the entire ML lifecycle with enterprise-grade practices
Hands-on notebooks for specific models, frameworks, and training strategies β See the Distributed Training β Deep Dives section above for full details.
Knowledge-enhanced AI systems with advanced embedding and retrieval techniques
Intelligent multi-agent frameworks and orchestration systems
Real-world applications and industry-specific solutions
Performance and efficiency improvements for production deployments
Comprehensive benchmarking and performance analysis frameworks
Legacy examples and deprecated implementations for reference and migration guidance
# Clone the repository
git clone <repository-url>
cd generative-ai-sagemaker
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install core dependencies
pip install -r requirements.txt
# Configure AWS credentials
aws configure
# Verify SageMaker access
aws sagemaker list-training-jobs --max-items 1
Run a simple inference example to validate your setup:
# Example: Deploy a pre-trained model for text generation
from sagemaker.huggingface import HuggingFaceModel
model = HuggingFaceModel(
transformers_version="4.28",
pytorch_version="2.0",
py_version="py310",
role=role,
model_data="s3://path-to-model"
)
predictor = model.deploy(
initial_instance_count=1,
instance_type="ml.g5.xlarge"
)
Data Preparation β Model Fine-tuning β Evaluation β Deployment β Monitoring
β β β β β
S3 Storage SageMaker Training Model Registry Endpoint CloudWatch
Document Ingestion β Embedding Generation β Vector Storage β Query Processing β Response Generation
β β β β β
Text Processing SageMaker Endpoint Vector DB Retrieval Logic LLM Inference
Task Definition β Agent Orchestration β Tool Execution β Result Aggregation β Final Output
β β β β β
LangGraph CrewAI Framework MCP Servers Agent Coordination Structured Response
We welcome contributions from the community! Please see our Contributing Guidelines for details on:
Security is our top priority. For security issue notifications and responsible disclosure, please see CONTRIBUTING.
This library is licensed under the MIT-0 License. See the LICENSE file for details.
Ready to build the future of AI? Start exploring the examples and building your next Generative AI application on Amazon SageMaker! π
This repository is actively maintained and regularly updated with the latest AWS services, model architectures, and best practices. Star β the repository to stay updated with new releases and features.
Jupyter Notebook
88.6%
Python
10.9%
Repository for training and deploying Generative AI models, including text-text, text-to-image generation and prompt engineering playground using SageMaker Studio.
Jupyter Notebook
218
456 commits
updated Sep 10, 2026
A comprehensive repository showcasing Generative AI workflows on Amazon SageMaker AI. This collection provides end-to-end implementations spanning the complete ML lifecycle, from foundational concepts to enterprise-scale deployments, covering model training, fine-tuning, inference optimization, MLOps automation, distributed training, RAG systems, intelligent agents, and real-world industry applications.
New to Generative AI on SageMaker? Start here:
Config-driven fine-tuning recipes for 20+ foundation models β Pick a model, choose a strategy (QLoRA, Spectrum, or Full Fine-tuning), and launch a SageMaker Training Job. The recipe generator handles everything from dataset formatting to adapter merging and evaluation.
β Get Started | β Available Models | β Instance Guide
Hands-on notebooks for specific models, frameworks, and training strategies β While the Recipes above offer a config-driven approach, the Distributed Training folder provides deep-dive implementations where you control every aspect: distributed strategies (DDP, FSDP, DeepSpeed ZeRO-3), reinforcement learning (DPO, GRPO), specialized frameworks (NVIDIA NeMo, veRL, Unsloth), and more.
This repository supports a comprehensive range of foundation models with various training methodologies. The table below shows model compatibility with different fine-tuning techniques, training frameworks, and deployment options.
| Models - Size | Use Case / Strategy | Notebook | Service | Frameworks & Libs |
|---|---|---|---|---|
| Qwen 3 0.6B | Function Calling, Agentic AI (FSDP, SFT, QLoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Qwen 3 0.6B | Function Calling, Agentic AI (DDP, SFT, QLoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Gemma 3 4B-IT | Reasoning (DeepSpeed ZeRO-3, SFT, LoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, DeepSpeed, SageMaker Model Trainer |
| Qwen 3 0.6B | Function Calling, Agentic AI (LoRA, DPO) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Arcee-Lite | Reasoning (FSDP, QLoRA, GRPO) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow, Weights & Biases |
| Qwen 3 0.6B | Reasoning (FSDP, SFT, LoRA) | Notebook | SageMaker AI Training Jobs | Ray, Grafana, Prometheus, Transformers, SageMaker Model Trainer |
| Qwen 3 0.6B | Reasoning (FSDP, SFT, LoRA) | Notebook | SageMaker AI Training Jobs | Heterogeneous Cluster, Ray, Grafana, Prometheus, SageMaker Estimator |
| DeepSeek-R1-Distill-Llama-8B | Reasoning (SFT, QLoRA) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, MLflow |
| GTE-Base-En-V1.5 | Embeddings | Notebook | SageMaker AI Training Jobs | Sentence Transformers, Accelerate, SageMaker Estimator |
| Qwen 2 0.5B Instruct | Summarization (GRPO) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL, Weights & Biases |
| Gemma 3 4B-It | Conversations, Reasoning (LoRA) | Notebook | SageMaker AI Training Jobs | Torch, TorchVision, TorchAudio, Unsloth, Psutil |
| Qwen 2 7B | Reasoning (GRPO) | Notebook | SageMaker AI Training Jobs | Verl, Torch, vLLM, FlashAttention |
| Qwen 3 8B | Conversations (Spectrum) | Notebook | SageMaker AI Training Jobs | Transformers, Accelerate, SageMaker Model Trainer, Spectrum |
| Meta LLaMA 3.2 3B | Function Calling, Agentic AI (SFT, LoRA, DPO) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL, Weights & Biases |
| Qwen 2.5 0.5B Instruct | Reasoning (GRPO) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL |
| LLaMA 3 8B Instruct | Reasoning, Conversation (SFT, LoRA, QLoRA, KD) | Notebook | SageMaker AI Training Jobs | Accelerate, Datasets, SageMaker, Transformers, TRL, TorchRun, Weights & Biases |
| LLaMA 3 / LLaMA 2 / Mistral | Text Generation (FSDP) | Notebook | SageMaker HyperPod (Slurm/EKS) | PyTorch, SMHP Training Operator |
| GPT on NeMo | Text Generation (Spectrum) | Notebook | SageMaker HyperPod (Slurm/EKS) | NVIDIA NeMo |
| SMoLM 1.7B on Picotron | Text Generation (FSDP) | Notebook | SageMaker HyperPod (Slurm/EKS) | Hugging Face Picotron |
| LLaMA 3.1 on TorchTitan | Text Generation (FSDP, Spectrum) | Notebook | SageMaker HyperPod (Slurm/EKS) | PyTorch, TorchTitan |
| Qwen 2.5 72B w/ HF TRL | Preference Alignment, Reasoning (GRPO) | Notebook | SageMaker HyperPod (Slurm/EKS) | PyTorch, Hugging Face TRL |
| Qwen 2.5 VL | Multimodality (SFT, QLoRA) | Notebook | SageMaker Training Jobs | SWIFT |
| Meta LLaMA 3 8B RLHF | Preference Alignment (FSDP, DPO, QLoRA) | Notebook | SageMaker Training Jobs | Hugging Face TRL |
| GPT-OSS 20B | Reasoning (Accelerate, DeepSpeed ZeRO-3, SFT, MXFP4, vLLM) | Notebook | SageMaker Training Jobs | Hugging Face Trainer, MXFP4 |
| GPT-OSS 20B | Reasoning (FSDP, SFT, MXFP4, vLLM) | Notebook | SageMaker Training Jobs | Hugging Face Trainer, MXFP4 |
| GPT-OSS 20B | Reasoning (SMDDP, SFT, MXFP4) | Notebook | SageMaker HyperPods (EKS) | HyperPod Recipes |
| GPT-OSS 20B | Reasoning (SMDDP, SFT, MXFP4) | Notebook | SageMaker TrainingJobs | HyperPod Recipes |
| LLaMA 3.1 8B Instruct | Reasoning (FSDP, SFT, QLoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| Mistral 7B v0.3 Instruct | Reasoning (DDP, SFT, QLoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| Mistral 7B v0.3 Instruct | Reasoning (FSDP, SFT, QLoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| Mistral 7B v0.3 Instruct | Reasoning (Accelerate, DeepSpeed ZeRO-3, SFT, LoRA) | Notebook | SageMaker TrainingJobs | Transformers, TRL, BitsAndBytes, Accelerate, MLflow, PEFT |
| DeepSeek R1 Distill Qwen 7B | Programming (GRPO, Ray) | Notebook | SageMaker TrainingJobs | Verl, Ray, TRL, Weights & Biases |
| Qwen 2.5 1.5B Instruct | Reasoning (GRPO, NeMo RL) | Notebook | SageMaker TrainingJobs | NVIDIA NeMo RL, Ray, vLLM, DTensor, EFA |
| Mistral 7B v0.1 | Text Generation (SFT, LoRA, FSDP2) | Notebook | SageMaker TrainingJobs | NVIDIA NeMo AutoModel, DTensor, FSDP2 |
| FLUX.1-dev | Image Generation (DreamBooth LoRA) | Notebook | SageMaker TrainingJobs | Hugging Face Diffusers, Accelerate, Prodigy, Weights & Biases |
Complete production workflows covering the entire ML lifecycle with enterprise-grade practices
Hands-on notebooks for specific models, frameworks, and training strategies β See the Distributed Training β Deep Dives section above for full details.
Knowledge-enhanced AI systems with advanced embedding and retrieval techniques
Intelligent multi-agent frameworks and orchestration systems
Real-world applications and industry-specific solutions
Performance and efficiency improvements for production deployments
Comprehensive benchmarking and performance analysis frameworks
Legacy examples and deprecated implementations for reference and migration guidance
# Clone the repository
git clone <repository-url>
cd generative-ai-sagemaker
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install core dependencies
pip install -r requirements.txt
# Configure AWS credentials
aws configure
# Verify SageMaker access
aws sagemaker list-training-jobs --max-items 1
Run a simple inference example to validate your setup:
# Example: Deploy a pre-trained model for text generation
from sagemaker.huggingface import HuggingFaceModel
model = HuggingFaceModel(
transformers_version="4.28",
pytorch_version="2.0",
py_version="py310",
role=role,
model_data="s3://path-to-model"
)
predictor = model.deploy(
initial_instance_count=1,
instance_type="ml.g5.xlarge"
)
Data Preparation β Model Fine-tuning β Evaluation β Deployment β Monitoring
β β β β β
S3 Storage SageMaker Training Model Registry Endpoint CloudWatch
Document Ingestion β Embedding Generation β Vector Storage β Query Processing β Response Generation
β β β β β
Text Processing SageMaker Endpoint Vector DB Retrieval Logic LLM Inference
Task Definition β Agent Orchestration β Tool Execution β Result Aggregation β Final Output
β β β β β
LangGraph CrewAI Framework MCP Servers Agent Coordination Structured Response
We welcome contributions from the community! Please see our Contributing Guidelines for details on:
Security is our top priority. For security issue notifications and responsible disclosure, please see CONTRIBUTING.
This library is licensed under the MIT-0 License. See the LICENSE file for details.
Ready to build the future of AI? Start exploring the examples and building your next Generative AI application on Amazon SageMaker! π
This repository is actively maintained and regularly updated with the latest AWS services, model architectures, and best practices. Star β the repository to stay updated with new releases and features.
Jupyter Notebook
88.6%
Python
10.9%