AWS AI Practitioner cheat sheet
AWS AI Practitioner · Keep the key ideas within reach.
Fundamentals of AI and ML
AI is the broad field of machines performing tasks associated with human intelligence; ML is the subset where models learn patterns from data instead of being explicitly programmed.
Supervised learning trains on labeled data (classification predicts discrete classes, regression predicts continuous values); unsupervised learning finds structure in unlabeled data (clustering, dimensionality reduction).
Reinforcement learning trains an agent by reward and penalty over sequential actions; it needs an environment, a reward signal, and an exploration strategy.
Training data is split into train/validation/test sets; the validation set tunes hyperparameters and the test set estimates generalization and must not influence training.
Overfitting = low training error but high validation error (high variance); underfitting = high error on both (high bias). Regularization, more data, and simpler models reduce variance.
Common metrics: accuracy (balanced classes), precision/recall/F1 (imbalanced classes), RMSE/MAE (regression), AUC-ROC (ranking quality).
AWS managed ML services: SageMaker for building, training, and deploying custom models; Bedrock for foundation models via API; Comprehend, Rekognition, Transcribe, and Forecast for prebuilt task-specific inference.
Feature engineering creates informative inputs; feature store centralizes reusable features; SageMaker Ground Truth produces labeled datasets including human-in-the-loop review.
Inference choices trade off latency and cost: real-time endpoints for low-latency requests, serverless inference for intermittent traffic, batch transform for large offline jobs, asynchronous inference for large payloads.
Fundamentals of Generative AI
Foundation models are large models pretrained on broad data that can be adapted to many downstream tasks; LLMs are foundation models specialized for text.
Transformer architecture uses self-attention to weigh relationships between tokens in parallel, enabling long-context modeling and scalable training.
Tokenization splits text into subword units; context window is the maximum token count (prompt plus output) the model can process in one request.
Training stages: pretraining (next-token prediction on large corpora), fine-tuning or instruction tuning (task/behavior adaptation), and alignment via RLHF using human preference rankings.
Inference sampling parameters: temperature controls randomness, top-p (nucleus) restricts to cumulative probability mass, top-k restricts to the k most likely tokens, max tokens caps output length.
Embeddings map text or images to dense vectors; semantic similarity is measured with cosine similarity and powers retrieval-augmented generation and vector search.
Hallucination is fluent but unsupported model output; grounding with retrieved documents, citations, and guardrails reduces it but does not eliminate it.
Amazon Bedrock provides serverless access to multiple foundation models through a unified API, with Knowledge Bases for RAG, Agents for tool use, and Guardrails for content filtering.
Amazon Q is a generative AI assistant family for business (Q Business) and developer (Q Developer) use cases, distinct from building custom applications on Bedrock.
Applications of Foundation Models
Prompt engineering patterns: zero-shot instruction, few-shot examples, chain-of-thought reasoning, and role/system prompts that fix persona and constraints.
Retrieval-augmented generation (RAG) pipeline: ingest and chunk documents, embed into a vector store, retrieve top-k passages by similarity, then pass them in the prompt for grounded answers.
Fine-tuning adjusts model weights for domain style or format; RAG adds external knowledge without retraining. Choose fine-tuning for behavior, RAG for fresh or proprietary facts.
Bedrock Knowledge Bases handles chunking, embedding, vector storage (e.g., OpenSearch Serverless, Aurora pgvector), and retrieval; Bedrock Agents orchestrate multi-step tasks by calling APIs via action groups.
Model selection criteria: task quality, context length, latency, cost per token, modality support (text, image, audio), and regional availability.
Provisioned throughput on Bedrock reserves model capacity for predictable high-volume workloads; on-demand pricing suits variable or low traffic.
Bedrock Flows chains prompts, models, and knowledge bases into a visual workflow; Bedrock Model Evaluation compares models on quality, toxicity, and robustness.
Common application patterns: summarization, classification/extraction, conversational assistants, code generation, semantic search, and content generation with human review.
Guidelines for Responsible AI
Core responsible AI dimensions: fairness, explainability, privacy, safety, controllability, verifiability, and governance.
Bias sources include unrepresentative training data, labeler bias, and proxy features; mitigation spans data balancing, fairness metrics, and post-processing adjustments.
Amazon Bedrock Guardrails can filter harmful content, deny topics, mask PII, block profanity, and ground responses in a source to reduce hallucinations.
Amazon SageMaker Clarify detects bias in data and models and produces feature-attribution explanations for transparency.
SageMaker Model Monitor detects data drift and model quality drift in production so degradation is caught before it affects users.
Human-in-the-loop review (A2I) is appropriate for high-stakes decisions; fully automated decisions require documented justification and appeal paths.
Transparency artifacts: model cards document intended use and limitations, data sheets document dataset provenance, and system cards describe architecture and risk controls.
Privacy-preserving techniques: PII detection and redaction, data minimization, encryption, and differential privacy for aggregate statistics.
Security, Compliance, and Governance for AI Solutions
Shared responsibility model: AWS secures the cloud (infrastructure, managed service internals); the customer secures data, IAM permissions, encryption choices, and application code.
IAM least privilege for AI workloads: scoped roles for Bedrock and SageMaker, separate execution roles, and no long-lived access keys in code.
Encryption: data at rest via AWS KMS customer-managed keys, data in transit via TLS; Bedrock and SageMaker support customer-managed KMS keys.
Network isolation: VPC endpoints (PrivateLink) keep traffic to Bedrock and SageMaker off the public internet; security groups and private subnets restrict access.
Data governance: Amazon Macie discovers and classifies sensitive data in S3; AWS Lake Formation and Glue Data Catalog control and catalog training data.
Auditability: AWS CloudTrail logs API activity, CloudWatch captures metrics and logs, and Bedrock model invocation logging records prompts and responses when enabled.
Compliance frameworks relevant to AI: GDPR, HIPAA, SOC 2, and ISO 27001; AWS Artifact supplies AWS compliance reports and agreements.
Governance controls include data residency (regional model availability), retention policies, approval workflows for model deployment, and documented risk assessments.
Generative AI security risks: prompt injection, training data poisoning, insecure output handling, and model denial of service; mitigations include input validation, output sanitization, and guardrails.