Lesson 3 of 4 Customizing Foundation Models

Choosing a Fine-Tuning Strategy

This lesson explains how the fine-tuning strategy, which changes model weights when prompting and RAG are not enough, depends on the data available, the behaviour needed, the budget and where the model will run.

Learning outcomes

After completing this lesson, you will be able to:

  • Fine-tune supported models on Amazon Bedrock.
  • Fine-tune open-weight models on SageMaker AI.
  • Choose between full and parameter-efficient fine-tuning.

Fine-tuning on Amazon Bedrock

Bedrock model customisation jobs fine-tune supported base models with no infrastructure to manage. Supervised fine-tuning uses labelled JSONL pairs; reinforcement fine-tuning uses prompts and reward functions; distillation uses a teacher model. You set hyperparameters such as epochs, batch size and learning rate, provide training and validation data in S3, and receive a custom model. Custom models are used through on-demand custom model deployment or Provisioned Throughput, depending on the model. Training is billed by tokens processed (tokens multiplied by epochs) plus monthly model storage.

Scenario questions

Bedrock or SageMaker AI?

Exam skills 2.1.2 · 2.2.8

Choose where to fine-tune for each team's requirements.

Log in to try this activity Interactive activities are free with an account.

Fine-tuning on SageMaker AI

SageMaker AI offers fine-tuning with more control than Amazon Bedrock. SageMaker JumpStart fine-tunes open-weight models in the customer's account with a few lines of code or a few clicks in SageMaker Studio, using tested configurations. SageMaker AI training jobs, or SageMaker HyperPod clusters for very large jobs, run custom fine-tuning scripts, including Amazon Nova customisation recipes.

This route gives full control of the fine-tuning method, the training hardware and the hosting of the resulting model, and it supports models and techniques that Bedrock's managed customisation does not. The cost is more operational work than Bedrock's fully managed fine-tuning.

The following diagram shows the path each of two teams takes to fine-tune a model, one on Amazon Bedrock and one on SageMaker AI.

Where each team fine-tunes. Team A, with 3,000 labelled examples, a Bedrock-supported model and no platform engineers, runs a Bedrock supervised fine-tuning job and uses on-demand custom model deployment. Team B needs QLoRA on an open-weight model with custom inference code inside its VPC, so it uses SageMaker JumpStart or a training job and a SageMaker AI endpoint.
The scenario is illustrative.

Full and parameter-efficient fine-tuning

Full fine-tuning updates every weight. It can achieve the largest change but needs large GPU memory, stores a full copy of the model and is most prone to catastrophic forgetting. Parameter-efficient fine-tuning (PEFT) freezes the base model and trains a small number of extra parameters. LoRA (low-rank adaptation) adds small low-rank matrices to attention layers; QLoRA does the same on a quantised base model to save more memory. PEFT trains faster and cheaper, produces small adapter files and preserves more general ability. Instruction tuning fine-tunes on varied instruction-response pairs to improve instruction following generally.

The following table compares the strategies.

StrategyTrainsCostForgetting riskUse when
Full fine-tuningAll weightsHighHigherLarge behaviour change, ample data and GPUs
LoRA / QLoRA (PEFT)Small adaptersLowLowerMost task adaptation, limited budget
Supervised fine-tuning (Bedrock)ManagedPer tokenManagedLabelled pairs, no infrastructure
Reinforcement fine-tuningManagedPer tokenManagedAnswers can be graded automatically
DistillationStudent modelPer tokenLowCut cost and latency of a large model

The following diagram compares what full fine-tuning and LoRA train.

Full fine-tuning compared with LoRA. Full fine-tuning updates every weight of a layer, needs large GPU memory, stores a full model copy and is most prone to forgetting. LoRA freezes the base weights W and trains two small low-rank matrices A and B whose product is added to W, so only a small adapter file is trained and stored.
Matrix sizes are schematic; real ranks are much smaller than layer widths.
Sort into groups

Full or parameter-efficient?

Exam skills 2.1.2

Sort each statement by whether it describes full fine-tuning or parameter-efficient fine-tuning such as LoRA.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing where to fine-tune

Two teams need fine-tuned models. Team A wants a Bedrock-supported model to adopt a support tone, has 3,000 labelled examples and no ML platform engineers. Team B needs an open-weight model fine-tuned with QLoRA on a niche medical task, hosted inside its VPC with custom inference code.

  • Team A: Bedrock supervised fine-tuning job, then on-demand custom model deployment. No infrastructure to manage.
  • Team B: SageMaker JumpStart or a SageMaker AI training job with QLoRA, then a SageMaker AI endpoint in its VPC.

Each choice follows from the constraints: managed simplicity for Team A, control over method and hosting for Team B.

Check yourself

Which fine-tuning methods are cheaper and better at preserving general ability?

Show answer

LoRA and QLoRA, which train small adapter weights instead of the whole model.

Exam Tips

Remember for the exam

  • Managed fine-tuning with no infrastructure: Bedrock model customisation.
  • Full control of method and hosting: SageMaker JumpStart or training jobs.
  • Cheaper fine-tuning that preserves general ability: LoRA or QLoRA.
  • Bedrock training cost: tokens x epochs plus model storage.
  • Custom Bedrock models are served with on-demand deployment or Provisioned Throughput.