Design an item category prediction system
Walmart LabsMachine Learning Engineer · OnsiteLast updated
This question tests the ability to design an end-to-end classification system for assigning retail items into a hierarchical category structure, focusing on feature selection, model architecture, and production deployment.
Problem Statement
Walmart catalogs millions of items across thousands of categories (e.g., Electronics > Audio > Headphones). Design a machine learning system to automatically predict the category of an item based on its metadata. Assume you have access to product titles, descriptions, images, and brand information.
System Requirements
Functional
- The system must classify new items in real-time as they are ingested into the catalog.
- The classification must map items to a multi-level taxonomy (Parent > Child > Leaf).
Non-Functional
- High throughput: Must handle 500 items per second.
- High accuracy: The system must handle long-tail categories where training data is sparse.
Your Design Should Cover:
- Data Strategy: How do you handle noisy product titles or missing descriptions? How do you curate ground truth labels if manual labeling is expensive?
- Modeling Approach: Describe the feature engineering and model architecture. How do you handle the hierarchical nature of the taxonomy?
- Evaluation: What metrics (beyond simple accuracy) would you track to ensure the system performs well across both popular and niche categories?
- Infrastructure: Provide a high-level architecture for training and inference, including how you would handle model updates as the product catalog evolves.
Hints
Hint 1
Consider whether to train a single flat classifier, a series of local classifiers for each level of the hierarchy, or a hierarchical model that enforces label constraints.
Hint 2
For the multimodal input (text and images), think about how embedding layers or pre-trained models like BERT and ResNet can be fused in a shared feature space.
Hint 3
Think about the trade-offs between a microservice-based inference architecture versus a batch-processing pipeline for initial catalog ingest.
Follow-up questions
- How would you handle 'concept drift' when vendors change product naming conventions or new product categories emerge?
- If the model makes a mistake, how would you design a human-in-the-loop mechanism to correct labels and improve the model?
- How would you measure the business impact of a misclassification (e.g., a laptop categorized as a kitchen appliance) on the user experience?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.