All Questions
Guardrails And Safety medium

Your multi-tenant SaaS gives each tenant its own Postgres database. To cut inference cost, you add a semantic cache keyed on the embedding of the user's question. Soon a user at tenant B receives an answer quoting tenant A's contract terms. What is the root cause and fix?

  1. A Embeddings can be inverted to reveal source text; switch to a self-hosted embedding model so vectors never leave your network.
  2. B The cache key ignores tenant identity; namespace entries by tenant and permission scope so lookups can never cross tenants.
  3. C The similarity threshold is too loose; raise it from 0.85 to 0.97 so only near-identical queries ever return a cached answer.
  4. D The cache TTL is too long; shorten it to a few minutes so any cross-tenant entries expire before another tenant can hit them.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions