Whole course

All flashcards

Reviewing needs JavaScript. You can read every card in the list below.

Loading your cards...

Read all 575 cards as a list

How LLMs work

  1. Front
    What does an LLM actually output at each generation step?
    Back
    A probability distribution over its vocabulary for the next token. One token is sampled, appended to the sequence, and the process repeats.
  2. Front
    Why is self-attention parallelizable in a way RNNs aren't?
    Back
    Every token's Query/Key/Value can be computed and compared with the other visible tokens in a few large matrix operations during training. An RNN needs the previous step's hidden state before it can do the next step.
  3. Front
    How does self-attention cost grow with sequence length n, and what does the causal mask do?
    Back
    The score matrix is n x n, so the score arithmetic is quadratic in n (prefill). The causal mask blocks each token from attending to later tokens so the model cannot peek at the answer.
  4. Front
    What problem does KV-caching solve?
    Back
    It avoids recomputing Key/Value vectors for all previous tokens at every decode step. Only the new token's K/V is computed and appended.
  5. Front
    Why divide attention scores by the square root of d_k?
    Back
    Dot products grow with vector size. Scaling keeps their variance near 1 so softmax does not saturate into a near one-hot output, which would starve the training signal.
  6. Front
    Prefill vs decode: which is typically compute-bound and which memory-bound?
    Back
    Prefill processes the whole prompt in parallel and keeps the GPU busy. Decode generates one token per step and is typically limited by memory bandwidth (reading weights and the KV-cache).
  7. Front
    Write the KV-cache size formula. What does it limit in production?
    Back
    2 x layers x KV-heads x head-dim x sequence length x batch x bytes per value. It grows linearly with context and with concurrent requests, so it often caps how many requests one GPU can serve. GQA/MQA shrink it by using fewer KV-heads.
  8. Front
    Why can't attention alone distinguish word order?
    Back
    Without position information, attention is permutation-equivariant: shuffle the input tokens and the outputs are shuffled the same way, with no sense of order. Positional information (learned, sinusoidal or rotary) must be injected.

Tokenization and embeddings

  1. Front
    What is BPE and why is it used?
    Back
    Byte-Pair Encoding repeatedly merges the most frequent adjacent pair of bytes/characters to build a subword vocabulary. Any text, even an unseen word, can then be written from a fixed set of pieces.
  2. Front
    Why do LLMs struggle with spelling and digit-level arithmetic?
    Back
    They see subword tokens, not characters or place-value digits. Tool use (code or a calculator) is the robust fix.
  3. Front
    How big are tokenizer vocabularies today, and is it the same for every model?
    Back
    No. Each model family trains its own. Public examples: tiktoken gpt2 has 50,257; cl100k_base is about 100k; o200k_base about 200k; Llama 3 uses 128K (sources checked 2026-10-09). Check the model you use.
  4. Front
    What is the vocabulary-size trade-off?
    Back
    A bigger vocabulary gives fewer tokens per text (cheaper, shorter sequences) but a larger embedding table and output layer.
  5. Front
    Are token embeddings fixed vectors?
    Back
    No. The embedding table has one row per token and is learned jointly with the rest of the model.
  6. Front
    How should you count tokens for a cost estimate?
    Back
    Use the tokenizer or token-counting tool for the exact model you will call, and measure real traffic in each language. Another family's count, or a '4 characters per token' rule, is only an estimate.

Sampling parameters and the model landscape

  1. Front
    What does temperature do, and what happens as it goes to 0?
    Back
    It divides the logits before softmax: higher gives a flatter distribution (more random), lower a sharper one. At 0 the choice is greedy, always the top token, but that does not guarantee identical outputs across runs.
  2. Front
    Top-k vs top-p: what is the difference and when does it matter?
    Back
    Top-k keeps a fixed number of highest-probability tokens. Top-p keeps the smallest set whose cumulative probability reaches p, so it keeps few tokens when the model is confident and more when it is unsure.
  3. Front
    Open-weight vs API-only model: one key trade-off?
    Back
    Open-weight: you can self-host, fine-tune and keep data in your infrastructure, but you own serving and operations. API-only: no infrastructure and often frontier quality, but data goes to the provider and you cannot change the weights.
  4. Front
    Does temperature 0 guarantee identical outputs? Why not?
    Back
    No. A key cause is that inference kernels are not batch-invariant: the result for your request can depend on how many other requests share the batch, and server load changes that (Thinking Machines Lab, 2025-09-10). Store outputs, validate against a schema and do not rely on regeneration.
  5. Front
    Why is a bigger context window not a free upgrade?
    Back
    You pay per token, prefill attention work and KV-cache memory grow with length, and quality can drop for information in the middle of long inputs. It also does not replace retrieval.
  6. Front
    Which sampling settings for extraction vs creative writing, and what caveat?
    Back
    Extraction and classification: low temperature (0 or near it). Creative writing: higher temperature or top-p below 1. Change one control at a time, and check whether your model accepts these parameters at all.

Prompting fundamentals

  1. Front
    Few-shot prompting vs fine-tuning: what is the difference?
    Back
    Few-shot shows examples in the prompt at inference time: no weight changes, but you pay for the example tokens on every call. Fine-tuning updates weights on labelled examples: upfront cost, and shorter prompts afterward.
  2. Front
    Chain-of-thought: benefit and caveat?
    Back
    It helps multi-step reasoning on models that do not already reason on their own. It costs tokens and latency, and the written reasoning may not reflect what actually drove the answer.
  3. Front
    What is a solid prompt skeleton?
    Back
    Role, context, task, format and constraints, including what to do when information is missing (for example answer 'unknown'). Show the exact output shape with an example.
  4. Front
    How do you reduce prompt injection from a document you pass to the model?
    Back
    Delimit the untrusted text, tell the model it is data and not instructions, validate the output, and limit what the output can trigger. Delimiters lower the risk; they do not remove it.
  5. Front
    Self-consistency: how does it work and what does it cost?
    Back
    Sample several chain-of-thought answers and take the majority. It raises reliability on short, votable answers, at about N times the cost and latency.
  6. Front
    How do you tell whether a prompt change helped?
    Back
    Run old and new prompts on the same labelled set (with edge cases) and compare pass rate. Keep the set as a regression test for later prompt or model changes.

Reasoning models and structured outputs

  1. Front
    When use a reasoning model and when not?
    Back
    Use for hard multi-step tasks where errors are costly and latency is tolerable. Prefer a fast model for extraction, classification, FAQ and tight latency targets. Decide by measuring on your own tasks.
  2. Front
    Does schema-constrained output guarantee correctness?
    Back
    No. It guarantees form, not truth. Still handle truncation and refusals, validate semantics, retry with the error a bounded number of times, and have a fallback.
  3. Front
    What do reasoning tokens cost, and are they visible?
    Back
    They are billed as output tokens and count toward the output limit, even when the API does not return them. Watch the reasoning-token count in usage data.
  4. Front
    Can you trust a reasoning model's visible reasoning as an audit trail?
    Back
    No. In one 2025 study, models mentioned a hint they used only 25% to 39% of the time on average. Treat it as a clue.
  5. Front
    JSON mode vs schema-constrained structured outputs?
    Back
    JSON mode gives syntactically valid JSON. Schema-constrained outputs restrict decoding to your JSON Schema, so the shape and types conform. Neither makes the values true (on Anthropic, enum capitalisation is also not guaranteed).
  6. Front
    Tool calling vs structured outputs: how do you choose?
    Back
    They are not a ladder. Use schema-constrained outputs to shape the reply. Use tool calling when the model should act or fetch through your functions. Validate arguments either way.
  7. Front
    What schema limits and quirks should you plan for?
    Back
    Providers support only a subset of JSON Schema (unsupported features return a 400), Anthropic does not guarantee enum capitalisation, and the first request with a new schema is slower because the schema is compiled.

Embeddings and similarity search

  1. Front
    Why cosine similarity for text embeddings?
    Back
    It compares direction only, so differences in vector length do not skew the ranking. It is the usual default for text embeddings, as long as the index uses the metric the model expects.
  2. Front
    What does an embedding model return for a chunk, and what does 'close' mean?
    Back
    One fixed-length vector for the whole chunk. Close vectors mean similar meaning, because contrastive training pulled matching pairs together and pushed others apart.
  3. Front
    Why is cosine as cheap as a dot product after normalizing?
    Back
    Both lengths are 1, so the denominator is 1. For unit vectors, Euclidean distance squared is 2 - 2(a·b), so it gives the same ranking too.
  4. Front
    Why can a raw dot product mis-rank results?
    Back
    It mixes angle with length, so a longer vector can outscore one that points closer to the query. Normalize, or use cosine.
  5. Front
    Query 'ERR-40412' returns general error pages. Cause and fix?
    Back
    Exact identifiers carry little learned meaning, so embeddings rank them poorly. Add keyword (BM25) search and merge with vector results: hybrid search.
  6. Front
    Results are on topic but do not answer the question. What helps?
    Back
    Embeddings measure topical closeness, not answer quality. Retrieve more candidates, then rerank them with a model that reads query and passage together.
  7. Front
    Why must index and query use the same embedding model?
    Back
    Each model builds its own vector space. Scores across models mean nothing, and no error is raised. Re-embed the whole corpus when you change models.

Vector databases

  1. Front
    What is HNSW?
    Back
    Hierarchical Navigable Small World: a layered proximity graph. Search starts in a sparse top layer, hops toward the query and descends to a dense bottom layer. High recall, memory-heavy.
  2. Front
    Is ANN search exact? What is recall@k?
    Back
    No. Recall@k is the share of the true top-k neighbors the index returned. It is the price paid for speed and memory.
  3. Front
    What do ef_search, M and ef_construction do in HNSW?
    Back
    ef_search: candidates tracked per query (more recall, more latency; adjustable per query). M: links per node. ef_construction: build-time search width. M and ef_construction are fixed at build, so changing them means a rebuild.
  4. Front
    IVF in one line?
    Back
    Cluster vectors around centers learned in a training step. At query time scan only the nprobe nearest clusters. Lighter on memory than HNSW; recall depends on nprobe and on training data.
  5. Front
    How do you measure ANN recall?
    Back
    On a sample of real queries, compute exact top-k by brute force and ANN top-k, and take the overlap. Change one knob at a time and record recall and latency.
  6. Front
    What does product quantization (PQ) trade?
    Back
    It stores compressed approximations of vectors to save memory and speed up distance checks, at some recall loss. Re-ranking a short list with the original vectors recovers some of it.
  7. Front
    When is pgvector enough, and when move to a dedicated database?
    Back
    Start with what you run (often pgvector) and measure. Move when a measured limit (latency, memory, ops burden, filtering) forces it. Qdrant and Weaviate are open source and can be self-hosted.
  8. Front
    Fewer than k results with a metadata filter, and stale results after an edit: causes?
    Back
    Filter applied after the ANN search removes candidates (fix: iterative scan, larger candidate list, partitioning). Stale: old chunks not overwritten or deleted, so use deterministic chunk IDs.

RAG architecture and chunking

  1. Front
    What is RAG, in one sentence?
    Back
    Retrieving relevant external content and putting it in the prompt so the model's answer is grounded in that content, without changing model weights.
  2. Front
    Why not embed a whole document as one vector?
    Back
    One vector blends every topic in the document, which dilutes relevance and loses the detail a question asks about. Chunking keeps retrieval specific.
  3. Front
    Name the chunk-size trade-off and what overlap adds.
    Back
    Small chunks: precise but may lose surrounding context. Large chunks: more context but blurrier matches and a noisier prompt. Overlap keeps boundary facts in at least one chunk, at the cost of more and near-duplicate chunks.
  4. Front
    What is small-to-big (parent-child) retrieval?
    Back
    Embed small chunks for precise matching, then return their larger parent section so the model gets context. Cost: bigger prompts and de-duplicating shared parents.
  5. Front
    Why must ACL filtering happen inside retrieval?
    Back
    Post-filtering can empty the top-k and can leak through scores, summaries and caches. Enforce permissions in the query (filter or namespace) and scope caches by identity.
  6. Front
    A table is split one row per chunk and retrieval gets worse. Why, and how do you fix it?
    Back
    Rows lose their column headers, so the numbers have no meaning. Keep small tables whole, repeat the caption and header in each chunk, or rewrite each row as a sentence before embedding.
  7. Front
    How do you choose a chunk size without folklore?
    Back
    Index at two or three sizes with other settings fixed, score recall@k on labelled questions, then check prompt cost and a few end-to-end answers.

The core RAG pipeline

  1. Front
    One-line rule for RAG vs fine-tuning?
    Back
    RAG for knowledge (fresh, citable, easy to update); fine-tuning for behaviour (style, format, task skill). They can be combined.
  2. Front
    Name the two lanes of a RAG pipeline and what is in each.
    Back
    Offline: parse, chunk, embed, index. Online (per query): retrieve, rerank, generate.
  3. Front
    Why must you version the index?
    Back
    Queries and chunks must use the same embedding model. Changing the model means re-embedding the whole corpus, so you need to know which model built which index.
  4. Front
    Confident wrong answer, correct passage exists in the corpus. What is the first test?
    Back
    Paste the gold passage into the prompt. Right answer: retrieval or ingestion problem. Still wrong: prompt or generation problem.
  5. Front
    Name four stages where a confident wrong answer can originate.
    Back
    Ingestion (bad parse, stale page), retrieval (filters, embedding, recall), ranking and context assembly (rerank, trimming), generation (model ignores or misreads context).

Better retrieval

  1. Front
    Why hybrid search?
    Back
    BM25 catches exact terms and IDs; vectors catch paraphrase. Fuse the lists (for example with Reciprocal Rank Fusion), then rerank.
  2. Front
    What does Reciprocal Rank Fusion compute, and why use it?
    Back
    score(d) = sum over lists of 1/(k + rank_i(d)), k = 60 by default (Cormack et al., SIGIR 2009). Ranks only, so no calibration of incompatible score scales.
  3. Front
    Bi-encoder vs cross-encoder?
    Back
    Bi-encoder embeds query and document separately (fast, precomputable). Cross-encoder scores the pair jointly (more accurate, one call per pair), so use it to rerank a shortlist.
  4. Front
    Why doesn't reranking fix a recall problem?
    Back
    It only reorders candidates it is given. If the right chunk is not in the shortlist, widen or change the first stage (more candidates, BM25, better query).
  5. Front
    What can go wrong with strict metadata pre-filters in an approximate index?
    Back
    Some ANN indexes lose recall or speed when a filter is very selective. Test your database with realistic filters. The filter value should come from the authenticated identity, not from user input.
  6. Front
    Name two costs of query transformations.
    Back
    Each adds an LLM call (latency, money) and can drift from the user's intent. Gate them to the queries that need them.
  7. Front
    What does MMR do?
    Back
    Maximal marginal relevance picks chunks that are relevant and different from those already chosen, so top-k is not near-duplicates.

All RAG types

  1. Front
    When does HyDE help and what is its risk?
    Back
    Helps when query and documents are phrased very differently. Risk: the hypothetical answer can be wrong and bias retrieval toward it.
  2. Front
    Self-RAG vs CRAG vs Adaptive RAG?
    Back
    Self-RAG: a trained model emits reflection signals and critiques itself. CRAG: grade retrieved docs, fall back (rewrite or web) when weak. Adaptive: route each query to no retrieval, single-shot or multi-step.
  3. Front
    What is the decision rule for choosing a RAG variant?
    Back
    Start with the simplest design that meets the quality bar, measure, and add complexity only for a failure you can name. Each extra call adds latency, cost and a failure mode.
  4. Front
    Naive, advanced, modular, agentic: one line each.
    Back
    Naive: retrieve once, generate once. Advanced: adds rewrite, rerank, filters. Modular: swappable stages wired by a router. Agentic: the LLM decides whether, what and how often to retrieve.
  5. Front
    When do you reach for GraphRAG, and what does it cost?
    Back
    For multi-hop or corpus-wide questions that top-k similarity handles poorly. Cost: expensive indexing, a graph that can go stale, and extraction errors that propagate.
  6. Front
    Name two things agentic RAG needs to be safe in production.
    Back
    Step limits to prevent loops, and tracing plus guardrails to evaluate and secure the many tool calls. Latency and cost become unpredictable without them.

