# What Are the Multi-Tenant Concerns?

> What multi-tenant means for an AI app, and the isolation, fairness, cost and leak risks to handle, explained simply for your AI interview.

**In short:** Multi-tenant means one AI system serves many customers, called tenants. The main concerns are keeping each tenant's data apart, sharing capacity fairly, tracking cost per tenant, and stopping leaks through caches, logs and fine-tuned models.

AI and LLM interview question Q354, LLM system design. Advanced, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-are-the-multi-tenant-concerns

## Say it in 30 seconds

A tenant is one customer sharing my app. With many tenants, I worry about four things. First, one firm's data must never reach another firm's answers, so the search filters by tenant inside the index query, using the login. Second, one tenant's big job must not slow the others, so each tenant gets its own limit. Third, I track cost per tenant. Fourth, caches, logs and fine-tuned models must not carry one tenant's data to another.

## Say it in 2 minutes

Multi-tenant means one system serves many customers, and each customer is a tenant. Imagine a legal search tool used by 120 law firms. Every firm's contracts are private, and the firms compete with each other, so one leak can end a client relationship. Every document and chunk must carry its tenant, and every search must filter on the caller's tenant, with the tenant taken from the login. A prompt instruction can be talked around, so the filter lives in code.

The second concern is noisy neighbours. If one insurer starts a 40,000-file backfill at nine in the morning, everyone else's chats can slow down. So rate limits are set per tenant, and a big job only uses its own share. The third concern is cost. I count the tokens each tenant uses, the small pieces of text a model bills by, set spend caps, and bill from the same numbers.

The less obvious leaks are in shared parts. Timing signals on a shared prompt cache can hint at what it holds, so high-sensitivity tenants get their own cache. Logs and traces are outputs too, so private text is removed from them, as with any output. A fine-tune, which is extra training on one customer's examples, produces an adapter, a small add-on file. That adapter can memorise rare examples from the tenant's data, so I never serve one tenant's adapter to another. OWASP, the open web security project, lists these under sensitive information disclosure.

No setting gives isolation for free. I test it: a user from one tenant tries to fetch another tenant's documents, and the test fails if one chunk from the wrong tenant shows up in an answer, a citation or a log.

## What are multi-tenant concerns, in plain words?

A tenant is one customer of your system. Multi-tenant means many tenants share the same app, servers and database.

The concerns come from sharing. The same code, index, queue and model serve everyone, so one tenant's data, load or cost can reach another tenant.

Think of a shared office building. Each firm has a locked room, the lift serves everyone, and a courier must never leave one firm's parcel in another firm's room. In an AI app, the rooms are the tenants' documents and chats, and the lift is the model's shared capacity.

A document is cut into small pieces called chunks. A search index is a store that finds the right chunks fast. A vector database is one kind of index that stores each chunk as a list of numbers, so similar text can be found.

- **Tenant:** One customer or group of users sharing the app.
- **Data isolation:** Keeping one tenant's data unseen by every other tenant.
- **Noisy neighbour:** One tenant's heavy use that slows everyone else.
- **Workspace:** A separate space for a project, environment or team, with its own limits.
- **Prompt cache:** Saved model work, reused so a repeat request is faster and cheaper.

## How do you stop one tenant's data reaching another's answer?

A major risk is one shared search index. If every firm's chunks sit in the same vector database, a search for liability can return a clause from a rival firm. OWASP, the open web security project, describes this risk for shared stores, and AWS sets the goal:

> "In a multi-tenant environment where different groups or classes of users share the same vector database, embeddings from one group might be inadvertently retrieved in response to queries from another group's LLM, potentially leaking sensitive business information." (OWASP, LLM08:2025)
>
> "determining how their multi-tenant environments will ensure that each tenant is prevented from accessing another tenant's resources." (AWS, SaaS Lens)

The fix is a rule in code. The app takes the firm from the signed-in session and passes it into the search as a filter, so other firms' chunks are never returned. OWASP says to enforce this inside the index query, not after retrieval. A line in the prompt asking the model to use one firm's files is only a request, so it cannot be the control.

OWASP also advises isolating per-tenant indexes for high-sensitivity work, so one faulty filter cannot expose every firm at once.

*Diagram, One shared index, filtered by firm: One shared index holds every firm's chunks. The search applies Firm A's ID from the login, so other firms' chunks are never returned. Only Firm A's text reaches the answer.*
1. The question, with Firm A's ID from the login, goes to the index.
2. The search asks only for Firm A's chunks, so other firms' chunks are never returned.
3. Only Firm A's chunks reach the model.

Here is the rule in a few lines of Python. The first function filters by firm before matching. The second skips the filter, and it reports that Denby's chunk matched too.

```python
# Three firms share one index. Each chunk carries its firm; the firm comes from the login.
CHUNKS = [
    {"firm": "Harlow", "text": "Harlow's liability cap is set per contract."},
    {"firm": "Denby", "text": "Denby's liability cap is 2 million pounds."},
    {"firm": "Harlow", "text": "Harlow's notice period is 90 days."},
]

def search(words, firm):
    # In production this filter goes into the index query. Code decides, not the prompt.
    return [c["text"] for c in CHUNKS
            if c["firm"] == firm and any(w in c["text"].lower() for w in words)]

def search_unfiltered(words):
    return [c["firm"] for c in CHUNKS
            if any(w in c["text"].lower() for w in words)]

print("Harlow user:", search(["liability"], "Harlow"))
print("Denby user:", search(["liability"], "Denby"))
print("No filter, firms found:", search_unfiltered(["liability"]))
```

Output:

