Exams / AIF-C01 / D3 Fundamentals of GenAI
Fundamentals of GenAI (part 1 of 3)
- Exam domain: Fundamentals of GenAI
Transformers, tokens and embeddings
| Concept | What to remember |
|---|---|
| Transformer | Uses a self-attention mechanism that weighs the importance of different tokens in the sequence; processes the whole sequence at once (unlike RNNs, which go element by element, and CNNs, which use convolutions). |
| Embeddings | Numerical vectors representing real-world objects/concepts so models can compare meaning. |
| Context window | Maximum number of tokens a model can consider in one request; decides how much fits in a prompt. |
| Multimodal model | Handles several data types (text, images, audio, video). |
| Hallucination | Fabricated or ungrounded output; mitigated by better prompts, RAG, or another model. |
Inference parameters
| Parameter | Effect |
|---|---|
| Temperature | Low = more deterministic, high = more random. |
| Top K / Top P | Limit how many (or what share of) candidate tokens are considered; higher = more diversity. |
| Response length | Minimum or maximum number of tokens to return. |
Default values and ranges depend on the model, and so do token limits: check them before reusing a prompt across models. Determinism is a parameter question, not something you obtain by writing "be deterministic" in the prompt. Real-time apps: evaluate inference speed (latency).
Prompt engineering
| Technique | Idea |
|---|---|
| Zero-shot | Task without examples. |
| Single-/one-shot | One example. |
| Few-shot | Several examples in the prompt (e.g. labeled sentiment samples). |
| Chain-of-thought | Ask for step-by-step reasoning on complex problems. |
| Prompt chaining | Several sequential prompts, each subtask feeding the next. |
| Negative prompt | Image models: say what must not appear (e.g. negativeText in Titan Image Generator). |
| System prompt | Defines role, instructions and behavioral boundaries. |
Prompt components: task, role (persona), response style (tone/format/structure), success criteria, context and examples. Tone, length and language problems are solved by iterating on the prompt.
Prompt engineering is not a security control: prompt injection is an application-level concern, and Bedrock Guardrails (denied topics, prompt-attack detection) provide managed enforcement with the least overhead.
Customizing a model
| Method | Data | Use |
|---|---|---|
| Prompt engineering | none | Cheapest first step. |
| Fine-tuning (transfer learning, instruction-based) | Labeled input/output (prompt/completion) pairs, JSON Lines (.jsonl) |
Teach a task, tone or style. |
| Continued pre-training | Unlabeled domain text | Add domain knowledge. |
| Pre-training | Huge datasets, from scratch | Build the base model. |
Exam traps
- "Labeled pairs" means fine-tuning; "unlabeled data" means continued pre-training.
- Prompt chaining (many prompts) is not chain-of-thought (one prompt, reasoning steps).
- Temperature 0 for determinism; writing it in the prompt does not work.
- Hallucination is not nondeterminism or bias.
- Prompt injection is the classic prompt engineering risk; data poisoning is a training-time risk.
- Zero-shot has no examples; it is not "retrieval" (that is RAG).
Docs
- https://aws.amazon.com/what-is/transformers-in-artificial-intelligence/
- https://docs.aws.amazon.com/bedrock/latest/userguide/inference-parameters.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-engineering-guidelines.html
- https://aws.amazon.com/what-is/prompt-engineering/
- https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-prepare.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html
- https://docs.aws.amazon.com/nova/latest/nova2-userguide/nova-cpt.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-image.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-injection.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-denied-topics.html
- https://aws.amazon.com/what-is/embeddings-in-machine-learning/
- https://docs.aws.amazon.com/prescriptive-guidance/latest/strategy-enterprise-ready-gen-ai-platform/patterns.html