RAG evaluation and hallucination

  1. Front
    Does RAG eliminate hallucination?
    Back
    No. It reduces it by grounding answers, but the model can still ignore, misread, or blend retrieved context with unsupported claims.
  2. Front
    Name two hallucination-mitigation techniques for RAG.
    Back
    An explicit "answer only from context" instruction with citations, and a retrieval-quality gate that refuses to answer when the best match score is too low.
  3. Front
    Three ways a model fails even with the right passage in the prompt?
    Back
    It ignores the context, misreads it, or blends it with plausible claims the passage never stated.
  4. Front
    Why is a copied similarity-score threshold risky?
    Back
    Scores are not comparable across embedding models or query types. Calibrate the gate on a labelled set and track both wrong refusals and wrong answers.
  5. Front
    Citations in the answer: what do they not guarantee?
    Back
    Presence of a citation does not mean the cited chunk supports the claim. Check citation accuracy.
  6. Front
    How do you classify a failure from a trace?
    Back
    Gold chunk not retrieved: retrieval. Gold chunk in prompt but answer contradicts it: generation. Answer follows a wrong or stale chunk: source.
  7. Front
    On a 30-question golden set, what is one extra correct answer worth, and what does it mean?
    Back
    About 3.3 percentage points. A one-question change is weak evidence; enlarge the set and inspect what changed.

RAG evaluation in depth

  1. Front
    What's the difference between a retrieval metric and a generation metric in RAG eval?
    Back
    Retrieval metrics (precision@k, recall@k, MRR) measure whether the right chunks were found; generation metrics (faithfulness, relevance) measure whether the answer is grounded in and addresses those chunks.
  2. Front
    Define recall@k, precision@k and MRR, and how they differ.
    Back
    Recall@k: was the relevant item found in the top k. Precision@k: fraction of the top k that is relevant. MRR: mean of 1/rank of the first relevant result, 0 if none; it also rewards ranking it higher.
  3. Front
    Three ranks 3, 1, none: what is MRR?
    Back
    (1/3 + 1 + 0) / 3, about 0.44. A miss counts as 0 and stays in the denominator.
  4. Front
    Retrieved gold = no, faithful = no, correct = yes. What does that mean?
    Back
    A lucky answer from the model's memory, not the corpus. It hides a retrieval gap and cannot be cited.
  5. Front
    Name three LLM-judge pitfalls and mitigations.
    Back
    Position bias, verbosity bias, self-preference. Use a fixed rubric, swap order in pairwise comparisons, calibrate against human labels, and prefer a judge from another model family.
  6. Front
    Why can synthetic evaluation questions mislead?
    Back
    They tend to copy chunk wording and be easier than real queries, inflating scores. Review a sample and add real logged queries and unanswerable questions.

Multimodal GenAI and document AI

  1. Front
    Why is parsing quality the usual cap on document RAG?
    Back
    Tables, reading order, scans and charts break text extraction; if the fact never reaches the chunk, nothing downstream can recover it.
  2. Front
    How does a vision-language model take in an image, and why does that cost money?
    Back
    A vision encoder cuts the image into patches, a projection maps them into the LLM's token space, and each patch becomes input tokens. More or larger images means more tokens, latency and spend.
  3. Front
    Name the four ways to read a document page.
    Back
    Text-layer extraction, OCR plus layout analysis, VLM page reading, and page-image retrieval. Start with the cheapest that passes your evaluation and route hard pages up.
  4. Front
    Users report wrong numbers from a table. How do you locate the failure?
    Back
    Open the chunk the retriever returned. Fact missing or scrambled: parsing. Right chunk not retrieved: retrieval. Right chunk in the prompt but wrong answer: generation. Fix the earliest broken layer.
  5. Front
    How should a table be chunked?
    Back
    Keep it whole, or split by row groups and repeat the header and unit in every chunk. Store it as Markdown, HTML or records with column names, plus page and section metadata.
  6. Front
    Why flag chart captions written by a VLM?
    Back
    They are model-generated, not the document's words, and can misread exact values. Labelling them keeps readers and later checks from treating them as source text.
  7. Front
    What is a sound evaluation for a document extraction pipeline?
    Back
    Field-level accuracy on a labelled sample, page-level retrieval recall, programmatic number checks (line items sum to the total), and a human review path for low-confidence fields.
  8. Front
    What privacy risk comes with VLM page reading?
    Back
    A page image sends everything on the page to a hosted API. Check retention and training terms, redact where possible, or self-host for sensitive documents.

Function and tool calling

  1. Front
    What does the model actually do when it "calls a function"?
    Back
    It emits a structured request (tool name plus arguments). Something outside the model executes it; for your own tools that is your application, which returns the result linked to the call id.
  2. Front
    What does a tool definition contain, and why does its quality matter?
    Back
    Name, description and JSON-schema parameters (with required fields). It is the only thing the model knows about the tool, so vague names, empty descriptions or free-text arguments lead to wrong calls.
  3. Front
    Why make side-effecting tools idempotent?
    Back
    Retries and loops can repeat a call. An idempotency key lets the downstream service recognise a repeat and not charge twice or send a duplicate email.
  4. Front
    Name four controls your executor applies to a model-proposed call.
    Back
    Validate arguments, authorize from the real session (not a model-supplied id), set timeouts with bounded retries, and treat results as untrusted. Add idempotency keys for side effects.
  5. Front
    Does strict mode make a tool call safe?
    Back
    No. Strict mode makes arguments follow the schema more reliably. It does not check permissions or whether the values are sensible, so executor checks stay.
  6. Front
    Client tools vs provider-hosted tools?
    Back
    Client tools are defined by you and run in your code. Hosted tools (for example web search or code execution) run on the provider's infrastructure, with less code for you but less control and possible extra charges.

Agentic patterns: ReAct, planning and memory

  1. Front
    What is the ReAct pattern?
    Back
    An explicit loop of Thought, Action (a tool call) and Observation (the tool result), repeated until the goal is met or a stopping control fires.
  2. Front
    Plan-then-execute vs reactive planning: trade-offs?
    Back
    Plan-then-execute is predictable and reviewable up front but brittle when the world deviates (needs checkpoints and replanning). Reactive adapts to each observation but costs more calls and can wander.
  3. Front
    What stopping controls does an agent loop need?
    Back
    A checkable done criterion, step cap, time and cost budgets, loop detection, escalation to a human when ambiguous, and tracing.
  4. Front
    How do you detect an agent stuck in a loop?
    Back
    Watch for the same tool called with the same arguments again, or several steps with no new information. Then stop, return a partial result and ask the user.
  5. Front
    Short-term vs long-term agent memory, and one risk of long-term?
    Back
    Short-term is the current context and scratchpad. Long-term is stored outside and retrieved when relevant. Risks include privacy of stored personal data and stale facts.
  6. Front
    Workflow vs agent, and when to prefer a workflow?
    Back
    A workflow follows predefined code paths; an agent lets the model direct its own steps and tools. Prefer the simpler design when the path is predictable, since agents cost more and can compound errors.

Model Context Protocol and tool ecosystems

  1. Front
    What problem does MCP solve and how does it relate to function calling?
    Back
    It replaces N x M custom integrations with N + M through a standard host-to-server protocol. Function calling is the model-facing interface; MCP standardises how the host discovers and invokes tools. They compose.
  2. Front
    Name three MCP security risks and a mitigation for each.
    Back
    Injection through tool descriptions or results (treat as untrusted, show inputs, approvals); over-broad or passed-through tokens (least privilege, accept only tokens issued for the server); malicious or changed servers (pin, allow-list, sandbox).
  3. Front
    Where does the USB-C analogy for MCP break?
    Back
    The model never talks to the server; the host mediates, so controls live there. Connecting a server means trusting text it controls, and trust is per server and per user, not plug-and-play.
  4. Front
    What are tools, resources and prompts, and who controls each?
    Back
    Tools are actions the model invokes (model-controlled). Resources are URI-identified context (application-driven). Prompts are templates the user picks (user-controlled).
  5. Front
    What changed in MCP revision 2026-07-28?
    Back
    Stateless requests with version and capabilities on each request (no initialize handshake, server/discover added), no protocol-level sessions or Mcp-Session-Id, multi round-trip requests for server-initiated input, and Roots, Sampling and Logging deprecated.
  6. Front
    Which transports are standard in current MCP, and how is state kept across calls?
    Back
    stdio for local subprocesses and Streamable HTTP for remote servers (HTTP+SSE is deprecated). Without sessions, a server returns an explicit handle that the model passes back as a tool argument, and the server checks ownership.

Context engineering and memory

  1. Front
    What are the four agent memory types, with one storage example each?
    Back
    Working (the window or a rolling summary), episodic (timestamped summaries of past interactions in a vector store), semantic (facts in a profile or key-value store), procedural (instruction or skill files). A teaching split, not a standard.
  2. Front
    The four context-engineering moves?
    Back
    Write (persist outside the window), select (bring in only what is relevant now), compress (summarise or trim), isolate (give a sub-task its own clean context and take back a short result).
  3. Front
    How do you lay out a prompt for caching, and what breaks it?
    Back
    Stable content first (tools, system rules, reference documents), variable content last. A change at one level invalidates it and everything after it: a new tool invalidates the whole cache, and a timestamp at the top of the system prompt invalidates the system prompt and what follows.
  4. Front
    A summary made the agent forget a constraint. What is the fix?
    Back
    This is drift. Pin must-keep rules verbatim in the system prompt or a note that compaction never rewrites, and test with a probe question about each pinned fact after every compaction.
  5. Front
    What does a memory design have to answer besides what to store?
    Back
    When to write, how to recall (similarity plus recency and importance), how to update and expire, and how to delete one user's data from records, summaries and embeddings. Treat recalled memory as untrusted data, not as instructions.
  6. Front
    Overflow, distraction, drift, tool-output bloat (course taxonomy): what does each measure look like?
    Back
    Overflow: tokens per step against the limit. Distraction: accuracy with and without the extra context. Drift: probe questions after compaction. Bloat: share of tokens from tool results and p95 tokens per call.

Multi-agent systems: when to use them and what they cost

  1. Front
    Multi-agent: when is it justified?
    Back
    When the work is broad and parallel, or when separate windows or distinct tools and permissions matter. Otherwise it adds tokens (Anthropic reported about 15 times a chat for its research system), latency and failure modes.
  2. Front
    Workflow vs agent vs multi-agent?
    Back
    Workflow: predefined code path. Agent: the model directs its own steps. Multi-agent: several coordinating agents. Choose the simplest structure that meets the bar.
  3. Front
    Why do long agent chains fail more often than their steps suggest?
    Back
    Errors compound: with independent steps, success is p to the power n. Illustrative: 0.9 over 8 steps is about 0.43. Use shorter chains, checks and checkpoints.

Agent evaluation: state, trajectory, pass^k and release gates

  1. Front
    What to trace per agent step?
    Back
    Prompt version, chosen tool and arguments, result, tokens, latency, cost and errors: enough to replay a failure.
  2. Front
    pass@k vs pass^k, and which fits a one-shot agent?
    Back
    pass@k: at least one of k runs succeeds. pass^k: all k succeed. A one-shot agent needs pass^k, which exposes the run-to-run variance that pass@k hides.
  3. Front
    Why grade an agent by state, not by its final message?
    Back
    The message is a claim and can be false. Check the world afterwards (the database row, the passing tests, the file), then use trajectory metrics for cost and risk.

Guardrails, safety and prompt injection

  1. Front
    What is prompt injection?
    Back
    Text that changes what a model does in a way its operator did not intend. It can arrive through the user or through content the model reads.
  2. Front
    Core defence principle against prompt injection?
    Back
    Treat retrieved and tool-returned content as data, never as instructions, and assume some injections will still succeed, so limit what a hijacked model can do.
  3. Front
    Direct vs indirect prompt injection?
    Back
    Direct: the user's own input is the attack. Indirect: an innocent user's agent reads third-party content (web page, email, retrieved document, tool output) that carries hidden instructions.
  4. Front
    False positive vs false negative in a guardrail?
    Back
    False positive: a legitimate request is blocked. False negative: an attack passes. A stricter threshold trades one for the other, so set it by the cost of each failure.

Limiting blast radius and treating output as untrusted

  1. Front
    What is least privilege (privilege separation) for agents?
    Back
    Give each agent and tool only the tools, data and permissions the task needs, and keep read capabilities apart from write or send capabilities, so a successful attack has a small blast radius.
  2. Front
    When should an agent require human approval before acting?
    Back
    Before irreversible, high-value or external-facing actions such as payments, deletions, sending messages and publishing.
  3. Front
    What is the lethal trifecta?
    Back
    An agent that combines access to private data, exposure to untrusted content and the ability to communicate externally is at risk of data theft. Avoid having all three in one agent (Simon Willison, 2025).
  4. Front
    What is improper output handling?
    Back
    Passing model output to a browser, database, shell or other system without validating or encoding it. Prompts can steer output, so treat it as untrusted input (XSS, SQL injection, code execution).

Cost and latency optimization

  1. Front
    Sort these levers by what they improve: prompt caching, model routing, a provider batch API.
    Back
    Prompt caching cuts input cost and time to first token. Model routing cuts cost and often latency, at a quality risk. A batch API cuts cost only, in exchange for delayed results.
  2. Front
    Does streaming reduce total latency or cost?
    Back
    No. The first token reaches the user earlier, so it feels faster, but total generation time and the tokens billed are unchanged.
  3. Front
    How does provider prompt caching work, and how do you get cache hits?
    Back
    The provider reuses the computed state for an exact, identical prompt prefix, and reads cost a fraction of normal input price. Put static content (system prompt, tools, examples) first and variable content last. Output is unaffected.
  4. Front
    What is the risk of a semantic cache and how do you limit it?
    Back
    It can return an answer for a similar but different question, or across tenant or permission boundaries. Use a strict tuned threshold, scope keys by tenant and document version, set short TTLs and sample hits for review.
  5. Front
    Model routing or cascade: what is the saving and what must you check?
    Back
    Easy requests go to a small cheap model and hard ones escalate. Cost falls only if few requests escalate. Check quality per query type on a labelled set, because an unchanged average can hide a failing slice.
  6. Front
    Write the cost and latency formulas for one LLM request.
    Back
    Cost = input tokens x input price + output tokens x output price (plus cache terms). Latency = queueing + time to first token + output tokens / output speed. Measure which term dominates; it differs by workload.
  7. Front
    What do you measure before optimizing a slow or expensive LLM feature?
    Back
    Input and output tokens, time to first token, total time at p50 and p95, and cost per request, per stage and per tenant. Then optimize the dominant term.
  8. Front
    Why is max_tokens a weak way to make answers shorter?
    Back
    It cuts generation wherever the limit falls, even mid-sentence. Ask for a shorter format in the prompt (sentence or paragraph limits) and keep max_tokens as a safety ceiling.

