Scrivio Interview library
ScenarioIntermediate7 min read · updated 12 November 2026

Compliance forbids sending customer data to external AI APIs, so your team must self-host a model for document summarisation for 500 internal users. What do you need to plan?

We need to plan five things: an open-weight model whose licence allows commercial use and whose quality we have verified on real documents; a serving stack with enough GPU capacity and an inference server that batches requests and pages the KV cache (such as vLLM or TGI), with queueing and autoscaling; throughput math from concurrent users, tokens per request and tokens per second per GPU; operations for model updates, monitoring, patching, access control and logging; and a total cost comparison with a compliant private hosted offering in our own cloud.

Why this question is asked

Compliance rules that forbid sending customer data to external AI APIs are common in banking, insurance, health and the public sector. Self-hosting sounds simple, download a model and run it, but serving 500 people reliably is an infrastructure project with real hardware costs and an operations burden. Interviewers ask this scenario to see whether we can turn a vague goal into a concrete plan with numbers, and whether we consider alternatives that may meet the same rule more cheaply. In this answer, we will choose and evaluate a model, design the serving stack, size the hardware with worked numbers, plan operations, and compare the total cost with a private hosted option.

1Choosing and Evaluating the Model

The first decision is which open-weight model to run, and two things constrain it. The licence must allow our use: some open-weight models are released under permissive licences such as Apache 2.0, while others have custom licences with conditions, for example on company size or acceptable use. Legal reviews the exact licence of the exact version before anything else. The second constraint is quality for our task, which we cannot read from a leaderboard.

So we build a small evaluation set: 100 to 200 real internal documents of the kinds users will summarise, with summaries written or approved by domain experts and a scoring guide (key facts present, nothing invented, right length). We run two or three candidate models of different sizes, for example a small 8B model, a mid-size model around 30B and a large 70B model, and compare quality against hardware needs. Often a mid-size model is good enough for summarisation, which saves a lot of hardware compared with the largest one.

2Designing the Serving Stack

A model on a single GPU served by a naive script can handle one request at a time. For 500 users we need an inference server built for concurrency. Servers such as vLLM and Hugging Face's TGI use continuous batching, which adds new requests to the running batch at every decode step instead of waiting for a batch to finish, and paged KV cache management, which stores each request's attention cache in small blocks so GPU memory is not wasted on reserved space. Together they raise throughput many times over a naive setup. vLLM also exposes an OpenAI-compatible API, so our Java services can use Spring AI's OpenAI client with a different base URL.

Around the inference server we put the usual production parts: a queue or rate limiter in front so a burst of requests waits instead of overloading the GPUs, at least two replicas for availability, autoscaling where GPU capacity allows it, and an internal gateway that authenticates users and logs calls.

Properties
# Java service pointing Spring AI's OpenAI-compatible client at our own vLLM
spring.ai.openai.base-url=https://llm.internal.example.com
spring.ai.openai.api-key=${INTERNAL_LLM_TOKEN}
spring.ai.openai.chat.options.model=summary-model # name served by vLLM
# The model server itself (one replica, illustrative)
$ vllm serve <model-id> --served-model-name summary-model --max-model-len 16384
Step throughSelf-hosted summarisation stack
  1. Internal users and apps500 users through the document tool
  2. Java summarisation serviceSpring AI client, chunking, prompts
  3. Internal gatewaySSO auth, quotas, queueing, audit logs
  4. Inference serversvLLM or TGI, continuous batching, paged KV cache
  5. GPU nodes2 or more replicas, in our data centre or private cloud

5 layers, from the top down. Step through them one at a time.

Customer data never leaves infrastructure we control.

3Doing the Throughput Math

Hardware sizing starts from usage. Suppose that in the busiest hour 300 of the 500 users are active and each requests 6 summaries, which is 1,800 requests per hour, or 0.5 per second. A typical document is 6,000 tokens of input and the summary is 400 tokens of output. That gives 3,000 input tokens per second to prefill and 200 output tokens per second to decode across all users.

Next we need the speed of one GPU for our chosen model, which we must measure with a load test rather than guess. Say a single high-end GPU serving the mid-size model with vLLM sustains 1,500 output tokens per second across many parallel requests, while each individual request sees about 30 tokens per second. A 400-token summary then takes about 13 seconds of decode per user, plus a second or two of prefill, and at 0.5 requests per second about 7 requests are in flight at any moment. One GPU covers the load with room to spare, so we plan two for redundancy and growth. If evaluation forces the 70B model, memory alone needs two or more large GPUs per replica, which roughly quadruples the hardware.

