This source assessment covers both Module 6 (Generative AI) and Module 9 (Agentic AI).
Module 9 Test: Agentic AI
This is your progress tracker. 20 questions: 5 Easy, 10 Moderate, 5 Hard. First solve all the questions yourself (think about the output in your mind before running the code in Colab), then check with the Answer Key.
| Score | Meaning |
|---|---|
| 18 to 20 | Excellent! Your grip on Modules 6 and 9 is strong. |
| 14 to 17 | Very good! Read the weak chapter again. |
| 10 to 13 | Okay. Run the code yourself and look again. |
| Below 10 | Don't worry. Start again from Chapters 29 to 33 and run every code |
| in Colab. |
EASY
Q1. What was the biggest change that the Transformer made compared to RNN/LSTM? A) It read text one word at a time
B) It worked only on images
C) It processed tokens together (in parallel) and caught relations through attention
D) It completely removed the need for training
Q2. What does Query (Q) mean in attention?
A) What I am looking for (the search)
B) The actual content/information of the token
C) The position of the token (order)
D) The value of the loss
Q3. What is the basic goal of LLM pre-training?
A) Classifying pictures
B) Cleaning data
C) Only doing translation D) Correctly guessing the next token
Q4. Which statement about the OpenAI API key is correct? A) It should be written in code and put on GitHub
B) It should be kept in an environment variable or Colab Secrets
C) It should be sent to friends on WhatsApp
D) It should be written in a website URL
Q5. Who actually runs the real function in function calling?
A) The model itself
B) The OpenAI server itself
C) Your own code D) The browser
MODERATE
Q6. Why do we divide the scores by sqrt(d_k) in scaled dot-product attention?
A) So that the output becomes smaller
B) So that softmax does not saturate (one weight does not get close to 1)
C) So that memory is saved
D) So that we know the order of tokens
Q7. Why is Positional Encoding needed in a Transformer?
A) To reduce the loss
B) To increase the vocabulary
C) To decide the number of heads
D) Because attention does not know the order of tokens by itself
Q8. Which is the correct difference between BERT and GPT?
A) BERT is encoder-only (looks both ways, masked LM); GPT is decoder-only (only the previous, predicts the next token)
B) BERT is decoder-only and GPT is encoder-only
C) Both are exactly the same
D) BERT generates text, GPT only does classification
Q9. What happens in sampling when temperature is changed from 0.2 to 2.0?
A) The answer becomes more certain and the same
B) The intelligence of the model increases
C) The answers become more random and different
D) The size of the answer becomes smaller
Q10. What is the biggest benefit of RAG?
A) The model's weights change
B) The need for a GPU disappears
C) Token cost becomes zero
D) Answers come from fresh/your own documents with sources, which reduces hallucination
Q11. Giving 3 examples (input -> output) in the prompt to make the model do a new task is called what?
A) Fine-tuning
B) Few-shot prompting
C) Embedding
D) Tokenization
Q12. For which problem is fine-tuning most suitable?
A) When you need a consistent style or a strict format of answer
B) To make the model remember new facts that change every day
C) To search the internet
D) To increase the context window
Q13. What is the purpose of max_turns in the agent's run loop?
A) To make the answer shorter
B) To change the model
C) To stop the loop from running too long (saves cost and stops endless cycles)
D) To clear the memory Q14. What is the difference between handoff and agent-as-tool?
A) In a handoff the manager keeps control; in as_tool the specialist gets control
B) In a handoff control goes to the specialist; in as_tool the manager keeps control
C) Both are exactly the same
D) Handoff is only for tools
Q15. What is prompt injection?
A) The API key being very long
B) A GPU memory error
C) The tokenizer running wrongly
D) Hidden instructions in outside text (web page/email) that mislead the model
HARD
Q16. What will be the output of this code?
import numpy as np
mask = np.tril(np.ones((3, 3), dtype=bool))
print(mask.sum())
A) 6 B) 3
C) 9
D) 0
Q17. In Multi-Head Attention, if d_model = 32 and h = 4 heads, what are the total parameters of Wq, Wk, Wv, Wo (without bias)?
A) 1024
B) 16384 C) 4096
D) 512
Q18. On a 1000 x 1000 weight matrix, what will be the total parameters of A and B for LoRA (rank r = 4)?
A) 4,000
B) 8,000 C) 1,000,000
D) 4,000,000
Q19. What will be the output of this code?
def cost(i, o):
return i/1_000_000*1.00 + o/1_000_000*4.00
print(round(cost(2000, 500), 3))
A) 0.002 B) 0.006 C) 0.04 D) 0.004
Q20. Each step of an agent is 90% correct. After 5 steps, what is approximately the probability that the whole task is correct?
A) 0.90 B) 0.45 C) 0.59
D) 0.50
Modules 6 and 9 Answer Key (with explanation)
| # | Level | Answer | Explanation |
|---|---|---|---|
| 1 | Easy | C) Processed tokens together (parallel) and caught relations through attention | There is no recurrence in the Transformer, there is attention: all tokens are seen together (in parallel), which makes training fast and makes distant relations easy. |
| 2 | Easy | A) What I am looking for (search) | Query = search, Key = identification (label), Value = actual content. The match of Query with Key makes the weights. |
| 3 | Easy | D) Correctly guessing the next token | An LLM is a very large language model which learns to guess the next token with cross-entropy; other abilities come from this. |
| 4 | Easy | B) Kept in an environment variable or Colab Secrets | The API key is a secret. If it is stolen, someone else uses it at your expense, so use environment/Secrets. |
| 5 | Easy | C) Your own code | The model only writes the function name and arguments; your code runs the function and gives the result back to the model. |
| 6 | Moderate | B) So that softmax does not saturate (one weight does not get close to 1) | When d_k increases, the spread of dot products increases and softmax becomes hard; dividing by sqrt(d_k) keeps the weights soft. |
| 7 | Moderate | D) Because attention does not know the order of tokens by itself | Self-attention is permutation- equivariant: shuffling tokens only changes the place of the output. So position information is added separately. |
| 8 | Moderate | A) BERT is encoder-only (looks both ways, masked | BERT is a bidirectional encoder that is good at |
| LM); GPT is decoder-only (onlytheprevious, predicts | understanding text; GPT is a causal decoder that |
| the next token) | generates text by guessing the next token. | ||
|---|---|---|---|
| 9 | Moderate | C) The answers become more random and different | Small temperature = sharp probabilities (certain answer); large = equal (random). It does not change intelligence, only randomness. |
| 10 | Moderate | D) Answers come from fresh/your own documents with sources, which reduces hallucination | RAG first finds the right chunks and gives them in the prompt, so the answer is based on your data and can be verified with sources. |
| 11 | Moderate | B) Few-shot prompting | In few-shot, the examples are inside the prompt and the model's weights do not change; in fine-tuning the weights change. |
| 12 | Moderate | A) When you need a consistent style or a strict format of answer | Fine-tuning teaches style, format and behaviour. For new and changing facts, RAG is better. |
| 13 | Moderate | C) To stop the loop from running too long (saves cost and stops endless cycles) | max_turns is a safety limit: if the agent gets stuck in a tool cycle, a MaxTurnsExceeded error comes and money is not wasted. |
| 14 | Moderate | B) In a handoff control goes to the specialist; in as_tool the manager keeps control | Handoff: the new agent handles the conversation. Agent-as-tool: the specialist does one helping job and the manager combines everything into the answer. |
| 15 | Moderate | D) Hidden instructions in outside text (web page/email) that mislead the model | Outside text read by an agent may contain an attacking instruction. Treat outside text as data, not orders, and limit tool permissions. |
| 16 | Hard | A) 6 | np.tril keeps the lower triangle (including the diagonal) as True: 1 + 2 + 3 = 6 True values. |
| 17 | Hard | C) 4096 | Parameters = 4 x d_model x d_model = 4 x 32 x 32 = 4096. Heads only use these matrices by splitting them, so the parameters do not increase with h. |
| 18 | Hard | B) 8,000 | A: (r x d) = 4 x 1000 = 4000, B: (d x r) = 1000 x 4 = 4000. Total 8000, while the full matrix has 1,000,000 parameters (only 0.8%). |
| 19 | Hard | D) 0.004 | Input: 2000/1e6 x 1 = 0.002. |
|---|---|---|---|
| Output: 500/1e6 x 4 = 0.002. Sum = 0.004 dollars. | |||
| 20 | Hard | C) 0.59 | p^n = 0.9^5 = 0.59049, i.e. only about 59%. Long agents |
| need small steps, checks and | |||
| a way back. |
Your score: ______ / 20