LLM inference and serving

  1. Front
    Slow first token versus slow streaming: which metric and which cause?
    Back
    Slow first token is high TTFT, caused by queueing or long-prompt prefill. Slow streaming after a good start is high inter-token latency, caused by decode speed, memory bandwidth or batch pressure.
  2. Front
    The KV pool is full: what does the server do, and what does it cost?
    Back
    New requests queue, or the engine (vLLM, for example) preempts running ones and recomputes them later, which hurts end-to-end latency. Fixes: fewer KV-heads per request (GQA), a shorter context limit, KV quantization, more GPUs or replicas, or a lower concurrency cap.
  3. Front
    What do PagedAttention and continuous batching each do?
    Back
    PagedAttention stores the KV-cache in on-demand blocks to remove fragmentation, which allows larger batches and prefix sharing. Continuous batching schedules per decode step, so finished requests leave and new ones join immediately.
  4. Front
    Does speculative decoding change the output, and when does it help?
    Back
    No. The large model verifies the draft's tokens, so the output distribution is preserved (up to hardware numerics). It helps most at low to medium load, depends on the draft's acceptance rate, and adds a second component.
  5. Front
    What trade does chunked prefill make?
    Back
    It splits a long prompt so other users' decode steps keep running, which smooths their streaming. The cost is a somewhat slower first token for the long prompt. A smaller per-step token budget favors inter-token latency, a larger one favors TTFT.
  6. Front
    What does quantization buy and what does it cost?
    Back
    Fewer bytes per weight, so less memory and less to read per decode step (a 7B model is about 14 GB in 16-bit, about 7 GB in 8-bit). The cost is rounding error and hardware or kernel dependence, so test on your own eval set.
  7. Front
    Why can a self-hosted GPU cost more per token than an API?
    Back
    You pay for GPU hours whether or not they are busy, so cost per token is the hourly price divided by the tokens actually served. Low utilization raises it. Add redundancy and engineering time before comparing.
  8. Front
    What is goodput and why prefer it to throughput?
    Back
    A common definition is the rate of requests that meet the latency targets (for example TTFT and inter-token limits). DistServe uses a stricter variant: the highest rate at which a target share, such as 90 percent, meets both limits. Raw throughput can look high while many users get an unacceptable experience.

Observability and eval pipelines

  1. Front
    Why do LLM systems need an offline eval pipeline?
    Back
    Output varies and cannot be asserted with equality, and many parts change independently. A golden set run on every change catches regressions before users meet them.
  2. Front
    What do you record for each production LLM request?
    Back
    Trace id, prompt and model versions, inputs and outputs (privacy-safe), retrieved ids and scores, tokens, latency per stage, cost, outcome signals and errors.
  3. Front
    How do production failures feed back into the eval set?
    Back
    Sample traces (weighted toward thumbs-down, abstentions and escalations), label them, add them to the golden set with a slice tag after redaction, then gate future changes on the set.
  4. Front
    Why read golden-set results per slice?
    Back
    An average can rise while one slice collapses. Small sets are also noisy: with 100 cases near 90 percent the sampling noise is about 3 points, so one point is not a signal.
  5. Front
    What does online monitoring catch that offline eval misses, and the reverse?
    Back
    Online catches live outages, cost and latency shifts and drift in real traffic. Offline catches quality regressions, including rare intents, before release. Neither replaces the other.
  6. Front
    What privacy rules apply to LLM traces?
    Back
    They hold user text and company documents. Redact personal data and secrets, restrict access to full prompts, set retention and deletion, and apply the same rules before reusing traces in an eval set.
  7. Front
    Which alerts help for an LLM service and what are they compared with?
    Back
    Error and timeout rate, p95 latency per stage, cost per request, input token growth, abstention and empty-retrieval rate, feedback and sampled quality scores. Compare each with your own baseline, especially after deploys.

Production deployment of RAG

  1. Front
    What makes RAG ingestion safe to operate?
    Back
    It is idempotent (content-hash ids), incremental, propagates deletes with tombstones, and records the embedding model and chunker version on every chunk.
  2. Front
    How do you re-embed a corpus with zero downtime?
    Back
    Build a new index version in the background with the new model, run the eval gate, then swap the alias together with the query-side model. Keep the old version for a one-step rollback.
  3. Front
    How do you size a vector index?
    Back
    Raw size is vectors x dimensions x bytes per value (10M x 768 x 4 B is about 31 GB) before index overhead. That decides RAM versus disk, quantization and sharding. Shard for size, replicate for query rate.
  4. Front
    Why can output guardrails conflict with streaming?
    Back
    Streamed text is shown before it can be fully checked. Choose check-first (slower first token), stream-first (risk of showing unchecked text) or check in chunks.

RAG security, reliability and release

  1. Front
    Where do you enforce document permissions in RAG?
    Back
    At retrieval: store ACLs as metadata, filter by user or group at query time, and verify on the final context. Never rely on the prompt to hide data, and key caches on tenant, permissions and document version.
  2. Front
    Reranker is slow or down: what do you degrade first?
    Back
    Skip the rerank and serve hybrid retrieval results, a small known quality loss. Do not drop retrieval or permission filtering. If retrieval is empty or weak, abstain or ask a clarifying question.
  3. Front
    Order the release path for a RAG change (chunker, embedder, prompt, model).
    Back
    Offline eval gate on quality, latency and cost, then shadow traffic, then a small canary, then full rollout, with rollback through an alias or feature flag. Version every component.
  4. Front
    A user asks for their data to be deleted. Where must the deletion reach in a RAG system?
    Back
    Vectors, caches and logs, not only the source store. Check your legal requirements.
  5. Front
    Which parts of a RAG system do you version for release?
    Back
    Everything that can change behaviour: prompts, embedding model, chunker, index, reranker and LLM. Put changes behind feature flags so rollback is one switch.

Evaluating LLM systems

  1. Front
    Why can't a public benchmark pick your model?
    Back
    Contamination, saturation and domain mismatch. Use benchmarks to shortlist; decide on your product eval.
  2. Front
    How do you validate an LLM judge before trusting it?
    Back
    Label a sample by humans, compute Cohen's kappa against the judge (not raw percent agreement), report the label balance, and re-check periodically.
  3. Front
    Why can high percent agreement between judge and humans mislead?
    Back
    When one label dominates, guessing it already agrees often. With 95% passes, chance agreement is about 0.905, so 90% observed is no better than chance. Use kappa and look at the rare class.
  4. Front
    What is the difference between a dev set and a held-out set?
    Back
    Iterate on the dev set. Use the held-out set only to gate releases. Tuning against it turns it into a second dev set and its score stops meaning anything.
  5. Front
    What should you do before choosing evaluation metrics?
    Back
    Error analysis: read 50 to 100 real failing traces, sort them into failure categories, and measure the top categories.
  6. Front
    Why is a +3 point gain on 100 cases weak evidence?
    Back
    Sampling noise: at a pass rate near 0.8, one score is uncertain by roughly 8 points either way (illustrative). Compare variants paired on the same cases, with a bootstrap interval, or add cases.

Fine-tuning vs RAG vs prompting

  1. Front
    When is fine-tuning the right choice over RAG?
    Back
    When you need consistent style, format or behaviour at scale, have labelled examples, and prompting has hit its limit. Not for injecting facts or current knowledge.
  2. Front
    Does fine-tuning fix hallucination?
    Back
    Not by itself. It does not supply correct facts, and one 2024 study found hallucination rose as new facts were absorbed. Training on correct refusals can improve abstention (R-Tuning, NAACL 2024). Facts still need grounding via RAG.
  3. Front
    What does each lever change: prompting, RAG, fine-tuning?
    Back
    Prompting changes the instructions. RAG changes the information in the prompt at answer time. Fine-tuning changes the weights, to teach a consistent pattern of behaviour.
  4. Front
    Three things fine-tuning does poorly compared with RAG?
    Back
    Keeping facts current (needs retraining), giving citations (no source passage), and per-user access control (weights are shared by every user).
  5. Front
    What must exist before you start a fine-tune?
    Back
    Labelled examples, a strong baseline (best prompt, plus RAG if facts matter), an eval with a held-out set, a reason prompting cannot meet, and a plan to retrain when the base model changes.

Fine-tuning methods: SFT, LoRA, QLoRA and DPO

  1. Front
    Explain LoRA in two sentences.
    Back
    Freeze the weights W and learn a low-rank update B x A (rank r much smaller than d), a tiny fraction of the parameters. Adapters are small, swappable and mergeable into W.
  2. Front
    RLHF vs DPO?
    Back
    RLHF trains a reward model then optimises with RL. DPO trains directly on preference pairs with a classification-style loss: no separate reward model or RL loop, though it still uses a frozen reference model.
  3. Front
    How many trainable weights does a rank-r LoRA adapter add to a d x d layer?
    Back
    2 x d x r (A is r x d, B is d x r). For d = 4096, r = 8: 65,536, about 0.39% of the layer's 16.8 million weights.
  4. Front
    What does QLoRA add to LoRA?
    Back
    The frozen base is held in 4-bit (NF4) while adapters train in higher precision, with double quantisation and paged optimisers. It cuts memory a lot, with slower steps; check quality on your task.
  5. Front
    Which data does SFT use, and which does preference tuning use?
    Back
    SFT: prompt and ideal-response pairs. Preference tuning: a prompt with a preferred and a rejected response.

Fine-tuning data, risks and shipping

  1. Front
    A tuned model looks fine offline but worse in production. First suspect?
    Back
    A prompt-format mismatch: training used a different system prompt or chat template than production. Train on the exact serving format.
  2. Front
    Name four risks of fine-tuning.
    Back
    Forgetting (general abilities regress), overfitting (memorises training examples), safety regression (weaker safety behaviour, even with benign data) and leakage (training data overlaps your evals).
  3. Front
    What do you compare a fine-tuned model against before shipping?
    Back
    The base model with the best prompt, plus RAG if facts matter. If the tune does not clearly beat that baseline, stay with the baseline.
  4. Front
    What do you need in place so a bad adapter can be reversed quickly?
    Back
    Adapters versioned together with their data and hyperparameters, a canary release, and a rollback path to the previous adapter or the base model.
  5. Front
    What is decontamination and why does it matter?
    Back
    Removing training examples that overlap your eval data. If they overlap, the scores measure memorisation and mean little.

Designing a RAG QA system

  1. Front
    In a permission-aware RAG system, where does the permission filter belong?
    Back
    Inside the retrieval query, using allowed groups stored as chunk metadata, so restricted text never reaches the prompt. Never ask the model to withhold something it was already shown.
  2. Front
    What should a RAG system do when the retrieved evidence is weak?
    Back
    Compare the best reranked score with a threshold tuned on unanswerable questions, and say it found nothing instead of generating a confident guess.
  3. Front
    Why might hybrid (keyword plus vector) search beat vector-only search?
    Back
    Vector search matches meaning but can blur exact strings such as error codes and product names; keyword search matches those exactly. The cost is a second index to keep in sync.
  4. Front
    Name degraded modes for a RAG system.
    Back
    Retriever down: keyword-only search. Reranker down: serve hybrid results. LLM down: fallback model or cited snippets only. Stale index: freshness warning, or refuse for sensitive sources.
  5. Front
    How do you estimate raw vector storage?
    Back
    Chunks × dimensions × bytes per value. Example: 2,000,000 × 1,024 × 4 bytes is about 8.2 GB before index overhead (illustrative numbers).
  6. Front
    In a typical RAG query, what dominates cost and what does a retriever cost?
    Back
    The LLM call dominates: retrieved chunks make up most of the input tokens. Retrieval and embedding are small by comparison, so cutting top-k is a first lever (and a quality trade).
  7. Front
    How do you close permission sync lag and cache leaks?
    Back
    Re-check the final few chunks against the source system before building the prompt, and key any answer cache on the user's permission set.

Designing an agent product

  1. Front
    Why does agent cost grow faster than the number of steps?
    Back
    Each step is a model call that re-reads the growing history. With a 2,000-token base and 800 tokens added per step, 6 steps send 24,000 input tokens, not 12,000 (illustrative).
  2. Front
    Which controls make an irreversible agent action safe?
    Back
    Approval of the exact action, spend and rate limits, idempotency keys, audit logs, compensation where an undo exists, and least-privilege credentials.
  3. Front
    How do you assign autonomy to an agent's tools?
    Back
    By worst case: read runs freely, reversible writes run and can be undone, irreversible or external actions need approval, and the most dangerous tools do not exist.
  4. Front
    A payment call times out after possibly charging. What does the executor do?
    Back
    The executor retries with the same idempotency key it created, so a charge that happened is returned, not repeated. If keys may have expired or the provider lacks support, look up by your own reference first. A new key means a new charge.
  5. Front
    What is compensation in a multi-step agent task?
    Back
    A cancelling action for each side-effecting step (cancel the hotel), run in reverse order when a later step fails. Actions with no undo need approval first.
  6. Front
    How do you grade an agent that says it finished?
    Back
    Check the final state in the system of record (was the user charged once?), plus trajectory and consistency across repeated runs, not the agent's own claim.

Designing content moderation and guardrail systems

  1. Front
    What layers can a moderation system combine?
    Back
    An input classifier, a policy prompt, an output check, a human review lane, and logging with appeals. They are a menu chosen by risk, not one fixed order.
  2. Front
    Is the moderation precision and recall threshold a technical or business decision?
    Back
    Business: engineering supplies the counts of both error types, and the product owner and policy team choose the point, per category, from the product's risk.
  3. Front
    Serial, windowed or parallel output moderation?
    Back
    Serial (buffer then release) for severe harm, windowed streaming for mixed risk, parallel with retraction for low severity. Streamed text cannot be un-shown.
  4. Front
    Why are most blocks false positives when violations are rare?
    Back
    When the false-positive rate is not far below the base rate, the false positives outnumber the true catches. Example: 4,500 caught versus 9,950 honest blocked is 4,500 / 14,450, about 31% precision (illustrative).
  5. Front
    What is shadow mode in moderation tuning?
    Back
    Run a new threshold or classifier on live traffic, record what it would do, act on nothing, and compare with labels. Sample near the threshold, because random samples of passed traffic hold almost no misses.
  6. Front
    How do you size the human review lane?
    Back
    Items in the borderline band per day divided by one reviewer's daily capacity, rounded up. 2,000 items at 960 per reviewer per day is 2.08, so 3 reviewers.

RAG interview drills and mock

  1. Front
    Five things to volunteer in a GenAI system design answer?
    Back
    Permission-filtered retrieval, an abstain path, a cost and latency budget, an evaluation and observability plan, and guardrails against injected content.
  2. Front
    What do you do in the first five minutes of a GenAI design answer?
    Back
    Clarify users, scale, latency target, accuracy bar, cost ceiling and permissions; state assumptions and name what is out of scope.
  3. Front
    Quick pattern for a token-cost estimate?
    Back
    (Input tokens × input price + output tokens × output price) × requests per day; then name the lever that cuts it most and its quality cost.
  4. Front
    How do you evaluate a design before launch?
    Back
    A golden set with unanswerable cases, retrieval and generation metrics scored separately, a red-team for injection and leaks, a load test of p95, and shadow traffic.
  5. Front
    What breaks first at 10 times scale?
    Back
    It depends on what grows. More chunks hit index memory; more queries hit LLM rate limits and cost; more updates hit ingestion throughput. Recompute the changed number first.
  6. Front
    What is the senior-level differentiator in a design round?
    Back
    Raising failure modes, limits and trade-offs without being asked, and tying choices to numbers or metrics.
  7. Front
    How do you respond when the interviewer changes a constraint?
    Back
    Restate it, name the earlier number it changes, recompute that number, then say which component changes and what the change costs.

