PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/System Design/Anthropic

Design a Dynamically Batched Inference API

Last updated: Jul 14, 2026

Quick Overview

Design a high-concurrency language-model inference API that dynamically batches compatible requests on a limited GPU pool. Balance interactive latency and throughput through admission control, memory-aware scheduling, continuous batching, cancellation, streaming, fairness, and overload handling.

  • hard
  • Anthropic
  • System Design
  • Machine Learning Engineer

Design a Dynamically Batched Inference API

Company: Anthropic

Role: Machine Learning Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

# Design a Dynamically Batched Inference API Design a high-concurrency HTTP API for language-model inference. Clients submit individual requests, but GPU workers should process compatible requests in dynamic batches for efficiency. The service has a limited GPU pool and must balance throughput with an interactive latency target in the sub-second range. Describe admission control, request routing, batch formation, scheduling, cancellation, streaming output, GPU memory management, fairness, and overload behavior. Explain which requests are compatible in one batch and how you would measure whether batching actually improves the system. ### Constraints & Assumptions - Prompt and generated lengths vary and are not fully known at admission time. - Requests can have different models, versions, decoding parameters, and priority classes. - A disconnected client should not consume unlimited generation work. - GPU memory, not only compute, can limit batch size. - The exact latency target and traffic shape must be measured rather than invented. ### Clarifying Questions to Ask - Is the API streaming, non-streaming, or both? - Which model variants and decoding settings must coexist? - Are requests preemptible, and are there tenant quotas or priorities? - What latency percentile and throughput objective defines success? - Can prompts share a prefix cache, and what isolation rules apply? ### What a Strong Answer Covers - Queueing and batch policies tied to measurable objectives. - Memory-aware scheduling and continuous batching. - Backpressure, fairness, cancellation, and failure isolation. - Version routing, observability, and safe degradation under overload. ### Follow-up Questions 1. How would speculative decoding change scheduling? 2. How would you prevent one long generation from delaying short requests? 3. How would you roll out a new model without fragmenting batches excessively? 4. When is a larger batch slower for users despite higher GPU throughput?

Quick Answer: Design a high-concurrency language-model inference API that dynamically batches compatible requests on a limited GPU pool. Balance interactive latency and throughput through admission control, memory-aware scheduling, continuous batching, cancellation, streaming, fairness, and overload handling.

Related Interview Questions

  • Find a Distributed Mode Efficiently - Anthropic (hard)
  • Design a Concurrent Image Processing Service - Anthropic (hard)
  • Design a Prompt Playground - Anthropic (hard)
  • Deploy a Large Model to GPU Workers - Anthropic (hard)
  • Design a Distributed Rate Limiter - Anthropic (medium)
|Home/System Design/Anthropic

Design a Dynamically Batched Inference API

Anthropic logo
Anthropic
Jul 8, 2026, 12:00 AM
hardMachine Learning EngineerOnsiteSystem Design
2
0

Design a Dynamically Batched Inference API

Design a high-concurrency HTTP API for language-model inference. Clients submit individual requests, but GPU workers should process compatible requests in dynamic batches for efficiency. The service has a limited GPU pool and must balance throughput with an interactive latency target in the sub-second range.

Describe admission control, request routing, batch formation, scheduling, cancellation, streaming output, GPU memory management, fairness, and overload behavior. Explain which requests are compatible in one batch and how you would measure whether batching actually improves the system.

Constraints & Assumptions

  • Prompt and generated lengths vary and are not fully known at admission time.
  • Requests can have different models, versions, decoding parameters, and priority classes.
  • A disconnected client should not consume unlimited generation work.
  • GPU memory, not only compute, can limit batch size.
  • The exact latency target and traffic shape must be measured rather than invented.

Clarifying Questions to Ask

  • Is the API streaming, non-streaming, or both?
  • Which model variants and decoding settings must coexist?
  • Are requests preemptible, and are there tenant quotas or priorities?
  • What latency percentile and throughput objective defines success?
  • Can prompts share a prefix cache, and what isolation rules apply?

What a Strong Answer Covers

  • Queueing and batch policies tied to measurable objectives.
  • Memory-aware scheduling and continuous batching.
  • Backpressure, fairness, cancellation, and failure isolation.
  • Version routing, observability, and safe degradation under overload.

Follow-up Questions

  1. How would speculative decoding change scheduling?
  2. How would you prevent one long generation from delaying short requests?
  3. How would you roll out a new model without fragmenting batches excessively?
  4. When is a larger batch slower for users despite higher GPU throughput?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Anthropic•More Machine Learning Engineer•Anthropic Machine Learning Engineer•Anthropic System Design•Machine Learning Engineer System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.