Java
// Back-of-the-envelope sizing (replace the assumptions with load-test numbers)
double reqPerSec = 300 * 6 / 3600.0; // 0.5 requests per second at peak
double outPerSec = reqPerSec * 400; // 200 output tokens/s needed
double secPerReq = 400 / 30.0 + 1.5; // ~14.8 s per request (decode + prefill)
double inFlight = reqPerSec * secPerReq; // ~7.4 concurrent requests (Little's law)
double gpuCapacity = 1_500; // output tokens/s one GPU sustains (measured)
double gpusNeeded = Math.ceil(outPerSec / gpuCapacity); // 1, plan 2 for redundancy

4Planning Operations

Once it runs, someone has to own it. Models improve, so we plan how we evaluate and roll out a new model version: same evaluation set, a canary replica, a rollback path. We monitor time to first token, tokens per second, queue length, error rate and GPU memory and utilisation, with alerts when queues grow. GPU drivers, the inference server and container images get security patches like any other software, which means scheduled maintenance windows across the replicas.

Security and compliance are why we are doing this, so they need care. Users authenticate with company SSO, access is limited to the groups allowed to summarise the relevant documents, and every request is logged with who asked and when. Whether prompt and output content is stored, and for how long, is a decision for the compliance team, since the documents are sensitive.

5Comparing Total Cost With a Private Hosted Option

Self-hosting is not the only way to meet the rule. Major clouds offer hosted models deployed in our own cloud tenancy and region, with contractual guarantees that data is not retained or used for training and does not leave the agreed boundary. If compliance accepts such an offering, it may be cheaper and much simpler than running GPUs. So before buying hardware, we ask compliance precisely what the rule forbids: external third-party APIs in general, or data leaving our control.

The cost comparison must be total. On the self-hosted side: GPU hardware or reserved cloud GPU instances running all the time, often idle at night, plus engineering and on-call time to run them. On the hosted side: per-token prices times our volume. At our example volume of a few thousand requests a day, a private hosted option often costs less; at very high, steady volume, or where only on-premises hardware is allowed, self-hosting wins.

Self-hosted versus private hosted (illustrative)
FactorSelf-hosted open-weightPrivate hosted in our cloud
Data controlFull, our hardwareContractual, in our tenancy and region
Model qualityBest open-weight we can runOften frontier models
Fixed costGPUs 24/7 plus operations teamLow
Variable costNear zero per tokenPer-token pricing
EffortHigh: serving, patching, upgradesLow: configuration and evaluation
Best whenStrict on-premises rule or very high volumeRule allows a compliant cloud service

6Follow-up questions

Why not just run Ollama on a big server?

Ollama is excellent for development, but production serving for hundreds of users benefits from servers designed for high concurrency, with continuous batching, paged attention, multi-GPU support and detailed metrics. We would use Ollama on laptops and vLLM or a similar server in production.

How do you handle documents longer than the context limit?

Split them into sections, summarise each section, then summarise the summaries, a map-reduce pattern. We set the server's maximum context length based on memory and our evaluation, and the Java service does the chunking.

What happens when all GPUs are busy?

Requests wait in the gateway queue with a timeout, and the UI shows that the summary is being prepared. If waits grow regularly, the metrics justify adding capacity; we should not let requests pile up on the inference server itself without limits.

7Conclusion

In this answer, we planned a self-hosted summarisation service for 500 users. We choose an open-weight model with a licence that allows commercial use and evaluate candidates on real documents, serve it with an inference server that batches requests and pages the KV cache, such as vLLM or TGI, behind a gateway with queueing and replicas, and size GPUs with throughput math from users, tokens per request and measured tokens per second. We plan model updates, monitoring, patching, access control and logging, and compare the total cost with a compliant private hosted offering in our own cloud before buying hardware.

What to say in the interviewAbout 90 seconds aloud

Open with

I would plan it in five parts. First the model: an open-weight model whose licence allows our commercial use, confirmed by legal, and chosen by evaluating two or three candidate sizes on a set of real internal documents with expert-approved summaries, since a mid-size model is often enough for summarisation.

Then, if they want more

Second the serving stack: an inference server such as vLLM or TGI, which gives continuous batching and paged KV cache management, at least two replicas, a gateway in front with SSO, quotas and a queue, and since vLLM is OpenAI-compatible our Spring services just change the base URL.

Third the sizing math: for example 300 active users at peak making 6 requests an hour is half a request per second; with 6,000 input and 400 output tokens each, that is about 200 output tokens per second and roughly 7 requests in flight.

I would measure one GPU's sustained tokens per second with a load test, which for a mid-size model may cover this alone, and plan two for redundancy. Fourth operations: evaluated model updates with canaries, monitoring of first-token time, throughput, queues and GPU memory, patching, access control and audit logging.

Fifth, I would compare total cost, GPUs running all day plus people, against a private hosted model in our own cloud tenancy, and confirm with compliance whether that would satisfy the rule.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring AI reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Compliance forbids sending customer data to external AI APIs, so your team must...": https://scrivio-interview-library.netlify.app/spring-boot/llm-fundamentals/4e0bf21114/