Ai Coding And Product Systems hard
Your answer engine has a 3-second end-to-end latency budget for each answer. Today it spends 0.3 s on search, 0.2 s on fetching, and 2.5 s generating with a large model that receives 30 full pages. Users report factual errors. Where should the budget go?
- A Move to a larger generator and keep all 30 full pages in context, since generation quality is the main driver of factual accuracy.
- B Cut retrieval to the top 3 results and spend the freed budget on a longer reasoning pass with the large generator model.
- C Skip page fetching, generate from search snippets only, and use the saved time for a second self-consistency generation pass.
- D Spend more on retrieval: rerank passages and extract relevant spans, then give a smaller generator a compact, cited context.
Answer: D. Spend more on retrieval: rerank passages and extract relevant spans, then give a smaller generator a compact, cited context.
An answer engine should **spend its budget on retrieval and citation, not generation**. Reranking and span extraction give a smaller model precise evidence, which trades raw generation power for grounding. A larger generator (A) still reasons over 30 noisy pages and hallucinates between them. Snippets (C) save time but often lack the facts needed, so they suit only simple lookup queries.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- Your assistant uses a classifier to route queries to a small or large model, which saves 60% of GPU spend. Analysis shows about 20% of hard queries are misrouted to the small model, which then gives confident wrong answers, and regenerate clicks on those threads have doubled. What should you do?
- Your workspace AI retrieves the top-k chunks from a shared vector index and passes them to the model with ACL metadata and a system prompt saying 'only use documents this user can access.' A user just received an answer quoting a private HR page they cannot open. What is the correct fix?
- Your support bot answers billing questions. One user has asked the same refund question three times, and retrieval confidence for that topic is low. What should the bot do next?
- Your AI review system receives a 4,000-line pull request spanning 60 files. Sending the whole diff in one prompt yields shallow, generic comments, and real bugs in files near the middle of the diff are missed. How should you structure the review?
- In your ChatGPT-style assistant, power users keep single threads running for weeks, reaching about 150K tokens. Cost per turn keeps climbing, latency is rising, and the model increasingly misses facts from early in the thread. What should you do?
- Your workspace AI filters retrieval using ACLs stored in the vector index, which is rebuilt nightly. An admin removes an employee from a confidential project page, but for the rest of the day the employee can still get AI answers drawn from it. What is the right fix?