Skip to main content

Large language models (LLMs)

These examples fine-tune and post-train large language models (LLMs) on AI Runtime. They cover parameter-efficient methods like Low-Rank Adaptation (LoRA) and full supervised fine-tuning across libraries including TRL, Unsloth, Axolotl, and LLM Foundry. For batch inference examples, see Batch inference.

Example

Interface

Description

Reinforcement learning of Gemma4-2B

Notebook

Post-train Gemma4-2B with Group Relative Policy Optimization (GRPO) and Low-Rank Adaptation (LoRA) on a single H100 GPU using Unsloth.

Supervised Fine-tuning (Full) of Qwen3-4B

Notebook

Full-weight fine-tune Qwen3-4B on a single H100 GPU with TRL, using BF16 mixed precision and gradient checkpointing.

Supervised Fine-tuning (LoRA) of Llama-3.2-3B

Notebook

LoRA fine-tune Llama-3.2-3B on a single GPU with the Unsloth library.

Supervised Fine-tuning (LoRA) of GPT-OSS 20B

Notebook

LoRA fine-tune GPT-OSS 20B on 8 H100 GPUs with TRL and distributed data parallelism.

Supervised Fine-tuning (Full) of Llama-3.2-1B

Notebook

Full-weight fine-tune Llama-3.2-1B on 8 H100 GPUs with TRL and DeepSpeed ZeRO Stage 3.

Supervised Fine-tuning (LoRA) of Olmo3 7B

Notebook

LoRA fine-tune Olmo3 7B across multiple GPUs with the Axolotl library.

Supervised fine-tuning (Full) and serving of Qwen3.5-0.8B

Notebook

Fine-tune Qwen3.5-0.8B on a single H100 GPU with TRL, then serve it behind a vLLM Model Serving endpoint.

Supervised Fine-tuning of Llama-3.2-3B on multi-GPUs

Notebook

LoRA fine-tune Llama-3.2-3B across multiple GPUs with the Unsloth library.

Supervised Fine-tuning (LoRA) of GPT-OSS 120B

Notebook

LoRA fine-tune GPT-OSS 120B on 8 H100 GPUs with TRL, using DDP and FSDP.

Training transformers on multi-GPUs

Notebook

Train Transformer models using PyTorch Fully Sharded Data Parallel (FSDP) to shard model parameters across multiple GPUs.

Multi-node FSDP fine-tuning of Llama 3.1 8B

CLI

Supervised fine-tune Llama 3.1 8B with PyTorch FSDP across two 8x H100 nodes, log training loss to MLflow, and save a consolidated checkpoint.

Multi-node FSDP2 fine-tuning of Qwen3.8-27B

CLI

Supervised fine-tune Qwen3.8-27B with PyTorch FSDP2 across four 8x H100 nodes.

Full-weight fine-tuning of Qwen3-8B for invoice extraction

CLI

Fine-tune Qwen3-8B for invoice and receipt entity extraction with TRL and DeepSpeed ZeRO-3 on one 8x H100 node.

Supervised fine-tuning of Qwen2.5-3B with Ray Train

CLI

Use Ray Train to fine-tune Qwen2.5-3B with one distributed data parallel worker per GPU on an 8x H100 node.

LoRA hyperparameter search for Qwen2.5-0.5B

CLI

Use Ray Tune and the asynchronous successive halving algorithm (ASHA) to search LoRA configurations across four A10 GPUs and log the best configuration to MLflow.

Example

Interface

Description

Reinforcement learning of Gemma4-2B

Notebook

Post-train Gemma4-2B with Group Relative Policy Optimization (GRPO) and Low-Rank Adaptation (LoRA) on a single H100 GPU using Unsloth.

Supervised Fine-tuning (Full) of Qwen3-4B

Notebook

Full-weight fine-tune Qwen3-4B on a single H100 GPU with TRL, using BF16 mixed precision and gradient checkpointing.

Supervised Fine-tuning (LoRA) of Llama-3.2-3B

Notebook

LoRA fine-tune Llama-3.2-3B on a single GPU with the Unsloth library.

Supervised Fine-tuning (LoRA) of GPT-OSS 20B

Notebook

LoRA fine-tune GPT-OSS 20B on 8 H100 GPUs with TRL and distributed data parallelism.

Supervised Fine-tuning (Full) of Llama-3.2-1B

Notebook

Full-weight fine-tune Llama-3.2-1B on 8 H100 GPUs with TRL and DeepSpeed ZeRO Stage 3.

Supervised Fine-tuning (LoRA) of Olmo3 7B

Notebook

LoRA fine-tune Olmo3 7B across multiple GPUs with the Axolotl library.

Supervised fine-tuning (Full) and serving of Qwen3.5-0.8B

Notebook

Fine-tune Qwen3.5-0.8B on a single H100 GPU with TRL, then serve it behind a vLLM Model Serving endpoint.

Supervised Fine-tuning of Llama-3.2-3B on multi-GPUs

Notebook

LoRA fine-tune Llama-3.2-3B across multiple GPUs with the Unsloth library.

Supervised Fine-tuning (LoRA) of GPT-OSS 120B

Notebook

LoRA fine-tune GPT-OSS 120B on 8 H100 GPUs with TRL, using DDP and FSDP.

Training transformers on multi-GPUs

Notebook

Train Transformer models using PyTorch Fully Sharded Data Parallel (FSDP) to shard model parameters across multiple GPUs.

Multi-node FSDP fine-tuning of Llama 3.1 8B

CLI

Supervised fine-tune Llama 3.1 8B with PyTorch FSDP across two 8x H100 nodes, log training loss to MLflow, and save a consolidated checkpoint.

Multi-node FSDP2 fine-tuning of Qwen3.8-27B

CLI

Supervised fine-tune Qwen3.8-27B with PyTorch FSDP2 across four 8x H100 nodes.

Full-weight fine-tuning of Qwen3-8B for invoice extraction

CLI

Fine-tune Qwen3-8B for invoice and receipt entity extraction with TRL and DeepSpeed ZeRO-3 on one 8x H100 node.

Supervised fine-tuning of Qwen2.5-3B with Ray Train

CLI

Use Ray Train to fine-tune Qwen2.5-3B with one distributed data parallel worker per GPU on an 8x H100 node.

LoRA hyperparameter search for Qwen2.5-0.5B

CLI

Use Ray Tune and the asynchronous successive halving algorithm (ASHA) to search LoRA configurations across four A10 GPUs and log the best configuration to MLflow.

Video demo​

This video walks through the Supervised Fine-tuning (LoRA) of Llama-3.2-3B example notebook in detail (12 minutes).

On this page