← Expedia Interview Insights

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

SeniorPrefer not to say
Jun 2026Remote

Summary

System design round at Expedia for an MLE role, focused entirely on building a text-to-image generation service from scratch. It was a long 45-ish minutes and the scope kept expanding every time I thought I'd covered enough ground.

Questions Asked (7)

Q1

Design a text-to-image generation service similar to DALL-E or Midjourney. Walk through the full system from user prompt submission to returned images.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

I started with the API layer and worked outward, which in retrospect was fine but I spent too long on the happy path.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then walk through the system architecture from prompt ingestion to image delivery, emphasizing scalability, latency, and cost trade-offs. Focus on the ML pipeline (text encoding, diffusion model, safety checks) and how it integrates with backend services, while highlighting Expedia-specific use cases like travel imagery.

Pro tip: Demonstrate awareness of operational challenges like GPU cost management and cold start latency, and propose concrete optimizations such as model caching, request batching, and asynchronous processing with webhooks.

1. Clarify Requirements and Scope

Ask about expected traffic, latency SLAs, image resolution, safety requirements, and budget constraints to tailor the design. Confirm whether the service is for internal use (e.g., generating travel destination images) or external customers.

2. High-Level Architecture

Outline the main components: API gateway, prompt validation, task queue, ML inference workers, image post-processing, storage, and delivery. Explain how requests flow asynchronously from submission to image retrieval.

3. ML Pipeline Details

Describe the text-to-image model (e.g., diffusion), including text encoding, iterative denoising, and optional fine-tuning for travel domain. Discuss model serving optimizations like quantization, batching, and GPU sharing.

4. Scalability and Reliability

Explain how to scale inference workers horizontally, manage GPU resources, handle failures with retries and dead-letter queues, and ensure high availability across regions. Mention autoscaling based on queue depth.

5. Trade-offs and Optimizations

Discuss trade-offs between latency, cost, and quality (e.g., model size, steps, resolution). Propose caching frequent prompts, using CDNs for image delivery, and implementing rate limiting and quotas.

Key Points to Mention

  • Asynchronous processing with a task queue (e.g., RabbitMQ, SQS) to decouple request submission from GPU-intensive inference.
  • Safety and moderation layers: prompt filtering, NSFW detection, and watermarking to comply with content policies.
  • Model serving optimizations: dynamic batching, mixed precision, and model quantization to reduce latency and cost.
  • Storage and delivery: object storage (S3) for generated images, signed URLs for secure access, and CDN for global distribution.
  • Monitoring and observability: track queue depth, inference latency, GPU utilization, and error rates; set up alerts.
  • Expedia-specific considerations: generating travel destination images, personalization based on user preferences, and integration with existing travel content pipelines.

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

Q2

How would you design the async API for image generation, including how clients know when their job is done?

API & IntegrationsSystem DesignTechnical Trade-offs
Author's notes

Talked through polling vs server-sent events vs webhooks.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., expected latency, scale, and client types) and then propose an asynchronous job-based API using REST endpoints for submission and status polling, with optional webhooks for push notifications. Discuss trade-offs between polling and webhooks, and cover error handling, idempotency, and scalability considerations.

Pro tip: Mention that you would include a 'Retry-After' header in polling responses to guide clients on when to check next, reducing unnecessary load and showing attention to API usability.

1. Clarify Requirements

Ask about expected job volume, latency requirements, client capabilities (e.g., can they receive webhooks?), and whether results need to be stored or can be ephemeral.

2. Design Submission Endpoint

Propose a POST endpoint (e.g., /generate) that accepts image generation parameters, returns a 202 Accepted with a job ID, and includes a Location header pointing to the status URL.

3. Design Status and Result Retrieval

Define a GET endpoint (e.g., /jobs/{jobId}) that returns job status (pending, processing, completed, failed) and, upon completion, either the image URL or the image itself. Include polling guidance via Retry-After.

4. Implement Notification Mechanisms

