Unifying Stacking and Cascading for Efficient Ensemble Inference

Ashwin Gerard Colaco, Sharad Mehrotra, Michael J. De Lucia, Kevin Hamlen, Murat Kantarcioglu, Latifur Khan, Ananthram Swami, Bhavani Thuraisingham, Unnat JainICML 2026

Introduction

In machine learning, practitioners constantly navigate the classic tug-of-war between accuracy and efficiency. Ensembles (stacking multiple models) represent the gold standard for accuracy, but they are computationally expensive because every model must be executed for every input. Cascades offer a faster alternative by running models sequentially and exiting early if a model is sufficiently "confident."

However, traditional cascades suffer from two major flaws. First, they exhibit poor aggregation, typically deciding to exit based solely on the last model's output while ignoring the collective wisdom of previously executed models. Second, they rely on naive heuristics, almost always defaulting to a "cheapest-first" ordering. While logical on the surface, this is rarely the most cost-effective path to a confident prediction.

LazyStack is a novel framework designed to bridge this gap. By leveraging reinforcement learning to find optimal model sequences and training lightweight meta-learners to aggregate evidence progressively, LazyStack achieves up to 38x speedups while retaining over 97% of full ensemble accuracy.

The LazyStack Framework

LazyStack operates in two primary phases to dynamically route inputs and aggregate predictions:

  1. Trajectory Discovery (The "Map"): The authors formulate model selection as a Markov Decision Process (MDP). Instead of rigidly sorting models by computational cost, the MDP balances the "reward" of a correct prediction against the "cost" of execution. This allows the system to discover optimal routing policies based on actual data dynamics rather than simple price tags.
  2. Prefix Meta-Learning (The "Compass"): For the common execution paths (trajectories) identified by the MDP, LazyStack trains "substackers"—lightweight Multi-Layer Perceptrons (MLPs). These substackers take the probability outputs from all models executed up to that point and produce a single, calibrated confidence score.

During inference, the system follows the MDP's policy: it runs a model, allows the substacker to aggregate all evidence seen so far, and exits immediately if the combined confidence hits a predefined threshold. If not, it proceeds to the next model in the sequence.

Key Insights: Trajectories and Ordering

  • Trajectory Concentration: A major theoretical hurdle in dynamic routing is the exponential number of possible model combinations ($2^k$). However, the authors discovered a phenomenon called "trajectory concentration." In practice, over 95% of samples follow just 3 to 8 common execution paths. This collapse from exponential complexity to a few linear paths is what makes training specialized aggregators computationally feasible.
  • Counterintuitive Ordering: The MDP reveals that the standard "cheapest-first" heuristic is often a trap. For example, on the NSL-KDD dataset, LazyStack learned to initiate the cascade with a moderately expensive LightGBM model rather than a cheaper Logistic Regression. The LightGBM model's higher confidence enabled immediate, one-and-done exits so frequently that it significantly lowered the average cost per query.
  • Superadditive Gains: Trajectory discovery and progressive aggregation are highly synergistic. Removing either component causes the system's efficiency to degrade rapidly toward the cost of running a full ensemble.

Empirical Evaluation and Results

The authors evaluated LazyStack across eight diverse benchmarks spanning four domains: Vision (CIFAR-100, ImageNet-1K), Tabular (NSL-KDD), Text Classification (AG News, SST-5), and LLM Routing (MMLU, ARC-Challenge, HEADLINES).

  • Massive Speedups: On the tabular NSL-KDD task, LazyStack achieved a 38x speedup while maintaining 97% of the full ensemble's accuracy. In vision tasks like CIFAR-100, it retained 97% accuracy with a 2.5x speedup.
  • LLM Dominance: For LLM routing, LazyStack outperformed specialized baselines like FrugalGPT and RouteLLM. It frequently adopted "skip-medium" policies—trying a small 7B model and, if uncertain, jumping directly to a massive 70B model, bypassing intermediate tiers that offered redundant information.
  • Sublinear Scaling: As the pool of available models grows, the average number of models executed per sample remains remarkably flat (typically 2–3). This indicates that LazyStack becomes increasingly efficient as the ensemble size expands.

Limitations and Future Directions

While LazyStack offers a robust solution for efficient inference, it has a few limitations:

  • The "Many-Class" Hurdle: Confidence-based early stopping struggles in environments with thousands of classes (e.g., ImageNet), as probability mass becomes too distributed. Consequently, efficiency gains are more modest here compared to few-class problems.
  • Data Requirements: LazyStack requires a labeled validation set to map trajectories and train substackers, preventing immediate "out-of-the-box" deployment in novel domains without initial data.
  • Generative Tasks: Currently, the framework is designed for classification. Extending LazyStack to open-ended LLM generation—where a single probability score cannot easily represent a full paragraph—remains an open challenge. Future work may explore "LLM-as-a-judge" mechanisms or embedding-based similarity to adapt the framework for generative AI.

Summary updated

BibTeX
@inproceedings{colaco2026unifying,
  author = {Ashwin Gerard Colaco and Sharad Mehrotra and Michael J. De Lucia and Kevin Hamlen and Murat Kantarcioglu and Latifur Khan and Ananthram Swami and Bhavani Thuraisingham and Unnat Jain},
  title = {{Unifying Stacking and Cascading for Efficient Ensemble Inference}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=XJLcR8dZcv},
}
Figure