Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

3.4.2. Customizing Foundation Models: Prompting, Fine-Tuning, Distillation and Reinforcement Fine-Tuning

💡 First Principle: Customization techniques differ in what they change and what data they need. Prompt engineering changes only the input. Retrieval changes only what the model reads. Fine-tuning variants change the model's weights, and each needs a different kind of data. Match the technique to the gap you measured, and to the data you actually have.

Task-specific prompt engineering is the first lever because it is free to change and instantly reversible:

TechniqueWhat it doesUse when
Clear instruction + contextStates the task, audience, constraints and inputAlways — most "model is bad" findings are underspecified prompts
Few-shot examplesIncludes input/output pairs in the prompt (in-context learning)Output format or labeling scheme must be consistent
Chain-of-thought / step-by-stepAsks the model to reason before answeringMulti-step reasoning, math, policy application
Prompt templates with variablesReusable prompt with placeholders filled at runtimeThe same task runs across many inputs and teams
Inference parametersTemperature, top P, top K, maximum length, stop sequencesLower temperature for deterministic extraction; higher for creative variety

Temperature reshapes the next-token probability distribution: a low value makes high-probability tokens more likely (more deterministic output), a high value flattens the distribution (more varied output). Top P limits sampling to the top share of cumulative probability; top K limits it to the K most likely tokens.

Foundation model customization methods. Amazon Bedrock currently offers supervised fine-tuning, distillation and reinforcement fine-tuning; each produces a private custom model, and training is billed on tokens processed × epochs plus monthly model storage. Continued pre-training on unlabeled text is done on SageMaker AI — for example JumpStart domain adaptation fine-tuning (below) — rather than as a Bedrock customization job.

MethodWhereData you provideWhat it changesChoose when
Supervised fine-tuningBedrock, SageMaker AILabeled prompt–completion pairs (JSONL), or Converse-format conversationsTask behaviour, format, tone, domain vocabularyYou have hundreds to thousands of high-quality examples of the exact output you want
Continued pre-training (domain adaptation)SageMaker AI (JumpStart domain adaptation)Unlabeled domain text (a CSV, JSON or TXT file)Domain knowledge and language familiarityYou have a large corpus of domain text but no labeled examples
DistillationBedrockPrompts (optionally some labeled pairs), or existing invocation logsTransfers a larger teacher model's quality to a smaller, faster, cheaper studentA big model meets the quality bar but is too slow or too expensive in production
Reinforcement fine-tuningBedrock (selected models)Prompts plus a reward function (Lambda code or a model-as-a-judge grader); invocation logs can supply promptsOptimizes toward a measurable definition of a good responseQuality is gradable but labeled "gold" answers are expensive or impossible to write

SageMaker AI JumpStart fine-tuning covers the open-weight models you host yourself: domain adaptation (unlabeled domain text — continued pre-training) or instruction-based fine-tuning (prompt–response examples), with hyperparameters such as epoch, learning_rate, per_device_train_batch_size and LoRA settings (lora_r, lora_alpha) for parameter-efficient fine-tuning.

Fine-tuning hygiene carries over from 3.2: hold out a validation set, watch for overfitting (training loss falling while validation loss rises), and guard against catastrophic forgetting with a low learning rate, few epochs, or parameter-efficient methods that leave most weights frozen.

After customization: a custom Bedrock model is served either through Provisioned Throughput (dedicated capacity, consistent performance) or by deploying it for on-demand inference (pay per use, no provisioned capacity) where supported. Models customized outside Bedrock — for example open-weight models fine-tuned on SageMaker AI — can be brought in with Amazon Bedrock Custom Model Import (Hugging Face safetensors weights from Amazon S3, supported architectures only).

⚠️ Exam Trap: Distillation needs prompts, not labeled answers — Bedrock generates the teacher's responses for you (or reuses teacher responses already in invocation logs, provided the teacher model matches). If a scenario says "we already log production prompts and responses from the large model and want a cheaper model," distillation from invocation logs is the signal.

⚠️ Exam Trap: "No labeled data, but we can write code that scores whether an answer is right" points to reinforcement fine-tuning, not supervised fine-tuning. "Lots of unlabeled domain documents" points to continued pre-training (domain adaptation fine-tuning on SageMaker AI JumpStart). "Answers must reflect documents that change weekly" points to RAG, not any fine-tuning method.

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•20 professional certifications