Offer webhooks as an optional push mechanism: clients provide a callback URL, and the service POSTs the result when done. Discuss fallback to polling and handling webhook failures with retries.

5. Address Operational Concerns

Cover idempotency keys for submission, rate limiting, authentication, job expiration, and monitoring. Discuss trade-offs between polling frequency and system load.

Key Points to Mention

  • Use of HTTP status codes: 202 Accepted for submission, 200 OK for status, 404 for unknown job.
  • Job ID generation and idempotency to prevent duplicate submissions.
  • Polling vs. webhooks: trade-offs in latency, complexity, and scalability.
  • Retry-After header to guide polling intervals and reduce server load.
  • Error handling: job failures, timeouts, and retry strategies.
  • Scalability: using a message queue (e.g., RabbitMQ, SQS) to decouple job submission from processing.

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

Q3

How would you manage and scale a GPU inference fleet to handle diffusion model workloads efficiently?

System DesignTechnical Trade-offs
Author's notes

This was the part I felt most confident in.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the workload characteristics (e.g., model size, batch size, latency requirements) and then propose a scalable architecture using Kubernetes with GPU nodes, autoscaling, and model optimization techniques. Emphasize trade-offs between cost, latency, and throughput, and how you would monitor and iterate.

Pro tip: Mention specific tools like NVIDIA Triton Inference Server for model serving and KEDA for autoscaling based on custom metrics like GPU utilization. Also, highlight the importance of caching and request batching to improve efficiency.

1. Understand Requirements

Ask clarifying questions about the diffusion models (e.g., Stable Diffusion variants), expected request volume, latency SLAs, and budget constraints. This ensures your design meets actual needs.

2. Design Scalable Architecture

Propose a Kubernetes-based infrastructure with GPU node pools, using a model server like Triton that supports dynamic batching and concurrent model execution. Include a load balancer and autoscaling policies.

3. Optimize for Efficiency

Discuss model optimization techniques such as quantization, pruning, and using TensorRT for faster inference. Also, consider caching frequent requests and pre-warming models to reduce cold starts.

4. Implement Monitoring and Autoscaling

Set up monitoring for GPU utilization, latency, and throughput using Prometheus and Grafana. Use KEDA or custom metrics to autoscale based on queue length or GPU usage, ensuring cost-effective scaling.

5. Address Trade-offs and Iterate

Acknowledge trade-offs between cost, latency, and accuracy (e.g., using smaller models or lower precision). Propose a feedback loop to continuously optimize based on real-world performance.

Key Points to Mention

  • Use of Kubernetes with GPU-enabled nodes and cluster autoscaler for dynamic scaling.
  • Leveraging NVIDIA Triton Inference Server for multi-framework support and dynamic batching.
  • Implementing request batching and caching to improve throughput and reduce latency.
  • Model optimization techniques like quantization, pruning, and TensorRT.
  • Autoscaling based on custom metrics (e.g., GPU utilization, queue length) using KEDA.
  • Monitoring and observability with Prometheus, Grafana, and logging for performance tuning.

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

Q4

How would you handle model versioning and run A/B tests across different versions of a diffusion model?

A/B Testing & ExperimentationSystem Design
Author's notes

Mentioned a model registry with immutable versioned artifacts and routing a percentage of traffic to a challenger model.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by outlining a robust model versioning system using tools like MLflow or DVC, then describe how to design A/B tests that isolate the impact of different diffusion model versions on key business metrics. Emphasize the importance of tracking both model artifacts and experiment metadata to enable reproducibility and statistical validity.

Pro tip: Highlight the need to monitor for model drift and ensure that your A/B test accounts for the high variance in diffusion model outputs by using sufficient sample sizes and guardrail metrics. Also, mention that you would version not just the model but also the data and hyperparameters to ensure full reproducibility.

1. Establish a Model Versioning System

Use tools like MLflow, DVC, or a custom registry to version model artifacts, hyperparameters, and training data. Ensure each version is uniquely identifiable and includes metadata for reproducibility.

2. Define Experiment Goals and Metrics

