KatInterview

Build a Multi-Model Inference Workflow Platform for External Clients

System DesignModel answer
HardModel answerSystem Designml-infrastructureorchestrationmodel-serving

Last updated

Design a platform that chains independently deployed ML models into reliable workflows, covering orchestration, schemas, caching, versioning, failure handling, observability, and tenant isolation.

Your organization runs several machine learning models, each deployed as its own service. Examples include a classifier, an embedding generator and a re-ranker. External customers want to combine these models into pipelines (for example, embed, then retrieve, then re-rank, then classify) without wiring the services together themselves.

Design a platform that lets customers define and run such pipelines. State your own assumptions about scale and latency, then cover:

  1. Request routing and orchestration: how a request enters, how the pipeline is executed, and how the synchronous and batch/asynchronous modes differ.
  2. Data flow and schemas: how data moves between models, how contracts are defined and validated, and where validation happens.
  3. Storage and caching: intermediate data, final results, retention, and cache design.
  4. Model and version management: how pipelines refer to models, how new versions are rolled out, and how results stay reproducible.
  5. Failure handling: timeouts, retries, fallbacks, and what happens when a long job crashes midway.
  6. Observability and traceability: tracing, metrics, and the audit trail.
  7. Scaling and deployment: how model services and the orchestration layer scale, including GPU considerations.
  8. Multi-tenancy: authentication, rate limiting, quotas and data isolation.
  9. Service communication: when you would pick RPC (such as gRPC) versus REST between internal services, and the trade-offs in latency, schema evolution, observability and backward compatibility.

Be explicit about the trade-offs behind your choices and what you would deliberately leave out of a first version.

Hints

Hint 1

Split the problem into two execution paths early: a low-latency synchronous path and a durable asynchronous path. Ask what each one can afford to pay for in terms of checkpointing and persistence.

Hint 2

Push as much validation as possible to pipeline registration time (type-checking the graph against model contracts) so the request-time hot path only validates the edge input.

Hint 3

For reproducibility and safe rollouts, think about resolving model aliases to exact versions at run start and recording them, and include the model version in cache keys so upgrades invalidate stale entries automatically.

Hint 4

For failure handling, think in terms of deadlines propagated through the whole chain, retry budgets to prevent retry storms, idempotent steps keyed by run and step, and declared degraded fallbacks.