1import{j as e,a as i,u as w}from"./index-CThNTRDP.js";import{u as j,c as v}from"./vendor-i18n-5wc_S7sb.js";import{T as b}from"./tracks-V9x7OOPz.js";import{H as f}from"./featuredBlog-DoX6FsgG.js";import{M as A}from"./fonts-UefbKBaI.js";import"./vendor-react-H8Xurm4u.js";const p=n=>{var s,r;return((r=(s=b.find(o=>o.id===n))==null?void 0:s.modules)==null?void 0:r.length)||0},k=p("interviewScenarios"),y=p("aiAgents"),L=p("llm"),g="https://aimlcompanion.ai",M={"what-is-rag":{title:"RAG Explained: How Retrieval-Augmented Generation Works (2026)",description:"Learn how Retrieval-Augmented Generation (RAG) works, why it reduces LLM hallucinations, and how it differs from fine-tuning. Includes step-by-step breakdown and real-world examples.",h1:"RAG Explained: How Retrieval-Augmented Generation Works",moduleLink:"/module/llm/rag",moduleName:"RAG Module",trackLink:"/curriculum/llm",trackName:"LLM Course"},"transformer-architecture":{title:"Transformer Architecture Explained: How Self-Attention Works (2026)",description:"Understand transformer architecture from scratch - self-attention, encoder-decoder, positional encodings, and why transformers replaced RNNs. Clear explanation with examples.",h1:"Transformer Architecture Explained: How Self-Attention Works",moduleLink:"/module/llm/transformerArchitecture",moduleName:"Transformer Architecture Module",trackLink:"/curriculum/llm",trackName:"LLM Course"},"agentic-ai":{title:"Agentic AI Explained: What Are AI Agents and How They Work (2026)",description:"What is agentic AI? Learn how AI agents work, their core components (memory, tools, planning), multi-agent systems, and real-world applications. Beginner-friendly guide.",h1:"Agentic AI Explained: What Are AI Agents and How They Work",moduleLink:"/module/aiAgents/introToAgents",moduleName:"Intro to AI Agents Module",trackLink:"/curriculum/aiAgents",trackName:"Agentic AI Course"},"gradient-descent":{title:"Gradient Descent Explained: How Machine Learning Models Learn (2026)",description:"A clear explanation of gradient descent - the algorithm that trains machine learning models. Covers cost functions, learning rate, batch vs stochastic GD, and Adam optimizer.",h1:"Gradient Descent Explained: How Machine Learning Models Learn",moduleLink:"/module/optimization/gradientDescent",moduleName:"Gradient Descent Module",trackLink:"/curriculum/optimization",trackName:"Optimization Course"},"ml-interview-questions":{title:"Top Machine Learning Interview Questions & Answers (2026)",description:"Comprehensive ML interview questions covering classical ML, deep learning, LLMs, system design, and MLOps. With sample answers and preparation tips for FAANG and ML engineer roles.",h1:"Top Machine Learning Interview Questions & Answers (2026)",moduleLink:"/module/interviewScenarios/classicalML",moduleName:"Interview Q&A Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course"},"generative-ai":{title:"Generative AI Explained: How GenAI Works and What You Can Build (2026)",description:"What is generative AI? Learn how LLMs, diffusion models, and GenAI systems work, how to use them via APIs, and how to build real GenAI applications. Comprehensive beginner guide.",h1:"Generative AI Explained: How GenAI Works and What You Can Build",moduleLink:"/module/llm/whatAreLLMs",moduleName:"What are LLMs Module",trackLink:"/curriculum/llm",trackName:"LLM & GenAI Course"},"multi-agent-systems":{title:"Multi-Agent Systems Explained: Building AI That Collaborates (2026)",description:"Learn how multi-agent AI systems work - orchestrators, workers, communication protocols, CrewAI, LangGraph, and OpenAI Agents SDK. Practical guide with architecture patterns.",h1:"Multi-Agent Systems Explained: Building AI That Collaborates",moduleLink:"/module/aiAgents/multiAgentPatterns",moduleName:"Multi-Agent Patterns Module",trackLink:"/curriculum/aiAgents",trackName:"Agentic AI & Multi-Agent Course"},"llm-interview-questions":{title:"LLM Interview Questions & Answers (2026) - Large Language Model Prep",description:"Top LLM interview questions with detailed answers covering transformers, attention, RAG, fine-tuning, RLHF, prompt engineering, hallucinations, and production LLM systems.",h1:"LLM Interview Questions & Answers (2026)",moduleLink:"/module/interviewScenarios/llmInterviewPrep",moduleName:"LLM Interview Prep Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course"},"agentic-ai-interview-questions":{title:"Agentic AI Interview Questions & Answers (2026) - AI Agent Interview Prep",de
vendor: 12,079 bytes, line 1
1scription:"Comprehensive agentic AI interview questions covering agent architecture, memory systems, tool use, multi-agent patterns, LangGraph, CrewAI, guardrails, and production agent systems.",h1:"Agentic AI Interview Questions & Answers (2026)",moduleLink:"/module/interviewScenarios/agentInterviewPrep",moduleName:"Agentic AI Interview Prep Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course"},"ai-engineer-interview-questions":{title:"AI Engineer Interview Questions & Answers (2026) - Complete Prep Guide",description:"Complete AI engineer interview prep: LLMs, RAG, agentic systems, ML system design, GenAI, prompt engineering, MLOps, and coding. Covers FAANG and AI startup interviews.",h1:"AI Engineer Interview Questions & Answers (2026)",moduleLink:"/module/interviewScenarios/classicalML",moduleName:"Interview Q&A Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course"},"genai-interview-questions":{title:"GenAI & Transformer Interview Questions & Answers (2026)",description:"GenAI interview questions covering transformers, self-attention, embeddings, RAG pipelines, GraphRAG, prompt techniques, MoE, quantization, DPO, and multimodal LLMs. With sample answers.",h1:"GenAI & Transformer Interview Questions & Answers (2026)",moduleLink:"/module/interviewScenarios/genAITransformersQA",moduleName:"GenAI & Transformers Q&A Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course"}};function I({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What is RAG?",children:[e.jsx("p",{children:"Retrieval-Augmented Generation (RAG) is a technique that enhances large language models (LLMs) by giving them access to external knowledge at inference time. Instead of relying only on information baked into the model weights during training, a RAG system retrieves relevant documents from a knowledge base and passes them to the LLM as context before generating a response."}),e.jsx("p",{children:"RAG was introduced by Facebook AI Research (Meta) in 2020 and has since become the dominant architecture for building production LLM applications that require up-to-date, accurate, or domain-specific knowledge."})]}),e.jsxs(t,{title:"Why RAG Exists: The Hallucination Problem",children:[e.jsx("p",{children:"LLMs like GPT-4 and Claude are trained on data up to a cutoff date. This creates two fundamental problems:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Knowledge cutoff:"})," The model cannot know about events, documents, or data that appeared after training ended."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Hallucinations:"})," When asked about topics where its training data is sparse or conflicted, the model often generates plausible-sounding but incorrect answers."]})]}),e.jsx("p",{children:`RAG solves both problems by providing the model with retrieved, verified documents as context at generation time. The model's job shifts from "recall from memory" to "synthesize from provided documents" - a task LLMs handle much more reliably.`})]}),e.jsxs(t,{title:"How RAG Works: Step by Step",children:[e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Indexing:"})," Your documents (PDFs, web pages, databases) are split into chunks and converted into vector embeddings using an embedding model. These vectors are stored in a vector database (Pinecone, Chroma, Weaviate, pgvector, etc.)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Retrieval:"})," When a user asks a question, the query is also converted into a vector embedding. The system searches the vector database for the most semantically similar document chunks using cosine similarity or approximate nearest neighbor search."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Augmentation:"})," The top-k retrieved chunks are inserted into the LLM prompt as context, alongside the original user query."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Generation:"})," The LLM reads the retrieved context and generates a grounded, factual response based on that information."]})]}),e.jsx("p",{children:'The key insight is that the LLM never needs to "know" the answer from training - it reads the relevant documents at runtime and synthesizes a response, just like a human reading reference material before answering a question.'})]}),e.jsxs(t,{title:"RAG vs Fine-Tuning: Which Should You Use?",children:[e.jsx("p",{children:"Both RAG and fine-tuning improve LLM performance on specific domains, but they solve different problems:"}),e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Dimension"}),e.jsx("th",{children:"RAG"}),e.jsx("th",{children:"Fine-Tuning"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"Best for"}),e.jsx("td",{children:"Frequently updated knowledge, large document sets, factual accuracy"}),e.jsx("td",{children:"Consistent style, format, tone, or specialized reasoning patterns"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Knowledge update"}),e.jsx("td",{children:"Real-time (just update the vector DB)"}),e.jsx("td",{children:"Requires retraining (expensive)"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Hallucination reduction"}),e.jsx("td",{children:"Strong - grounded in retrieved docs"}),e.jsx("td",{children:"Moderate - still relies on weights"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Cost"}),e.jsx("td",{children:"Storage + retrieval API costs"}),e.jsx("td",{children:"GPU compute for training"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Latency"}),e.jsx("td",{children:"Adds retrieval step (~50-200ms)"}),e.jsx("td",{children:"Same as base model inference"})]})]})]}),e.jsx("p",{children:"In practice, many production systems combine both: fine-tuning for style and reasoning, RAG for factual grounding."})]}),e.jsxs(t,{title:"Advanced RAG Patterns",children:[e.jsx("p",{children:"Basic RAG has known failure modes. Advanced RAG techniques address them:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Hybrid Search:"})," Combines dense vector search with sparse keyword search (BM25) to improve recall on exact-match queries."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Re-ranking:"})," A second-stage model re-ranks retrieved chunks by relevance before passing to the LLM, improving precision."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Corrective RAG (CRAG):"})," The system evaluates retrieved document quality and falls back to web search if retrieved docs score below a threshold."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"GraphRAG:"})," Builds a knowledge graph over documents to enable multi-hop reasoning across entities and relationships."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Adaptive RAG:"})," Routes queries - simple factual questions go direct to the LLM, complex ones trigger full retrieval pipelines."]})]})]}),e.jsx(t,{title:"Real-World RAG Applications",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Enterprise Q&A:"})," Customer support bots grounded in product documentation and knowledge bases."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Legal research:"})," Systems that retrieve relevant case law and statutes before answering legal questions."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Medical information:"})," Clinical decision support grounded in up-to-date medical literature."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Code assistants:"})," Retrieving relevant codebase context before generating code suggestions."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Financial analysis:"})," Grounding answers in real-time earnings reports, filings, and market data."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/llm/rag",moduleName:"RAG Module",trackLink:"/curriculum/llm",trackName:"LLM Course",message:"Learn RAG hands-on with interactive visualizations showing the full retrieval pipeline - from embedding and indexing to retrieval, augmentation, and generation."})]})}function G({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What is a Transformer?",children:[e.jsx("p",{children:'The Transformer is a neural network architecture introduced in the 2017 paper "Attention Is All You Need" by Vaswani et al. at Google. It replaced recurrent neural networks (RNNs and LSTMs) as the dominant architecture for sequence modelling and became the foundation of every major LLM - GPT, BERT, Claude, Gemini, and LLaMA all use transformer architecture.'}),e.jsx("p",{children:"The revolutionary insight was that you could model relationships between all positions in a sequence simultaneously using attention, rather than processing tokens sequentially as RNNs do. This enabled massive parallelization during training, allowing models to scale to unprecedented sizes."})]}),e.jsxs(t,{title:"The Self-Attention Mechanism",children:[e.jsx("p",{children:'Self-attention is the core innovation of transformers. For each token in a sequence, self-attention computes how much "attention" it should pay to every other token when building its representation.'}),e.jsx("p",{children:"Mechanically, each token is projected into three vectors: Query (Q), Key (K), and Value (V). The attention score between two tokens is the dot product of their Q and K vectors, scaled and softmaxed to produce weights. The output is a weighted sum of all Value vectors."}),e.jsx("p",{children:'This means a word like "bank" can attend to "river" or "money" in context - the same token gets a different representation depending on what surrounds it. This is contextual understanding that RNNs approximate but transformers achieve precisely.'}),e.jsxs("p",{children:[e.jsx("strong",{children:"Multi-head attention"}),' runs this process in parallel across multiple "heads", each learning different types of relationships (syntactic, semantic, positional, etc.), then concatenates the outputs.']})]}),e.jsxs(t,{title:"Encoder vs Decoder Architectures",children:[e.jsx("p",{children:"The original transformer has an encoder-decoder structure, but modern LLMs typically use one or the other:"}),e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Architecture"}),e.jsx("th",{children:"Attention Type"}),e.jsx("th",{children:"Best For"}),e.jsx("th",{children:"Examples"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"Encoder-only"}),e.jsx("td",{children:"Bidirectional (sees full sequence)"}),e.jsx("td",{children:"Classification, embedding, understanding"}),e.jsx("td",{children:"BERT, RoBERTa, DistilBERT"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Decoder-only"}),e.jsx("td",{children:"Causal (only sees past tokens)"}),e.jsx("td",{children:"Text generation, chat, completion"}),e.jsx("td",{children:"GPT, Claude, LLaMA, Mistral"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Encoder-Decoder"}),e.jsx("td",{children:"Both"}),e.jsx("td",{children:"Translation, summarization, seq2seq"}),e.jsx("td",{children:"T5, BART, mT5"})]})]})]})]}),e.jsxs(t,{title:"Positional Encodings",children:[e.jsx("p",{children:"Unlike RNNs, transformers process all tokens simultaneously with no inherent sense of order. Positional encodings inject position information into token embeddings so the model knows where each token appears in the sequence."}),e.jsx("p",{children:"The original paper used sinusoidal encodings (fixed mathematical functions of position). Modern LLMs use learned positional embeddings or Rotary Position Embeddings (RoPE), which have better length generalization properties and are used in LLaMA, Mistral, and most frontier models."})]}),e.jsxs(t,{title:"Why Transformers Replaced RNNs",children:[e.jsx("p",{children:"RNNs process tokens sequentially - each step depends on the previous hidden state. This creates two problems that transformers solve elegantly:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Vanishing gradients:"}
1)," RNNs struggle to learn long-range dependencies because gradients decay exponentially over many steps. Self-attention connects every pair of tokens directly, regardless of distance."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"No parallelism:"})," Sequential processing means you cannot parallelize across the sequence length during training. Transformers process all tokens simultaneously, enabling GPU/TPU utilization at massive scale."]})]})]}),e.jsx(t,{title:"Key Transformer Variants",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"BERT (2018):"})," Encoder-only, bidirectional. Pre-trained with masked language modelling. Excellent for classification and embedding tasks."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"GPT series:"})," Decoder-only, causal. Scaled from 117M to 1.8T+ parameters. The blueprint for instruction-following chat models."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"T5:"}),' Encoder-decoder trained on a unified "text-to-text" format for every task. Still widely used for summarization and translation.']}),e.jsxs("li",{children:[e.jsx("strong",{children:"LLaMA / Mistral:"})," Efficient decoder-only models with RoPE, Grouped Query Attention (GQA), and SwiGLU activations. Open-weight frontier models."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Vision Transformer (ViT):"})," Applies transformer architecture to image patches instead of text tokens, enabling the same architecture across modalities."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/llm/transformerArchitecture",moduleName:"Transformer Architecture Module",trackLink:"/curriculum/llm",trackName:"LLM Course",message:"Explore transformer architecture interactively - visualize attention patterns, walk through the math, and see how BERT and GPT differ in their attention masks."})]})}function T({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What is Agentic AI?",children:[e.jsx("p",{children:"Agentic AI refers to AI systems that take sequences of actions autonomously to achieve goals, rather than simply responding to a single prompt. An AI agent perceives its environment, reasons about what actions to take, executes those actions using tools, and adapts based on outcomes - operating in a loop until the goal is achieved."}),e.jsx("p",{children:'The term "agentic" comes from the concept of agency - the capacity to act independently toward goals. Traditional LLM interactions are stateless question-answer exchanges. Agentic AI adds the ability to plan, remember, use tools, and pursue multi-step objectives across extended time horizons.'})]}),e.jsxs(t,{title:"How AI Agents Work: The Core Loop",children:[e.jsx("p",{children:"Most AI agents follow a Perceive-Think-Act loop:"}),e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Perceive:"})," The agent receives input - a user request, a tool result, an environmental observation, or a message from another agent."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Think:"})," The LLM reasons about the current state, what it knows, what it needs, and what action to take next. This may involve chain-of-thought reasoning or structured planning."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Act:"})," The agent executes an action - calling a tool (web search, code execution, API call, file read/write), delegating to a sub-agent, or responding to the user."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Observe:"})," The agent receives the result of its action and updates its understanding before the next iteration."]})]}),e.jsx("p",{children:"This loop continues until the agent decides the goal is achieved, encounters an unrecoverable error, or hits a configured step limit."})]}),e.jsx(t,{title:"The Four Core Components of an AI Agent",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"LLM (Brain):"})," The language model does the reasoning, planning, and decision-making. GPT-4, Claude, Gemini, and Llama are common choices. The LLM's instruction-following and reasoning quality directly determines agent capability."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Tools:"})," Functions the agent can call to interact with the world - web search, code execution, database queries, API calls, file operations. Tools are what give agents real-world impact beyond text generation."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Memory:"})," Agents need to remember context across steps. Short-term memory is the conversation/context window. Long-term memory uses vector databases or structured storage to persist information across sessions."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Planning:"})," For complex tasks, agents decompose goals into sub-tasks. Planning strategies include ReAct (Reason+Act), Chain-of-Thought, Tree-of-Thought, and more structured planner-executor patterns."]})]})}),e.jsxs(t,{title:"Multi-Agent Systems",children:[e.jsx("p",{children:"For complex tasks, single agents hit limitations in context length, specialization, and parallelism. Multi-agent systems address this by having multiple specialized agents collaborate:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Orchestrator-worker:"})," A planner agent breaks down the task and delegates to specialist agents (researcher, coder, writer, reviewer)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Hierarchical:"})," Agents organized in layers - high-level planners delegate to mid-level coordinators who manage task-s
1pecific workers."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Peer-to-peer:"})," Agents communicate as equals, negotiating and critiquing each other's outputs (debate, reflection patterns)."]})]}),e.jsx("p",{children:"Frameworks like LangGraph, CrewAI, and OpenAI Agents SDK provide infrastructure for building multi-agent systems with state management, tool sharing, and agent communication protocols."})]}),e.jsxs(t,{title:"Agent Guardrails and Safety",children:[e.jsx("p",{children:"Autonomous agents executing actions in the real world require careful safety design:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Human-in-the-loop:"})," Requiring human approval before irreversible actions (sending emails, deleting files, making payments)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Action constraints:"})," Limiting which tools agents can call and what parameters they can use."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Output validation:"})," Checking agent outputs against expected formats and safety rules before execution."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Prompt injection defence:"})," Preventing malicious content in tool results from hijacking agent behaviour."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Observability:"})," Full logging of every agent step, tool call, and reasoning trace for debugging and auditing."]})]})]}),e.jsx(t,{title:"Real-World Agentic AI Applications",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Software engineering agents:"})," GitHub Copilot Workspace, Devin, SWE-agent - agents that read codebases, write code, run tests, and fix bugs autonomously."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Research agents:"})," Agents that search the web, read papers, synthesize findings, and write reports."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Data analysis agents:"})," Agents with code execution that explore datasets, generate visualizations, and produce insights."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Customer service agents:"})," Multi-turn agents with access to CRM, order management, and knowledge base tools."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Personal assistants:"})," Agents managing calendars, emails, and tasks by calling APIs on the user's behalf."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/aiAgents/introToAgents",moduleName:"Intro to AI Agents Module",trackLink:"/curriculum/aiAgents",trackName:"Agentic AI Course",message:`Build your understanding of agentic AI with ${y} interactive modules covering agent architecture, LangChain, LangGraph, CrewAI, memory systems, and capstone projects.`})]})}function P({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What is Gradient Descent?",children:[e.jsx("p",{children:"Gradient descent is the optimization algorithm that trains machine learning models. It works by iteratively adjusting a model's parameters (weights) in the direction that reduces prediction error, using the gradient (slope) of the loss function as a guide."}),e.jsx("p",{children:"Almost every modern ML model - from linear regression to GPT-4 - is trained using some variant of gradient descent. Understanding it is foundational to understanding how machine learning works at a mechanical level."})]}),e.jsxs(t,{title:"The Loss Function: What Are We Minimizing?",children:[e.jsx("p",{children:"Before gradient descent can run, you need a loss function (also called cost function or objective function) that measures how wrong the model's predictions are. Common examples:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Mean Squared Error (MSE):"})," For regression. Average of squared differences between predictions and true values. Penalizes large errors heavily."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Cross-Entropy Loss:"})," For classification. Measures the divergence between predicted probability distributions and true labels."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Binary Cross-Entropy:"})," For binary classification. A special case of cross-entropy for two-class problems."]})]}),e.jsx("p",{children:'The loss function turns the abstract goal of "make good predictions" into a specific mathematical function that gradient descent can minimize.'})]}),e.jsxs(t,{title:"How Gradient Descent Works",children:[e.jsx("p",{children:"Imagine the loss function as a hilly landscape. Your model's parameters define your current position on this landscape. The height at your position is your current loss. Your goal is to find the lowest valley."}),e.jsx("p",{children:"Gradient descent does this by computing the gradient - the direction of steepest ascent - and stepping in the opposite direction. The update rule is:"}),e.jsx("p",{style:{fontFamily:A,background:i.backgroundAlt,padding:"8px 12px",borderRadius:6,fontSize:"clamp(12px, 2.5vw, 14px)"},children:"θ = θ - α à âL(θ)"}),e.jsx("p",{children:"Where θ are the parameters, α is the learning rate, and âL(θ) is the gradient of the loss with respect to the parameters. In neural networks, these gradients are computed via backpropagation using the chain rule of calculus."})]}),e.jsxs(t,{title:"Types of Gradient Descent",children:[e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Batch Size"}),e.jsx("th",{children:"Update Frequency"}),e.jsx("th",{children:"Tradeoffs"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"Batch GD"}),e.jsx("td",{children:"Full dataset"}),e.jsx("td",{children:"Once per epoch"}),e.jsx("td",{children:"Stable but slow, high memory"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Stochastic GD (SGD)"}),e.jsx("td",{children:"1 sample"}),e.jsx("td",{children:"Every sample"}),e.jsx("td",{children:"Noisy but fast, escapes local minima"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Mini-batch GD"}),e.jsx("td",{children:"32-512 samples"}),e.jsx("td",{children:"Every mini-batch"}),e.jsx("td",{children:"Balance of stability and speed - used in practice"})]})]})]}),e.jsx("p",{children:'In practice, mini-batch gradient descent is universal. The term "SGD" in most ML frameworks (PyTorch, TensorFlow) actually refers to mini-batch SGD.'})]}),e.jsxs(t,{title:"The Learning Rate: The Most Critical Hyperparameter",children:[e.jsx("p",{children:"The learning rate (α) controls step size. It has a disproportionate effect on training:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Too high:"})," The optimizer overshoots the minimum, causing loss to oscillate or diverge."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Too low:"})," Training converges extremely slowly, and you may get stuck in suboptimal local minima."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Just right:"})," Smooth, steady convergence to a good minimum."]})]}),e.jsx("p",{children:"Modern practice uses learning rate schedules (warmup + cosine decay) rather than a fixed learning rate, allowing large initial steps that shrink as training progresses."})]}
1),e.jsx(t,{title:"Modern Optimizers: Beyond Vanilla SGD",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Momentum:"})," Accumulates a velocity vector in the direction of persistent gradients, accelerating in consistent directions and damping oscillations."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"AdaGrad:"})," Adapts learning rates per-parameter based on historical gradient magnitudes. Good for sparse data."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"RMSProp:"})," Fixes AdaGrad's diminishing learning rate problem using an exponential moving average of squared gradients."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Adam:"})," Combines momentum and RMSProp. Maintains both a first moment (mean) and second moment (variance) of gradients. The default choice for most deep learning. Over 90% of published models use Adam or a variant."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"AdamW:"})," Adam with decoupled weight decay. Standard for training transformer models like BERT and GPT."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/optimization/gradientDescent",moduleName:"Gradient Descent Module",trackLink:"/curriculum/optimization",trackName:"Optimization Course",message:"See gradient descent in action with interactive visualizations. Adjust learning rate, momentum, and batch size and watch the loss surface update in real time."})]})}function C({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsx(t,{title:"How to Prepare for ML Interviews",children:e.jsx("p",{children:"Machine learning interviews at top companies (Google, Meta, Amazon, Apple, Microsoft, OpenAI) typically cover four areas: ML fundamentals, coding, system design, and behavioural. This guide covers the most frequently asked questions in each area, with guidance on how to frame strong answers."})}),e.jsx(t,{title:"Classical Machine Learning Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Explain the bias-variance tradeoff."})," High bias = model too simple, underfits. High variance = model too complex, overfits. Regularization (L1/L2, dropout) and ensemble methods help navigate this tradeoff."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is regularization and why do we use it?"})," L1 (Lasso) adds absolute weight penalty, drives weights to zero for feature selection. L2 (Ridge) adds squared weight penalty, shrinks weights smoothly. ElasticNet combines both. Use when training loss is low but validation loss diverges."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"How does a decision tree make splits?"})," By maximizing information gain (entropy reduction) or minimizing Gini impurity at each node. Greedy, top-down approach. Prone to overfitting without pruning."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Why does logistic regression output a probability?"})," The sigmoid function maps the linear combination of inputs to [0,1]. Cross-entropy loss optimizes the log-likelihood of the Bernoulli distribution."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is gradient boosting?"})," An ensemble method that trains trees sequentially, each correcting the residuals of the previous. XGBoost, LightGBM, and CatBoost are optimized implementations. Often the best performer on tabular data."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"How would you handle class imbalance?"})," Resampling (SMOTE, undersampling), class weights in loss function, threshold tuning, precision-recall AUC instead of accuracy, or ensemble methods with balanced bagging."]})]})}),e.jsx(t,{title:"Deep Learning Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"What is vanishing/exploding gradient and how do you fix it?"})," In deep networks, gradients can shrink exponentially (vanishing) or grow exponentially (exploding) during backprop. Fixes: ReLU activations (vs sigmoid/tanh), batch normalization, residual connections (ResNet), gradient clipping."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain batch normalization."})," Normalizes layer inputs to zero mean and unit variance across the batch. Reduces internal
1covariate shift, allows higher learning rates, acts as regularizer. Applied before or after activation (debate exists)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is the difference between dropout and L2 regularization?"})," Dropout randomly zeroes activations during training, forcing redundant representations. L2 penalizes large weights in the loss. Both reduce overfitting but through different mechanisms. They can be used together."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"How does a CNN work?"})," Convolutional layers apply learned filters across spatial positions to detect features (edges, textures, objects). Pooling reduces spatial dimensions. Translation invariance emerges from weight sharing across positions."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain attention mechanism."})," Computes a weighted sum of value vectors, where weights come from the similarity (dot product) between query and key vectors. Enables the model to focus on relevant parts of the input regardless of position."]})]})}),e.jsx(t,{title:"LLM & Generative AI Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"What is the difference between pre-training and fine-tuning?"})," Pre-training: unsupervised learning on massive text corpora (next-token prediction). Fine-tuning: supervised adaptation on smaller task-specific datasets. RLHF/DPO aligns fine-tuned models with human preferences."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is RAG and when should you use it over fine-tuning?"})," RAG retrieves external documents at inference time; fine-tuning bakes knowledge into weights. Use RAG for frequently updated knowledge, large document sets, and when transparency matters. Use fine-tuning for consistent style, format, and reasoning patterns."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What causes LLM hallucinations?"})," Models optimize for plausible next-token prediction, not factual accuracy. When confident in a wrong direction, they generate fluent but fabricated content. Mitigation: RAG, chain-of-thought, verification steps, constitutional AI."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain in-context learning."})," LLMs can perform new tasks from a few examples in the prompt, with no weight updates. Emergent behaviour from scale. Few-shot prompting leverages this. Performance depends heavily on prompt quality and example ordering."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is prompt injection?"})," Malicious instructions hidden in user input or retrieved content that override the system prompt and hijack model behaviour. Critical security concern for agentic systems with tool access."]})]})}),e.jsxs(t,{title:"ML System Design Questions",children:[e.jsx("p",{children:"System design questions assess your ability to architect production ML systems. Common prompts:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:'"Design a recommendation system for a streaming platform."'})," Cover: candidate generation (collaborative filtering, content-based), ranking model (two-tower, gradient boosted), feature engineering (user history, item metadata, context), offline evaluation (nDCG, recall@k), online A/B testing, feedback loops."]}),e.jsxs("li",{children:[e.jsx("strong",{children:'"Design a real-time fraud detection system."'})," Cover: feature engineering (velocity features, behavioural patterns), model choice (gradient boosting for tabular, reason: interpretability + speed), streaming inference (<100ms requirement), class imbalance handling, model monitoring, drift detection."]}),e.jsxs("li",{children:[e.jsx("strong",{children:'"How would you deploy and monitor an LLM in production?"'})," Cover: serving infrastructure (vLLM, TGI), batching strategies, latency vs cost tradeoffs, prompt caching, guardrails, output validation, observability (latency P99, error rates, hallucination rate), drift monitoring."]})]})]}),e.jsx(t,{title:"Interview Preparation Tips",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Know y
1our fundamentals deeply:"})," Interviewers probe beyond surface definitions. Understand the math, not just the names."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Practice explaining tradeoffs:"}),' Almost every ML decision involves tradeoffs. Train yourself to always say "it depends on X, and the tradeoff is Y vs Z."']}),e.jsxs("li",{children:[e.jsx("strong",{children:"Prepare scenario-based answers:"}),` "Tell me about a time you debugged a model that wasn't performing" is common. Have 3-4 specific stories ready.`]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Review recent papers:"})," For research-oriented roles, expect questions on recent advances (attention variants, scaling laws, RLHF, LLM agents)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Coding matters:"})," Expect to implement metrics (precision/recall/F1), preprocessing steps, or simple ML algorithms from scratch."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/interviewScenarios/classicalML",moduleName:"ML Interview Q&A Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course",message:"Practice with 293 scenario-based interview questions covering classical ML, deep learning, LLMs, system design, and MLOps - all with detailed model answers."})]})}function t({title:n,children:s}){return e.jsxs("section",{style:{marginBottom:"clamp(24px, 5vw, 36px)"},children:[e.jsx("h2",{style:{fontSize:"clamp(16px, 3.5vw, 22px)",fontWeight:700,color:i.text,marginBottom:"clamp(10px, 2vw, 14px)",paddingBottom:8,borderBottom:`2px solid ${i.border}`},children:n}),e.jsx("div",{className:"guide-section-body",style:{fontSize:"clamp(13px, 2.8vw, 15px)",lineHeight:1.75,color:i.textSecondary},children:s})]})}function a({nav:n,moduleLink:s,moduleName:r,trackLink:o,trackName:h,message:d}){const{logEvent:l}=w(),{t:c}=j("pages"),x=m=>{const u=m.replace(/^\//,"").split("/");(u[0]==="module"&&u[1]&&u[2]||u[0]==="curriculum")&&(window.location.href=m)};return e.jsxs("div",{style:{marginTop:"clamp(24px, 5vw, 36px)",padding:"clamp(18px, 4vw, 28px)",background:`linear-gradient(135deg, ${i.card}, ${i.backgroundAlt})`,border:"1px solid var(--color-info)",borderRadius:12,textAlign:"center"},children:[e.jsx("p",{style:{fontSize:"clamp(13px, 2.8vw, 15px)",color:i.textSecondary,marginBottom:"clamp(14px, 3vw, 20px)",lineHeight:1.6},children:d}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"center",flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>x(s),style:{padding:"clamp(8px, 2vw, 11px) clamp(16px, 4vw, 24px)",background:"var(--color-info-fill)",color:"#fff",border:"none",borderRadius:8,fontWeight:700,fontSize:"clamp(12px, 2.5vw, 14px)",cursor:"pointer"},children:c("guide.cta_start",{name:r})}),e.jsx("button",{onClick:()=>x(o),style:{padding:"clamp(8px, 2vw, 11px) clamp(16px, 4vw, 24px)",background:"transparent",color:"var(--info-text)",border:"1px solid var(--color-info)",borderRadius:8,fontWeight:600,fontSize:"clamp(12px, 2.5vw, 14px)",cursor:"pointer"},children:c("guide.cta_view",{name:h})})]}),e.jsxs("a",{href:`/blog/${f.slug}`,onClick:()=>{l("featured_post_click",null,null,{slug:f.slug,placement:"guide_cta"})},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:44,marginTop:"clamp(10px, 2.5vw, 14px)",color:i.textSecondary,fontSize:"clamp(11px, 2.5vw, 13px)",fontWeight:600,textDecoration:"underline",textUnderlineOffset:3,touchAction:"manipulation"},children:[c("guide.cta_blog")," ","â"]})]})}function R({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What is Generative AI?",children:[e.jsx("p",{children:"Generative AI (GenAI) refers to AI systems that create new content - text, images, code, audio, video - rather than just classifying or predicting from existing data. The defining characteristic is generation: given a prompt or context, the model produces novel output that did not exist before."}),e.jsx("p",{children:"The current GenAI wave is dominated by large language models (LLMs) like GPT-4, Claude, Gemini, and LLaMA, which generate text, and diffusion models like Stable Diffusion and DALL-E, which generate images. Both are trained on massive datasets and have demonstrated capabilities that were considered impossible just five years ago."})]}),e.jsxs(t,{title:"How Large Language Models (LLMs) Work",children:[e.jsx("p",{children:"LLMs are the engine behind most GenAI applications. They are trained on billions of text documents using a simple objective: predict the next token given all previous tokens. Despite this simple training signal, models trained at sufficient scale develop emergent capabilities - reasoning, coding, translation, summarization - that were never explicitly trained."}),e.jsx("p",{children:"Key architectural components:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Tokenization:"})," Text is split into tokens (roughly word fragments). GPT-4 uses ~100K token vocabulary. The model operates on token IDs, not raw text."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Transformer layers:"})," Stacked self-attention + feed-forward blocks. Each layer refines the representation of each token in context of all others."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Context window:"})," The maximum number of tokens the model can process at once. Modern frontier models support
1128K-1M+ token contexts."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Sampling:"})," At inference, the model outputs a probability distribution over all tokens. Temperature, top-p, and top-k control how that distribution is sampled to produce varied vs. deterministic outputs."]})]})]}),e.jsxs(t,{title:"The GenAI Stack: From Model to Application",children:[e.jsx("p",{children:"Building a GenAI application involves multiple layers:"}),e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Layer"}),e.jsx("th",{children:"What it does"}),e.jsx("th",{children:"Examples"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"Foundation model"}),e.jsx("td",{children:"Core language understanding and generation"}),e.jsx("td",{children:"GPT-4, Claude 3, Gemini, LLaMA 3"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"API / Inference"}),e.jsx("td",{children:"Serves model outputs via REST API"}),e.jsx("td",{children:"OpenAI API, Anthropic API, Together.ai"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Orchestration"}),e.jsx("td",{children:"Chains prompts, tools, memory, agents"}),e.jsx("td",{children:"LangChain, LlamaIndex, LangGraph"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Retrieval (RAG)"}),e.jsx("td",{children:"Grounds outputs in external documents"}),e.jsx("td",{children:"Pinecone, Chroma, pgvector"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Evaluation"}),e.jsx("td",{children:"Measures output quality, safety, groundedness"}),e.jsx("td",{children:"RAGAS, TruLens, LangSmith"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Application"}),e.jsx("td",{children:"User-facing product layer"}),e.jsx("td",{children:"Chat UI, API endpoint, embedded widget"})]})]})]})]}),e.jsxs(t,{title:"Prompt Engineering: Getting the Best from GenAI",children:[e.jsx("p",{children:"Prompt engineering is the practice of designing inputs to elicit better outputs from LLMs. Key techniques:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Zero-shot:"}),' Describe the task directly. "Summarize this document in 3 bullet points."']}),e.jsxs("li",{children:[e.jsx("strong",{children:"Few-shot:"})," Provide examples of input-output pairs before the real task. Dramatically improves consistency for structured outputs."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Chain-of-thought (CoT):"}),' Instruct the model to "think step by step" before answering. Dramatically improves reasoning on math, logic, and multi-step problems.']}),e.jsxs("li",{children:[e.jsx("strong",{children:"System prompts:"})," Set the model's persona, constraints, and behaviour globally. The foundation of any production LLM application."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Structured outputs:"})," Instruct the model to return JSON, markdown tables, or other parseable formats. Critical for downstream processing."]})]})]}),e.jsxs(t,{title:"Fine-Tuning vs Prompting vs RAG",children:[e.jsx("p",{children:"Three main approaches to adapting GenAI models for specific tasks:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Prompt engineering:"})," No training. Fast iteration. Limited by context length and prompt sensitivity. Best for general-purpose tasks."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"RAG:"})," Retrieves external documents at inference. Best for knowledge-intensive tasks with frequently updated information. No model modification required."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Fine-tuning:"})," Additional training on domain-specific data. Best for consistent style, format, and specialized reasoning. Requires labelled data and GPU compute."]})]}),e.jsx("p",{children:"Production systems often combine all three: a fine-tuned model with RAG, guided by a carefully engineered system prompt."})]}),e.jsx(t,{title:"What Can You Build with Generative AI?",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Chatbots and assistants:"})," Customer support, internal knowledge bases, tutoring systems."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Code generation:"})," Copilot-style tools, automated code review, test generation, documentation."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Content creation:"})," Marketing copy, email drafting, report summarization, translation."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Data extraction:"})," Parsing unstructured documents (PDFs, emails, forms) into structured data."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Semantic search:"})," Finding documents by meaning, not keywords, using embedding models."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Agentic workflows:"})," Multi-step automation where the LLM plans and executes tasks using tools."]})]})}),e.jsx(t,{title:"GenAI Safety and Limitations",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Hallucinations:"})," Models confidently generate incorrect information. Mitigate with RAG, verification steps, and grounding."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Prompt injection:"}
1)," Malicious inputs override instructions. Critical risk for agents with tool access."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Bias:"})," Training data biases surface in outputs. Requires evaluation and red-teaming."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Cost:"})," Token-based pricing scales with usage. Caching, batching, and model selection matter for production economics."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Latency:"})," Large models generate ~20-80 tokens/second. Streaming and smaller models address UX requirements."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/llm/whatAreLLMs",moduleName:"What are LLMs Module",trackLink:"/curriculum/llm",trackName:"LLM & GenAI Course",message:`Master Generative AI with ${L} interactive LLM modules - from transformer internals to RAG, fine-tuning, prompt engineering, function calling, and building real GenAI applications.`})]})}function S({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What Are Multi-Agent AI Systems?",children:[e.jsx("p",{children:"A multi-agent AI system is a network of individual AI agents that collaborate, communicate, and coordinate to accomplish tasks that would be too complex, large, or slow for a single agent. Each agent has its own role, context, tools, and decision-making capability. Together, they form a system greater than the sum of its parts."}),e.jsx("p",{children:"Multi-agent systems are the natural evolution of single-agent architectures. When tasks require parallel execution, specialized expertise, or self-verification (one agent critiques another's work), a single-agent approach hits hard limits in context length, specialization, and reliability."})]}),e.jsxs(t,{title:"Why Multi-Agent Systems?",children:[e.jsx("p",{children:"Single agents fail at complex tasks for predictable reasons:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Context window limits:"})," A codebase with 500 files cannot fit in a single context. A researcher agent reading 200 papers fills the window before synthesizing anything."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Specialization:"})," A single agent cannot be simultaneously expert at web research, Python coding, SQL analysis, and report writing. Specialized agents outperform generalists on each subtask."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Parallelism:"})," Sequential single-agent execution is slow. Multi-agent systems run subtasks concurrently - a researcher, a coder, and a writer working simultaneously."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Reliability:"})," Errors compound in long single-agent chains. Critic agents, verifier agents, and human-in-the-loop checkpoints catch mistakes before they cascade."]})]})]}),e.jsx(t,{title:"Core Multi-Agent Architecture Patterns",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Pattern"}),e.jsx("th",{children:"Structure"}),e.jsx("th",{children:"Best For"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"Orchestrator-Worker"}),e.jsx("td",{children:"One planner agent delegates to specialist workers"}),e.jsx("td",{children:"Research, content pipelines, complex coding tasks"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Supervisor"}),e.jsx("td",{children:"A supervisor monitors and corrects worker outputs"}),e.jsx("td",{children:"Quality assurance, high-stakes generation"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Debate / Critique"}),e.jsx("td",{children:"Agents argue, critique, and refine each other's outputs"}),e.jsx("td",{children:"Reducing hallucinations, improving reasoning quality"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Hierarchical"}),e.jsx("td",{children:"Multi-level: strategic planner â tactical coordinators â task workers"}),e.jsx("td",{children:"Enterprise workflows, software engineering"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Peer-to-peer"}),e.jsx("td",{children:"Agents communicate as equals via message passing"}),e.jsx("td",{children:"Simulation, distributed problem solving"})]})]})]})}),e.jsxs(t,{title:"Agent Communication: How Agents Talk to Each Other",children:[e.jsx("p",{children:"Agents exchange information through structured messages, shared memory, or direct function calls. Key mechanisms:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Message passing:"})," Agents send structured messages (often JSON) to a central orchestrator or directly to other agents. LangGraph models this as a graph of nodes exchanging state."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Shared state:"})," A common state object (dictionary, database) that all agents read from and write to. Simple but requires careful conflict handling."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Blackboard systems:"})," A shared working memory where agents post results and subscribe to relevant updates."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Agent-to-Agent Protocol (A2A):"})," Google's emerging standard for agent interoperability across different systems and frameworks."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Model Context Protocol (MCP):"})," Anthropic's protocol for standardizing how agents expose and consume tools, enabling plug-and-play tool ecosystems."]})]})]}),e.jsx(t,{title:"Key Frameworks for Multi-Agent Systems",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"LangGraph:"})," Graph-based agent orchestration from LangChain. Nodes are agents or tools; edges define control flow. Supports cycles, conditionals, and human-in-the-loop. Best for complex state-driven workflows."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"CrewAI:"}),' Role-based multi-agent framework. Define agents as "crew members" with roles, goals, and backstories. Sequential and hierarchical process types. Excellent developer experience for rapid prototyping.']}),e.jsxs("li",{children:[e.jsx("strong",{children:"OpenAI Agents SDK:"})," First-party SDK for building OpenAI-powered agent systems. Handoff patterns, guardrails, tracing built in. Production-focused with strong observability."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"AutoGen (Microsoft):"})," Conversation-based multi-agent framework. Agents communicate via natural language. Strong for code-executing agent systems."]}
1),e.jsxs("li",{children:[e.jsx("strong",{children:"Swarm (OpenAI):"})," Lightweight experimental framework demonstrating agent handoff patterns. Educational value, not production-ready."]})]})}),e.jsx(t,{title:"Building a Multi-Agent System: Key Design Decisions",children:e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Task decomposition:"})," Break the goal into subtasks. Which subtasks can run in parallel? Which are sequential dependencies?"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Agent roles:"})," Define each agent's specialty, tools, and scope. Clear boundaries prevent agents from duplicating work or stepping on each other."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Communication topology:"})," Orchestrator-worker (centralized) vs peer-to-peer (decentralized). Centralized is easier to debug; decentralized scales better."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"State management:"})," What shared state exists? Who can write to it? How are conflicts resolved?"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Error handling:"})," What happens when a worker agent fails? Retry policy, fallback agent, or escalate to human?"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Observability:"})," Log every agent action, tool call, and message. Multi-agent failures are extremely hard to debug without full traces."]})]})}),e.jsx(t,{title:"Real-World Multi-Agent Applications",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Software engineering:"})," Planner â coder â test writer â reviewer agents collaborating on feature implementation."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Research synthesis:"})," Search agent â reader agents (parallel) â synthesizer â fact-checker â writer pipeline."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Financial analysis:"})," Data fetcher â quantitative analyst â risk assessor â report writer, with compliance checker as supervisor."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Customer service:"})," Triage agent routes to specialist agents (billing, technical, returns), with escalation agent for unresolved cases."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Due diligence:"})," Multi-agent system researching company financials, news, competitors, and regulatory filings in parallel before synthesizing a report."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/aiAgents/multiAgentPatterns",moduleName:"Multi-Agent Patterns Module",trackLink:"/curriculum/aiAgents",trackName:"Agentic AI & Multi-Agent Course",message:`Build real multi-agent systems with ${y} interactive modules covering LangGraph, CrewAI, OpenAI Agents SDK, agent memory, observability, and capstone projects including a multi-agent research system.`})]})}function q({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What to Expect in LLM Interviews",children:[e.jsx("p",{children:'LLM engineer and AI researcher interviews test deep understanding of large language model architecture, training, deployment, and failure modes. Interviewers at companies like OpenAI, Anthropic, Google DeepMind, Meta AI, and fast-growing AI startups expect you to go beyond surface definitions - they want to see that you understand the "why" behind every design decision.'}),e.jsx("p",{children:"Questions span four domains: architecture internals, training and alignment, inference and deployment, and production system design. This guide covers the most frequently asked questions with the depth of answer that gets offers."})]}),e.jsx(t,{title:"Transformer & Architecture Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Explain self-attention from first principles."})," Each token produces Q, K, V vectors. Attention score = softmax(QK^T / âd_k) Ã V. This lets every token attend to every other token regardless of distance, solving the long-range dependency problem that killed RNNs. Multi-head attention runs this in parallel across H heads, each learning different relationship types."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is the difference between encoder-only, decoder-only, and encoder-decoder transformers?"}
1)," Encoder-only (BERT): bidirectional attention, sees full sequence, best for classification/embeddings. Decoder-only (GPT, Claude): causal attention (left-to-right only), best for generation. Encoder-decoder (T5, BART): encoder processes input with full attention, decoder generates output attending to encoder states."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Why does attention scale by âd_k?"})," Without scaling, dot products grow large in high dimensions, pushing softmax into regions of near-zero gradient (saturation). Dividing by âd_k keeps variance stable regardless of embedding dimension."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What are positional encodings and why are they needed?"})," Transformers process all tokens simultaneously with no inherent order. Positional encodings inject position information into token embeddings. Original: sinusoidal (fixed). Modern: RoPE (Rotary Position Embeddings) - encodes relative positions via rotation, better length generalization. Used in LLaMA, Mistral, GPT-4."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is Grouped Query Attention (GQA) and why does it matter?"})," Standard multi-head attention has H query, key, and value heads. GQA shares K/V heads across groups of Q heads, reducing KV cache memory by a factor of H/G. Critical for long context inference - LLaMA 3 uses GQA to make 128K context economically viable."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain the KV cache."})," During autoregressive generation, keys and values for all previous tokens are cached to avoid recomputation. KV cache memory = 2 à layers à heads à head_dim à sequence_length à batch_size à bytes_per_param. At 128K context with large models, this becomes the primary memory bottleneck."]})]})}),e.jsx(t,{title:"Training & Alignment Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"What is the pre-training objective for GPT-style models?"})," Next-token prediction (autoregressive language modelling). Given tokens tâ...tâ, predict tâââ. Cross-entropy loss over the vocabulary. Despite simplicity, this objective at scale produces emergent capabilities in reasoning, coding, and instruction-following."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain RLHF (Reinforcement Learning from Human Feedback)."})," Three stages: (1) Supervised fine-tuning on human demonstrations. (2) Reward model training - humans rank model outputs, reward model learns to predict human preference scores. (3) PPO (Proximal Policy Optimization) - fine-tune LLM to maximize reward model scores while staying close to the SFT model (KL penalty prevents reward hacking)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is DPO and how does it differ from RLHF?"})," Direct Preference Optimization bypasses the reward model entirely. It directly optimizes the LLM on preference pairs (chosen vs rejected) using a closed-form objective derived from the RLHF reward maximization problem. Simpler, more stable, no PPO, competitive performance. Widely used in open-source fine-tuning (Zephyr, Tulu)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What are scaling laws?"})," Chinchilla scaling laws (Hoffmann et al., 2022): optimal compute budget should be split roughly equally between model parameters and training tokens. C â 6ND where C=compute, N=params, D=tokens. Chinchilla (70B params, 1.4T tokens) outperformed GPT-3 (175B params, 300B tokens) despite fewer parameters."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is instruction tuning?"}),' Fine-tuning a pre-trained LLM on (instruction, response) pairs to teach it to follow user instructions. Converts a "document completer" into an "assistant". FLAN, InstructGPT, and Alpaca demonstrated that even small instruction datasets dramatically improve instruction-following.']})]})}),e.jsx(t,{title:"RAG, Prompting & Production Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"When would you use RAG vs fine-tuning?"})," RAG: frequently updated knowledge, large document sets, need for verifiable citations, hallucination reduction on factual tasks. Fine-tuning: consistent output style/format, specialized reasoning patterns, low-latency requirements (no retrieval step), when training data is available. Most production systems combine both."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What causes hallucinations and how do you reduce them?"})," Hallucinations arise from training on conflicting/sparse data and optimizing for fluency not accuracy. Mitigation: RAG (ground in retrieved docs), chain-of-thought (explicit reasoning steps), self
1-consistency (sample multiple times, majority vote), constitutional AI (self-critique), uncertainty estimation."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is prompt injection and how do you defend against it?"})," Malicious content in user input or retrieved documents overrides system prompt instructions. Defences: input sanitization, output validation, privilege separation (system prompt vs user input clearly delimited), sandboxed tool execution, monitoring for anomalous agent behaviour."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"How do you evaluate an LLM application in production?"})," Offline: RAGAS (faithfulness, answer relevance, context precision/recall), human evaluation, LLM-as-judge. Online: latency P50/P95/P99, error rate, user satisfaction signals (thumbs up/down, session length), hallucination rate on held-out factual test set, cost per query."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain vLLM and PagedAttention."})," vLLM is an inference server that implements PagedAttention - managing KV cache like OS virtual memory. Instead of pre-allocating contiguous memory per sequence, KV blocks are allocated dynamically on demand. Enables continuous batching (new requests fill gaps left by completed ones), dramatically improving GPU utilization and throughput."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/interviewScenarios/llmInterviewPrep",moduleName:"LLM Interview Prep Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course",message:"Practice with 48 scenario-based LLM interview questions across 4 progressive tiers - from foundational concepts to production system depth. Includes LLM Scenario Q&A covering RAG pipelines, GraphRAG, DPO, MoE, and quantization."})]})}function E({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What to Expect in Agentic AI Interviews",children:[e.jsx("p",{children:"Agentic AI and AI agent engineering is one of the fastest-growing job categories in 2026. Companies building autonomous workflows, coding agents, research agents, and customer-facing AI systems need engineers who understand agent architecture deeply - not just how to call an API."}),e.jsx("p",{children:"Interviews test your understanding of agent design patterns, failure modes, tool ecosystems, multi-agent coordination, memory systems, and production safety. This guide covers the questions that separate candidates who have used frameworks from those who understand how they work."})]}),e.jsx(t,{title:"Agent Architecture Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"What is the ReAct pattern and when does it fail?"})," ReAct (Reason + Act) interleaves reasoning traces with tool calls: think â act â observe â think â act. Strong for tasks where reasoning and action are tightly coupled. Fails when: reasoning traces become too long (context fills), the model gets stuck in loops, or tool outputs are noisy and mislead the next reasoning step."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain the difference between a planner-executor architecture and a single ReAct agent."})," Single ReAct: one agent reasons and acts in one context, limited by context length and multi-tasking. Planner-executor: planner LLM decomposes the goal into a structured plan, executors (specialist agents or tools) carry out individual steps with their own context. Better for long-horizon tasks, allows parallelism, easier to debug step-by-step."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What are the four types of agent memory?"})," (1) In-context (short-term): conversation history in the context window - fast but limited. (2) External (long-term): vector DBs, key-value stores, SQL - unlimited but requires retrieval. (3) Episodic: summaries of past task executions, helps agent learn from experience. (4) Semantic: structured world knowledge (knowledge graphs, entity stores). Production agents combine all four."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"How does tool design affect agent reliability?"}),' Tools should be atomic, idempotent, and have clear error messages. Broad tools ("do anything in the database") lead to unpredictable agent behaviour. Narrow tools ("run this specific SQL query") are easier to validate, audit, and constrain. Tool descriptions in the system prompt are as important as the tool implementation - vague descriptions cause wrong tool selection.']}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is the difference between LangGraph and CrewAI?"})," LangGraph: graph-based, nodes are agents/tools, edges define control flow, supports cycles and conditionals, explicit state machine - better for complex stateful workflows needing fine control. CrewAI: role-based, agents have personas/goals, higher-level abstraction, sequential and hierarchical process types - better for rapid prototyping and role-driven collaboration patterns."]})]})}),e.jsx(t,{title:"Multi-Agent System Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"How do you handle agent failures in a multi-agent pipeline?"})," Design for failure: every agent call should have timeout, retry with backoff (max 3 attempts), and a fallback strategy. For worker failure: retry with different worker, degrade to simpler approach, or escalate to human. For orchestrator failure: checkpoint state so w
1ork isn't lost. Log every agent action with correlation IDs for post-mortem debugging."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is agent context management and why is it hard?"})," Each agent has a finite context window. In multi-agent systems, passing full conversation history between agents quickly exceeds limits. Solutions: summarization (compress prior steps), selective context (pass only relevant state), structured handoff schemas (agents pass typed data objects, not free text), scratchpad patterns (working memory separate from handoff payload)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"How do you prevent prompt injection in agentic systems?"}),' Tool outputs (web search results, document retrieval, API responses) may contain malicious instructions. Defences: clearly delimit tool output from system instructions, validate tool outputs before passing to LLM, use a separate "sanitizer" LLM that strips instruction-like content from retrieved documents, scope agent permissions to minimum necessary (read-only by default).']}),e.jsxs("li",{children:[e.jsx("strong",{children:"What observability does a production agent system need?"})," Every agent step logged with: timestamp, agent ID, input context hash, tool called, tool arguments, tool result, reasoning trace, next action, latency, token count, cost. Alerting on: step count exceeding threshold, tool error rate spikes, latency P99 breaches, unexpected tool combinations. LangSmith, Arize Phoenix, and Weights & Biases Weave are common choices."]})]})}),e.jsx(t,{title:"Scenario-Based Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:'"Design an agent that can research a company and produce a due diligence report."'})," Agents needed: web search agent (public news, LinkedIn, Crunchbase), financial data agent (SEC filings if public), competitor analysis agent, risk assessment agent, report writer. Orchestrator decomposes task, runs research agents in parallel, synthesizer combines findings, critic agent checks for gaps, writer produces final report. Human review gate before delivery."]}),e.jsxs("li",{children:[e.jsx("strong",{children:'"Your coding agent is producing incorrect code 40% of the time. How do you debug this?"'})," Instrument every step. Check: is the problem in task decomposition (wrong plan), tool selection (wrong tools called), code generation (LLM error), or test execution (environment issue)? Run eval suite on a fixed set of tasks to establish baseline. Identify failure pattern - is it a specific language, task type, or context length? Add a code review agent that critiques output before returning. Consider smaller, more specialized models for code generation."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/interviewScenarios/agentInterviewPrep",moduleName:"Agentic AI Interview Prep Module",trackLink:"/curriculum/aiAgents",trackName:"Agentic AI & Multi-Agent Course",message:"Practice with 53 scenario-based agentic AI interview questions across 9 progressive tiers. Covers agent architecture, multi-agent patterns, memory systems, tool design, guardrails, and production system design."})]})}function z({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsxs(t,{title:"What Does an AI Engineer Interview Cover?",children:[e.jsx("p",{children:"The AI Engineer role emerged as the primary interface between frontier LLMs and production applications. Unlike ML researchers who train models, AI engineers build systems that use models - RAG pipelines, agentic workflows, evaluation frameworks, and GenAI-powered products. Interviews reflect this: less math, more systems thinking."}),e.jsx("p",{children:"Companies hiring AI engineers include every major tech company, AI-native startups, and traditional enterprises building their first LLM products. The interview format typically covers: LLM fundamentals, system design, coding (Python, API integration), and behavioural. This guide covers all four."})]}),e.jsx(t,{title:"LLM Fundamentals Every AI Engineer Needs",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Tokenization:"})," LLMs don't read words - they read tokens (subword units). GPT-4 uses cl100k tokenizer (~100K vocabulary). Rule of thumb: 1 token â 0.75 words in English. Non-English text tokenizes less efficie
1ntly. Token count directly drives API cost and context limit consumption."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Temperature and sampling:"})," Temperature=0 â deterministic (always highest probability token). Temperature=1 â sample from raw distribution. Temperature>1 â flatter distribution, more randomness. Top-p (nucleus sampling) caps sampling to tokens whose cumulative probability exceeds p. In production: temperature=0 for structured output, 0.7-1.0 for creative tasks."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Context windows:"})," The maximum tokens a model can process in one call (input + output). GPT-4o: 128K. Claude 3.5: 200K. Gemini 1.5 Pro: 1M. Longer context = higher cost per call and higher latency. Strategy: use smallest context that fits the task."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Embeddings:"})," Dense vector representations of text. Semantically similar text has high cosine similarity. Used in RAG (search), classification, clustering, and anomaly detection. text-embedding-3-large (OpenAI) and voyage-3 (Anthropic) are frontier embedding models. Dimension: 256-3072 depending on model and task."]})]})}),e.jsx(t,{title:"AI System Design Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:'"Design a RAG system for a 10,000-document enterprise knowledge base."'})," Ingestion: chunk documents (512-1024 tokens with overlap), generate embeddings, store in vector DB (Pinecone/pgvector). Retrieval: embed query, top-k similarity search (k=5-20), optional BM25 hybrid search for keyword queries. Generation: stuff retrieved chunks into prompt with source citations. Evaluation: RAGAS faithfulness and answer relevance. Monitoring: track queries where retrieved context was irrelevant (low faithfulness score)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:'"How would you reduce LLM API costs by 60% without degrading quality?"'})," (1) Prompt caching - Anthropic and OpenAI support caching system prompts, up to 90% reduction on repeated calls. (2) Model routing - GPT-4o-mini or Haiku for simple classification/extraction, frontier models only for complex reasoning. (3) Batch API - 50% discount for non-latency-sensitive workloads. (4) Output length control - explicit max_tokens, structured outputs instead of free text. (5) Semantic caching - cache responses to semantically similar queries."]}),e.jsxs("li",{children:[e.jsx("strong",{children:'"Design an evaluation framework for a customer service LLM."'})," Offline metrics: factual accuracy (against ground truth), response relevance (LLM-as-judge), policy compliance (no offers outside approved scope), tone (sentiment analysis). Online metrics: customer satisfaction score (post-conversation survey), resolution rate (was issue resolved without human escalation), escalation rate, avg handle time. A/B test new model versions with small traffic slices before full rollout."]})]})}),e.jsx(t,{title:"Coding Questions AI Engineers Face",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Implement a simple RAG pipeline from scratch."})," Key components: document chunker, embedding generator (API call), vector store (in-memory cosine similarity or pgvector), retriever (top-k search), prompt builder (system + retrieved context + user query), LLM caller. Expect to code this in Python in ~30 minutes."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Implement retry logic with exponential backoff for LLM API calls."})," Handle: rate limit errors (429), server errors (5xx), timeout errors. Exponential backoff: wait 2^attempt seconds + random jitter. Max 3-5 retries. Log every retry with attempt number, error type, wait time."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Parse structured JSON output from an LLM reliably."})," Use function calling / structured outputs (OpenAI) or tool use (Anthropic) for guaranteed schema. Fallback: regex extraction, then JSON repair libraries (json-repair). Always validate against Pydantic schema before downstream use."]})]})}),e.jsx(t,{title:"Behavioural Questions Specific to AI Engineering",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:'"Tell me about a time an LLM system you built failed in production."'})," Strong answers include: what the failure mode was (hallucination, latency spike, prompt injection), how you detected it (monitoring alert vs user report), what you did immediately (circuit breaker, rollback), what you did long-term (eval coverage, better guardrails), and what you'd do differently."]}),e.jsxs("li",{children:[e.jsx("strong",{children:'"How do you evaluate whether to build with an LLM or a traditional ML model?"'})," LLM: unstructured text input/output, few labelled examples, rapid prototyping needed. Traditional ML: structured tabular data, large labelled dataset, strict latency requirements (<10ms), interpretability required, high prediction volume (cost matters at scale)."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/interviewScenarios/classicalML",moduleName:"Interview Q&A Modules",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course",message:`Prepare for AI engineer interviews with ${k} modules covering classical ML, deep learning, GenAI, LLMs, agentic AI, system design, MLOps, and scenario-based Q&A. 293 total questions across 4 progressive tiers.`})]})}function N({nav:n}){return e.jsxs(e.Fragment,{children:[e.jsx(t,{title:"What GenAI Interviews Test",children:e.jsx("p",{children:"Generative AI interviews at AI-first companies go deep on transformer internals, modern training techniques, and production GenAI system design. Interviewers expect you to know the papers, understand the tradeoffs, and have opinions on the design decisions. This guide covers the questions that appear most in GenAI researcher, ML engineer, and AI product engineer interviews."})}),e.jsx(t,{title:"Transformer & Attention Deep Dives",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"What is the computational complexity of self
1-attention?"})," O(n²d) where n=sequence length, d=model dimension. The n² term is the bottleneck for long sequences - doubling context length quadruples attention compute. This is why Flash Attention, sparse attention, and sliding window attention exist. Flash Attention reorders the computation to be IO-bound rather than compute-bound, achieving same result 2-4x faster with less memory."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain embeddings and why they matter for RAG."}),' Embeddings map text to dense vectors where semantic similarity = geometric proximity (cosine similarity). A well-trained embedding model places "transformer architecture" and "self-attention mechanism" close together. RAG retrieval quality depends almost entirely on embedding quality - retrieval recall at k is your ceiling. Evaluate embeddings with MTEB benchmark before selecting a model.']}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is sparse vs dense search and when do you combine them?"})," Dense search: vector similarity via embeddings. Captures semantic meaning, handles synonyms and paraphrasing. Weak on exact matches, rare terms, product codes. Sparse search: BM25 keyword matching. Exact-match reliable, fast, no embeddings needed. Weak on semantic similarity. Hybrid search combines both with RRF (Reciprocal Rank Fusion) or learned combination weights. Use hybrid when queries mix semantic intent with specific terms."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain GANs and VAEs - how do they differ from LLMs as generative models?"})," GANs: generator vs discriminator adversarial training, implicit density estimation, prone to mode collapse, excellent for image synthesis. VAEs: encode to latent distribution, decode to reconstruction, explicit latent space, smoother interpolation. LLMs: autoregressive, explicit probability over token sequences, trained on next-token prediction. GANs/VAEs dominate image/audio generation; LLMs dominate discrete token generation (text, code)."]})]})}),e.jsx(t,{title:"Modern Training Techniques",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"What is Mixture of Experts (MoE) and why does it matter?"})," MoE replaces dense feed-forward layers with N expert networks and a router that activates only k experts per token (typically k=2). Total parameters are large but compute per token is fixed at k/N of a dense equivalent. GPT-4 and Mixtral use MoE. Result: same training compute buys much larger model capacity. Challenges: load balancing (preventing router collapse onto few experts), communication overhead in distributed training."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Explain quantization - INT8, INT4, GGUF."})," Quantization reduces model weight precision from FP32/BF16 to lower bit-widths. INT8: 2x memory reduction, <1% quality loss on most tasks. INT4: 4x reduction, measurable quality loss on complex reasoning. GGUF (llama.cpp format): 2-8 bit mixed precision, CPU-friendly. Production: AWQ and GPTQ are post-training quantization methods that minimize quantization error by calibrating on representative data."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is DPO and how does it compare to PPO for alignment?"})," PPO (RLHF): trains separate reward model, uses RL to optimize LLM against reward signal, complex pipeline with reward hacking risk. DPO: directly optimizes on preference pairs (chosen vs rejected), no RL, no reward model, closed-form loss derived from optimal RLHF solution. DPO is simpler and more stable; PPO may achieve higher ceiling with careful tuning. SimPO and ORPO are further DPO variants reducing memory requirements."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"What is prompt caching and how does it save cost?"})," Anthropic and OpenAI cache the KV states of common prefixes (system prompts, long documents). Subsequent requests with the same prefix skip recomputation for cached tokens - up to 90% cost reduction, 85% latency reduction on cached portion. Cache invalidates after 5 minutes of inactivity (Anthropic) or per-session (OpenAI). Critical for production systems with fixed system prompts or repeated document context."]})]})}),e.jsx(t,{title:"GenAI System Design Questions",children:e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:'"Design a GraphRAG system for a legal document corpus."'}),' Extract entities (cases, statutes, judges, parties) and relationships (cites, overrules, involves) using LLM extraction. Store in graph DB (Neo4j). At query time: entity recognition on query, graph traversal to find relevant connected nodes, retrieve associated document chunks, rank by graph centrality + semantic similarity, generate answer with citation graph. Advantage over vanilla RAG: multi-hop reasoning ("cases that cite Roe v Wade AND involve privacy") that vector search cannot do.']}),e.jsxs("li",{children:[e.jsx("strong",{children:'"How would you build a multimodal RAG system?"'})," Ingest: extract text from PDFs (PyMuPDF), generate image descriptions for charts/diagrams using vision LLM, generate audio transcripts, chunk all modalities. Embed: use multimodal embedding model (CLIP, Voyage multimodal) or separate embeddings per modality. Retrieve: query each modality index, fuse results. Generate: pass retrieved text + images to multimodal LLM (GPT-4o, Claude 3.5). Challenge: aligning retrieval quality across modalities."]})]})}),e.jsx(a,{nav:n,moduleLink:"/module/interviewScenarios/genAITransformersQA",moduleName:"GenAI & Transformers Q&A Module",trackLink:"/curriculum/interviewScenarios",trackName:"Interview Prep Course",message:"Practice GenAI interview questions with the GenAI & Transformers Q&A module covering GANs, VAEs, transformer architecture, self-attention, embeddings, and sparse vs dense search. Plus the RAG, Prompting & Modern GenAI Q&A module covering GraphRAG, DPO, MoE, quantization, and multimodal LLMs."})]})}const W={"what-is-rag":I,"transformer-architecture":G,"agentic-ai":T,"gradient-descent":P,"ml-interview-questions":C,"generative-ai":R,"multi-agent-systems":S,"llm-interview-questions":q,"agentic-ai-interview-questions":E,"ai-engineer-interview-questions":z,"genai-interview-questions":N};function U({guideSlug:n,nav:s}){const{t:r}=j("pages"),o=M[n],h=W[n];return v.useEffect(()=>{if(!o)return;
1const d="guide-jsonld";let l=document.getElementById(d);return l||(l=document.createElement("script"),l.id=d,l.type="application/ld+json",document.head.appendChild(l)),l.textContent=JSON.stringify({"@context":"https://schema.org","@type":"Article",headline:o.h1,description:o.description,author:{"@type":"Organization",name:"AI-ML Companion",url:g},publisher:{"@type":"Organization",name:"AI-ML Companion",url:g},url:`${g}/guide/${n}`,inLanguage:"en",isPartOf:{"@type":"WebSite",name:"AI-ML Companion",url:g}}),()=>{const c=document.getElementById(d);c&&c.remove()}},[n,o]),!o||!h?e.jsxs("div",{style:{padding:"clamp(40px, 8vw, 80px) clamp(16px, 4vw, 24px)",textAlign:"center",color:i.text},children:[e.jsx("h1",{style:{fontSize:"clamp(20px, 5vw, 32px)",marginBottom:16},children:r("guide.not_found_title")}),e.jsxs("p",{style:{color:i.textSecondary},children:[r("guide.not_found_before")," ",e.jsx("button",{onClick:()=>s&&s("curriculum"),style:{color:"var(--info-text)",background:"none",border:"none",cursor:"pointer",font:"inherit"},children:r("guide.not_found_link")})," ",r("guide.not_found_after")]})]}):e.jsxs("div",{style:{maxWidth:780,margin:"0 auto",padding:"clamp(24px, 5vw, 48px) clamp(16px, 4vw, 24px)"},children:[e.jsxs("nav",{"aria-label":r("guide.breadcrumb_aria"),style:{marginBottom:"clamp(16px, 3vw, 24px)",fontSize:"clamp(11px, 2.5vw, 13px)",color:i.textMuted},children:[e.jsx("button",{onClick:()=>s&&s("home"),style:{background:"none",border:"none",color:"var(--info-text)",cursor:"pointer",font:"inherit",padding:0},children:r("guide.home")}),e.jsx("span",{style:{margin:"0 6px"},children:"/"}),e.jsx("span",{style:{color:i.text},children:r("guide.guides")}),e.jsx("span",{style:{margin:"0 6px"},children:"/"}),e.jsx("span",{style:{color:i.textSecondary},children:o.h1.split(":")[0]})]}),e.jsx("h1",{style:{fontSize:"clamp(20px, 5vw, 32px)",fontWeight:800,color:i.text,lineHeight:1.25,marginBottom:"clamp(8px, 2vw, 14px)",letterSpacing:"-0.3px"},children:o.h1}),e.jsx("p",{style:{fontSize:"clamp(13px, 2.8vw, 15px)",color:i.textSecondary,lineHeight:1.65,marginBottom:"clamp(24px, 5vw, 36px)",paddingLeft:"clamp(10px, 2vw, 16px)"},children:o.description}),e.jsx(h,{nav:s}),e.jsxs("div",{style:{marginTop:"clamp(32px, 6vw, 48px)",paddingTop:"clamp(16px, 3vw, 24px)",borderTop:`1px solid ${i.border}`,display:"flex",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[e.jsx("button",{onClick:()=>s&&s("curriculum"),style:{background:"none",border:"none",color:"var(--info-text)",cursor:"pointer",font:"inherit",fontSize:"clamp(12px, 2.5vw, 14px)",fontWeight:600},children:r("guide.browse_all")}),e.jsx("button",{onClick:()=>s&&s("home"),style:{background:"none",border:"none",color:i.textMuted,cursor:"pointer",font:"inherit",fontSize:"clamp(12px, 2.5vw, 14px)"},children:r("guide.back_home")})]})]})}export{M as GUIDE_META,U as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.