```text
Harlow user: ["Harlow's liability cap is set per contract."]
Denby user: ["Denby's liability cap is 2 million pounds."]
No filter, firms found: ['Harlow', 'Denby']
```

## How do you stop one tenant slowing the rest?

Give each tenant its own share of the rate limit, so a big job uses only its part. Anthropic's rate-limit docs describe the same idea for workspaces, and AWS names the problem:

> "To protect workspaces in your organization from potential overuse, you can set custom spend and rate limits for each workspace." (Anthropic, rate limits)
>
> "The idea behind noisy neighbor is that a user of a system could place load on the system's resources that could have an adverse effect on other users of the system." (AWS, SaaS Lens)

In practice I give every tenant its own per-minute budget, send a clear wait message when it runs out, and move big backfills to a night queue, so they never compete with daytime chats.

*Diagram, Big jobs get their own share: Two kinds of tenant share one model quota. The limit gives each insurer its own share, so the backfill slows to that share and the chats stay fast. Fairness is set in code, so no single tenant can take the whole quota.*
1. The backfill sends its requests to the shared limit.
2. The normal chats send theirs to the same limit.
3. Each insurer's share is kept apart, so the backfill slows and the chats stay fast.

## What about cost, caches, logs and fine-tuned models?

Cost is the third concern. Count the tokens each tenant uses (the small pieces of text a model reads and bills by), cap spend per tenant, and bill from the same numbers, so one heavy customer shows on the dashboard before it shows on the invoice.

The quieter leaks live in the shared parts:

- **Cache: Shared speed-up.** Anthropic says its prompt caches are isolated by workspace on the Claude API and on some cloud platforms. Timing and cache-hit signals can still hint at content, so high-sensitivity tenants get their own cache.
- **Logs: Shared record.** Traces and telemetry can hold a tenant's text. Remove private text from them (redact) like any other output, and keep each tenant's logs only as long as its contract allows.
- **Fine-tunes: Shared memory.** A tenant's adapter can memorise rare examples closely. Never serve one tenant's adapter to another.

OWASP lists these under sensitive information disclosure, where a system reveals data through a channel nobody meant to open. Its list of channels covers logs, telemetry and cache behaviour, as well as the final answer.

> **Tip:** Asked about isolation, name every surface: the index, the cache, the logs, the fine-tunes and the tools the agent can call. Naming only the database misses three of them.

### How would you prove a tenant is really isolated?

Seed two test tenants with different documents. Sign in as one, then ask for the other's documents by name, by topic and by copy-paste. Check the answer, the citations, the logs and the cache.

Keep this test in the build pipeline. A new index or cache setting can undo isolation without any change to the app code, so a leaked chunk should fail the build.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A tenant defined, and the shared parts named: index, cache, queue, logs and models.
- [ ] Isolation enforced in code, taken from the login, never from the prompt.
- [ ] Per-tenant rate limits and cost metering, so one customer cannot starve the rest.
- [ ] The quiet leaks: caches, logs and fine-tuned adapters.
- [ ] A test where a second tenant tries to fetch the first tenant's data.
- [ ] Honest that isolation is something you design and test.

**Common traps**

- Trap: "One database per customer solves everything." Better: It helps, but caches, logs, shared models and tools still need checks. Name them.
- Trap: "The system prompt says to use only this customer's data." Better: A prompt is only a request. Filter by tenant in the index query, using the login.
- Trap: "Each tenant has a rate limit, so we are fine." Better: A limit stops one heavy job. It does nothing for a leak through a shared cache, so watch the shared parts too.

## Can you spot the risk?

**Spot the risk:** Your legal search serves 120 firms from one index. Which search call is safe?

A. search(query, firm=request.body['firm_id'])
B. search(query, firm=session.firm_id)
C. search(query, firm=None)  # the prompt says to use only the user's firm
D. search(query)  # top 5 results by similarity

**Answer:** B. The firm comes from the signed-in session, which the user cannot edit. A firm ID in the request body can be changed by anyone, and a prompt line is only a request.

**Quick check:** A Firm B user gets a clause from Firm A in an answer. What fixes the root cause?

A. A longer system prompt
B. Filter every search by the caller's firm inside the index query, before ranking
C. A larger model
D. A higher result limit

**Answer:** B. The filter belongs in the search itself. A longer prompt is only a request, and a bigger model or a higher result limit does nothing to stop the wrong chunk getting in.

## Can you answer these from memory?

**Flash cards**

- **What is a tenant?** One customer or group of users sharing your app, whose data must stay apart.
- **Main data risk?** One shared index returns another tenant's chunk. Filter by tenant inside the index query.
- **What is a noisy neighbour?** One tenant's heavy load slows everyone else. Fix it with per-tenant limits.
- **Quiet leak in a shared cache?** Timing and cache-hit signals can hint at content. Isolate sensitive tenants.
- **Where do fine-tunes leak?** An adapter trained on one tenant can memorise rare examples. Never share it.
- **What do you test?** A second tenant tries to fetch the first tenant's data. One leaked chunk fails the build.

## Likely follow-up questions

- Q352 Design a work copilot that never leaks data the user can't access. https://designervenkat.online/interview/ai/design-a-work-copilot-that-respects-permissions
- Q353 Design an LLM gateway. https://designervenkat.online/interview/ai/design-an-llm-gateway
- Q355 What is your fallback when a provider is down? https://designervenkat.online/interview/ai/what-is-your-fallback-when-a-provider-is-down
- Q356 Design rate limiting. https://designervenkat.online/interview/ai/design-rate-limiting
- Q364 Security architecture for LLM apps? https://designervenkat.online/interview/ai/security-architecture-for-llm-apps