Coding, project defense and mock rounds

  1. Front
    What do you do when asked for a number you never measured?
    Back
    Be honest that it is unmeasured, separate a target from a result, and name the measurement you would add, such as a per-stage trace.
  2. Front
    When does a rank-1 document from one list beat a document with the same rank in both?
    Back
    With k = 60, when that shared rank r is above 62: 1/61 beats 2/(60 + r). At r = 62 they tie. Fusion rewards agreement but does not guarantee it wins.
  3. Front
    Can a document in only one list beat a document in both lists under RRF?
    Back
    Yes. With k = 60, first in one list scores 1/61 = 0.0164, while 70th in both scores 2/130 = 0.0154. Agreement helps, but it does not override a very weak rank.
  4. Front
    How do you label a number in a project defense?
    Back
    Measured, estimated or unknown. For an unknown, say so and name the measurement you would add.
  5. Front
    Four behavioural stories to prepare for a GenAI role?
    Back
    A quality regression you diagnosed, a latency versus quality trade-off, a time you pushed back on an LLM where something simpler worked, and a time you managed expectations about hallucinations.
  6. Front
    What are the three mock rounds?
    Back
    Round 1: questions (Drills A and B). Round 2: an unseen design prompt (Drill C). Round 3: project defense plus coding (Drills D and E).

What is an agent harness?

  1. Front
    What is an agent harness?
    Back
    Everything around the model that makes it an agent: loop, tools, state, sandbox, permissions, verification, orchestration, observability. Agent = model + harness.
  2. Front
    What is harness engineering, and what is its unit of improvement?
    Back
    Designing the environment, constraints and feedback loops so an agent stays reliable, and improving them from observed failures. The unit is the environment, not the prompt.
  3. Front
    How do prompt, context and harness engineering nest?
    Back
    Prompt (wording of one call) sits inside context (what the model sees now), which sits inside the harness (adds persistence, enforcement, orchestration, observability and the improvement loop).
  4. Front
    Name the six harness component families.
    Back
    Instructions, tools, infrastructure (filesystem, git, sandbox, browser), orchestration, enforcement (hooks, permissions, linters, tests), observability.
  5. Front
    Inner versus outer harness?
    Back
    Inner (Böckeler: the builder's harness) is shipped by the tool or model builder and you do not control it. Outer (the user's harness) is what you add: instruction files, MCP servers, skills, hooks, linters, tests. That is where application engineers have leverage.
  6. Front
    What are the four failure layers and their fixes?
    Back
    Context (it lacked information): fix retrieval and docs. Constraint (acted outside scope): fix permissions and hooks. Verification (wrong output unchecked): fix tests and evaluators. Planning (wrong approach, loops): fix decomposition and loop detection.
  7. Front
    How do you estimate success of an n-step task?
    Back
    About p to the power n for per-step success p, assuming independent steps. 0.98 over 25 steps is about 0.60. Errors are usually correlated, so say roughly.
  8. Front
    Two levers for long tasks that keep failing?
    Back
    Raise per-step reliability (better tools, context, verification after a step) or add recovery (detect and repair an error mid-task, with checkpoints).
  9. Front
    What is the ratchet?
    Back
    Every real mistake becomes a permanent rule, check or hook, with the incident noted. When a stronger model makes it redundant, remove it.
  10. Front
    What does "assumptions decay" mean for a harness?
    Back
    Each component assumes something the model cannot do. Re-test it when the model changes: some scaffolding retires, harder tasks need new scaffolding.
  11. Front
    Which meanings of "harness" should you disambiguate in an interview?
    Back
    Test harness, evaluation harness (benchmark runner), reinforcement-learning environment wrapper, and agent harness. Ask which is meant.

The agent loop and tool design

  1. Front
    Who decides that an agent's work is done?
    Back
    The harness, by checking. The model proposes that it is done; a message with no tool call is a claim to verify with tests, a schema, a required artefact or a check the harness runs itself.
  2. Front
    Why was a feature list that starts all failing useful for long-running agents?
    Back
    The agent was told to mark an entry passing only after testing it, so it could not simply declare the job finished from earlier progress. It is an instruction, not a mechanism; a check the harness runs itself is stronger (Anthropic, Nov 2025).
  3. Front
    What does a good tool error look like?
    Back
    It says what failed, why, and what to try, written for a model: "File not found: src/a.py. Did you mean src/app.py? Use list_dir." Not a code or a stack trace.
  4. Front
    Where do you handle transient tool failures?
    Back
    In the harness, with retries and backoff the model does not see. Return a message only when retries run out. Otherwise the model burns its step budget on flakiness.
  5. Front
    What signals no progress, and what do you do?
    Back
    The same call with the same arguments, or the same error, repeated. Nudge once, then stop or escalate to a human, and log it.
  6. Front
    Guidelines for a tool set?
    Back
    Few, thoughtful tools for real workflows, not one per endpoint; no overlaps; descriptions written for a new colleague; readable short output; arguments that make mistakes hard (poka-yoke); read and write split.
  7. Front
    How do you improve tools?
    Back
    Run realistic multi-step tasks with checkable outcomes, read the transcripts, find where the model misuses a tool, then change the tool, not the prompt. Keep a held-out set.
  8. Front
    What is a conditional edit and why use it?
    Back
    An edit that carries the text it expects to replace, so a stale line number fails instead of editing the wrong line. Optimistic concurrency for model edits.
  9. Front
    What is progressive disclosure of tools?
    Back
    The model starts with a way to find tools and loads full definitions only for those it needs, so a large catalog does not fill the window before work starts.
  10. Front
    How do you handle a very long tool output?
    Back
    Keep the head and tail, write the full output to a file and give the model the path, summarise noisy sources with a cheaper model, and redact secrets first.
  11. Front
    Trade-off of giving an agent a general shell?
    Back
    Few definitions and great capability, but a large blast radius and noisy output. It needs a sandbox, allow and deny lists, timeouts and output caps.
  12. Front
    When is replaying a crashed run safe?
    Back
    Only when tools are idempotent: an idempotency key or a conditional edit means a repeated step has no extra effect. Persist messages, results, plan and side-effect ids after each step.
  13. Front
    Why version tool schemas?
    Back
    A model's behaviour can depend on tool names and shapes. Renaming a tool or changing an argument can regress calls that worked, so re-run your tasks and record the change.

Context and long-running agents

  1. Front
    Name the two problems that long agent runs hit.
    Back
    Context rot inside a session (a crowded window degrades use of what is in it) and amnesia across sessions (each new window starts blank). The harness budgets the first and writes state down for the second.
  2. Front
    What is context rot?
    Back
    As the number of tokens in the window grows, the model's ability to recall information from it falls. Treat the window as a finite attention budget (Anthropic, Sep 2025).
  3. Front
    Three cheap moves to protect the context budget?
    Back
    Cap what enters (truncate and offload large outputs), clear old raw tool results, and compact the conversation late and in one step.
  4. Front
    What should a compaction keep as written?
    Back
    The goal and acceptance criteria, constraints, key decisions with their reasons, open to-dos, files touched, the last failing command and error, and identifiers needed later.
  5. Front
    What can a compaction drop or replace with a pointer?
    Back
    Raw tool output (save it to a file), repeated reads, and exploration that led nowhere. Keep the fact of what was tried and why it failed.
  6. Front
    Two ways a compaction goes wrong?
    Back
    Details are lost and then reinvented with confidence, and negative knowledge (what failed and why) disappears. Changing early context also defeats prefix caching.
  7. Front
    What does the initializer session create in Anthropic's long-running pattern?
    Back
    An init script, a progress file, a first git commit and a feature list with every entry failing. Later coding sessions use the same harness and tools with a different first prompt.
  8. Front
    Why a JSON feature list rather than Markdown?
    Back
    Anthropic reports the model was less likely to change structured JSON inappropriately than Markdown. The agent was told to change only each entry's passes field.
  9. Front
    Is "change only passes" a lock?
    Back
    No: it is an instruction in a prompt. The harness should reject other edits, or keep the list where the agent can write only the status.
  10. Front
    What is the session startup routine?
    Back
    Check the working directory, read the git log and progress file, read the feature list and pick one unfinished item, run the init script, and run a basic end-to-end check before adding anything.
  11. Front
    Why keep the instruction file short?
    Back
    A long file crowds the window, flattens priorities and goes stale. Keep a short map that points into a docs folder, and tie each rule to a past failure (Osmani).
  12. Front
    What does "if the agent cannot read it, it does not exist" mean in practice?
    Back
    Decisions held in chat or in heads must be written into the repository as plain versioned text. Scope memory per session and make it fail closed when no scope is known.

Guides, sensors and enforcement

  1. Front
    What is a guide, and what is a sensor?
    Back
    A guide steers the agent before it acts (instructions, skills, templates). A sensor observes after it acts so the agent can correct itself (linters, tests, reviews). Use both (Böckeler, Apr 2026).
  2. Front
    Computational versus inferential controls?
    Back
    Computational: deterministic, fast, cheap checks (tests, linters, type checkers, structural tests). Inferential: a model's judgment (AI review, LLM judge): slower, costlier, less predictable.
  3. Front
    Which sensors run on every change?
    Back
    Computational ones. Spend inferential checks where meaning matters and no deterministic test exists, and treat their verdicts as less certain.
  4. Front
    What does keep quality left mean?
    Back
    Run checks as early as possible: fast ones (format, lint, types, quick tests) right after an edit or before commit; expensive ones (slower tests, deep review) later; drift scans continuously.
  5. Front
    What is the rule for sensor output?
    Back
    Success silent, failure verbose: print nothing when a check passes, and a short, specific message the agent can act on, with the fix, when it fails.
  6. Front
    Why is a hook a guarantee and a prompt rule a suggestion?
    Back
    A hook is code the harness runs at a defined point whatever the model decides. A prompt rule depends on the model following it every time.
  7. Front
    Which hook points can block, and which cannot?
    Back
    Before a tool call can block it. After a tool call cannot undo it (it can feed a message back). A stop hook can prevent the agent from finishing, for example while tests fail. Other points, such as prompt submission, can block too, so check the current docs (Claude Code).
  8. Front
    How should permissions be tiered?
    Back
    Read-only: allow. Reversible write in a sandbox: allow. Costly or external: allow-list or approve each use. Destructive or irreversible: explicit human approval. Fail closed when scope is unknown.
  9. Front
    Why does approval fatigue matter?
    Back
    If people click approve constantly they stop looking. Sandboxing sets boundaries so the agent works freely inside them; Anthropic reports 84 percent fewer permission prompts in internal use (Oct 2025).
  10. Front
    Why do sandboxes need both file and network limits?
    Back
    Without network limits a compromised agent could send out files; without file limits it could escape the sandbox and reach the network. Each covers the other's gap.
  11. Front
    What is the lethal trifecta and the response?
    Back
    Private data, exposure to untrusted content and external communication in one agent allow data theft (Willison, Jun 2025). Avoid the combination: remove a leg, separate by trust, least privilege.
  12. Front
    How do you stop an agent from editing the tests?
    Back
    Make them unwritable for the agent (permissions or a hook on protected paths), keep success criteria where it cannot rewrite them, and grade with an independent run in CI.
  13. Front
    Which part of verification is weakest?
    Back
    Behaviour (does it do the right thing). Böckeler says reliance on AI-generated tests is not good enough yet; add coverage and mutation checks and manual testing for critical paths.

Orchestration, subagents and people in the loop

  1. Front
    What is the first reason to use a subagent?
    Back
    Context isolation: it explores in its own window and returns a short result (often 1,000 to 2,000 tokens), so the parent's window stays clean (Anthropic, Sep 2025).
  2. Front
    What does isolation cost?
    Back
    Total tokens: Anthropic reports agents used about 4 times a chat's tokens and multi-agent systems about 15 times in their system, so the task must be valuable enough.
  3. Front
    When do subagents not pay?
    Back
    Small tasks, work where all agents need the same context, and tightly coupled edits. Most coding tasks have fewer parallel parts than research.
  4. Front
    What goes in a delegation contract?
    Back
    Objective and what good looks like, constraints and budget, allowed tools, an output format the parent can read without redoing the work, and a stop condition with where to write artefacts.
  5. Front
    How should agents hand work to each other?
    Back
    Through files and structured, validated results, not long transcripts. Use job ids and status fields to make handoffs resumable, and name one owner per artefact.
  6. Front
    Why separate builder and checker?
    Back
    An agent grading its own work has a conflict. Prefer deterministic tests, or a separate agent, and agree what done means before the work starts. It adds a second pass of cost.
  7. Front
    How should models be routed?
    Back
    By step type, risk and context size: strong for planning and ambiguity, smaller for routine work, with a fallback to the stronger model. Re-test routing on each new model; switching models mid-conversation can lose cached context.
  8. Front
    How do you isolate parallel agents on one repository?
    Back
    A working copy or container per task, ownership by module, a queue with locks for shared resources, small changes and an integration step. In our judgment, coordination cost grows faster than throughput.
  9. Front
    Why state a practice's conditions?
    Back
    A practice is right only under its operating conditions. Minimal blocking review suits high throughput, cheap corrections and strong tests, and would be risky in low-volume or high-risk work.
  10. Front
    Where do people belong in an agent system?
    Back
    At intent and acceptance, irreversible actions, escalations and the steering loop, where they turn recurring failures into guides, sensors and hooks (Böckeler).
  11. Front
    What is an autonomy ladder?
    Back
    Suggest only, act with approval, act and notify, act alone. Move each kind of action up as evidence builds, based on reversibility, blast radius and verification strength.

Evaluating and operating a harness

  1. Front
    What makes a fair harness experiment?
    Back
    Hold the model fixed and change one component; use the same tasks, split into tuning and held-out sets; run several trials; grade the end state; seal the environment.
  2. Front
    What should you do with graders?
    Back
    Choose them on purpose (code, model or human), calibrate model graders against people, and read transcripts from many trials to find broken graders (Anthropic, Jan 2026).
  3. Front
    Why replicate leaderboard gains?
    Back
    Harness-only gains often come from vendor or practitioner posts without full methodology. Replicate on your own tasks before relying on them.
  4. Front
    How do pass@k and pass^k differ for p = 0.8, k = 5?
    Back
    pass@5 = 1 − 0.2^5 ≈ 0.9997 (at least one success). pass^5 = 0.8^5 ≈ 0.328 (all succeed). An agent that usually works can be unusable if someone relies on it every time.
  5. Front
    What is cost per resolved task?
    Back
    Attempt cost divided by success rate. 0.80 at 40 percent is 2.00; 1.00 at 65 percent is about 1.54. Better success can justify a pricier attempt.
  6. Front
    What is the improvement loop?
    Back
    Run tasks, collect traces, classify failures by layer, make a structural change, re-run held-out tasks; keep it if better with no regressions, otherwise revert.
  7. Front
    Why prefer structural fixes to prompt text?
    Back
    A tool, sensor or hook can be measured and enforced. Add a regression check for each fix. Prompt patches depend on the model complying every time.
  8. Front
    What goes in a trace?
    Back
    Versioned prompts, model, tool calls and results, permission decisions, durations, tokens, cost and stop reason, in a standard format such as OpenTelemetry, with secrets redacted.
  9. Front
    What do you do when the model changes?
    Back
    Run the held-out tasks first to re-baseline, ablate components that assumed the old model's weaknesses, tie each rule to a failure, delete what you cannot justify, and version the harness as code.
  10. Front
    A sensor never fires. Good or bad?
    Back
    Unknown: quality or blindness. Seed a known fault to see whether it fires. Böckeler lists this as an open question.
  11. Front
    What does operating an agent need?
    Back
    Checkpoint and resume with idempotent tools, budgets and timeouts with a kill switch, rollback, safe degradation when a check is down, a runbook, and an incident that ends in a new guide, sensor or hook.
  12. Front
    What should the agent do if its verifier is unavailable?
    Back
    Stop and escalate rather than proceed unverified.