Clearly define the business and technical metrics (e.g., user engagement, image quality scores, inference latency) that will determine the success of each model version. Choose primary and guardrail metrics.

3. Design the A/B Test

Randomly assign users to control and treatment groups, ensuring each group experiences a different model version. Determine sample size and duration based on expected effect size and variance.

4. Deploy and Monitor

Deploy the model versions in a production-like environment, logging all relevant metrics and ensuring no cross-contamination between groups. Monitor for technical issues and statistical significance.

5. Analyze Results and Iterate

After the test, analyze the results using statistical methods to determine if the new version outperforms the baseline. Document findings and decide whether to roll out, iterate, or roll back.

Key Points to Mention

  • Use of model registries (e.g., MLflow, DVC) for versioning artifacts and metadata
  • Importance of reproducibility: versioning data, code, and hyperparameters alongside the model
  • A/B testing framework: randomization, control/treatment groups, and avoiding contamination
  • Metric selection: business metrics (e.g., conversion) and technical metrics (e.g., FID, inference time)
  • Statistical power analysis: determining sample size and test duration
  • Monitoring and guardrail metrics to detect negative impacts or drift

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

Q5

What does a safety pipeline look like for a system like this, covering both prompt filtering and output moderation?

System DesignTechnical Trade-offs
Author's notes

Two-stage felt obvious: classify the prompt before inference to avoid wasting GPU cycles, then run an NSFW classifier on the output before delivery.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the safety pipeline as a layered defense-in-depth system with distinct stages: input filtering, model-level safeguards, and output moderation. Then walk through each stage, explaining the techniques, trade-offs (e.g., latency vs. accuracy, false positives vs. false negatives), and how you would evaluate and monitor the pipeline. Finally, tie it back to Expedia's domain by highlighting travel-specific risks like scams, unsafe recommendations, and PII leakage.

Pro tip: Emphasize that safety is not a one-time filter but a continuous, measurable process—mention how you'd use A/B testing and red teaming to iteratively improve filters without over-blocking legitimate queries. Also, note the importance of logging and human-in-the-loop review for edge cases.

1. Define safety objectives and threat model

Clarify what 'safety' means for Expedia's system: preventing harmful content, bias, PII leakage, scams, and unsafe travel advice. Identify likely attack vectors such as prompt injection, jailbreaking, and adversarial inputs.

2. Design prompt filtering (input moderation)

Describe techniques like keyword blocklists, regex patterns, ML classifiers (e.g., toxicity, intent detection), and embedding-based similarity to known harmful prompts. Discuss trade-offs between latency, cost, and coverage.

3. Implement model-level safeguards

Explain how to harden the model itself: system prompts, instruction tuning, RLHF, and constrained decoding. Mention techniques like self-critique or chain-of-thought verification to reduce harmful outputs.

4. Design output moderation

Outline post-processing steps: toxicity classifiers, PII detection, factuality checks, and rule-based filters. Consider using a secondary model to review outputs and flag or rewrite unsafe content.

5. Monitor, evaluate, and iterate

Set up metrics (precision/recall, false positive rate, latency), logging, and dashboards. Use red teaming, user feedback, and A/B tests to continuously improve the pipeline and adapt to new threats.

Key Points to Mention

  • Layered defense: combine rule-based, ML-based, and model-level safeguards to avoid single points of failure.
  • Trade-offs: latency vs. accuracy, false positives (blocking legitimate queries) vs. false negatives (allowing harm), and cost of additional models.
  • Domain-specific risks for Expedia: travel scams, unsafe destinations, PII in bookings, and biased recommendations.
  • Evaluation metrics: precision, recall, F1, and business metrics like user engagement and trust.
  • Human-in-the-loop: escalation paths for ambiguous cases and continuous feedback for model improvement.
  • Adversarial robustness: techniques like prompt injection detection, input sanitization, and red teaming.

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

Q6

How would you optimize costs in this system, especially given the expense of GPU inference at scale?

Technical Trade-offsSystem DesignProduct Strategy
Author's notes

