All exams← All AWS Certified AI Practitioner (AIF-C01) notes

Foundation models & prompt engineering: AWS Certified AI Practitioner (AIF-C01) revision notes

Revision notes

What is a foundation model?

A foundation model (FM) is a large, pre-trained model trained on huge, broad datasets that can be adapted to many downstream tasks (text, image, code, audio) rather than one narrow job.

Amazon Bedrock is the AWS managed service that gives serverless, API access to FMs from multiple providers (Amazon, Anthropic, Meta, Mistral, Cohere, Stability AI, AI21) without you managing infrastructure.

Key foundation model concepts

  • Pre-training: the model learns general patterns from massive unlabelled data; this is expensive and done once by the provider.
  • Fine-tuning: you adapt a pre-trained FM to your own labelled data for a specific task; cheaper and faster than training from scratch.
  • Continued pre-training (domain adaptation): further training on unlabelled domain data to improve vocabulary/context understanding.
  • Retrieval Augmented Generation (RAG): the model retrieves relevant external data at inference time to ground its answer, reducing hallucination without retraining.
  • Amazon Bedrock Knowledge Bases is AWS's managed RAG feature, using vector embeddings and a vector store.

Inference parameters (exam favourites)

  • Temperature (0 to 1): controls randomness/creativity. Low = deterministic, focused, repeatable. High = diverse, creative, riskier.
  • Top P: controls diversity by only sampling from the smallest set of tokens whose cumulative probability meets P. Lower Top P = narrower, more predictable choices.
  • Top K: limits sampling to the K most likely next tokens.
  • Max tokens / response length: caps the length of the generated output and therefore cost.
  • These parameters affect output quality and cost but do NOT change the model's underlying knowledge.

Prompt engineering essentials

Prompt engineering is crafting inputs to get better, more reliable outputs WITHOUT changing model weights - it's the cheapest and fastest way to improve results.

  • Zero-shot prompting: no examples given, just the instruction.
  • Few-shot prompting: a small number of examples included in the prompt to show the desired pattern.
  • Chain-of-thought (CoT) prompting: asking the model to reason step by step, improving performance on multi-step or logic problems.
  • Prompt templates: reusable structured prompts with placeholders, useful for consistency at scale.
  • Negative prompting: telling the model what NOT to do or include, common in image generation.

Prompt risks and mitigation

  • Prompt injection: malicious input trying to override the system prompt or instructions - a security concern for AI Practitioner exam.
  • Jailbreaking: attempts to bypass safety guardrails.
  • Hallucination: the model confidently generates false or unsupported information - mitigate with RAG, fine-tuning, or lower temperature.
  • Amazon Bedrock Guardrails helps filter harmful content, block denied topics, and reduce hallucinations at the platform level.

Common mistakes

  • Confusing fine-tuning (changes model weights) with prompt engineering (changes only the input, no retraining).
  • Thinking temperature and Top P do the same thing - they are separate, complementary controls.
  • Forgetting RAG does NOT retrain the model; it augments the prompt with retrieved context at runtime.
  • Assuming more examples always help - few-shot only needs enough examples to demonstrate the pattern, not a full dataset.

Key facts

Flashcards

What is a foundation model?
A large model pre-trained on broad data that can be adapted to many downstream tasks, not just one narrow job.
tap to reveal
What does Amazon Bedrock provide?
Serverless API access to foundation models from multiple providers (Anthropic, Meta, Mistral, Cohere, AI21, Stability AI, Amazon) without managing infrastructure.
tap to reveal
What does the temperature parameter control?
Randomness of output: low temperature = focused/deterministic, high temperature = creative/varied.
tap to reveal
What does Top P do?
Limits sampling to the smallest set of tokens whose cumulative probability reaches P, controlling diversity of output.
tap to reveal
What does Top K do?
Restricts the model to choosing its next token only from the K most likely candidates.
tap to reveal
Define zero-shot prompting.
Giving the model an instruction with no examples of the desired output.
tap to reveal
Define few-shot prompting.
Including a small number of examples in the prompt to demonstrate the desired pattern before the real task.
tap to reveal
What is chain-of-thought prompting?
Prompting the model to reason step by step, which improves accuracy on multi-step or logical tasks.
tap to reveal
What is RAG and what problem does it solve?
Retrieval Augmented Generation - retrieves relevant external data at inference time to ground answers and reduce hallucination, without retraining the model.
tap to reveal
What is Amazon Bedrock Knowledge Bases?
AWS's managed RAG feature that uses vector embeddings and a vector store to ground model responses in your data.
tap to reveal
How does fine-tuning differ from prompt engineering?
Fine-tuning updates the model's weights using labelled data; prompt engineering only changes the input text and does not retrain the model.
tap to reveal
What is prompt injection?
A security risk where malicious input attempts to override a model's system prompt or safety instructions.
tap to reveal
What is hallucination in the context of FMs?
When a model confidently generates false or unsupported information; mitigated by RAG, fine-tuning, or lower temperature.
tap to reveal
What does Amazon Bedrock Guardrails do?
Filters harmful content, blocks denied topics, and helps reduce hallucinations at the platform level.
tap to reveal
What is negative prompting typically used for?
Telling the model what to exclude or avoid, commonly used to steer image generation away from unwanted elements.
tap to reveal
Practice questions