Harness engineering: interview drills

  1. Front
    Give the 90-second answer shape for any concept.
    Back
    Define it in one sentence, give one concrete example, name one trade-off or cost, and say how you would check it. Rehearse until it fits in about ninety seconds.
  2. Front
    What are the six harness component families?
    Back
    Instructions, tools, infrastructure, orchestration, enforcement, observability.
  3. Front
    Why is "done" a hypothesis?
    Back
    The model may be wrong or inventing. The harness checks against tests and state before the run ends.
  4. Front
    Why a hook rather than a prompt rule?
    Back
    A hook runs in code at a defined point whatever the model decides, so the rule holds. A prompt rule is a suggestion.
  5. Front
    What is the ratchet, and why can a better model mean fewer rules?
    Back
    Each real failure becomes a permanent check. Components assume model weaknesses, so remove one when its assumption stops holding.
  6. Front
    n-step success, pass@k, pass^k and cost per resolved task: the formulas?
    Back
    p^n; 1 − (1 − p)^k; p^k; attempt cost divided by success rate. For example 0.99^40 ≈ 0.67, and 0.9^10 ≈ 0.35.
  7. Front
    How do you compute steps before compaction?
    Back
    (threshold share × (window − output reserve) − fixed prompt) ÷ tokens per step. Capping tool output is the cheapest way to get more steps.
  8. Front
    What are the eight parts of a harness design answer?
    Back
    Clarify; context; tools and environment; loop and state; enforcement; verification; orchestration; evaluation and operations.
  9. Front
    What marks a strong design answer?
    Back
    Reproduce first, independent verification, numbers, isolation per task, explicit stop conditions, named failure classes, the improvement loop, and honesty about what stays with people.
  10. Front
    What do you do when the interviewer changes a constraint?
    Back
    Re-cost the design aloud: cap steps and output, route routine steps to a smaller model, and say what quality risk you accept.
  11. Front
    Scenario: it edits the tests to pass.
    Back
    The success criteria were writable. Make tests unwritable for the agent, use a hook on protected paths, and grade in CI.
  12. Front
    Scenario: success is flat and cost is up 40 percent after an upgrade.
    Back
    Old compensations now add steps. Ablate them one at a time on held-out tasks and check that tool shapes still suit the model.

The LangChain map and Runnables

  1. Front
    How do LangChain, LangGraph and LangSmith fit together?
    Back
    LangChain: quick path to an agent and a common model interface. LangGraph: the stateful runtime LangChain agents are built on (persistence, interrupts, loops). LangSmith: tracing, evaluation and deployment, usable with any framework.
  2. Front
    What is Deep Agents?
    Back
    A packaged agent harness on top of LangGraph: planning, subagents, filesystem tools and context management. Use it for long, open-ended tasks.
  3. Front
    Does LangSmith need LangChain?
    Back
    No. It traces and evaluates agents built with any framework or a plain SDK. Tracing is switched on through environment variables.
  4. Front
    What changed in LangChain 1.0 that dates an old tutorial?
    Back
    create_agent replaces create_react_agent; middleware extends the loop; structured output comes from the main loop; content_blocks give a provider-neutral view; legacy chains and memory moved to langchain-classic.
  5. Front
    What is a Runnable?
    Back
    The shared interface of every component: the same calls for one input, a batch, async or a stream. Because the shape is shared, components compose.
  6. Front
    How do a pipe and a dict compose Runnables?
    Back
    A pipe runs left to right, passing each output on. A dict runs its branches on the same input in parallel and gathers a dict of results.
  7. Front
    When does the pipe style stop being enough?
    Back
    When you need loops (retry until valid), branching on state, waiting for a person, or resuming after a crash. The pipe flow has no cycles and no durable state; use a graph.
  8. Front
    Two ways to get typed output in LangChain?
    Back
    On a bare model: with_structured_output(schema), optionally returning the raw reply and parse error. In an agent: response_format, using provider-native output or a tool strategy; the result is under structured_response.
  9. Front
    Why is typed output not a guarantee?
    Back
    Output can be cut off at the token limit, a loose schema lets the model fill filler, and a valid value can be wrong. Validate, retry a bounded number of times, define the failure path.
  10. Front
    Where does a tool's schema come from?
    Back
    The function: its docstring is the description and its type hints are the input schema. The docstring is part of your prompt.
  11. Front
    Why inject user_id into a tool instead of making it an argument?
    Back
    A model-chosen id can be changed by prompt injection or a persuasive user. A hidden runtime parameter is filled from the caller's session, so the model never chooses whose data is read.
  12. Front
    Two-step, agentic and hybrid RAG: when each?
    Back
    Two-step (always retrieve, then answer): predictable latency, FAQ bots. Agentic (retrieval as a tool): flexible, variable latency. Hybrid (adds rewriting and checks, may loop): ambiguous or quality-sensitive flows.
  13. Front
    When would you skip LangChain entirely?
    Back
    A single model call or simple feature with no state, tools or vendor swap: call the provider SDK. Add the framework when you can name the concrete benefit.

Agents, middleware and memory

  1. Front
    What does create_agent build?
    Back
    A loop on the LangGraph runtime: call the model, run the tools it asks for, add results, stop when no tool is requested. Persistence and approvals come from the runtime.
  2. Front
    The middleware hooks and when each runs?
    Back
    Node-style: before_agent and after_agent (once per invocation), before_model and after_model (every model turn). Wrap-style: wrap_model_call and wrap_tool_call (around each call; the handler can run zero, one or many times).
  3. Front
    Which hook fits history trimming? A tool retry? A reply guard?
    Back
    Trimming: before_model. Tool retry or error shaping: wrap_tool_call. Reply guard: after_model.
  4. Front
    How do you stop a runaway agent loop?
    Back
    A model call limit (and a tool call limit) in middleware, with a chosen exit behaviour. Do not rely on a prompt sentence.
  5. Front
    Middleware execution order for [m1, m2, m3]?
    Back
    before hooks: m1, m2, m3. wrap hooks nest, m1 outermost. after hooks: m3, m2, m1.
  6. Front
    Where should redaction and approval go?
    Back
    Redaction first, before anything that logs or forwards. Approval only on tools that write, spend or send, not on every tool.
  7. Front
    What needs a checkpointer in a create_agent agent?
    Back
    Conversation continuity by thread id, human-in-the-loop approval that resumes, and per-thread limits. Runtime context and the system prompt do not.
  8. Front
    State, short-term memory, runtime context, long-term memory?
    Back
    State: messages plus custom fields, per thread. Short-term: checkpointer plus thread id. Context: read-only data per invocation (user, tenant). Long-term: a namespaced store across threads.
  9. Front
    Why does cost sometimes rise after enabling summarisation?
    Back
    Each summary is an extra model call, a trigger that fires too often repeats it, and lost facts can cause extra tool calls. Check traces before and after.
  10. Front
    Name the five multi-agent patterns in the docs.
    Back
    Subagents, handoffs, skills, router, custom workflow (a LangGraph graph).
  11. Front
    Cost of each pattern?
    Back
    Subagents: extra model call per request. Handoffs: sequential. Skills: loaded text stays in context. Router: stateless, a routing call every time. Custom: more code.
  12. Front
    When should you add a second agent?
    Back
    Only for a measured need: context isolation, parallel work or independent evaluation. A single agent with good tools often does the job.
  13. Front
    Old to new: create_react_agent, prompt=, pre_model_hook, post_model_hook?
    Back
    create_agent, system_prompt=, before_model middleware, after_model middleware. Legacy chains and retrievers moved to langchain-classic.
  14. Front
    A safe migration method?
    Back
    Pin versions, write evaluations of current behaviour, port one piece at a time, compare traces and scores after each, then remove the bridge package.

LangGraph: state, nodes, edges and control flow

  1. Front
    What are the three primitives of a LangGraph graph?
    Back
    State (shared data, with merge rules), nodes (functions that return partial updates) and edges (fixed, conditional or dynamic routing). Compile the graph before use.
  2. Front
    What should a node return?
    Back
    A partial update with only the keys it changed. Returning the whole state risks overwriting other nodes' work.
  3. Front
    How do you bound a retry loop in a graph?
    Back
    Keep a counter in state and have the routing function end the run when it reaches the cap. Also set the recursion limit.
  4. Front
    What is a reducer?
    Back
    The merge rule for one state key. Default: replace. An append reducer combines lists; the message reducer appends and updates by message id.
  5. Front
    Why do parallel writes to one key need a reducer?
    Back
    Two nodes in a round both write it; the runtime needs a rule to combine them. Without one the update is invalid or one write is lost.
  6. Front
    How do you clear a list that has an append reducer?
    Back
    Returning an empty list merges nothing in. Use the overwrite wrapper to bypass the reducer, from one node per round.
  7. Front
    What is a super-step?
    Back
    One round: all active nodes run in parallel on the same state, updates merge at the boundary through the reducers, and the next nodes activate.
  8. Front
    Why set the recursion limit yourself?
    Back
    The default can change between versions and is large (1000 from 1.0.6 per the docs). An unbounded cycle is an unbounded bill. Set it at the top level of the run config.
  9. Front
    Why must a node's side effects be safe to repeat?
    Back
    A retry or resume can re-run a step. The runtime saves state, not your outside effects, so use idempotency keys.
  10. Front
    Conditional edge, Command or Send?
    Back
    Conditional edge: a function picks the next node. Command: a node returns an update and the next node together. Send: fan out workers with their own input when the count is known only at run time.
  11. Front
    What happens if a node returns Command(goto=...) and also has a static edge?
    Back
    Both run. The static edge still fires alongside the goto, so remove it if you meant only the goto.
  12. Front
    Map-reduce in LangGraph?
    Back
    A routing function returns one Send per item; a worker node handles each; an append reducer on the results key gathers them; a join runs after.
  13. Front
    Graph API or functional API?
    Back
    Graph API when you want the shape visible: shared state, several decisions, parallel merges. Functional API to add durability to procedural code with simple branching. Same core capabilities.
  14. Front
    When is a graph the wrong tool?
    Back
    A linear pipeline with no loops, state or pauses: plain functions or a pipe chain. A standard tool agent: create_agent.

LangGraph: persistence, human approval and failure

  1. Front
    Checkpointer or store?
    Back
    Checkpointer: one thread's state at each step, keyed by thread id (continuity, approvals, time travel, recovery). Store: memories across threads, keyed by namespace and key (long-term memory).
  2. Front
    What does a thread id select?
    Back
    Which saved state to load. Reuse it to continue; a new id starts fresh. Treat it as part of access control.
  3. Front
    Why not the in-memory saver in production?
    Back
    Checkpoints are in RAM and lost on restart, so paused runs and conversations vanish. Use a database-backed saver, and prune old checkpoints.
  4. Front
    How does interrupt pause and resume a run?
    Back
    interrupt saves state through the checkpointer and returns its payload to the caller. Invoking again with a resume command on the same thread continues; interrupt then returns the resume value.
  5. Front
    Where does execution restart after an interrupt?
    Back
    At the top of the same node, not the line after the call. Everything before interrupt runs again.
  6. Front
    Rules for using interrupt?
    Back
    Needs a checkpointer and thread id; JSON-serialisable payload; no bare try-except around it; stable interrupt order; no while-true loop (use a conditional edge); resume parallel interrupts with a map of ids.
  7. Front
    Static breakpoints or interrupt for approvals?
    Back
    interrupt. Static breakpoints (before or after a node) are a debugging aid; the docs do not recommend them for human-approval flows.
  8. Front
    What guarantee do outside side effects get after a failure or resume?
    Back
    At least once. A node that failed part-way re-runs from its start. Use idempotency keys or check for an existing result.
  9. Front
    How do you stop a duplicate approval from refunding twice?
    Back
    Send the refund with a stable key derived from the request, so a second resume is recognised and ignored. A fresh random key per attempt would not help.
  10. Front
    The three durability modes?
    Back
    exit (save only when the run ends: fastest, no mid-run recovery), async (save while the next step runs: small loss window), sync (save before the next step: safest, slowest).
  11. Front
    What does replay from a checkpoint do?
    Back
    Nodes before it are not re-run; nodes after it run again, so model calls and side effects happen again and may differ. Replaying from the final checkpoint does nothing.
  12. Front
    What does a fork do?
    Back
    Updates state at an earlier checkpoint and branches a new checkpoint from it. The original history stays intact. Later steps then run live.
  13. Front
    Wrong assumption at step 4 of 9: how to fix it?
    Back
    Fork from the checkpoint before step 4 with corrected state. Steps 1 to 3 are not redone; steps 4 to 9 run again, with their side effects.

LangSmith: tracing, datasets and evaluation

  1. Front
    Run, trace, thread, project?
    Back
    Run: one unit of work (a model call, a retrieval, a tool), like an OpenTelemetry span. Trace: the runs for one operation. Thread: traces of one conversation, grouped by a thread_id metadata key. Project: the container for one application's traces.
  2. Front
    How is tracing enabled for LangChain and LangGraph code?
    Back
    Environment variables: LANGSMITH_TRACING=true and LANGSMITH_API_KEY, with an optional LANGSMITH_PROJECT (default project name is default). Plain code uses a decorator or context manager.
  3. Front
    What do you add to every trace from day one?
    Back
    Tags and metadata: app version, model, prompt version, tenant, environment, and a thread id for conversations. Without them you cannot filter by version when a release goes wrong.
  4. Front
    Why do traces go missing in a serverless function?
    Back
    Tracing sends from a background thread and the process can exit first. Wait for tracers in a finally block, or make callbacks synchronous.
  5. Front
    How do you keep personal data out of traces?
    Back
    Redact before sending: flags that hide inputs or outputs, an anonymizer with regex rules or a function, or per-function processing. Decide region and retention too.
  6. Front
    The five-step method for debugging from a trace?
    Back
    Find the trace; read top down for the slow, costly or wrong run; check that run's exact inputs; classify the cause; reproduce, fix, and add the case to a dataset.
  7. Front
    How does a one-off failure become a permanent test?
    Back
    Add the failing trace to a dataset with the correct answer as a reference, so every later experiment runs it.
  8. Front
    Dataset, example, split, experiment?
    Back
    Dataset: a collection of examples. Example: inputs plus an optional reference output and metadata. Split: a named subset (an example can be in several). Experiment: one application version evaluated on a dataset.
  9. Front
    Who sees a reference output?
    Back
    Only evaluators. It is never passed to the application under test.
  10. Front
    Which evaluator type for what?
    Back
    Code: format, schema, exact match, thresholds. LLM judge: helpfulness, groundedness, tone (calibrate it). Human: ground truth and judge calibration. Pairwise: compare two versions when absolute scores are noisy.
  11. Front
    What extra should you score for an agent?
    Back
    The trajectory: right tools, right order, no redundant calls, within the step budget. A correct answer reached wastefully still has a problem.
  12. Front
    Offline versus online evaluation?
    Back
    Offline: curated datasets before release, with reference outputs. Online: sampled live runs and threads, with no reference outputs, so only reference-free checks such as format or groundedness.
  13. Front
    How do you make an evaluation score trustworthy?
    Back
    Calibrate the judge on human labels; compare versions on the same examples and look at slices; repeat runs for non-determinism; keep a hold-out set; watch for metric gaming; track cost and latency too.
  14. Front
    The judge says v2 is +6 points but users complain. What do you check?
    Back
    Judge bias (longer answers), the dataset not matching real questions, a slice that got worse, judge calibration, format versus usefulness. Compare length-controlled, sample recent production questions, read failures.
  15. Front
    What is an automation rule?
    Back
    An item type (runs or threads), a filter, a sampling rate and an action: annotation queue, dataset, webhook, online evaluator, code evaluator or extended retention. It can be backfilled to older runs.
  16. Front
    What does a good release gate require?
    Back
    An experiment on a pinned dataset version that beats the baseline with no slice worse, then a gradual release watched by online evaluators.

