Bird
Raised Fist0

ML Platform - Feature Store, Training, Serving Infra, End-to-End

SYSTEM-DESIGNseniorInterview freq: very_high
Choose your preparation mode6 modes available
๐ŸŽฏ
Design an End-to-End ML Platform for a Large-Scale E-commerce Application
45 min ยท senior
senior

You are tasked with designing an ML platform for a large-scale e-commerce application with 20M DAU. The platform must support feature storage, model training, and real-time serving. The P99 latency SLA for serving predictions is 100ms. Your team consists of 5 engineers, and you have 9 months to deliver a production-ready system. Data includes user interactions, purchase history, and product metadata.

  • 20M DAU with a P99 latency SLA of 100ms for serving predictions
  • Team of 5 engineers with a 9-month timeline
  • Data includes user interactions, purchase history, and product metadata
  • Need to support both batch and real-time feature updates
  • Models must be retrained weekly with fresh data
๐Ÿ“‹
Guided Steps
1/4
Step 1
Feature Store Design
How will you design the feature store to handle both batch and real-time updates efficiently?
๐Ÿ’ก Hint
Consider the trade-offs between consistency and latency when choosing a storage solution.
Use a hybrid storage solution (e.g., Redis for real-time, Parquet on S3 for batch) because it balances low-latency access with cost-effective storage.
Mid: Proposes a single storage solution. Senior: Justifies a hybrid approach with specific latency and cost considerations.
โš ๏ธCommon Wrong Answer
Choosing only a batch storage solution like S3, leading to high latency for real-time feature access.
Step 2
Model Training Pipeline
What will your model training pipeline look like, considering the need for weekly retraining?
๐Ÿ’ก Hint
Think about how to automate data ingestion and model retraining while ensuring data freshness.
Implement a pipeline using Apache Airflow for orchestration because it allows for automated, scheduled retraining with dependency management.
Mid: Describes a manual retraining process. Senior: Proposes an automated pipeline with clear data freshness and dependency management.
โš ๏ธCommon Wrong Answer
Relying on manual scripts for retraining, which can lead to stale models and increased operational overhead.
Step 3
Serving Infrastructure
How will you design the serving infrastructure to meet the 100ms P99 latency requirement?
๐Ÿ’ก Hint
Consider the impact of model complexity and feature retrieval on serving latency.
Deploy models using a microservices architecture with model caching to minimize latency because it allows for scalable and efficient prediction serving.
Mid: Suggests a monolithic serving approach. Senior: Proposes a microservices architecture with specific latency optimizations.
โš ๏ธCommon Wrong Answer
Using a monolithic architecture that struggles to meet latency requirements under high load.
Step 4
Monitoring and Maintenance
What monitoring and maintenance strategies will you implement to ensure system reliability?
๐Ÿ’ก Hint
Think about how to detect and respond to data drift and model performance degradation.
Implement monitoring with Prometheus and Grafana for system metrics and custom alerts for data drift because it ensures timely detection and response to issues.
Mid: Mentions basic monitoring. Senior: Proposes comprehensive monitoring with specific metrics and alerting strategies.
โš ๏ธCommon Wrong Answer
Neglecting to implement data drift detection, leading to unnoticed model performance degradation.
๐Ÿ“Š
Scoring Rubric
โ–ผ Show
Must Have - 60%
  • Proposes a hybrid feature store solution to balance latency and cost.
  • Designs an automated model training pipeline with data freshness considerations.
  • Suggests a microservices architecture for serving to meet latency requirements.
  • Includes comprehensive monitoring and alerting strategies for system reliability.
Good to Have - 30%
  • Considers scalability in the feature store design.
  • Automates data validation in the training pipeline.
  • Optimizes serving infrastructure for both CPU and GPU models.
  • Implements A/B testing framework for model performance evaluation.
Bonus - 10%
  • Proposes a feature engineering framework to streamline feature creation.
  • Includes a rollback strategy for model serving in case of failures.
  • Designs a CI/CD pipeline for continuous integration and deployment of models.
โœ…
Model Answer
โ–ผ Reveal

