← Google Interview Insights

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

SeniorPrefer not to say
Jun 2026

Summary

Google ML design round for an MLE role. One question, pretty focused: build a system that identifies leaf categories from a photo using retrieval and ranking. Felt like a reasonable scope for the time given but there's a lot of ground to cover.

Questions Asked (1)

Q1

Design a mobile app feature that takes a photo of a leaf and identifies its category, using a retrieval-based approach combined with a ranking model.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

The retrieval plus ranking framing is the interesting part here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., latency, accuracy, on-device vs. cloud) and then outline a two-stage system: first retrieve candidate leaf categories using an embedding-based nearest neighbor search, then re-rank them with a lightweight model. Emphasize trade-offs between retrieval efficiency and ranking accuracy, and discuss how to handle scalability and user experience.

Pro tip: Mention that the retrieval step can be done on-device using a compressed embedding model to reduce latency and privacy concerns, while the ranking model can be a small neural network that runs efficiently on mobile. This shows awareness of practical deployment constraints.

1. Clarify Requirements and Constraints

Ask about expected latency, accuracy targets, device constraints (on-device vs. cloud), and the number of leaf categories. This ensures the design aligns with real-world needs.

2. Design the Retrieval Stage

Propose using a pre-trained image encoder (e.g., MobileNet) to generate embeddings for the query leaf image, then perform approximate nearest neighbor search (e.g., using FAISS or ScaNN) over a database of leaf embeddings to retrieve top-K candidates.

3. Design the Ranking Stage

Use a lightweight ranking model (e.g., a small MLP or gradient boosted trees) that takes the query embedding and candidate embeddings (or additional features) to re-rank the top-K candidates and output the final category.

4. Discuss Training and Data Pipeline

Explain how to train the embedding model (e.g., using triplet loss or contrastive learning) and the ranking model (e.g., using pairwise or listwise ranking losses). Mention data augmentation and handling of new categories.

5. Address Deployment and Trade-offs

Talk about on-device vs. cloud inference, model quantization, latency vs. accuracy trade-offs, and how to update the index as new leaf categories are added.

Key Points to Mention

  • Embedding-based retrieval using approximate nearest neighbor search (e.g., FAISS, ScaNN) for scalability.
  • Two-stage architecture: retrieval for efficiency, ranking for accuracy.
  • Choice of image encoder (e.g., MobileNet, EfficientNet) and training with metric learning (triplet loss, contrastive loss).
  • Ranking model design: lightweight model (e.g., MLP) using query-candidate embeddings and possibly additional features.
  • On-device deployment considerations: model quantization, pruning, and latency constraints.
  • Handling of new categories and index updates without full retraining.

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