LangSmith Deployment: running agents in production

  1. Front
    Why do agents need more than a request handler?
    Back
    Runs are long, bursty, stateful, streaming, interruptible and sometimes scheduled. A plain handler hits timeouts, loses runs on deploy and cannot resume. A runtime supplies durable state, streaming and queues.
  2. Front
    Assistant, thread, run, store, checkpoint?
    Back
    Assistant: a graph plus configuration. Thread: one conversation's state container. Run: one execution. Store: memory across threads. Checkpoint: a snapshot so an interrupted run can resume.
  3. Front
    Where does the Agent Server keep what?
    Back
    Assistants, threads, runs and cron jobs always in PostgreSQL. Redis handles signalling, cancellation and streaming and holds only ephemeral data.
  4. Front
    How does a background run work?
    Back
    Create a run on a thread; the call returns before the work finishes. Check status later, join to wait, then read the final thread state.
  5. Front
    The hosting options?
    Back
    Cloud (vendor runs everything); hybrid (vendor control plane, your servers and data); self-hosted with control plane (your Kubernetes, enterprise); standalone server (you run it with Postgres, Redis and a licence); or build your own.
  6. Front
    What do you rebuild if you build your own runtime?
    Back
    Streaming with reconnect, resume after interrupt, queues, cron, and concurrency rules for new messages on a busy thread.
  7. Front
    Where is the lock-in?
    Back
    Graph code is open source and portable. The server runtime is the part you rent. Weigh it against the cost of rebuilding the runtime.
  8. Front
    The four double-texting strategies?
    Back
    Enqueue (default: finish, then run the new input), reject (refuse new runs while one is active), interrupt (halt, keep progress, add the input), rollback (halt, revert everything, restart with the new input).
  9. Front
    Which strategy for a chat product? For a transactional agent?
    Back
    Chat: usually interrupt or rollback, since the old run is stale. Transactional: enqueue or reject, because abandoning a half-done real action is risky; rollback does not undo a payment.
  10. Front
    What does the custom auth handler do?
    Back
    Runs on every request, validates credentials and returns the user's identity and extra fields. Self-hosted servers have no default authentication.
  11. Front
    How do you enforce thread ownership?
    Back
    Set an owner in thread metadata on create; return a filter on the caller's identity for reads and searches. Runs inherit their thread's access control; the store uses namespace rewriting.
  12. Front
    Budgets and safety for a deployed agent?
    Back
    Per-run caps (model calls, tool calls, time, money) and a set recursion limit; a kill switch and a degraded mode; identity from the auth context; idempotent tools; redacted traces; a deletion path across threads, checkpoints, store and traces.
  13. Front
    What must be true to deploy while runs are paused for approval?
    Back
    State is durable; the new graph reads the old state; node names and interrupt order stay stable; side effects are idempotent; the rollout is understood and tested.
  14. Front
    A safe release path for a prompt, model or graph change?
    Back
    Offline experiment beats the baseline with no slice worse, then a gradual release with online evaluators, pinned versions, and a rollback path for graph and prompt together.

LangChain ecosystem: interview drills

  1. Front
    The 90-second opener on LangChain, LangGraph and LangSmith?
    Back
    LangChain: common model interface and create_agent for the standard loop. LangGraph: the stateful runtime beneath, for state, checkpoints, interrupts, streaming. LangSmith: tracing, evaluation, deployment, for any framework. Start with the SDK, then create_agent, then a graph; name a case for using none.
  2. Front
    What closing line shows judgement?
    Back
    "For a single prompt with a typed answer I would call the provider SDK directly." Name the least machinery that does the job.
  3. Front
    Checkpoint storage per day?
    Back
    Conversations × saved steps × state size. 20,000 × 12 × 40 KB = 9.6 GB. Keep references in state, not documents, and set retention.
  4. Front
    Cost per resolved conversation?
    Back
    Cost per attempt ÷ resolution rate. 6 cents ÷ 0.7 ≈ 8.6 cents. Track it, not cost per call.
  5. Front
    Trace budget with 10% sampling plus all errors?
    Back
    Sampled traces plus the errors not already sampled: 2,000 + 0.9 × 600 = 2,540 a day for 20,000 conversations and 3% errors.
  6. Front
    Odds that all retries fail?
    Back
    Failure rate to the power of attempts, if independent: 0.05³ = 0.0125%. Real failures are correlated (an outage), so also add a fallback.
  7. Front
    The eight parts of a design answer for an approval agent?
    Back
    Clarify; shape (router, graph); state and memory; tools (idempotency, caps, ownership); guardrails and budgets; evaluation; deployment; failure modes.
  8. Front
    Where does the refund call go, and why?
    Back
    After the interrupt, with an idempotency key from the request. The node restarts on resume, so anything before the pause runs again; the key absorbs a duplicate resume.
  9. Front
    Markers of a strong design answer?
    Back
    Idempotency, authorisation, budgets and evaluation gates raised unprompted; retrieval separated from generation quality; what not to automate; cost per resolved ticket; a rollback story.
  10. Front
    A refund went out twice. First checks?
    Back
    A side effect before the interrupt; a duplicate resume; no idempotency key. Look at where the refund call sits relative to the interrupt.
  11. Front
    Chat forgets turns in production but not locally?
    Back
    No checkpointer, a new thread id per request, or an in-memory saver behind several replicas. Compare thread ids on consecutive traces.
  12. Front
    Bill tripled after a release?
    Back
    Defeated prompt cache, summarising off, more tool calls, bigger retrieved chunks, retries. Read tokens per run by run type in the traces.
  13. Front
    Evaluation score up, users unhappy?
    Back
    Judge bias, a dataset that no longer matches real questions, a slice that got worse, latency. Check scores by slice and read ten failures.

Request lifecycle, metrics and the roofline

  1. Front
    List the steps of one request and say which sets TTFT and which sets ITL.
    Back
    Tokenize, queue, prefill, decode loop, stream. TTFT is queueing plus prefill (plus network, as a client sees it). ITL is the decode step time.
  2. Front
    How do you compute inter-token latency and end-to-end latency?
    Back
    ITL = (e2e latency − TTFT) ÷ (output tokens − 1). End-to-end latency = TTFT + generation time.
  3. Front
    Why is a throughput figure alone not a result?
    Back
    It needs the token type (input or output), the concurrency, and the TTFT and ITL users saw at that load. Bigger batches raise throughput and can lengthen each wait.
  4. Front
    What is goodput?
    Back
    Requests per second that meet the latency targets. 30 req/s with 90 percent on target gives 27 good req/s, more than 40 req/s with 60 percent on target (24).
  5. Front
    Cost per million tokens formula, and what moves it?
    Back
    GPU price per hour ÷ (tokens per second × 3600) × 10⁶. It falls as utilization rises: a quarter of the load gives four times the cost per token.
  6. Front
    How many FLOPs and bytes does one decode token need for P parameters?
    Back
    About 2P FLOPs (a multiply and an add per weight, attention aside) and P × bytes-per-weight bytes read from memory each step.
  7. Front
    Define arithmetic intensity and the ridge point.
    Back
    Intensity is FLOP per byte moved. The ridge is peak FLOP/s ÷ peak bandwidth. Below it a workload is memory-bound, above it compute-bound.
  8. Front
    What is decode intensity at batch B with b bytes per weight?
    Back
    About 2B ÷ b, so exactly B for BF16. It reaches the ridge at B* = ridge × b ÷ 2.
  9. Front
    Is prefill always compute-bound?
    Back
    No. Prefill intensity is about the prompt length n for BF16 weights. Compare n with the ridge: a 4,000-token prompt is compute-bound, a 30-token one is not.
  10. Front
    Which datasheet number do you use for the ridge, and what is the trap?
    Back
    The dense tensor-core figure. Listed numbers are often "with sparsity", about twice the dense figure. Take bandwidth and FLOPs from the datasheet of the exact part.
  11. Front
    How do you bound batch-1 decode speed?
    Back
    Step time ≥ weight bytes ÷ (bandwidth × number of GPUs). Example: 16 GB over 3.35 TB/s gives 4.8 ms, so at most about 209 tokens per second.
  12. Front
    What does the weights-only ceiling ignore?
    Back
    The KV-cache read (grows with context and batch), inter-GPU communication, quantization scale overhead, and kernels that reach only part of peak bandwidth.
  13. Front
    Name the four families of serving techniques.
    Back
    Do less work, move fewer bytes, use hardware better, run reliably. Each answers a roofline question: bytes cut decode time, batching raises intensity, caching skips prefill.

Memory and the KV-cache

  1. Front
    KV-cache bytes per token?
    Back
    2 × layers × KV heads × head dimension × bytes per value. Use KV heads, not query heads. Llama 3 8B in 16-bit: 128 KiB; 70B: 320 KiB.
  2. Front
    How do you turn memory into concurrency?
    Back
    KV budget = GPU memory × utilization − weights − overhead. Divide by (bytes per token × tokens per sequence). Store the cache in FP8 and the count roughly doubles.
  3. Front
    What does "fits is not serves" mean?
    Back
    Weights can fit in GPU memory while nothing is left for the cache and overhead, so the server cannot hold even one sequence. Fix with smaller weights, more GPUs or shorter contexts.
  4. Front
    How does the KV-cache limit decode speed?
    Back
    Each step reads the weights once for the batch and every sequence's own cache. At large batch and long context the caches can outweigh the weights, lowering the throughput ceiling.
  5. Front
    What problem does PagedAttention solve?
    Back
    Fragmentation and over-reservation. The pool is split into fixed blocks (16 tokens by default in vLLM) with a block table per sequence, so waste is at most part of one block.
  6. Front
    What does PagedAttention not change?
    Back
    The bytes a token's keys and values need, and the attention arithmetic. Its gains come from larger batches and from enabling block sharing and preemption.
  7. Front
    How does prefix caching find a match?
    Back
    Each full block is hashed from its parent hash, its tokens and extras such as a LoRA ID or cache salt. A new prompt's blocks are looked up; used blocks are reference-counted; least recently used are evicted.
  8. Front
    What makes a prefix cacheable?
    Back
    It must be identical and at the start of the prompt (static first, dynamic last), computed by the same model and adapter, and the request must reach the engine that holds it.
  9. Front
    Prefix cache versus response cache?
    Back
    Prefix caching reuses intermediate keys and values for a shared prompt start and still runs the model. A response cache returns a stored whole answer for a repeated request.
  10. Front
    GQA versus MQA versus MHA?
    Back
    MHA: a KV head per query head. MQA: one KV head, smallest cache, can lose quality. GQA: groups share a KV head, in between; 8 KV heads against 32 query heads is a 4 times smaller cache.
  11. Front
    What is MLA and what did DeepSeek-V2 report?
    Back
    Multi-head latent attention caches a compressed latent vector and expands it at use. DeepSeek-V2 reports a 93.3 percent smaller KV cache than DeepSeek 67B, a model-to-model comparison.
  12. Front
    What do you do before shipping a quantized KV-cache?
    Back
    Evaluate on your own set, including long contexts. Docs give no accuracy figures and recommend calibrated scales.
  13. Front
    What happens when the KV pool is full?
    Back
    Queue (TTFT rises), preempt (recompute or swap), or shed load. A preemption storm shows as high utilization with falling goodput. Watch the preemption count.

Model and kernel optimization

  1. Front
    What does FlashAttention change, and what stays the same?
    Back
    It tiles attention with an online softmax so the n × n score matrix never goes to HBM: fewer memory accesses. The result is exact attention.
  2. Front
    Why does FlashAttention help prefill more than decode?
    Back
    Prefill has an n × n score matrix per head; decode has one query row, so its traffic is dominated by reading weights and the KV-cache.
  3. Front
    What does quantization store?
    Back
    x ≈ scale × q, with the scale per tensor, channel or group. Group size 128 with a 16-bit scale averages 4.125 bits per 4-bit weight.
  4. Front
    Why do activation outliers hurt per-tensor 8-bit?
    Back
    The largest value sets the scale, so small values round to zero or lose precision. Weights are better behaved than activations.
  5. Front
    LLM.int8() in one line?
    Back
    W8A8 with outlier feature dimensions multiplied in 16-bit and the other 99.9 percent of values in 8-bit.
  6. Front
    GPTQ and AWQ in one line each?
    Back
    GPTQ: layer-wise weight-only quantization using approximate second-order information. AWQ: weight-only, protects about 1 percent salient channels chosen from activation statistics by scaling them.
  7. Front
    SmoothQuant and FP8 in one line each?
    Back
    SmoothQuant: moves quantization difficulty from activations to weights offline for W8A8. FP8: 8-bit floats (E4M3, E5M2) with wider range; needs supporting hardware.
  8. Front
    Which quantization for memory-bound decode?
    Back
    Weight-only low-bit (W4A16, W8A16, FP8 weights): fewer bytes per step, and idle arithmetic hides unpacking. A 4-bit step floor falls toward a quarter of BF16, less in practice.
  9. Front
    Which quantization for compute-bound work?
    Back
    W8A8 or FP8, because 8-bit matrix hardware runs faster. Weight-only gains little past the ridge and adds unpacking work.
  10. Front
    What is the hardware catch for FP8 W8A8?
    Back
    Support depends on the GPU generation. vLLM's table (2026-10-21) lists it for Ada and Hopper, not Ampere. Check the table for the version you run.
  11. Front
    How do you validate a quantized model?
    Back
    Perplexity first (coarse), then task evals against the 16-bit baseline with slices, production-like calibration data, a canary and a rollback. Perplexity alone misses task regressions.
  12. Front
    What do CUDA graphs and fusion remove?
    Back
    Graphs: per-kernel CPU launch overhead, by replaying a recorded sequence with one launch (padded to captured batch sizes). Fusion: round trips to memory between adjacent operations.
  13. Front
    Why can temperature 0 vary between runs?
    Back
    Floating-point addition is not associative and kernels change reduction order with batch size. Batch-invariant kernels fix it at a speed cost (one write-up: 26 s became 42 to 55 s).

Scheduling and decoding

  1. Front
    Static versus continuous batching?
    Back
    Static: wait for N, run until all finish; short requests wait for the longest. Continuous: re-form the batch every step; finished sequences leave, waiting ones join. Needs on-demand cache allocation.
  2. Front
    Why does a large prefill freeze streaming?
    Back
    It occupies a whole step. 16,000 tokens on an 8B model is at least about 259 ms at peak, so every running decode waits that long for its next token.
  3. Front
    How does chunked prefill work, and what does the budget trade?
    Back
    Each step holds one token per running decode plus a chunk of the waiting prompt up to a token budget. Smaller budget: smoother ITL. Larger: faster TTFT for long prompts. Prefill compute is unchanged.
  4. Front
    State Little's law and use it for capacity.
    Back
    L = λW: requests in flight = arrival rate × time in system. Sustainable rate = concurrency limit ÷ time a request holds a slot (queue wait excluded). 20 sequences held for 8 s each is 2.5 requests per second.
  5. Front
    What do you do when demand exceeds capacity?
    Back
    Admission control (reject early with 429 or 503 and a retry hint), priority for interactive traffic, per-tenant quotas, preemption of lowest priority, and cancel on disconnect. Queues alone do not help.
  6. Front
    How does speculative decoding work?
    Back
    A cheap draft proposes γ tokens; the target scores all of them in one pass. Accept each with probability min(1, p/q); on a rejection resample from norm(max(0, p − q)) and stop.
  7. Front
    Speculative speedup formula?
    Back
    Expected tokens per step = (1 − α^(γ+1)) / (1 − α). Speedup = that ÷ (γc + 1), with c the draft step time over the target step time. α = 0.8, γ = 4, c = 0.05 gives about 2.8.
  8. Front
    Is speculative decoding lossy?
    Back
    No. With correct accept and reject sampling the output distribution equals the target's for any draft; a poor draft only lowers speed. Hardware numerics can still cause small variation.
  9. Front
    When does speculative decoding stop helping?
    Back
    Verification processes about (γ + 1) × B tokens per step. Past the ridge it is no longer free, so gains shrink at high batch or load. Low acceptance rate also kills the gain.
  10. Front
    Name draft sources for speculative decoding.
    Back
    Separate small model; Medusa heads (tree attention); EAGLE head over target features; multi-token prediction built into the base model; n-gram or prompt lookup (training-free, good when output repeats input).
  11. Front
    What is prefill and decode disaggregation?
    Back
    Separate pools: prefill machines compute the KV-cache and send it over a fast link to decode machines. Each pool is tuned for its own target. Costs: transfer, two pools, capacity waste.
  12. Front
    How big is the KV transfer, and when is disaggregation worth it?
    Back
    4,096 tokens on a 70B model is about 1.34 GB, about 27 ms at 400 Gb/s line rate. Worth it at high volume with strict TTFT and ITL targets and long prompts; chunked prefill first for small deployments.