The ideal design involves a hybrid feature store using Redis for real-time access and Parquet on S3 for batch storage. The model training pipeline is automated with Apache Airflow, ensuring weekly retraining with fresh data. Serving is handled by a microservices architecture with model caching to meet the 100ms P99 latency requirement. Comprehensive monitoring with Prometheus and Grafana is implemented to detect data drift and performance issues.

  • Hybrid feature store with Redis and Parquet because it balances low-latency access with cost-effective storage.
  • Automated training pipeline using Apache Airflow for scheduled retraining and data freshness.
  • Microservices architecture for serving with model caching to meet latency requirements.
  • Monitoring with Prometheus and Grafana for system metrics and custom alerts for data drift.
Using a single storage solution that cannot handle both batch and real-time needs.
Manual retraining processes leading to stale models.
Monolithic serving architecture that struggles with scalability and latency.
Lack of data drift detection, causing unnoticed model performance degradation.

Practice

(1/5)
1. In an LLM serving system, what is a likely failure mode if the KV Cache is not properly managed?
medium
A. Inaccurate predictions due to speculative decoding
B. Decreased throughput due to batching inefficiencies
C. Higher memory usage leading to system crashes
D. Increased latency due to redundant computations

Solution

  1. Step 1: Identify the role of KV Cache.

    KV Cache prevents redundant computations, reducing latency.
  2. Step 2: Eliminate wrong options.

    Batching inefficiencies affect throughput, not KV Cache. Memory issues are possible but less direct. Speculative decoding affects accuracy, not KV Cache.
  3. Final Answer:

    Option D -> Option D
  4. Quick Check:

    KV Cache mismanagement leads to redundant computations. [OK]
Hint: KV Cache mismanagement leads to redundant computations. [OK]
Common Mistakes:
2. In a neural collaborative filtering system, what is a likely failure mode if the model is not performing well on new users?
medium
A. Data leakage from training to validation sets.
B. Overfitting due to too many layers in the neural network.
C. Cold start problem due to lack of user interaction data.
D. Underfitting due to insufficient model complexity.

Solution

  1. Step 1: Identify the issue with new users.

    New users often lack interaction data, leading to the cold start problem.
  2. Step 2: Eliminate wrong options.

    Options A and D relate to model complexity, not new user performance. Data leakage from training to validation sets. is about data leakage, not specific to new users.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    New users = cold start issue [OK]
Hint: New users = cold start issue [OK]
Common Mistakes:
3. As an agent system scales to handle 10x more tasks, which component is most likely to become a bottleneck?
hard
A. Memory Architecture
B. Data Input Pipeline
C. Planning Algorithm
D. Tool Use Integration

Solution

  1. Step 1: Consider scaling impact

    Handling more tasks increases data and state storage requirements.
  2. Step 2: Identify potential bottlenecks

    Memory Architecture is likely to struggle with increased storage demands, while other components are less directly affected by task volume.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Scaling = Memory bottleneck risk [OK]
Hint: Scaling often stresses memory first. [OK]
Common Mistakes:
4. As the number of LLMs evaluated increases tenfold, which component of the evaluation system is most likely to fail first?
hard
A. Human evaluator availability
B. Benchmark task diversity
C. Data storage capacity
D. LLM-as-Judge processing power

Solution

  1. Step 1: Analyze scalability of components

    Human evaluators are a bottleneck as scaling requires more human resources.
  2. Step 2: Eliminate wrong options

    Data storage and processing power can be scaled with infrastructure, and task diversity is not a direct scalability issue.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Human evaluators are the bottleneck in scaling. [OK]
Hint: Human evaluators are the bottleneck in scaling. [OK]
Common Mistakes:
5. At 10x data scale, which component of a model registry is most likely to fail first?
hard
A. Lineage tracking database
B. Governance compliance checks
C. Model deployment pipeline
D. Model versioning system

Solution

  1. Step 1: Consider data scale impact

    Lineage tracking databases often struggle with large data volumes due to the need to store extensive metadata.
  2. Step 2: Eliminate wrong options

    Model versioning system is incorrect as versioning systems are typically designed for scalability. Model deployment pipeline is wrong because deployment pipelines are less affected by data volume. Governance compliance checks is incorrect as compliance checks are not data volume intensive.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Lineage databases struggle with scale [OK]
Hint: Lineage databases struggle with scale [OK]
Common Mistakes:
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard