Design a Multi-Model Inference Cost Optimization System

Last updated: May 21, 2025

Quick Overview

Design a system that minimizes inference costs across multiple LLM providers while maintaining quality SLAs. Cover model selection, caching, request batching, and cost monitoring.

Cursor
System Design
Software Engineer
Cursor
May 21, 2025
Software Engineer
Onsite - System Design
System Design
Medium

10

8

3,972 solved


Design a system that minimizes inference costs across multiple LLM providers while maintaining quality SLAs. Cover model selection, caching, request batching, and cost monitoring.

At $2B ARR, Cursor's inference costs are a significant line item. This question tests your ability to optimize costs in a system that makes millions of LLM calls per day across multiple providers. The interviewer expects practical cost reduction strategies that do not sacrifice user experience.

What the Interviewer Expects
  • Design a cost-aware routing system across multiple providers
  • Implement semantic caching for repeated or similar requests
  • Use request batching to reduce per-request overhead
  • Build cost monitoring and alerting dashboards
  • Balance cost reduction against quality and latency SLAs
Key Topics to Cover
Cost optimization in ML systems
Semantic caching
Request batching and multiplexing
Multi-provider strategy
SLA management
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you handle a sudden price increase from a model provider?
  • How would you decide when to invest in training your own model vs using a third-party API?
  • What is your cache invalidation strategy when the underlying model is updated?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional Requirements:

  1. Multi-Provider Inference: Ability to route inference requests to various LLM providers (e.g., OpenAI, Google, AWS) based on cost and quality metrics.
  2. **Request B...
Capacity Estimation

Assuming Cursor handles 10 million inference requests per day:

  • Average inference cost per request across providers: $0.01 (varies by provider and model).
  • Daily cost without optimization: 10,000,00...

Submit Your Answer
Markdown supported

Related Questions