Distributed serving, engines and hardware

  1. Front
    What is the layout rule of thumb?
    Back
    Use the smallest parallelism that fits and meets the target, then scale out with replicas. Fewer GPUs means less communication, so consider quantization before adding GPUs.
  2. Front
    TP, PP, DP, EP: what is split and what is communicated?
    Back
    TP: matrices in each layer, all-reduces inside layers. PP: groups of layers, activations between stages. DP: nothing split, no per-request traffic. EP: experts, all-to-all token routing.
  3. Front
    Where should TP and PP live?
    Back
    TP inside a node on fast links (NVLink). PP across nodes. Without NVLink, vLLM's guidance prefers pipeline parallelism. A token still crosses every pipeline stage.
  4. Front
    How much does TP communication add?
    Back
    Two all-reduces per layer per token in the standard split (252 for a 126-layer model). They are small messages, so latency dominates; at an assumed 10 µs each, about 2.5 ms per step.
  5. Front
    Do the layout arithmetic for a 405B model.
    Back
    Cache 504 KiB per token. 8-bit weights 405 GB on 8 H100: about 139 GB of cache, about 32 sequences of 8,192 tokens, step floor about 15 ms. BF16 (810 GB) needs larger-memory GPUs such as H200.
  6. Front
    Active versus total parameters in MoE?
    Back
    Compute per token follows active parameters; memory and, at larger batches, bandwidth follow total. Mixtral 8x7B: 47B total, 13B active. DeepSeek-V3: 671B total, 37B active.
  7. Front
    How much of an MoE layer does a batch touch?
    Back
    With top-2 of 8 uniform routing, 1 − (3/4)^B: 25 percent at batch 1, 90 percent at 8, 99 percent at 16. A step then reads nearly all expert weights.
  8. Front
    Why do MoE deployments show p99 spikes?
    Back
    Expert parallelism waits for the slowest GPU, and hot experts (imbalanced routing) create stragglers. Mitigate with expert replication, balanced routing and routing-aware batching.
  9. Front
    How do you serve many fine-tunes on one GPU?
    Back
    Keep one base model resident and load small LoRA adapters on demand, batching across adapters. A rank-16 adapter on four projections of an 8B model is about 27 MB, 0.17 percent of the base.
  10. Front
    What are the costs of multi-LoRA serving?
    Back
    Adapter load latency, cache pressure, separate prefix caches per adapter (the adapter changes keys and values), and wasted memory from an oversized maximum rank setting.
  11. Front
    How do you choose an engine?
    Back
    Support for your model, quantization, adapters and structured output; performance on your own length distribution at your target latency; operational maturity; hardware lock-in. Check status: TGI was archived 2026-03-21.
  12. Front
    Which four hardware numbers matter?
    Back
    Memory capacity (what fits), bandwidth (decode speed), low-precision compute (prefill and large batch), interconnect (TP and EP scaling). Compare numbers on the same basis; datasheet peaks are often "with sparsity".
  13. Front
    Why is self-host cost at full load misleading?
    Back
    Cost per token scales with 1 / utilization. $2.50 per hour at 2,500 tokens per second is about $0.28 per million at full load and about $0.93 at 30 percent (illustrative).

Production operations: capacity, scaling and failure

  1. Front
    How many replicas do you need?
    Back
    Peak load ÷ per-replica goodput capacity ÷ target utilization (about 0.6 to 0.7), rounded up, plus spares for failures and deploys. Example: 7,500 tokens/s ÷ 2,000 ÷ 0.65 = 5.8, so 6 plus 1 spare.
  2. Front
    What is the Little's law check on a capacity plan?
    Back
    In flight = arrival rate × time in system. Divide by replicas and compare with the KV pool. 20 req/s × 9 s = 180; over 5 replicas is 36 each; a pool of 30 means cache is the constraint.
  3. Front
    Which autoscaling signals lead?
    Back
    Queue or waiting depth, KV-cache utilization, running sequences against benchmarked limits, TTFT p95, tokens per second against capacity. Not CPU, and not GPU utilization alone.
  4. Front
    What makes up cold start?
    Back
    Image pull, weight load (70 GB at 2 GB/s is 35 s), CUDA-graph capture and warm-up, in sequence. Mitigate with pre-pulled images, local weight caches, streamers, warm pools and scaling ahead of ramps.
  5. Front
    How do you scale up and down?
    Back
    Up fast, down slowly. Drain on scale-in: stop new requests, let streams finish up to a maximum generation time, then terminate. Minimum replicas for latency-sensitive tiers.
  6. Front
    How should requests be routed?
    Back
    Least loaded by queue depth or cache usage (cost varies 100 times), prefix-aware where it helps hits, session affinity for chat, adapter-aware, priority tiers, and a router that is itself evaluated.
  7. Front
    When is a retry safe, and what does hedging cost?
    Back
    Retry idempotent requests that failed before the first token, with jitter and the propagated deadline. Hedging sends a second copy of slow requests and doubles GPU load for the hedged share.
  8. Front
    Why does closed-loop load mislead?
    Back
    Clients wait for replies, so offered load drops when the server slows. A server with capacity 8 req/s looks stable. Use open-loop arrivals (Poisson at a set rate) to see queues and tails.
  9. Front
    What goes in an honest benchmark?
    Back
    Realistic length distributions, open-loop arrivals, TTFT and ITL at p50/p95/p99 and goodput at the target across load levels, warm-up discarded, cache hit rate controlled, hardware and precision fixed.
  10. Front
    What do repeated runs on one server do?
    Back
    They can reuse prefix-cache entries and inflate throughput. Vary the seed, restart, or use a sweep mode that resets caches.
  11. Front
    How do you debug a latency regression?
    Back
    What changed? TTFT up: queue, KV full or preemption, longer prompts, lower prefix hit rate, routing, cold replicas. ITL up: batch or context, prefill interference, throttling, interconnect. Reproduce, bisect, profile, fix, add an alert.
  12. Front
    Symptoms or causes: what do you page on?
    Back
    Page on symptoms (TTFT and ITL percentiles, errors, goodput, saturation). Put causes (KV use, queue, hit rate, preemptions, acceptance rate) on dashboards for diagnosis.
  13. Front
    How should a service degrade?
    Back
    Shed low-priority load, cut max tokens, switch to a smaller model, serve cached answers where valid, return clear 429 or 503 with a retry hint. Health checks must generate a token.