Prompt caching was my first move since popular prompts are surprisingly clustered.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system's goals and constraints, then propose a layered cost optimization strategy that balances performance, latency, and cost. Emphasize that optimization is an ongoing process requiring measurement, experimentation, and iteration.

Pro tip: Quantify the impact of each optimization in terms of cost savings and performance trade-offs, and always tie it back to business metrics like conversion rate or customer satisfaction.

1. Understand the System and Cost Drivers

Identify the key components, usage patterns, and where GPU inference costs originate (e.g., model size, request volume, latency requirements).

2. Measure and Establish Baselines

Instrument the system to track cost per inference, GPU utilization, and latency; establish baseline metrics to quantify improvements.

3. Apply Optimization Techniques

Implement model-level (quantization, pruning, distillation), inference-level (batching, caching, dynamic batching), and infrastructure-level (autoscaling, spot instances, multi-tenancy) optimizations.

4. Evaluate Trade-offs and Iterate

Assess the impact of each optimization on accuracy, latency, and cost; prioritize based on business value and iterate.

5. Monitor and Continuously Improve

Set up ongoing monitoring and alerting for cost and performance; regularly revisit optimizations as workloads and technologies evolve.

Key Points to Mention

  • Model optimization techniques: quantization, pruning, knowledge distillation, and using smaller models where possible.
  • Inference optimization: dynamic batching, caching frequent requests, and using optimized runtimes like TensorRT or ONNX Runtime.
  • Infrastructure strategies: autoscaling, spot instances, GPU sharing, and multi-tenancy to improve utilization.
  • Caching and precomputation: caching embeddings or predictions, and precomputing results for common queries.
  • Cost-aware architecture: using serverless GPUs, right-sizing instances, and implementing fallback to CPU for non-critical tasks.
  • Monitoring and experimentation: A/B testing optimizations, tracking cost per prediction, and setting up cost anomaly detection.

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

Q7

How would you handle abuse prevention and rate limiting for a public-facing image generation API?

System DesignAPI & Integrations
Author's notes

Standard token bucket per user, stricter limits on free tier, flag accounts generating high volumes of borderline content.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints of the image generation API, such as expected traffic, cost per generation, and abuse vectors. Then propose a layered defense strategy combining rate limiting, authentication, monitoring, and cost-aware throttling. Emphasize how you would balance user experience with protection, and how you would iterate based on data.

Pro tip: Tie rate limits to the cost of GPU inference—e.g., use token buckets with different tiers for free vs. paid users—and mention that you'd log and analyze abuse patterns to adapt limits dynamically. This shows you understand both the technical and business sides.

1. Clarify requirements and abuse vectors

Ask about expected traffic, user types, cost per image, and potential abuse scenarios (e.g., spam, resource exhaustion, malicious content). This ensures your solution is tailored.

2. Design authentication and authorization

Propose API keys or OAuth with scopes, and tiered access (free, premium) to enforce different rate limits and quotas based on user identity.

3. Implement rate limiting and quotas

Use algorithms like token bucket or sliding window, applied per user/IP/API key, with dynamic limits based on cost and load. Consider distributed rate limiting with Redis.

4. Add abuse detection and mitigation

Monitor for anomalies (e.g., sudden spikes, repeated similar prompts) and employ techniques like CAPTCHA, IP blacklisting, or temporary bans. Integrate content moderation for generated images.

5. Monitor, log, and iterate

Set up logging and dashboards to track usage, abuse attempts, and system health. Use this data to refine limits and detection rules continuously.

Key Points to Mention

  • Rate limiting algorithms (token bucket, leaky bucket, sliding window) and their trade-offs
  • Tiered access and quotas based on user authentication and payment status
  • Cost-aware throttling: linking limits to GPU inference cost and capacity
  • Distributed rate limiting using Redis or similar for scalability
  • Abuse detection: anomaly detection, pattern recognition, and automated mitigation
  • Content moderation and safety filters for generated images to prevent misuse

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