← Apple Interview InsightsMachine Learning Engineer

Apple·Machine Learning Engineer·Onsite - System Design / Architecture·Senior

Senior
Jun 2026

Summary

System design round at Apple for an ML Engineer role, focused entirely on building a news feed service at scale. The question covered a lot of ground and I felt like I was playing catch-up the whole time.

Questions Asked (5)

Q1

Design a news feed service similar to Facebook, Twitter, or Instagram. Walk through the full system including post creation, follow graph, home timeline, likes and comments, and how you'd scale it from a million to a billion users.

System DesignTechnical Trade-offsData Modeling
Author's notes

This was a beast of a question and I think I spent too long on the basic CRUD stuff before getting to the parts they actually cared about.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying functional and non-functional requirements, then design the core components (post creation, follow graph, timeline generation, interactions) with a focus on data modeling and scalability. Emphasize trade-offs between fan-out-on-write and fan-out-on-read, and how you would evolve the architecture from 1M to 1B users. Since the role is ML Engineer at Apple, highlight where machine learning can enhance ranking, recommendations, and content moderation.

Pro tip: Demonstrate awareness of Apple's privacy-first approach by discussing on-device ML for ranking and federated learning for personalization, and always tie scalability decisions back to concrete metrics like latency, throughput, and storage.

1. Clarify Requirements and Scope

Ask questions to define functional requirements (post creation, follow, timeline, likes, comments) and non-functional requirements (scale, latency, availability, consistency). Establish assumptions about user count, read/write ratio, and data size.

2. High-Level Architecture and Data Model

Sketch the main components: API gateway, post service, graph service, timeline service, interaction service, and storage layers. Define data models for users, posts, follows, likes, and comments, choosing appropriate databases (e.g., SQL for graph, NoSQL for posts).

3. Timeline Generation and Fan-out Strategies

Explain how to generate home timelines using fan-out-on-write (push) or fan-out-on-read (pull), and discuss hybrid approaches. Cover caching, ranking (including ML-based ranking), and handling celebrities with many followers.

4. Scaling from 1M to 1B Users

Describe scaling techniques: sharding, replication, caching, CDNs, and asynchronous processing. Discuss how to handle hotspots, ensure low latency, and maintain availability. Mention capacity planning and monitoring.

5. ML Integration and Trade-offs

Highlight where ML fits: ranking timelines, recommending follows, detecting spam/abuse, and personalizing content. Discuss trade-offs between model complexity, latency, and privacy, and how to deploy models at scale (e.g., on-device vs. server-side).

Key Points to Mention

  • Fan-out-on-write vs. fan-out-on-read and hybrid approaches for timeline generation
  • Data modeling choices: graph databases for social graph, wide-column stores for posts, and caching for hot data
  • Sharding strategies (e.g., by user ID) and replication for scalability and fault tolerance
  • Use of message queues and stream processing for asynchronous tasks like feed updates and notifications
  • ML applications: learning-to-rank for timelines, collaborative filtering for follow recommendations, and NLP for content moderation
  • Privacy and on-device ML considerations, especially in Apple's ecosystem

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What are the trade-offs between fan-out-on-write and fan-out-on-read, and how would you handle celebrity or very high-follower accounts differently?

System DesignTechnical Trade-offs
Author's notes

They pulled this out as a standalone thread mid-conversation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining fan-out-on-write and fan-out-on-read, then compare their trade-offs in terms of latency, storage, and complexity. Discuss how to handle celebrity accounts by using a hybrid approach, such as fan-out-on-write for normal users and fan-out-on-read for celebrities, and mention optimizations like caching and precomputation.

Pro tip: Emphasize that the choice depends on the specific requirements and constraints of the system, and that a hybrid approach often works best. Also, relate it to ML systems if possible, e.g., how feature stores handle similar trade-offs.

1. Define the two approaches

Clearly explain what fan-out-on-write (push) and fan-out-on-read (pull) mean in the context of a social feed or similar system.

2. Compare trade-offs

Discuss latency, storage, write/read amplification, consistency, and complexity for each approach.

3. Identify the celebrity problem

Explain why celebrity accounts with millions of followers break the naive fan-out-on-write approach due to write amplification and latency spikes.

4. Propose a hybrid solution

Describe a hybrid approach: use fan-out-on-write for most users and fan-out-on-read for celebrities, or use a combination with caching and precomputation.

5. Discuss optimizations and ML relevance

Mention additional optimizations like caching, sharding, and asynchronous processing, and relate to ML systems if applicable.

Key Points to Mention

  • Latency and throughput differences between write and read fan-out
  • Storage and compute trade-offs: precomputing feeds vs. on-the-fly aggregation
  • Write amplification and hot partitions for celebrity accounts
  • Hybrid approach: push for normal users, pull for celebrities
  • Caching strategies and precomputation for celebrity feeds
  • Relevance to ML systems: feature stores, online/offline consistency, and real-time inference

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

How would you incorporate ML-based feed ranking into this system? What signals would you use and how would you serve ranked results with low latency?

System DesignTechnical Trade-offsProduct Analytics & Metrics
Author's notes

Probably my strongest part of the whole session.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system context and product goals, then propose a two-stage ranking architecture (candidate generation + ranking) with a feature store and model serving layer. Discuss signals across user, item, and context dimensions, and explain how to achieve low latency via caching, precomputation, and model optimization.

Pro tip: Emphasize privacy-preserving techniques like on-device ranking or federated learning, which align with Apple's values and differentiate your answer. Also, quantify latency budgets and trade-offs (e.g., model complexity vs. inference time) to show engineering maturity.

1. Clarify requirements and constraints

