Interview bank, weekly quizzes and answer keys
100 technical and 50 AI product questions with model answers, 90 quiz questions with explanations (15 per week), and a model answer for every subject assignment. Use the search box to find a topic.
100 technical questions
What is a virtual environment?Python
An isolated set of libraries for one project, so package versions do not conflict across projects.
What does HTTP status 401 mean?APIs
Unauthorised: the key or credentials are missing or wrong.
Why use environment variables for keys?APIs
They keep secrets out of code and version control, and let each environment use its own values.
What is a token?LLM
A piece of text the model reads and writes; usage and cost are counted in tokens.
What is a context window?LLM
The maximum number of tokens the model can consider at once, including instructions, history and retrieved text.
What does temperature do?LLM
It controls randomness when choosing the next token; lower is more predictable.
Pre-training versus fine-tuning?LLM
Pre-training teaches general language from large data; fine-tuning adapts a model to a task or style with a smaller dataset.
What is inference?LLM
Running a trained model to produce output for an input.
Difference between system and user prompts?Prompting
The system prompt sets rules and role; the user prompt is the request.
How do you get structured output?Prompting
Specify a schema, use the provider's structured output or JSON mode, and validate the result in code.
What is an embedding?Embeddings
A vector of numbers that represents meaning; similar meanings get similar vectors.
What is cosine similarity?Embeddings
A measure of the angle between two vectors, used to rank semantic similarity.
What is RAG?RAG
Retrieval-augmented generation: retrieve relevant passages and give them to the model to answer from.
Why does chunk size matter?RAG
Too small loses context; too large adds noise and cost and can dilute the answer.
What is reranking?RAG
A second model or scorer that reorders retrieved chunks for better relevance before generation.
Name two vector databases and when to use each.Vector DB
Chroma for simple local projects; pgvector when PostgreSQL is already in use; Qdrant or Pinecone for scale and managed hosting.
What is an agent?Agents
A system that loops: decides an action, uses a tool, observes the result and continues until the goal is met.
How do you stop an agent looping forever?Agents
A step limit, a stop condition, cost budget and timeouts, plus logging of each step.
What is function calling?Tools
The model returns a structured request to call a named function with arguments; your code runs it and returns the result.
What is MCP?MCP
Model Context Protocol: an open standard that lets AI apps discover and use tools, resources and prompts from servers.
What is a golden dataset?Evals
A fixed, expert-checked set of test inputs and expected answers used to measure every change.
What is groundedness?Evals
Whether an answer is supported by the provided sources.
What is LLM-as-a-judge and what are its limits?Evals
Using a model to score outputs. It is fast, but can be biased; check it against human ratings.
Why do models hallucinate?Hallucinations
They generate likely continuations, not verified facts; missing context and ambiguous questions increase the risk.
What is prompt injection?Security
Hidden instructions in input or retrieved text that try to override the system's rules. Treat retrieved text as untrusted data.
What drives latency in an LLM app?Latency
Retrieval time, prompt length, model size, output length and network calls; measure each part separately.
How do you reduce LLM cost?Cost
Shorter prompts, caching, smaller models for simple steps, routing, batching and limiting output length.
What should you log for each LLM request?LLMOps
Prompt and model versions, retrieved sources, token counts, latency, errors and feedback, with personal data removed.
How do you design for failure?Architecture
Timeouts, retries with backoff, fallback responses, a human handoff and monitoring alerts.
What is human-in-the-loop?Responsible AI
A design where a person reviews or approves model output or actions, especially for high-risk decisions.
What is the difference between a list and a dictionary?Python
A list keeps items in order and you reach them by position; a dictionary maps keys to values and you reach them by key. JSON objects become dictionaries in Python.
Why use try and except around an API call?Python
Network calls fail for reasons outside your code (timeouts, rate limits, bad keys). Catching specific errors lets you retry, show a clear message or fall back instead of crashing.
What does pip install -r requirements.txt do and why pin versions?Python
It installs every listed package. Pinning versions makes builds repeatable, so a new library release cannot silently break the app.
What is async and when does it help in AI apps?Python
Async lets one process wait on many slow input/output calls at once, such as several model or retrieval calls, instead of waiting for each in turn. It does not speed up heavy computation.
Difference between GET and POST?APIs
GET reads data and sends parameters in the URL; POST sends a body to create something or run an action. Model calls are POST requests because the prompt is in the body.
What does HTTP 429 mean and how do you handle it?APIs
Too many requests: you hit a rate limit. Back off and retry with increasing delays, respect any retry-after header, and queue or batch work.
What is the difference between 4xx and 5xx errors?APIs
4xx means the request was wrong (bad input, no permission); fix the request. 5xx means the server failed; retrying later can work.
What is idempotency and why does it matter for retries?APIs
An idempotent request has the same effect if sent twice. Retrying a non-idempotent action such as a payment can do it twice, so use idempotency keys.
What is streaming in an LLM API?APIs
The server sends the answer in pieces as it is generated. Users see text sooner, and long requests avoid time-outs.
What is a transformer, in one sentence?LLM
A neural network design that uses attention to weigh how much every token in the input matters to every other token, which lets it model long-range context.
What is attention?LLM
A mechanism that lets the model look at all earlier tokens and decide which ones matter most for predicting the next token.
Why do longer prompts cost more and run slower?LLM
You pay per input token, and the model must process every token before answering. Output tokens are generated one at a time, so long answers are slower still.
What is a reasoning (thinking) model and when is it worth it?LLM
A model that works through a problem internally before answering. Worth it for multi-step maths, code and planning; wasteful for simple lookups and short answers.
What is effort (or reasoning budget) in modern model APIs?LLM
A setting that controls how much the model thinks and how thorough its answer is. Higher effort can improve hard tasks at the cost of latency and tokens.
What is a knowledge cut-off?LLM
The date after which the model has no training data. Anything newer must come from retrieval or tools.
What are open-weight models and why choose one?LLM
Models whose weights you can download and run yourself. Chosen for data control, offline use, customisation or cost at very high volume; you take on hosting and safety work.
What is fine-tuning good for, and what is it bad for?LLM
Good for style, format and narrow repeated tasks. Bad for adding fast-changing facts, which belong in retrieval.
What is multimodal input?LLM
A model that accepts images, audio or documents as well as text, such as reading a scanned invoice.
What is few-shot prompting?Prompting
Putting a few worked examples in the prompt so the model copies the pattern. Good for format and tone; costs tokens on every call.
How do you write a good prompt for a production task?Prompting
State the role and goal, give context and data clearly separated (for example in tags), list rules and the output format, show an example, and say what to do when unsure. Then test it on a golden set.
What is prompt chaining?Prompting
Splitting a task into steps, each with its own prompt, and passing outputs forward. Easier to test and debug than one huge prompt.
Why separate instructions from data in a prompt?Prompting
So text inside the data cannot be read as instructions, which reduces prompt injection and confusion.
How are embeddings different from keyword search?Embeddings
Keyword search matches exact words; embeddings match meaning, so 'holiday' can find 'paid leave'. Keyword search is better for exact codes and names.
What is the dimension of an embedding?Embeddings
The length of the vector, often hundreds to a few thousand numbers. Higher dimensions can hold more nuance but cost more storage and search time.
Can you mix embeddings from two different models?Embeddings
No. Vectors from different models live in different spaces. Change model, re-embed everything.
What is hybrid search?RAG
Combining keyword (BM25) and vector search results, usually with a weighted merge. It finds both exact terms and paraphrases.
What is query rewriting?RAG
Using a model to turn a vague or conversational question into a clear search query, for example adding the subject from earlier in the chat.
What is top-k and how do you pick k?RAG
The number of chunks retrieved. Too small misses answers; too big adds noise and cost. Choose by measuring recall and answer quality on the golden set; 3 to 8 is common.
What is contextual retrieval?RAG
Adding a short description of where a chunk sits in its document before embedding it, so a chunk like 'It rose 3%' carries its subject.
How do you keep a RAG index fresh?RAG
Re-index changed documents on a schedule or event, store document versions and dates, and remove superseded chunks.
How do you enforce access control in RAG?RAG
Store access labels with each chunk and filter by the user's permissions at retrieval time, before anything reaches the model.
When is RAG the wrong choice?RAG
When answers need calculation over structured data (use SQL or tools), when the knowledge is tiny and stable (put it in the prompt), or when the task is style rather than facts (prompting or fine-tuning).
Fixed-size or recursive chunking: which first?Chunking
Recursive, because it respects paragraphs and sentences. Measure recall@k before trying anything fancier.
How do you chunk tables?Chunking
Keep each row with its header, or rewrite rows as sentences, so a chunk is meaningful on its own.
What is an approximate nearest neighbour index?Vector DB
A structure such as HNSW that finds near-best matches very fast by not comparing against every vector. You trade a little recall for a lot of speed.
What is metadata filtering?Vector DB
Restricting search to chunks whose metadata matches, such as country or department, before or during the vector search.
Can PostgreSQL be a vector database?Vector DB
Yes, with the pgvector extension. Good when you already run Postgres and need joins, filters and transactions alongside vectors.
Workflow or agent: how do you choose?Agents
Use a fixed workflow when the steps are known; use an agent only when the model must choose steps at run time. Workflows are cheaper and easier to test.
What is the agent loop?Agents
The model decides an action, the code runs the tool, the result goes back to the model, and this repeats until the model answers or a limit is hit.
What is a multi-agent system and its main risk?Agents
Several agents with different roles passing work between them. Main risks: cost, loops and errors compounding between agents; add limits and checks.
What memory does an agent have?Agents
Short-term: the conversation and tool results in the context window. Long-term: notes or vectors stored outside and retrieved when needed.
How do you evaluate an agent?Agents
Score task success on a set of realistic tasks, plus steps taken, tool-call accuracy, cost and safety violations. Check the trajectory, not only the final answer.
What makes a good tool definition?Tools
A clear name, a description of when to use it, a strict input schema with types and limits, and outputs that are short and structured.
How do you make tool use safe?Tools
Least privilege, validate inputs in code, treat outputs as data, require human approval for actions with real-world effects, and log every call.
What happens if a tool fails?Tools
Return a clear error to the model as the tool result so it can try another way, and stop after a set number of failures.
MCP server versus client?MCP
The server exposes tools, resources and prompts (for example a ticket system); the client is the AI application that connects to it and offers them to the model.
What security risks does MCP add?MCP
Over-broad permissions, untrusted servers, and injected instructions in tool output. Approve servers, scope credentials and review actions.
What is the difference between offline and online evaluation?Evals
Offline runs a fixed test set before release; online measures live traffic after release (feedback, escalations, sampled reviews). You need both.
What metrics would you use for a RAG system?Evals
Retrieval recall@k, answer accuracy, citation accuracy, groundedness, correct refusal rate, latency p95 and cost per answer.
How big should a golden set be?Evals
Start with 30 to 50 real questions covering the main intents and edge cases; grow it with every failure found. Coverage matters more than size.
How do you check an LLM judge is reliable?Evals
Compare its scores with human labels on a sample, measure agreement, fix the rubric, and re-check whenever the judge model or prompt changes.
What is regression testing for prompts?Evals
Running the full golden set after every prompt change so a fix for one case does not break others.
What is the difference between faithfulness and correctness?Hallucinations
Faithfulness means the answer matches the sources given; correctness means it matches the truth. A faithful answer from an outdated document is still wrong.
How do citations help?Hallucinations
They tie each claim to a source users can check, and they let you measure whether the cited source supports the claim.
What is data exfiltration through an agent?Security
Injected instructions make an agent send private data out, for example through a URL or an email tool. Block outbound tools, or require approval, for untrusted contexts.
How should API keys be handled?Security
Stored in a secret manager or environment variables, never in code, logs or the browser; rotated, scoped and monitored.
What is jailbreaking?Security
Prompts designed to make the model ignore its safety rules. Defend with the provider's safety features, input and output checks, and limited capabilities.
What is time to first token and how do you improve it?Latency
The wait before output starts. Improve it with streaming, a shorter prompt, prompt caching and a faster model.
How does parallelism help?Latency
Independent steps, such as searching several sources, can run at the same time, so total time is the slowest step instead of the sum.
What is prompt caching?Cost
The provider stores a repeated prompt prefix so later calls that reuse it are cheaper and faster. Put fixed content first and changing content last.
What is the batch API used for?Cost
Non-urgent jobs such as nightly summaries or evals, sent together for a large discount with results returned later.
What is model routing?Cost
Sending each request to the cheapest model that can handle it, for example a small model for classification and a large one for hard questions.
What is a canary release for an AI feature?LLMOps
Releasing a new prompt or model to a small share of users first and comparing metrics before a full rollout.
What is drift and how do you catch it?LLMOps
A change in user questions or data that lowers quality. Catch it by tracking topic mix, refusal and feedback rates and by sampling conversations weekly.
Why pin model versions?LLMOps
So behaviour does not change without your eval running first. Move to a new version deliberately, after testing.
Why containerise an AI service?Deployment
The same image runs the same everywhere, with fixed Python and library versions, which makes deploys and rollbacks reliable.
What does a health check endpoint do?Deployment
Gives the platform a cheap way to confirm the service is up, so it can restart or stop routing traffic to an unhealthy instance.
Where should guardrails sit in the architecture?Architecture
At every boundary: input, retrieval, before tools act, and output. No single layer is enough.
What is bias in an AI system and how do you test for it?Responsible AI
Systematically worse outcomes for some groups. Test by slicing eval results by language, region or user group and comparing.
What should an AI feature disclose to users?Responsible AI
That they are talking to AI, its limits, how to reach a human, and how their data is used.
50 AI product management questions
How do you decide if a problem needs AI?Strategy
Check whether it needs language or judgement that rules cannot handle, whether data exists, and whether a simpler solution works first.
How is AI PM different from traditional PM?Strategy
Outputs vary, so quality must be defined, measured and monitored, and failure cases planned for.
How would you validate an AI feature idea before building?Discovery
Interview users, run a manual or wizard-of-oz prototype, measure the task time and accuracy the user needs, then pilot.
How do you prioritise AI use cases?Prioritisation
Score impact, effort, risk, data readiness and time to value; start with a high-value, low-risk workflow.
What is a North Star metric for an AI support bot?Metrics
Resolution rate with safe escalation: correct resolutions per week, which reflects both value and quality.
Which metrics would you track after launch?Metrics
Task completion, escalation rate, accuracy sample, hallucination rate, cost per task, latency and satisfaction.
Build or buy?Trade-offs
Compare time to value, three-year cost, data privacy, differentiation and the team's ability to maintain; pilot to decide.
How do you choose a model?Trade-offs
Start with the cheapest model that passes the golden dataset; upgrade only where quality needs it, and check privacy terms.
What data do you need for a RAG product?Data
Documents with owners, permissions, freshness rules and a plan to remove stale content.
How do you agree a quality bar with stakeholders?Evaluation
Define measurable thresholds per use case, the acceptable error rate, and the human review path for failures.
How would you handle a customer's personal data?Responsible AI
Minimise what is sent, mask personal data in logs, apply retention rules, and get legal review.
What does AI governance include?Governance
Use policies, approval for new use cases, risk assessment, audit logs and clear accountability.
How do you manage an engineer who says the model cannot do it?Stakeholders
Ask what evidence they have, run a small evaluation together, and agree on a test that would change the decision.
How do you calculate ROI for an AI assistant?Business case
Hours saved times loaded cost, plus revenue effects, minus build, run and evaluation costs over a set period.
How would you launch an AI feature safely?Launch
Limited beta, human approval for risky actions, monitoring, a rollback plan and clear user feedback loops.
A chatbot gives wrong refund policy answers. What do you do?Case
Contain: restrict or switch off the topic; investigate the retrieved sources; fix the document or prompt; add the case to the golden dataset; monitor.
What makes a good first AI use case for a company?Strategy
High volume, clear success measure, low harm when wrong, available data and an owner who wants it. Internal tools often fit before customer-facing ones.
How do you write an AI product vision?Strategy
Name the user, the job they struggle with, how AI changes it, and the measurable outcome in 12 to 24 months, plus what you will not do.
What is a moat for an AI product when everyone uses the same models?Strategy
Proprietary data and feedback loops, workflow integration, distribution, trust and evaluation know-how, not the model itself.
How do you find AI opportunities in a workflow?Discovery
Map the workflow step by step, time each step, find language-heavy, repetitive or judgement steps, and check which have data and tolerate some error.
What is a Wizard of Oz test?Discovery
Humans pretend to be the AI behind a real interface to test demand and the experience before building the model part.
How do you test whether users trust AI output?Discovery
Watch them use it: do they check sources, edit, or ignore it? Track acceptance and edit rates, and ask what would make them rely on it.
How do you size the value of an AI feature?Prioritisation
Volume x time saved per task x loaded cost x expected adoption, plus revenue or risk effects, minus build and run costs.
How do you say no to an AI feature request?Prioritisation
Show the evidence: the problem is rare, a simpler fix exists, the data is missing or the risk is too high. Offer the smaller step you will take instead.
What is the difference between model metrics and product metrics?Metrics
Model metrics measure output quality (accuracy, groundedness); product metrics measure user and business results (adoption, time saved, resolution). Good model scores do not guarantee product success.
Name guardrail metrics for an AI feature.Metrics
Harmful or wrong answer rate, escalation rate, complaint rate, cost per task and latency p95. They must not get worse while the main metric improves.
How do you measure time saved?Metrics
Time the task with and without the feature on matched samples, or log task durations before and after, and check quality is the same.
What does a good AI dashboard show?Metrics
Volume, quality (eval score and sampled reviews), user feedback, escalation, latency, cost, and splits by version, topic and segment.
Accuracy versus coverage: how do you decide?Trade-offs
Decide by the cost of a wrong answer. High-risk domains answer fewer questions with higher accuracy and refuse more; low-risk ones can answer more.
Large model or small model?Trade-offs
Start with the strongest model to prove value, build the eval, then test smaller or cheaper options against the same bar.
Prompting, RAG or fine-tuning?Trade-offs
Prompting first; RAG when answers depend on your own or changing knowledge; fine-tuning for consistent style or narrow tasks at scale.
What makes documents ready for RAG?Data
A clear owner, current versions, no duplicates, readable text (not scans without OCR), access labels and a refresh process.
How do you get labelled data for evaluation?Data
Collect real questions from logs or tickets, have experts write expected answers and sources, and add failures from production every week.
Who should own the golden set?Evaluation
The PM owns what good looks like with domain experts; engineers own the harness. Changes to expected answers need review.
What is a release bar?Evaluation
The minimum scores a version must meet to ship, agreed in advance, for example 90 percent accuracy and 100 percent correct refusal on unsafe questions.
How would you handle a biased output reported by a user?Responsible AI
Acknowledge, reproduce, assess impact, contain if needed, fix the data or prompt, add the case to the eval and report the change.
When must a human stay in the loop?Responsible AI
When an error is costly or irreversible: money, health, legal, hiring or account changes. The AI can draft; a person decides.
What goes into an AI risk register?Governance
Each risk (hallucination, data leak, injection, bias, cost overrun, outage), likelihood, impact, owner, mitigation and how it is monitored.
How do privacy rules such as India's DPDP Act affect an AI product?Governance
You need a lawful basis or consent for personal data, purpose limits, minimisation, security, retention limits and a way to handle user requests. Check with legal for specifics.
How do you explain AI uncertainty to executives?Stakeholders
Use numbers from the eval (for example 92 of 100 answers correct), show examples of the failures, and explain the safeguards and the plan to improve.
Legal wants to block the launch. What do you do?Stakeholders
Understand the specific risk, show the controls and eval evidence, propose a narrower or staged launch, and agree the conditions to expand.
How do you price an AI feature?Business case
Base it on value delivered and on cost to serve: include tokens per task at expected usage, set limits or tiers for heavy users, and watch margin.
What hidden costs do AI products have?Business case
Evaluation and labelling, monitoring, human review, prompt maintenance, provider price changes, retries and support for wrong answers.
What is in an AI launch checklist?Launch
Eval above the bar, red-team results, monitoring and alerts, rollback switch, human handoff, user disclosure, support briefed, and a staged rollout plan.
How do you run an A/B test for an AI feature?Launch
Randomise users, pick a primary metric and guardrails up front, run long enough for the novelty effect to fade, and check results by segment.
Adoption of your AI assistant is 10 percent after a month. What do you do?Case
Find out why: discoverability, trust, quality or fit with the workflow. Look at usage funnels and talk to non-users, then fix the biggest blocker first.
Costs doubled last month. What do you do?Case
Break cost down by feature, prompt version and user; look for longer prompts, retries, heavy users or a model change; apply caching, limits or routing; re-run the eval.
A competitor launches an AI feature. Should you copy it?Case
Only if it solves a real problem for your users better than your current plan. Check the evidence and your data advantage, then decide.
Design a metric framework for an AI meeting summariser.Case
North Star: meetings with summaries used. Quality: rep edit rate, missed action items. Product: weekly active users. Business: time saved and CRM data completeness. Guardrails: privacy incidents, latency.
Your AI tutor gives a wrong maths answer to a student. Walk through your response.Case
Contain (add a check or disable the topic), investigate the cause, fix, add the case to the eval, communicate with the student and teachers, and track the rate going forward.
System design: nine cases with model answers are on each system design lesson page, under the mock-interview lesson: open the cases.
90 questions, 15 per week
Answer, then press Check. Each answer shows why it is right. Score yourself: 12 or more out of 15 means you are ready for the week's assessment.
Week 1: 15 questions
Week 2: 15 questions
Week 3: 15 questions
Week 4: 15 questions
Week 5: 15 questions
Week 6: 15 questions
Model answers for the 26 assignments
Each key shows what a strong answer contains. Compare your work with the key; the marking notes say what to check. Use a key only after you have tried the assignment.
Subject 1: Python for AI beginners
Assignment: Write a function that takes a list of monthly expenses and returns the average, with a guard for an empty list. Save it in a Git repository with a README.
def average(expenses):
if not expenses:
return 0.0 # or raise ValueError("no expenses"), and say which in the README
return sum(expenses) / len(expenses)
print(average([1200, 800, 1000])) # 1000.0
print(average([])) # 0.0
README: what the function does, how to run it, the empty-list choice and one example. Marking: correct average, guard for empty input, a commit history with at least two commits, readable README.Subject 2: APIs and backend fundamentals
Assignment: Use the requests library to call a free public API and print three fields from the JSON response.
import requests
r = requests.get("https://api.github.com/repos/python/cpython", timeout=10)
r.raise_for_status()
d = r.json()
print(d["full_name"], d["stargazers_count"], d["language"])
Marking: a timeout is set, errors are checked (raise_for_status or status code), three fields are printed by key, and no key is hard-coded if the API needs one.Subject 3: LLM and generative AI fundamentals
Assignment: Explain in 150 words, to a non-technical manager, why an LLM can sound confident and still be wrong. Use the words token and training.
Model answer (about 150 words): An LLM is trained on huge amounts of text to predict the next token, a small piece of a word. During training it learns which words usually follow others, so it becomes very good at sounding fluent and sure. But it does not look facts up or check them when it answers. If the right fact was rare or missing in its training, or happened after training ended, it still produces the most likely-sounding words, which can be wrong. Its confidence comes from style, not from knowing. That is why we give it trusted documents to answer from, ask it to cite them, let it say "I don't know", and test it before relying on it. Marking: uses token and training correctly, no jargon beyond them, explains fluency versus fact checking, gives at least one safeguard.
Subject 4: LLM API integration: your first AI application
Assignment: Build a command-line app: the user types a question, the app calls an LLM (or fake_llm), prints the answer, and quits on the word exit.
while True:
q = input("You: ").strip()
if q.lower() == "exit":
break
if not q:
continue
print("AI:", chat(SYSTEM, q).text) # starter/llm.py, or fake_llm offline
Marking: loop until exit, ignores empty input, catches API errors with a clear message, key read from the environment. Starter project: examples/w1_first_call.py shows the call.Subject 5: Understanding RAG (retrieval-augmented generation)
Assignment: Change chunk size to 8 and to 20 words. For three questions, record which chunk ranks first each time, and write one sentence on what changed.
Expected finding: with 8-word chunks the top chunk often holds only part of the answer (for example the number without its subject); with 20-word chunks the right chunk ranks first more often but contains extra text. One-sentence conclusion, for example: "Bigger chunks kept the answer with its context and ranked first for 3 of 3 questions, at the cost of more words sent to the model." Marking: a table of question, chunk size, top chunk; a conclusion supported by the table.
Subject 6: Document processing and chunking
Assignment: Take one real PDF (a public policy or report). Extract, clean and chunk it. Write a table of 10 facts and the chunk where each one appears.
Deliverable: the extraction code, the cleaned text and a table of 10 rows: fact | chunk id | page. Model approach: starter/pdf_loader.py and starter/chunking.py recursive(max_words=80); clean repeated headers and footers; keep page metadata. Marking: every fact found in exactly the chunk listed; at least one fact that spans a boundary is discussed (fixed with overlap or bigger chunks).
Subject 7: Embeddings and vector databases
Assignment: Compare keyword matching and the toy embedding on five questions with synonyms (e.g. 'holiday' vs 'leave'). Report which method finds more correct chunks.
Expected result: keyword matching fails on synonyms ("holiday" does not match "leave"), the toy embedding finds some because it shares other words, and a real embedding model finds most. Report a table of 5 questions x 2 methods (correct or not) and a conclusion: semantic search for paraphrases, keywords for exact codes, hybrid for both. Marking: honest results, including where the toy embedding also fails.Subject 8: Project: PDF-based RAG chatbot
Assignment: Deliver the chatbot with a README, 10 test questions and a short report of what failed and how you fixed it.
Model deliverable: the starter project's PDF chatbot adapted to your PDF; README with architecture diagram and run steps; evals/golden.jsonl with 10 or more questions including 2 unanswerable; a report like: "Initial accuracy 6/10. Failures: two table questions (fixed by row chunking), one wrong page (metadata lost, fixed), one false answer to an unanswerable question (raised the retrieval threshold). Final 9/10, refusals 2/2." Marking: evidence before and after, at least one real fix.
Subject 9: AI agent fundamentals
Assignment: Add a third tool to the example (for example get_policy_text) and change scripted_model to use it. Print each step.
Add to TOOLS: "get_policy_text": lambda topic: {"topic": topic, "text": POLICIES.get(topic, "not found")}. In scripted_model, after the balance step return {"action": "tool", "name": "get_policy_text", "args": {"topic": "leave"}} once, then the final answer quoting it. Print each step: decision, tool, result. Marking: the loop handles three tools, unknown tools return an error, a step limit exists. With a key, examples/w3_agent_tools.py shows the same loop with Claude.Subject 10: Tool calling and agent development
Assignment: Write a tool schema for 'create_support_ticket' with title, priority (low/medium/high) and customer_id. Validate priority and reject anything else.
{"name": "create_support_ticket", "description": "Create a support ticket for a customer. Use only after confirming the issue.",
"input_schema": {"type": "object", "properties": {"title": {"type": "string", "minLength": 5, "maxLength": 120}, "priority": {"type": "string", "enum": ["low", "medium", "high"]}, "customer_id": {"type": "string", "pattern": "^C[0-9]{6}$"}}, "required": ["title", "priority", "customer_id"]}}
In code: if args["priority"] not in {"low", "medium", "high"}: return {"error": "priority must be low, medium or high"}. Marking: enum in the schema and a check in code (never trust the model alone).Subject 11: Model Context Protocol (MCP)
Assignment: Write a one-page security note for an MCP server that reads customer tickets: what it reads, what it may change, and how a human approves changes.
One-page note headings and model content: Purpose (read tickets to draft replies). Reads: ticket text, customer tier, past 90 days only; never payment data. May change: add internal notes and draft replies only; cannot close tickets, refund or email customers. Approval: drafts appear in the agent's queue; a human sends. Credentials: a service account scoped to read tickets and write drafts, rotated every 90 days. Threats: injected text in tickets treated as data; all tool calls logged; rate limits. Marking: explicit read and write lists, human approval, scoped credentials, injection named.
Subject 12: Project: AI research agent
Assignment: Build the agent for one topic. Submit the report, the list of approved sources, and a table of claims checked against sources.
Deliverables: a 1 to 2 page report on one topic; a list of approved sources (with why each is trusted); a claims table: claim | source URL | quote | supported (yes/no). Model standard: every factual claim has a source, unsupported claims are removed or marked, the agent had a step limit and a cost limit. Marking: at least 10 claims checked, at least 90 percent supported.
Subject 13: AI evaluation
Assignment: Create a 20-question golden dataset for your PDF chatbot (Week 2). Include 4 questions the documents do not answer. Report the score before and after one change.
Model golden set row: {"question": "How many days of paid leave do I get?", "expect": "20 days", "page": 1}; refusal rows use "expect": "REFUSE". 20 rows: 16 answerable across all sections, 4 unanswerable. Report: score before (for example 14/16 and 3/4 refusals), the one change (for example a refusal sentence in the prompt) and the score after. The starter's evals/run_evals.py prints exactly this scorecard. Marking: questions are realistic, unanswerable ones are plausible, the change is measured.Subject 14: Hallucinations, guardrails and AI quality
Assignment: Write a hallucination analysis: 10 test questions, the number of unsupported answers, the cause of each, and the mitigation you chose.
Table: question | answer | supported? | cause | mitigation. Typical causes: retrieval missed the chunk (fix chunking or k), the document is ambiguous (fix the document), the model added outside knowledge (stricter grounding rule and groundedness check), unanswerable but answered (retrieval threshold and refusal sentence). Summary line, for example "3 of 10 unsupported; after the threshold and prompt changes, 1 of 10." Marking: causes are diagnosed, not guessed.
Subject 15: Latency and cost
Assignment: Produce a one-page cost and latency report for your chatbot, with one proposal to cut cost by 30% and its effect on quality.
Model report: requests per day, average input and output tokens, cost per request and per day, p50 and p95 latency per step (see examples/l3_latency_cost.py). Proposal to cut cost by 30 percent, for example: retrieve 3 chunks instead of 6 and enable prompt caching for the system prompt; expected saving computed from token counts; eval run before and after shows accuracy unchanged (or the drop stated). Marking: numbers, a computed saving and a measured quality effect.
Subject 16: LLMOps: running AI in production
Assignment: Write a runbook: what to check each morning, the alert thresholds, and the rollback steps when quality falls below the bar.
Runbook: Each morning check the dashboard (volume, refusal rate, thumbs-down rate, p95 latency, cost yesterday) and the overnight eval run. Alerts: error rate over 2 percent for 10 minutes; p95 over 6 s; cost per day over 130 percent of the 7-day average; refusal rate outside 5 to 20 percent. Rollback: switch PROMPT_VERSION or model ID back in configuration, redeploy, confirm the eval, post in the incident channel. Marking: specific thresholds, named owner, rollback in under 15 minutes.
Subject 17: AI product discovery
Assignment: Write a discovery brief for one workflow in a company you know: problem, users, evidence, AI vs non-AI decision, feasibility, and a one-year ROI estimate with assumptions.
Model brief (one company workflow, for example HR queries): Problem: HR handles 1,200 policy questions a month, 6 minutes each. Users: employees and HR staff. Evidence: ticket logs, 5 interviews. AI vs non-AI: an FAQ page exists but answers are scattered across 40 PDFs, so search plus generation is justified. Feasibility: documents available and owned; errors are low-harm with a handoff. ROI: 1,200 x 6 min x 0.6 deflection = 72 hours a month x 600 rupees per hour = about 43,000 rupees a month, against about 15,000 rupees run cost plus build. Payback under 6 months. Marking: assumptions stated, a non-AI option considered.
Subject 18: End-to-end AI project: enterprise knowledge and research copilot
Assignment: Deliver milestone 1 to 3 in Week 5 and milestone 4 and 5 in Week 6 (after reviewing the interview questions).
Milestones and evidence: 1) problem and PRD approved; 2) ingestion and retrieval with recall@k reported; 3) answers with citations and a golden set score; 4) agent or tool step and evaluation report; 5) deployed demo, monitoring and a 3-minute video. Marking: each milestone has a dated artefact and a gate decision (go or fix).
Subject 19: AI product documentation
Assignment: Write the PRD for your capstone using the Part G template.
Model PRD outline using Part G: problem, personas, journey with AI and human approval points, functional and non-functional requirements (p95 latency, cost per answer, privacy), user stories with acceptance criteria that include quality thresholds (for example "90 percent of golden questions answered correctly with a correct citation"), architecture, evaluation plan, risk register, metrics, roadmap, monitoring and rollback. Marking: every requirement is testable, risks have owners.
Subject 20: Deployment, GitHub and portfolio
Assignment: Publish your repository with a README, a deployed demo link and a three-minute demo video.
Checklist: public repository with README (problem, architecture diagram, run, test, deploy, eval results), no secrets in history, Dockerfile or hosting config, live demo URL with /health, and a 3-minute video: problem (30 s), demo (90 s), architecture and evaluation (45 s), next steps (15 s). Marking: a stranger can run it from the README in under 15 minutes.
Subject 21: AI product management fundamentals
Assignment: Complete the AI PM strategy one-pager for your capstone.
One-pager: target user and job; why now; the AI bet (what the model does and what it does not); differentiation (data, workflow, distribution); success metrics; key risks and mitigations; 3 milestones. Marking: one page, measurable, honest about risks.
Subject 22: AI product metrics
Assignment: Produce a metrics table for your capstone with North Star, 3 technical, 3 product, 2 customer and 2 business metrics.
Example table for a policy chatbot: North Star: questions resolved without HR follow-up per week. Technical: answer accuracy on the golden set, citation accuracy, p95 latency. Product: weekly active users, repeat use, thumbs-up rate. Customer: CSAT, time to answer. Business: HR hours saved, cost per resolved question. Each with a target and data source. Marking: each metric has a definition, target and owner.
Subject 23: AI system design
Assignment: Design 3 systems from Part D's list (RAG chatbot, research agent, support assistant) using the template in Part G.
Use the eight-step template for each design. Model answers for nine cases, including a RAG chatbot (case 1), a research agent (case 3) and a support assistant (case 2), are on the mock interviews page. Marking: clarifying questions first, at least two alternatives per major choice, an evaluation plan and named failure modes.
Subject 24: Technical interview preparation
Assignment: Complete 20 questions from Part H, record your answers, and mark them against the model answers.
Use the interview bank (100 technical questions with model answers). Mark each recorded answer 1 to 4 on accuracy, structure, trade-offs and clarity. Model of a good self-review: "RAG answer: accurate (3) but no trade-off (2); rewrite adds when RAG is the wrong choice." Marking: 20 answers scored, weakest 3 rewritten.
Subject 25: AI product management interview preparation
Assignment: Write answers to 10 AI PM questions from Part H, each using your capstone as the example.
Use the 50 AI PM questions. A model answer structure: user and problem, options, recommendation, metrics, risks, next step, with a number from your capstone, for example "our refusal rate fell from 12 to 4 percent after adding a retrieval threshold." Marking: every answer uses the capstone, includes a metric and a risk.
Subject 26: Mock interviews (three rounds)
Assignment: Run three mock rounds with a peer or with the AI mock interview page, and submit your scores and a rewritten answer for each weak question.
Submit: rubric scores for rounds 1 to 3, two runs a week apart, and rewritten answers for every question scored below 3. The mock interviews lesson has the rubric, the timing plan and nine system design cases with model answers. Marking: scores improve between runs, rewrites address the rubric criterion that was weak.
Answer keys for the new lessons
New lesson: Chunking
Expected: a table of 4 strategies x (chunks, average words, recall@3). Typical result on a real 20-page PDF: fixed 200 words without overlap 10/15, with 15 percent overlap 12/15, recursive 13/15, by heading 13/15 with the best citations. Choice explained with recall and token cost; failures inspected (usually tables or answers split across pages). Run examples/l1_chunking.py on your PDF to get the numbers.
New lesson: Hallucinations guardrails
Expected: 5 unanswerable questions (plausible but absent, such as a policy the document does not cover) and 5 attacks (two direct, such as "ignore previous instructions", three indirect, hidden in a document or web page). Report refusal and block rates before and after one new guardrail, for example a retrieval-score threshold or a wider injection pattern. A strong answer also reports false positives (real questions blocked).
New lesson: Latency cost
Expected: a table of 50 requests summarised as p50 and p95 per step, tokens in and out, cost per request and per correct answer (cost divided by golden-set successes). One optimisation (fewer chunks, prompt caching, a lower max_tokens, a cache for repeats) with before and after numbers and the eval score both times.
New lesson: Llmops monitoring
Expected: JSON logs with prompt version and redacted personal data; two prompt versions with eval scores; release_gate output showing one PASS and one BLOCKED with the reason; a one-page runbook with alerts, on-call owner and rollback steps (see examples/l4_llmops.py and the Subject 16 key).
New lesson: Fastapi docker
Expected: a public URL whose /health returns status ok; the Dockerfile (slim base, non-root user, health check, no secrets); a README with run, test and deploy steps; proof that the key is not committed (for example .env in .gitignore and .dockerignore, and the host's secret settings screenshot with the value hidden).
New lesson: Pdf chatbot
Expected: the repository built from the starter project on your PDF; evals/golden.jsonl with 15 or more questions including 3 unanswerable; the run_evals.py scorecard (for example answer accuracy 0.87, citation accuracy 0.93, refusal 1.00); a screenshot or video of the Streamlit app; a README with the architecture diagram and the numbers.
New lesson: Mock interviews
Expected: two scored runs of all three rounds a week apart, rewritten answers for the two weakest questions and for one system design case, compared with the model answers. Improvement of at least one rubric point on the rewritten answers is the target.