Ai Coding And Product Systems medium
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?
- A Strengthen the system prompt with explicit refusal examples so the model reliably skips chunks the user is not authorized to view.
- B Filter candidates by the user's ACLs inside the retrieval query so that unauthorized chunks never reach the prompt.
- C Run a second LLM pass over the final answer to detect and redact any sentences that appear to come from restricted pages.
- D Build a separate vector index per user containing copies of every document they can access, rebuilt whenever they open the app.
Answer: B. Filter candidates by the user's ACLs inside the retrieval query so that unauthorized chunks never reach the prompt.
**The retrieval layer enforces permissions, not the model.** Anything placed in the prompt can leak through paraphrase or prompt injection, so prompt instructions (A) and post-hoc redaction (C) are never sufficient. The tradeoff is that filtered vector search costs more and can lower recall when filters are very restrictive. Per-user indexes (D) avoid filtering but multiply storage and reindexing. They only make sense when users share almost no content.
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 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?
- Free users consume 70% of your assistant's GPU hours but bring in about 5% of revenue through conversions. Leadership wants to keep the free tier useful enough to drive upgrades. Which policy fits?