Ask about scale, latency SLAs, privacy requirements, and existing infrastructure. Confirm whether ranking is for a feed (e.g., news, social) and what business metrics matter (CTR, dwell time, diversity).

2. Design the ranking pipeline

Propose a two-stage system: candidate generation (e.g., using embeddings or heuristics) to narrow millions of items to hundreds, then a ranking model (e.g., gradient boosted trees or neural network) to score and order. Mention offline training and online serving.

3. Select and engineer signals

List user signals (historical interactions, demographics, real-time context), item signals (content features, popularity, freshness), and cross features (user-item affinity). Discuss feature engineering, normalization, and handling missing data.

4. Address low-latency serving

Explain techniques: precompute embeddings and features in a feature store, use approximate nearest neighbor search for candidate generation, cache frequent requests, and optimize model inference (quantization, pruning, ONNX). Consider edge vs. server inference.

5. Evaluate and iterate

Define offline metrics (NDCG, recall@k) and online A/B testing. Monitor latency, model drift, and business metrics. Discuss feedback loops and retraining cadence.

Key Points to Mention

  • Two-stage ranking: candidate generation and ranking to balance quality and latency
  • Feature store for consistent online/offline features and low-latency retrieval
  • Real-time signals (e.g., recent clicks, session context) vs. batch features
  • Model serving optimizations: quantization, distillation, hardware acceleration (e.g., Apple Neural Engine)
  • Privacy-preserving ML: on-device ranking, federated learning, differential privacy
  • Latency budget breakdown: candidate generation <10ms, ranking <50ms, total <100ms

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How does your design change as you scale from 1 million to 1 billion users? What breaks first and how do you fix it?

System DesignAdaptability & Ambiguity
Author's notes

Classic scaling arc question.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the ML system's scope and constraints, then walk through scaling stages (1M, 10M, 100M, 1B users) focusing on what breaks first at each stage. Prioritize data pipeline bottlenecks, training/serving infrastructure, and model freshness, and propose fixes like sharding, caching, and distributed training.

Pro tip: Emphasize that at Apple scale, privacy and on-device processing are critical, so discuss federated learning and differential privacy as part of your scaling strategy. Also, quantify the impact of each bottleneck (e.g., 'at 10M users, feature computation latency grows linearly and becomes the bottleneck') to show analytical rigor.

1. Clarify Requirements and Assumptions

Ask about the ML use case (e.g., recommendation, ranking), latency/throughput SLAs, data volume, and privacy constraints. State assumptions to frame the scaling discussion.

2. Identify Bottlenecks at Each Scale

For each order-of-magnitude increase, pinpoint what breaks first: data ingestion, feature engineering, training time, model serving, or monitoring. Use concrete examples like 'at 10M users, daily retraining exceeds 24 hours'.

3. Propose Architectural Changes

Describe fixes such as sharding data pipelines, using distributed training (e.g., Horovod, parameter servers), caching features, and moving to online learning or federated learning for privacy.

4. Address Trade-offs and Priorities

Discuss trade-offs between consistency, latency, cost, and privacy. Prioritize fixes based on user impact and business goals, and mention incremental rollout strategies.

5. Summarize and Iterate

Recap the scaling journey, highlight key lessons (e.g., design for 10x, not 1000x), and suggest monitoring and auto-scaling to handle future growth.

Key Points to Mention

  • Data pipeline scalability: sharding, batch vs. stream processing, and backpressure handling.
  • Distributed training: data/model parallelism, gradient compression, and asynchronous updates.
  • Model serving: low-latency inference, model quantization, and edge deployment for privacy.
  • Feature store: consistency between training and serving, and caching strategies.
  • Federated learning and differential privacy for on-device personalization at scale.
  • Monitoring and retraining: drift detection, automated retraining pipelines, and canary deployments.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

How would you handle real-time feed updates, for example pushing new posts to a user's feed without them refreshing?

System DesignAPI & Integrations
Author's notes

Short exchange.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: scale, latency, consistency, and client platforms. Then propose a hybrid architecture using WebSockets for real-time push and a fallback to long polling, with a fan-out service and a message queue to handle high throughput. Finally, discuss how ML models (e.g., ranking, filtering) integrate into the pipeline without adding latency.

Pro tip: Emphasize Apple's privacy-first approach: ensure user data is encrypted and consider on-device processing for feed ranking to minimize server-side personalization. Also, mention the importance of battery efficiency and network conditions on mobile devices.

1. Clarify Requirements

Ask about scale (DAU, posts per second), latency expectations, consistency needs, and client types (iOS, web). This shows you understand the problem before jumping to solutions.

2. High-Level Architecture

Propose a pub/sub system with WebSockets for real-time push, backed by a message queue (e.g., Kafka) and a fan-out service that writes to user feeds. Mention fallback to long polling for compatibility.

3. ML Integration

Explain how ML models (ranking, filtering) fit in: either pre-computed offline or online with low-latency inference. Discuss trade-offs between freshness and relevance.

4. Scalability & Reliability

Address partitioning, replication, and backpressure. Mention using CDNs for static content and edge computing for lower latency.

5. Privacy & Efficiency

Highlight Apple's focus on privacy: end-to-end encryption, on-device ML, and minimizing data transfer. Also discuss battery and bandwidth optimizations.

Key Points to Mention

  • WebSockets vs. long polling vs. SSE for real-time updates
  • Fan-out on write vs. fan-out on read for feed generation
  • Message queues (Kafka, RabbitMQ) for decoupling and buffering
  • ML model serving: online vs. offline, latency considerations
  • Privacy-preserving techniques: on-device ML, differential privacy
  • Mobile constraints: battery, network variability, background updates

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.