Dharma Insights — Operational№ 083 · AI Systems
← The Signal№ 083 · AI Systems · September 9, 2025 · 4 min read

Hierarchical ML Systems

Beyond the Monolith: Architecting Hierarchical and Multi-Layered ML Systems for Scale and Cost-Efficiency Introduction In the world of machine learning, the old paradigm of building a single, monolithic model to…

Beyond the Monolith: Architecting Hierarchical and Multi-Layered ML Systems for Scale and Cost-Efficiency

Introduction

In the world of machine learning, the old paradigm of building a single, monolithic model to solve a complex problem is giving way to a more sophisticated, multi-layered approach. The Instacart case study on item availability shows that this architectural shift is not just a theoretical concept; it's a necessity for building scalable, cost-effective, and robust ML systems today. This article will break down what hierarchical ML systems are, why they are becoming the industry standard, and provide a clear blueprint for builders and practitioners.

Why the Monolith Was No Longer Enough

Instacart's previous item availability system, a batch-scoring job that ran every 2-4 hours, faced a number of common limitations found in legacy ML systems. The core issues were:

  • Stale Data: The long delay between updates meant the model couldn't provide real-time predictions, leading to "score staleness".

  • Cost & Scalability: As Instacart's catalog grew to hundreds of millions of items, scoring everything frequently became economically unfeasible and unnecessary.

  • Business Use Case Mismatch: The old model produced a single score for each item, unable to differentiate between a customer planning an order for the next day and a shopper needing real-time stock information.

The Solution: A Hierarchical G-T-R Architecture

To address these challenges, Instacart developed a new, real-time, hierarchical model. This approach serves as a perfect blueprint for how modern ML systems are designed and is now a widely adopted standard. The model breaks the problem into three distinct layers:

  • General (G) Component: This layer provides a stable baseline by predicting an item's typical availability based on long-term patterns over 7 to 180 days. It solves the sparse data problem by using a principled algorithm to find a sufficiently large and relevant sample of data, even for items with limited recent observations.

  • Trending (T) Component: A powerful Technique/Method, an XGBoost model, is used here to quantify short-term deviations from the general score. This layer captures trends from events like supply chain disruptions and its interpretability is enhanced by comparing its output against the General score.

  • Real-Time (R) Component: This layer responds to the latest shopper or retailer signals to infer short-term availability. As a prime example of cost optimization, this component is only applied to the approximately 1% of items that have recent signals, which led to a significant 80% reduction in computational costs for the company.

The Platform that Made It Possible

This sophisticated system required a modern, end-to-end MLOps platform to support it. Instacart’s internal platform,

Griffin, is the comprehensive vehicle that provides the infrastructure for Instacart's teams to build, train, and deploy machine learning models at scale. It's a hybrid platform that leverages established open-source tools like Ray for distributed training, Kubernetes for orchestration, and Snowflake for data management.

Beyond a Single Case Study: A Widely Adopted Standard

The principles established by Instacart's journey are now a de facto standard for building robust, scalable, and cost-effective ML systems in the real world. You can see similar hierarchical architectures in:

  • Recommender Systems: Where a system uses layers for a quick "candidate generation," a more complex "ranking" model, and a final "re-ranking" layer for personalization or diversity.

  • Fraud Detection: A multi-layered system can combine a fast, simple model to flag suspicious transactions in real-time with a more complex model (like XGBoost) for deeper analysis, and a final "human-in-the-loop" layer for review.

  • Predictive Maintenance: Where different models predict a component's typical lifespan, detect short-term anomalies, and issue real-time alerts for critical failures.

Conclusion for the Modern Builder

Instacart's experience offers a clear blueprint for any organization looking to move beyond the monolithic approach:

  • Deconstruct the Problem: Move from a single monolithic model to a multi-component, hierarchical structure like the G-T-R model. This improves interpretability and handles specific challenges like sparse data.

  • Modernize Your Infrastructure: Adopt a dedicated MLOps platform to handle the end-to-end ML lifecycle. A stratified serving structure can lead to massive cost savings while maintaining performance and freshness.

  • Support Context-Awareness: Design your systems to provide different predictions for different business use cases.

In short, while monolithic models still have a place, the future of high-value, mission-critical ML systems is overwhelmingly modular and hybrid. By sharing its approach, Instacart provides a valuable case study that moves the conversation from the theoretical "what" to the practical "how".

Independent researcher | Blockchain, ML, Financial Systems | Remote Dharma

View all signals →