Exams / AIF-C01 / D3 Fundamentals of GenAI
Fundamentals of GenAI (part 2 of 3)
- Exam domain: Fundamentals of GenAI
Tokens, embeddings and modality
| Concept | What to remember |
|---|---|
| Token | A sequence of characters a model reads or predicts as one unit: a word, part of a word, punctuation or a common phrase. |
| Embedding | Text transformed into a vector of numbers so the similarity between objects can be compared mathematically. |
| Modality | The type of data a model accepts or produces (text, image, audio...). Compare modalities when picking an FM for the output types you need. |
| Multimodal LLM | Takes text and images in and answers in text (for example a tutor that reads a photo of a question). |
| Transformer | Architecture behind LLMs and text generation; GANs, VAEs and diffusion models are mainly image generators. |
Inference parameters
| Parameter | Effect |
|---|---|
| Temperature | Lower = more deterministic and consistent; higher = more random. |
| Top K | Number of most-likely candidate tokens considered for the next token. |
| Top P | Share of cumulative probability considered for the next token. |
| Stop sequences | Characters that stop generation. |
| Max tokens / output length | Length only, not randomness. |
Lowering temperature is the answer for "consistent / deterministic / fewer hallucinations" when RAG is not offered. For image models, the number of generation steps (diffusion refinement passes) is the lever for detail; "token length" is a text concept.
Prompt engineering
| Technique | Use it when |
|---|---|
| Zero-shot | No examples are given. |
| Few-shot | You give several input-output examples so the model copies a format. |
| Chain-of-thought | You ask the model to think step by step (numerical or multi-step reasoning). |
| Context in the prompt | You supply documents, facts and constraints that guide the answer. |
Good prompts state the task, key facts, and the desired output format and length. In Bedrock Prompt Management, a tools configuration lets a tool-capable model call external services; variables only substitute values.
Models are stateless: to let an LLM use earlier messages, the application sends the previous user and assistant messages again with each request (Converse API).
RAG, chunking and customization
| Approach | Purpose |
|---|---|
| RAG | Model references an authoritative knowledge base outside its training data before answering; no retraining; reduces hallucinations. |
| Chunking | Splits documents into focused passages so retrieval returns more relevant context. |
| Continued pre-training | Trains on unlabeled domain data so the model becomes more domain-specific. |
| Fine-tuning | Adapts a model on labeled data; the next step after prompt engineering fails on domain vocabulary. |
Evaluation
Evaluation is the lifecycle stage where accuracy is tested. Metrics: F1 (precision + recall) for question answering; ROUGE and BLEU compare word overlap; BERTScore compares meaning through embeddings (best for slang or spelling variations); time to first token is latency; word error rate is for speech.
Exam traps
- Hallucination is the production drawback of GenAI; the fix named most often is RAG.
- "Number of candidate tokens" = Top K, not temperature or max tokens.
- Conversation memory comes from resending messages, not from logging, Provisioned Throughput or Personalize.
- Several examples = few-shot; one example = one-shot.
- Continued pre-training improves domain knowledge, it does not shrink the model or speed up inference.