Inference engineering: interview drills

  1. Front
    Give the 90-second answer: why is decode memory-bound?
    Back
    Each step reads all weights for about 2 operations each, so intensity is near the batch size (for BF16), far below the ridge (about 295 on an H100). Batching raises intensity almost for free.
  2. Front
    What limits concurrency per GPU?
    Back
    The KV pool left after weights and overhead, divided by bytes per sequence. 2 × layers × KV heads × head dim × bytes per token, times tokens per sequence.
  3. Front
    Which levers move TTFT, and which move ITL?
    Back
    TTFT (queue plus prefill): prefix caching, chunked prefill, shorter prompts, capacity. ITL (decode step): fewer bytes (quantization), smaller batch or context, speculative decoding, parallelism.
  4. Front
    Batch-1 decode bound, worked.
    Back
    Step ≥ weight bytes ÷ aggregate bandwidth. 14B in 8-bit on 1.5 TB/s: 14 GB ÷ 1.5 TB/s = 9.3 ms, about 107 tokens per second. Ignores cache, communication and overhead.
  5. Front
    KV bytes and concurrency, worked.
    Back
    40 layers, 8 KV heads, 128, FP8: 81,920 bytes per token. A 4,096-token sequence is about 0.34 GB, so a 30 GB pool holds about 89.
  6. Front
    Speculative speedup, worked.
    Back
    α = 0.85, γ = 5, c = 0.08: expected tokens (1 − 0.85⁶)/0.15 = 4.15; speedup 4.15 ÷ 1.4 = about 2.97.
  7. Front
    Cost and replicas, worked.
    Back
    $2.80 per hour, 2,200 tokens/s at 50 percent: $0.71 per million. 18 req/s × 300 tokens = 5,400 tokens/s ÷ (1,500 × 0.65) = 5.5, so 6 plus 1 spare.
  8. Front
    What are the seven parts of a platform design answer?
    Back
    Clarify targets, estimate (Little's law, weights, cache), choose the stack, architecture, evaluation and rollout, failure modes and operations, cost and trade-offs.
  9. Front
    What marks a strong design answer?
    Back
    Numbers with assumptions, interactive and batch separated, cache arithmetic driving concurrency, autoscaling on queue or cache, a cold-start plan, a quality gate for quantization, failure modes raised unprompted.
  10. Front
    What do you do when the interviewer changes a constraint?
    Back
    Re-cost the design aloud: say what changes in the arithmetic, what you would add or give up, and what quality or operational risk you accept.
  11. Front
    Why does a reasoning model change serving cost?
    Back
    Hidden reasoning tokens are generated like output, so decode time, cache per request and cost all grow. Cap, budget or route by difficulty.
  12. Front
    What can explain a production TTFT four times worse than the benchmark?
    Back
    Fixed short prompts, closed-loop clients and a hot prefix cache in the benchmark. Replay real traces with open-loop arrivals and control the cache.
  13. Front
    Why scope KV-cache quantization by context length?
    Back
    Its accuracy risk grows with context. Evaluate by input length and keep 16-bit cache where long inputs matter.

When to tune, and what it costs

  1. Front
    Retrieval or tuning: which fits a changing fact, and which fits a behaviour?
    Back
    Retrieval for what the model should know (current, citable, permissioned). Tuning for how it should behave (format, tone, routine, cost). Weights cannot cite a source or be edited by changing one document.
  2. Front
    Name three sound reasons to fine-tune.
    Back
    A format or routine that a strong prompt still gets wrong at volume; a small model matching a large one on a narrow task; a consistent tone or policy at scale. Also: baking in a long fixed prefix, or running an open model you host.
  3. Front
    What must a tuned model beat before it ships?
    Back
    The best prompt plus retrieval, on a held-out set, using the newest base model you could use. Beating a first-draft prompt proves little.
  4. Front
    Break-even for a tuning project?
    Back
    Payback = one-off cost (data, training, evaluation) ÷ (gross saving per day − hosting per day − maintenance per day). Maintenance is the re-tune cost spread over its interval.
  5. Front
    How can a cheaper alternative cancel a tune's saving?
    Back
    The baseline moves. If prefix caching already makes a repeated prefix cheap, baking it in can save at most what is still being paid, which may be less than the tuned model's hosting.
  6. Front
    What is the model treadmill?
    Back
    A tune is tied to one base model, and bases improve every few months. Budget for re-tuning, and re-run the prompt and retrieval baseline on the newest base before re-investing.
  7. Front
    Bytes per parameter for full fine-tuning with Adam in mixed precision?
    Back
    About 16: 2 (16-bit weights) + 2 (gradients) + 12 (32-bit master copy, momentum and variance at 4 each). This is model states only.
  8. Front
    Why do LoRA and QLoRA need so much less memory?
    Back
    The base is frozen, so it needs no gradients or optimiser state, only storage: 2 bytes per parameter in 16-bit, about 0.5 in 4-bit. Only the small adapter pays the 16 bytes.
  9. Front
    What does a model-state memory estimate leave out?
    Back
    Activations (grow with batch and sequence length), the logits tensor (tokens × vocabulary × bytes), framework overhead and 4-bit quantisation constants. Treat the estimate as a floor.
  10. Front
    Training compute for a dense model?
    Back
    About 6 × N × D FLOPs: roughly 2 forward plus 4 backward per parameter per token. Time = FLOPs ÷ sustained FLOP/s. N is approximately non-embedding parameters.
  11. Front
    How much compute does LoRA save?
    Back
    About a third: frozen layers skip weight gradients but still compute the gradients that reach the adapters, so roughly 4ND instead of 6ND. The big saving is memory.
  12. Front
    Why not divide by a vendor's headline teraFLOPS to get training time?
    Back
    Headline figures can be marked 'with sparsity' and are peaks. Use the rate your job sustains, or an assumed round figure that you state. The share of peak reached is model FLOPs utilisation.

Data engineering for fine-tuning

  1. Front
    What is the main trap of each tuning data source: experts, logs, a stronger model, a checker, public sets?
    Back
    Experts: slow, costly, annotators drift. Logs: personal data, consent, weakly checked approvals. Stronger model: copied errors and provider terms. Checker: a weak checker is gamed. Public sets: licence, overlap with your evals, wrong distribution.
  2. Front
    What did LIMA show, and what does it not show?
    Back
    1,000 curated examples were enough to teach a 65B base model a response style that generalised. It does not show that new skills or facts can be taught with so few. It is one study, and its authors name the effort of writing such data as the limit.
  3. Front
    How do you make synthetic data usable?
    Back
    Seed by hand, vary personas and difficulty, then verify with something other than the generator (run code, validate schema, recompute numbers, second judge). Drop failures, deduplicate, blend with real data, and keep a real-only test set.
  4. Front
    How do you answer 'how many examples do I need?'
    Back
    Train on 10, 25, 50 and 100 percent with the same recipe and score each on the same golden set. A flat end of the curve means more of the same data will not help; fix coverage or labels. A rising curve means collect more.
  5. Front
    What is the order of cleaning steps, and what does each protect against?
    Back
    Filter (junk), deduplicate (memorisation and train-test overlap), decontaminate (eval items in training), remove personal data (regurgitation, privacy), then split. Rendering and masking come after the split.
  6. Front
    Why does the decontamination window need to fit your data?
    Back
    A 13-word overlap filter, as used for GPT-3, cannot match a test item shorter than 13 words. Choose N from the item lengths and test the filter, because the GPT-3 filter had a bug that let some overlaps through.
  7. Front
    Why strip personal data before training?
    Back
    Models can emit training text verbatim; Carlini et al. extracted names, phone numbers and emails from GPT-2, including strings seen in one document. Removing data from trained weights is hard, so clean first and keep lineage to retrain.
  8. Front
    Why is a random row split dangerous?
    Back
    Related rows (turns of one thread, chunks of one document) land on both sides, so the held-out score partly measures recall of seen content. Split by group, as GroupKFold and GroupShuffleSplit do, or by time when the task drifts.
  9. Front
    What is the golden set for, and how is it different from validation?
    Back
    The golden set is hand-verified and used for the final answer only; nobody trains or tunes on it. A separate validation set drives early stopping and settings. Report slices (rare intents, long inputs, languages) as well as the average.
  10. Front
    What does 'the chat template is the contract' mean?
    Back
    Render training data with the exact template used at serving, through the tokenizer's own template function. Omit the generation prompt for training and do not add special tokens twice. A mismatch leaves the loss looking normal and production output poor.
  11. Front
    How do you mask the loss in SFT, and what must stay unmasked?
    Back
    Positions to ignore get label -100. Common chat practice is to learn from assistant tokens only; in TRL this is a setting and the default depends on the data format. The end-of-turn token stays in the target so the model learns to stop.
  12. Front
    What is the decoded-batch audit?
    Back
    Before training, decode a few real batches with their labels shown. Check by eye that the template matches serving, the end token is present, and the mask covers the prompt but not the answer. Template and mask faults do not show in the loss.

PEFT, LoRA and QLoRA in depth

  1. Front
    How many trainable numbers does a rank-r LoRA adapter have for a d-output, k-input matrix, and what is its limit?
    Back
    r × (d + k), against d × k for a full update. The product B·A has rank at most r, so it can move the layer only within an r-dimensional family: good for narrow changes, weaker for big new skills.
  2. Front
    Why is B initialised to zero and A random, not both zero?
    Back
    The gradient of each factor depends on the other. With both at zero neither moves. With B at zero and A random, the update starts at zero (the base model) and B receives a non-zero gradient first.
  3. Front
    What does alpha over r do in a LoRA layer?
    Back
    It multiplies the B·A term, setting how loudly the adapter speaks. Change rank without alpha and the scale changes. PEFT defaults are r=8, alpha=8, so a scale of 1.
  4. Front
    How do you count a whole model's LoRA parameters?
    Back
    For every adapted matrix add r × (inputs + outputs), then sum over matrices and layers. Narrower matrices (such as grouped-query key and value projections) add less.
  5. Front
    How do you turn an adapter count into training memory?
    Back
    Multiply by the 16 bytes per trained parameter of states with Adam in mixed precision. A 15-million-parameter adapter is about 0.24 GB. The frozen base adds only its storage.
  6. Front
    Targets or rank: which do the papers say to change first?
    Back
    Targets. LoRA on all linear layers was needed to match full fine-tuning in the QLoRA study, and rank was close to flat in both papers' tests. Test two ranks on held-out data before raising it.
  7. Front
    What learning rates did the QLoRA paper use?
    Back
    2e-4 for the 7B and 13B models, 1e-4 for 33B and 65B, with a bigger batch for the larger ones. One team's setup, not a default: sweep your own.
  8. Front
    What does NF4 do, and what is the block size in QLoRA?
    Back
    A 4-bit data type fitted to bell-shaped, zero-centred weights, not evenly spaced. Weights are quantised in blocks of 64, each with its own constant, so an outlier harms only its block.
  9. Front
    What does double quantisation save?
    Back
    It quantises the per-block constants to 8 bits in blocks of 256, cutting their overhead from 0.5 to 0.127 bits per parameter. About 0.11 GB instead of 0.44 GB for a 7B base.
  10. Front
    What do paged optimisers do, and what stays in 16-bit in QLoRA?
    Back
    They move optimiser state between GPU and CPU memory (unified memory) to survive memory spikes, at the cost of slower steps. The adapter, its gradients and the matrix multiply stay in 16-bit; only storage is 4-bit.
  11. Front
    When does full fine-tuning beat LoRA?
    Back
    On demanding domains with lots of data, such as code and maths with continued pretraining, where low-rank LoRA substantially underperformed in one study. LoRA forgot less. Ladder: LoRA on all linear layers, then higher rank, then full tune only if the gap justifies the cost.
  12. Front
    Merge an adapter or keep it swappable?
    Back
    Merge (W + (alpha/r)·B·A) for one dominant adapter: no added latency. Swap for many tenants on one base: small files, shared base, and mixed-task batching is awkward after merging. Merge a 4-bit-trained adapter into a 16-bit copy and re-evaluate.

Training practice and distributed training

  1. Front
    Which tokens carry the loss in a typical SFT run, and why?
    Back
    The response (completion or assistant) tokens, so the number measures the behaviour you want to teach. Padding is excluded by an ignore index. Check that the prompt is masked and the end token is present.
  2. Front
    Why not pick the checkpoint by validation loss alone?
    Back
    Cross-entropy measures imitation, not the task. Choose by a held-out task metric (JSON-valid rate, exact match, rubric score), and use validation loss as a sanity check.
  3. Front
    Name two quiet setup errors that give a healthy-looking SFT curve.
    Back
    A length limit that truncates the answer away, and an end token that is missing or does not match the chat template so the model never stops. Loss on prompt tokens is a third.
  4. Front
    Effective batch size with accumulation and several GPUs?
    Back
    Sequences per pass x accumulation steps x data-parallel GPUs. Accumulation saves activation memory and costs wall-clock time; the update is the same as one large batch.
  5. Front
    What does gradient checkpointing save, and what does it cost?
    Back
    It saves activation memory by not storing them all, and costs extra compute because they are recomputed in the backward pass. It does not shrink weights, gradients or optimiser state.
  6. Front
    Which memory levers attack activations, and which attack model states?
    Back
    Activations: smaller per-pass batch (accumulation), checkpointing, shorter sequences, activation offloading. States: LoRA or QLoRA, sharding (ZeRO or FSDP), offloading states to CPU or NVMe.
  7. Front
    The accumulation loss trap for token-level losses?
    Back
    Correct loss = total loss over the accumulation step divided by the total non-padding tokens in it, not the average of per-batch averages. Averaging the averages over-weights short sequences.
  8. Front
    Per-GPU model states with Adam in mixed precision, P parameters, N GPUs?
    Back
    Replicated: 16P. ZeRO-1: 4P + 12P/N. ZeRO-2: 2P + 14P/N. ZeRO-3 or FSDP full shard: 16P/N. Floors, before activations and temporary gathered layers.
  9. Front
    What does full sharding pay for its memory saving?
    Back
    More communication: parameters are all-gathered around the forward and backward passes and gradients reduce-scattered. The ZeRO paper counts 1.5 times the data-parallel volume for stage 3.
  10. Front
    When should you not shard?
    Back
    When weights, gradients, optimiser state and activations already fit on one GPU. Plain data parallelism is simpler and avoids the gathering traffic. Offload only after sharding is not enough.
  11. Front
    Training loss falls, validation loss rises, task metric falls. What is it and what do you do?
    Back
    Overfitting. Restore an earlier checkpoint or train fewer epochs, and consider more varied data. It is different from forgetting, which validation loss on your own data does not show.
  12. Front
    The debugging order for a misbehaving run?
    Back
    Decode what the model sees (inputs and labels), overfit a tiny batch, compare training and serving prompts, run the base model for a true baseline, then change one variable at a time with seed, versions and data hash pinned.
  13. Front
    Loss flat from step 0: first checks?
    Back
    Decode a batch to see whether the labels are all masked, count trainable parameters, and try to overfit eight examples. Only then look at learning rate.

Alignment and preference optimisation

  1. Front
    What are the three steps of the RLHF recipe in InstructGPT?
    Back
    SFT on demonstrations, a reward model trained on human rankings of outputs, then reinforcement learning (PPO) against that reward. Reported in Ouyang et al., 2022.
  2. Front
    What does the KL penalty do in RLHF, and what does it cost?
    Back
    It charges the policy for drifting from the SFT model, keeping it where the reward model's scores can be trusted and its answers varied. The cost is some of the possible gain; beta sets the balance.
  3. Front
    What does a PPO-based RLHF run need that DPO does not?
    Back
    A separately trained reward model, a value model (about the size of the policy), and sampling from the policy during training. Both need the preference data and a frozen reference.
  4. Front
    Write the DPO loss in words.
    Back
    Minus log-sigmoid of beta times [log(new/ref) for the preferred answer minus log(new/ref) for the rejected answer]. It rewards raising the preferred answer's ratio above the rejected one's.
  5. Front
    What does beta do in DPO?
    Back
    It scales the log-ratios and so controls deviation from the reference. A larger beta makes the same movement count for more, the loss saturates sooner, and the model stays closer.
  6. Front
    Why does DPO still need a reference model?
    Back
    Every log-ratio divides the trained model's probability by the reference's. The reference defines what 'moved' means. Its log-probabilities for fixed pairs can be computed once and reused.
  7. Front
    A DPO pair has beta 0.1, preferred log-ratio +1.0 and rejected -2.0. What is the loss?
    Back
    Margin = 0.1 × 3.0 = 0.3. Loss = -ln(sigmoid(0.3)) ≈ 0.554. At the start, with both log-ratios 0, the loss is ln 2 ≈ 0.693.
  8. Front
    Which DPO relative fits which data or constraint?
    Back
    IPO: pairs, bounded target gap. KTO: single answers with a binary label. ORPO: pairs, adds an odds-ratio term to SFT, no reference. SimPO: pairs, length-normalised reward plus margin, no reference.
  9. Front
    Why are reported gains for DPO-family methods not a ranking?
    Back
    Each paper uses its own models, datasets, judges and tuned baselines, and the methods are not run against each other under one setup. The KTO paper itself says no single loss wins everywhere. Test on your evaluation.
  10. Front
    How is a group-relative advantage computed in GRPO?
    Back
    Sample G answers per prompt, score them, then A_i = (r_i − group mean) ÷ group standard deviation. No value model is needed. An all-equal group gives zero advantage and no signal.
  11. Front
    GRPO versus verifiable rewards: what is the difference?
    Back
    GRPO is the optimiser. Verifiable rewards are one source of scores. DeepSeekMath scored groups with a reward model; DeepSeek-R1 used rule-based accuracy and format rewards with GRPO.
  12. Front
    What is reward hacking, and what are two defences?
    Back
    The model scores well on the proxy without doing what you wanted (for example longer or more confident answers). Defences: a KL leash or larger beta, early stopping on a held-out measure, fresh pairs on current outputs, length checks.
  13. Front
    Does having no reward model make DPO immune to over-optimisation?
    Back
    No. It removes one moving part. IPO's analysis describes overfitting to one-sided pairs, and SimPO's ablation shows length being exploited when it is not normalised.
  14. Front
    When is each approach worth its cost?
    Back
    SFT for demonstrations; DPO-style when you have pairs and a gap SFT cannot close; KTO for thumbs-only data; GRPO for checkable tasks with a sampling budget; PPO-RLHF for specialist teams. Judgment, not data.

Evaluation, deployment and special cases

  1. Front
    What is a baseline ladder for a tuned model?
    Back
    Base zero-shot, then the best prompt with examples, then prompt plus retrieval or tools, then a cheaper small model if plausible. The tune must beat the highest rung you could realistically ship, on the newest base.
  2. Front
    Why report an interval and slices, not one score?
    Back
    On a few hundred items a gain of a couple of points can sit inside the noise. A bootstrap shows the spread, and slices show groups that got worse while the average rose.
  3. Front
    Which suites does a gate keep separate, and why?
    Back
    Task (interval, slices), regression against the base, safety (refusals and over-refusal), and format validity. They fail differently, and valid format is not correct content. Pass rules are written before training.
  4. Front
    How do you detect forgetting in practice?
    Back
    Run the same general suite on the base and the tuned model and read the drop relative to the base. The task score may rise while the general suite falls. Mitigate with lower learning rate or epochs, a smaller adapter, and mixed-in general data.
  5. Front
    Why must the safety suite run on the tuned model itself?
    Back
    Qi et al. (2023) report that tuning an aligned model can weaken its safety behaviour, and that benign data can do it too, to a lesser degree. Base results do not carry over. Measure refusals on harmful prompts and answers on harmless ones.
  6. Front
    Overfitting or forgetting: how do the signals differ?
    Back
    Overfitting shows as a held-out score below the training score, sometimes with verbatim repeats. Forgetting shows as a fall on abilities the data never touched. Check the held-out set for one and the regression suite for the other.
  7. Front
    Merged weights or separate adapters?
    Back
    Merge for one dominant model, with no extra per-request step. Keep adapters separate on a shared base for many tenants, A/B tests and rollback by pointing to the earlier adapter. Whichever you choose, version the base, adapter, data and template together.
  8. Front
    Task arithmetic, TIES and DARE in one line each?
    Back
    Task arithmetic: add or negate scaled task vectors (tuned minus base). TIES: trim small changes, elect a sign per parameter, merge only agreeing values. DARE: randomly drop most deltas and rescale the rest to reduce interference (TIES trims by size and resolves signs; DARE drops at random).
  9. Front
    What must you re-check after a merge?
    Back
    Everything. A merge is a new model and can lose abilities, and merging into a quantised base re-quantises the weights, so the result is not the tested artefact. Re-run the whole gate on the merged model.
  10. Front
    What does tuning an embedding model force downstream?
    Back
    Vectors from the old and new models are not comparable, so re-embed the whole corpus into a new index and re-check similarity thresholds. Evaluate recall on held-out queries and passages not used to build the training pairs.
  11. Front
    When is a reranker the smaller tune?
    Back
    When the right passages are retrieved but ranked badly. A cross-encoder reranker needs no corpus re-embedding and leaves the generator alone. Check its latency, since it runs on every query.
  12. Front
    What do you check on a distilled student?
    Back
    The teacher's failure slices and rare cases, not only the average, the cheaper rungs of the baseline ladder, and the terms of use for the teacher's outputs as training data.

Fine-tuning: interview drills

  1. Front
    The 90-second answer to 'Should we fine-tune?'
    Back
    Sort the failure (knowledge to retrieval, behaviour to prompt first, cost to caching or a smaller model). A tune must beat the best prompt-plus-retrieval baseline on the newest base, held out. Test the break-even against caching. LoRA first, gate, canary, rollback, re-run when the base changes.
  2. Front
    What closing line shows judgement?
    Back
    "If the failure is stale facts, I would not tune at all." Name a case where you would not use the method.
  3. Front
    Full fine-tuning states for 8B and 34B?
    Back
    16 bytes per parameter: 128 GB and 544 GB. A floor: activations, logits and overhead come on top.
  4. Front
    LoRA parameters for a stated config?
    Back
    Sum r × (d_in + d_out) over every adapted matrix. Hidden 3,072, 28 layers, MLP 8,192, rank 16, all linear: 26,148,864, about 0.82 percent of the base linear parameters, about 0.42 GB of states.
  5. Front
    QLoRA states for a 34B model, adapter 0.5 percent?
    Back
    0.5 × 34 = 17 GB base, plus 2.72 GB adapter states, plus about 0.54 GB of constants: about 20.3 GB. Not a normal batch on 24 GB; activations and logits decide.
  6. Front
    ZeRO per-GPU states for 34B on 16 GPUs?
    Back
    Data parallel 544 GB; ZeRO-1 161.5; ZeRO-2 97.75; ZeRO-3 34 GB. Stage 3 costs about 1.5 times the communication.
  7. Front
    Training time from 6ND, and LoRA?
    Back
    FLOPs = 6 × N × D; time = FLOPs ÷ sustained rate. 8B, 100M tokens, 300 TFLOP/s: about 4.4 hours; LoRA about two thirds, roughly 3.0 hours. A memory trick more than a compute trick.
  8. Front
    DPO loss for beta 0.25, log-ratios +0.6 and -1.4?
    Back
    Margin = 0.25 × 2.0 = 0.5; loss = -ln sigmoid(0.5) ≈ 0.474. At beta 1.0 the loss is about 0.127: the pair looks solved sooner, so the model stays nearer the reference.
  9. Front
    The nine parts of a tuning-program answer?
    Back
    Clarify; baseline with caching; data; method; training plan; gate; serving and rollout; upkeep; alternatives and fallback.
  10. Front
    Clean loss, broken production JSON?
    Back
    Template mismatch, missing end token, truncation. Decode a batch, then compare the training and serving prompts.
  11. Front
    Task up, general ability down?
    Back
    Forgetting. Run the regression suite on base and tuned; lower strength, smaller adapter, mix general data.
  12. Front
    Score jumped 15 points after a data refresh?
    Back
    Leakage or duplicates between train and evaluation. Check overlap and re-split by group.