Exams / AIF-C01 / D3 Fundamentals of GenAI
D3.3
Fundamentals of GenAI (part 3 of 3)
- Exam domain: Fundamentals of GenAI
Inference parameters: diversity and length
| Parameter | Effect |
|---|---|
| Temperature | A lower temperature leads to more deterministic responses; a higher temperature flattens the distribution and leads to more random, diverse output. |
| Top K | Number of most-likely candidates considered for the next token (lower = more focused). |
| Response length | Minimum or maximum number of tokens to return. |
- Creative and brief: raise temperature, lower response length.
- "Outputs less diverse" for an LLM: change temperature. Batch size, learning rate and optimizer type are training settings, not inference settings.
- Because tokens are sampled, the same prompt can give different answers: this is nondeterminism, not a bug or a security flaw.
Prompt engineering techniques
| Technique | Signature |
|---|---|
| Zero-shot | Instruction only, no examples (e.g. "Classify the following text as sports, politics or entertainment"). |
| Few-shot | Examples included in the prompt; for intent detection the examples are user message → correct intent pairs. |
| Chain-of-thought | "Think step by step"; the model reasons through intermediate steps before the final answer. |
| Persona and tone | Role/tone context shapes vocabulary and style, so answers represent the brand. |
| Negative prompt | Image models (Amazon Nova Canvas): negativeText excludes objects or styles. Inpainting/outpainting/mask prompts edit regions, they do not exclude traits. |
| Prompt caching | Cache checkpoints reuse a static prompt prefix (e.g. a system prompt) to cut latency and input-token cost, without changing the model. |
Training stages and customization
| Term | Meaning |
|---|---|
| Pre-training | Building a foundation model from scratch (random weights, language-modeling objective, huge web corpus). |
| Continued pre-training | Extends pre-training with additional unlabeled domain text (legal, medical...). |
| Supervised fine-tuning | Needs labeled input-output examples for specific tasks. |
| RAG | Not a fine-tuning method: retrieves context at inference time. |
Embeddings, hallucination and grounding
- Embeddings: vector representations of text that capture meaning; used for semantic similarity, clustering and retrieval. (Storing vectors is the vector store's job; lower-precision weights is quantization.)
- Hallucination: plausible-sounding but incorrect or unrelated output. Not overfitting, not data leakage.
- Mitigation: contextual grounding checks in Bedrock Guardrails filter responses not grounded in a reference source. Knowledge Bases evaluation metric Faithfulness measures how well responses avoid hallucination with respect to retrieved texts.
- Multimodal: image input → text output requires a multimodal model.
- Typical GenAI use: summarizing text. Classification, segmentation and forecasting are classic ML.
Exam traps
- "Same input, different outputs": nondeterminism (sampling), not guardrails.
- "Plausible but wrong": hallucination; if both varying output and false info appear, pick nondeterminism + hallucination.
- Unlabeled data: continued pre-training; labeled pairs → fine-tuning / few-shot examples.
- "Prevent hallucination": contextual grounding (not "relevance grounding").
- Caching a system prompt: prompt caching, not fine-tuning, guardrails or knowledge bases.
Docs
- https://docs.aws.amazon.com/bedrock/latest/userguide/inference-parameters.html
- https://docs.aws.amazon.com/nova/latest/userguide/prompting-image-negative.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/titan-embedding-models.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-eval-retrieve.html
- https://docs.aws.amazon.com/nova/latest/userguide/nova-cpt.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html
- https://docs.aws.amazon.com/nova/latest/userguide/prompting-chain-of-thought.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-contextual-grounding-check.html
- https://docs.aws.amazon.com/wellarchitected/latest/generative-ai-lens/definitions.html