The interview problem

Practice prompt

Design document-review inference with caching, batching and fair admission. Then consider eight GPUs: a large-model batch occupies all eight, while a small-model batch occupies one. Each batch runs for the same duration. How do you share capacity without starving either workload?

Reported-topic adaptation from a promotional Anthropic interview post published August 26, 2026. Interview date and first-person authorship are unverified. The original architecture, calculations and added constraints below are practice material, not a confirmed expected answer. Reviewed September 26, 2026.

1. Separate the toy scheduler from the real service

Clarify whether batch duration includes model loading, how many documents fit in a batch, whether models can remain resident together, and whether work is interruptible. For the initial arithmetic, assume compatible GPUs, both models immediately available, nonpreemptive one-second batches, no switching overhead and enough queued small batches to fill eight devices. These are simplifying assumptions, not properties of production models.

For document review, ask about maximum document size, tenant isolation, deadlines and human review. Treat model output as a proposed review result with citations, not an autonomous legal decision. Spend 5 interview minutes on scope, 10 on service flow, 10 on feasibility calculations, 10 on fairness and 10 on failures.

2. Admit bounded work before allocating GPUs

A proposed POST /reviews accepts a document reference, review policy version, desired model and idempotency key. Authenticate document access before any cache lookup. Validate type and size, extract text in bounded workers, estimate token work and persist a job. Return an ID for asynchronous review rather than holding an HTTP connection indefinitely. Keep extraction, inference and final result states separate so retries do not redo every stage.

Logical flow: authorized upload → extraction → versioned result cache → per-model queues → batch scheduler → GPU workers → result store. Partition queue accounting by tenant and model. Use token or estimated GPU-time budgets in addition to request counts; one thousand-page document is not equivalent to one short memo. Reject, defer or ask for smaller scope when the predicted queue wait already exceeds the deadline.

Batch compatible model versions and reasonably similar input lengths, with limits on tokens, memory and maximum queue delay. A batching window trades latency for efficiency; never wait indefinitely for a full batch. Standard dynamic batching can help within a model, but does not by itself solve allocation between a model requiring eight devices and another requiring one.

3. Derive a feasible allocation

Let f be the fraction of one-second slots assigned to the large model. Its ideal service rate is f batches/second. Small-model service is at most 8(1 − f) batches/second. For arrival rates λL and λS measured in batches/second, stability requires λL < f and λS < 8(1 − f), leaving strict headroom for variability. Therefore λL + λS/8 < 1 is a necessary capacity condition under these assumptions.

If both queues receive 0.8 batches/second, feasible f lies strictly between 0.8 and 0.9. At f = 0.85, ideal capacities are 0.85 large and 1.2 small batches/second. A repeating twenty-slot illustration uses seventeen large slots and three small slots. Spreading the small slots reduces their maximum wait compared with placing all three together. This arithmetic establishes capacity feasibility, not a tail-latency guarantee; measure the actual queue distribution under bursty arrivals.

For equal saturated batch throughput, solve f = 8(1 − f), giving f = 8/9. Equal GPU-time shares instead give f = 1/2, yielding 0.5 large versus 4 small batches/second. Neither is universally fair. Equal document throughput depends on documents per batch, and tenant fairness depends on contracts. State which quantity the policy protects.

4. Prevent fragmented availability from starving large work

Independent small-job dispatch can keep at least one GPU busy forever. When a large batch earns service, reserve an upcoming start boundary and stop launching small batches that would cross it. Let already-running work drain, then acquire the full group atomically. In the toy fixed-duration model, synchronized slots make this simple. With variable durations, use measured bounds or accept uncertain reservation time; do not claim a hard start deadline from average runtime.

Combine tenant quotas, age-based urgency and weighted GPU-time accounting. Permit small work to backfill unused capacity only when it cannot delay the reservation. A scheduler should remain work-conserving when one queue is empty, but borrowing capacity must not erase the other queue's accumulated entitlement. If a large batch needs eight GPUs and one fails, admit no such batch until capacity returns or an explicitly supported smaller topology is selected.

Real model swaps may require eviction, transfer, warmup and memory reallocation. If a scheduling cycle has C seconds of useful service and H seconds of switching, only C/(C + H) of wall time remains useful. Longer epochs amortize H but increase queue delay. Dedicated pools or extra replicas may be preferable when both models have tight latency objectives.

5. Measure useful cache hits without leaking documents

Key a reusable result by tenant security boundary, content digest, extraction version, model version, review policy and relevant inference settings. Recheck authorization before returning a cached result. A digest is not permission. Do not share private results between tenants simply because bytes match. Permission changes and deletion must propagate to cached copies under the retention policy.

Request hit rate is hits divided by eligible lookups. Also measure estimated GPU work avoided: a 90% hit rate on tiny documents can save less compute than a 20% hit rate on very long ones. Track extraction-cache, exact-result-cache and model-prefix-cache hits separately. Prefix reuse saves only part of inference and does not imply a complete cached answer. Coalesce concurrent identical authorized requests to avoid a miss storm.

6. Recover and evaluate the complete result

Use attempt IDs and conditional result commits so a timed-out worker cannot overwrite a newer successful attempt. Retrying inference may produce different text; idempotency promises one authoritative stored result, not deterministic model generation. Cancellation releases queued reservations and signals active workers, but resource reclamation is confirmed only after execution stops.

Monitor queue age by tenant/model, deadline misses, useful GPU work, batch fullness, switch overhead and retries. Validate review quality using a versioned set of documents with human-reviewed expectations, including unreadable scans, contradictory passages and unsupported claims. A faster scheduler that drops difficult documents can appear efficient while degrading the product.

7. Defend the trade-off

Foundation: explain why equal arrival rates do not imply equal GPU demand. Senior: prevent large-job starvation while preserving small-job latency. Staff: decide when model-switch overhead and tenant deadlines justify separate pools. Score 0–2 each for explicit assumptions, feasible arithmetic, fairness policy, cache boundaries and failure recovery. Full marks require mechanisms and their limitations.

Compare this online service with training-job scheduling and streaming inference. Its distinctive issue is competing GPU group sizes with deadline-sensitive batches.

Sources and next steps

The solution and self-review criteria are original educational material.

Continue your preparation

Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.