Interview Study Guide

Guide / AI engineering Senior level

23. Senior AI questions, traps and AI-native engineering

Created · Updated · 5 min read

23.1 Senior-level AI questions with model answers#

  1. “Your RAG answers were good in testing but users complain after launch.” Real queries differ from test queries: log and cluster production queries, find failing slices (language, intent, new products), check retrieval hit rate on them, add them to the eval set, fix ingestion gaps. Monitor drift continuously.
  2. “You switched to a newer, better model and quality dropped.” Prompts are tuned to a model; run the full eval suite before switching, compare per slice, adjust prompts, canary the change, keep the old model as fallback.
  3. “How do you know your LLM judge is right?” Calibrate against human labels, measure agreement, check known biases, re-validate on judge changes, spot-check disagreements.
  4. “The agent sometimes loops forever and burns money.” Step/token/time/cost caps, loop detection, better tool error messages, plan-then-execute, a supervisor check, and alerting on cost per task outliers.
  5. “When does a vector DB stop being optional?” When the corpus outgrows memory or brute-force latency, updates are frequent and concurrent, filters and multi-tenancy are needed, or several services need the same index. Below that, an in-process index or pgvector is simpler and correct.
  6. “Users ask questions whose answers span 50 documents.” Plain top-k won’t cover it: query decomposition, map-reduce summarization, GraphRAG global search, or precomputed summaries.
  7. “How do you handle a document that’s updated — old chunks still get retrieved.” Version documents, delete chunks by doc_id on re-index (idempotent upserts), store valid_from/valid_to, filter to latest, and re-index via CDC events.
  8. “Two semantically similar queries got the same cached answer, but one should have been different.” Semantic cache thresholds are risky: restrict to non-personalized intents, include key entities in the cache key, use a high threshold, and validate with evals; prefer exact caches for anything transactional.
  9. “How would you cut LLM cost 70% without quality loss?” Measure cost per stage, route easy traffic to a small model, prompt caching, trim context (better retrieval = fewer chunks), shorter outputs, batch offline work, distill/fine-tune for the highest-volume task — prove each step with evals.
  10. “How do you stop the assistant leaking other customers’ data?” Permission filters inside retrieval queries, tenant-scoped indexes, tools that authorize as the end user, output PII checks, no shared memory across users, red-team tests for cross-tenant access.
  11. “The model must never give medical/financial advice or promise refunds.” Defence in depth: system prompt policy, input classifier for those topics, output checker against policy, tool-level limits (refund cap in code), human escalation. Prompt rules alone are not enforcement.
  12. “Latency is 8 s; product wants 2 s.” Break down the trace; stream; parallelize; smaller model for intermediate steps; fewer sequential LLM calls (merge steps); cache; reduce output tokens; precompute.
  13. “How do you A/B test an LLM feature?” Randomize users, define a primary business metric (resolution, conversion) plus guardrail metrics (cost, latency, safety incidents, escalations), run long enough for significance, watch novelty effects.
  14. “Fine-tune or RAG for our company’s support tone and policies?” RAG for policies (they change, need citations); fine-tune (or few-shot + style guide) for tone/format if prompting isn’t enough; evals decide.
  15. “How do you make LLM output deterministic for tests?” You can’t fully: temperature 0, fixed seeds where supported, structured outputs, assert on properties not exact strings, run multiple samples and use pass rates with thresholds.
  16. “What happens when the LLM provider has an outage?” Gateway failover to another provider/region/model (pre-tested prompts per model), degrade to retrieval-only answers or a static flow, queue non-urgent work, clear user messaging.

23.2 Traps that reveal inexperience#

  • Saying “just fine-tune it” for knowledge that changes weekly.
  • Using an agent where a three-step workflow would do.
  • Trusting the model to enforce permissions (“the prompt says don’t show other users’ data”).
  • Only measuring average latency or average eval score; ignoring slices and p95.
  • Forgetting that embeddings change when the model changes (mixing vector versions).
  • Evaluating only the final answer and not retrieval.
  • Rendering model output as HTML or executing generated code/SQL without sandboxing.
  • Ignoring cost until the bill arrives.
  • Claiming “no hallucinations” — the right claim is “measured groundedness of X% on our eval set, with these mitigations”.

23.3 What “AI-native engineer” means in interviews#

Companies increasingly test how you build with AI, not just how you build AI features.

  • Using coding agents well: Claude Code, Cursor, Copilot, Codex-style agents. Write specs and context files (project conventions, architecture notes), break work into verifiable tasks, let the agent run tests, review every diff critically.
  • Spec- and test-driven development: tests and type checks are the guardrails that make AI-written code safe to merge.
  • Knowing failure modes: confident wrong code, outdated APIs, subtle security bugs, over-engineering; verify with docs, tests and review.
  • Building internal AI tooling: on-call assistants, log/trace summarizers, PR reviewers, data-question bots — small tools that save team hours.
  • AI product sense: streaming UX, showing sources and uncertainty, easy correction and feedback, graceful fallback to humans, setting user expectations.
  • Live exercises you may get: build a small RAG or agent in 60–90 minutes with AI tools allowed; debug a failing prompt/eval; review an AI-generated PR; design an eval for a given feature.

23.4 Study plan for Part 2#

WeekFocusHands-on
1Sections 14–15: LLM fundamentals, prompting, structured outputBuild a structured extraction tool with validation and retries
2Sections 16–17: vector DBs and RAGBuild RAG on pgvector with hybrid search + reranker; measure recall@k
3Sections 18–19: GraphRAG, agents, MCPWrite an MCP server; build a LangGraph agent with human approval and checkpoints
4Sections 20–21: evals, guardrails, LLMOpsEval suite in CI with LLM judge; add a gateway with fallback and semantic cache
5Sections 22–23: question banksTwo mock AI design interviews per week

Resources: AI Engineering (Chip Huyen), Build a Large Language Model (From Scratch) (Sebastian Raschka) for internals, Anthropic’s “Building effective agents” and the provider cookbooks, the Microsoft GraphRAG paper/repo, the OWASP Top 10 for LLM Applications, and RAGAS/LangSmith/Langfuse docs for evals.

Finished this page?Mark it done to track your progress across the guide.
Pritam Ghosh · System design & AI engineering study notes