Foundation models & prompt engineering: 5 practice questions

Q1. What is a foundation model (FM) in the context of AWS AI services?
  • A.  A rules-based expert system with no machine learning component
  • B.  A small model trained only for a single narrow classification task
  • C.  A large, pre-trained model trained on broad, diverse data that can be adapted to many downstream tasks
  • D.  A model that can only process structured tabular data
Show answer & explanation
✓ Answer: C. A large, pre-trained model trained on broad, diverse data that can be adapted to many downstream tasks
Foundation models are large models pre-trained on vast, diverse datasets, giving them broad general capability that can then be adapted (via prompting or fine-tuning) to many different downstream tasks. This contrasts with traditional narrow ML models built for one specific task.
Q2. Which AWS service provides serverless access to foundation models from multiple providers through a single API?
  • A.  Amazon Comprehend
  • B.  AWS DeepComposer
  • C.  Amazon Bedrock
  • D.  Amazon SageMaker JumpStart
Show answer & explanation
✓ Answer: C. Amazon Bedrock
Amazon Bedrock is a fully managed, serverless service that offers a unified API to access foundation models from Amazon and third-party providers such as Anthropic, AI21 Labs, Cohere, Meta, and Stability AI. SageMaker JumpStart also hosts FMs but requires managing endpoints/infrastructure yourself.
Q3. In prompt engineering, what does 'zero-shot prompting' mean?
  • A.  Providing exactly one example before asking the model to perform the task
  • B.  Asking the model to complete a task without providing any examples in the prompt
  • C.  Fine-tuning the model on zero training examples
  • D.  Running the same prompt multiple times and averaging the outputs
Show answer & explanation
✓ Answer: B. Asking the model to complete a task without providing any examples in the prompt
Zero-shot prompting means giving the model only an instruction or question, relying entirely on its pre-trained knowledge with no in-prompt examples. One-shot and few-shot prompting instead include one or several examples to guide the response format and style.
Q4. A prompt engineer wants a foundation model to produce more consistent, deterministic outputs across repeated runs of the same prompt. Which inference parameter should be lowered?
  • A.  Top-k
  • B.  Temperature
  • C.  Max tokens
  • D.  Stop sequences
Show answer & explanation
✓ Answer: B. Temperature
Temperature controls randomness in token selection; a lower temperature (closer to 0) makes the model favour the highest-probability tokens, producing more deterministic and repeatable output. Max tokens only limits output length and does not affect variability.
Q5. What is the primary purpose of few-shot prompting?
  • A.  To include a small number of input-output examples in the prompt so the model can infer the desired pattern
  • B.  To reduce the number of tokens sent to the model
  • C.  To restrict the model to only a few possible output categories
  • D.  To fine-tune model weights using a small labelled dataset
Show answer & explanation
✓ Answer: A. To include a small number of input-output examples in the prompt so the model can infer the desired pattern
Few-shot prompting supplies a handful of example input-output pairs directly in the prompt, letting the model learn the desired task pattern purely through in-context learning, without any weight updates. This differs from fine-tuning, which permanently changes model parameters.
Test yourself
See the AWS Certified AI Practitioner (AIF-C01) page

More AWS Certified AI Practitioner (AIF-C01) topics