Lesson 4 of 4 Hyperparameters, Tuning and Model Fit

Combining Models with Ensembles and Cascades

This lesson explains how combining several models improves performance or reduces cost, as the exam guide asks, through ensembles and cascades of small and large models.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish bagging from boosting.
  • Combine models with stacking and blending.
  • Reduce cost with model cascades.

Bagging and boosting

Bagging (bootstrap aggregating) trains many models in parallel on random samples of the data drawn with replacement and averages their predictions or takes a vote. Averaging cancels out individual errors and lowers variance; random forests are the classic example. Boosting trains models in sequence, each focusing on the errors of the previous ones, which lowers bias; XGBoost, LightGBM and CatBoost are gradient boosting implementations. Boosting usually gives higher accuracy but can overfit if not regularised.

Match the pairs

Ensemble methods

Exam skills 2.2.6

Match each ensemble method with how it combines models.

Log in to try this activity Interactive activities are free with an account.

Stacking and blending

Stacking trains different kinds of base models, such as a gradient-boosted model, a neural network and a linear model, then trains a meta-model on their out-of-fold predictions to learn how to combine them. Blending is a simpler variant using a held-out set. Diverse base models whose errors differ give the largest gains. On SageMaker AI, base models can be hosted together with a multi-container endpoint or a serial inference pipeline.

Combining models to reduce cost

A cascade sends every request to a cheap model first and escalates only uncertain cases to an expensive one; for example, a small classifier handles clear cases and a large model or a human handles the rest. For FMs, Bedrock intelligent prompt routing applies the same idea between a smaller and a larger model in a family. Routing by request type sends simple tasks to small models. The following table summarises the methods.

MethodCombinesMain benefit
BaggingParallel models on bootstrap samplesLower variance
BoostingSequential models fixing errorsLower bias, high accuracy
StackingDiverse models plus a meta-modelHighest accuracy, more complexity
Cascade / routingCheap model first, expensive model for hard casesLower average cost and latency

The following diagram shows a document triage cascade in which a small classifier handles confident cases and a foundation model handles the rest.

The document triage cascade. A lightweight BlazingText classifier sees every document; the 80% it classifies with confidence above 0.95 are routed directly, and only the remaining 20% go to the foundation model, cutting cost by roughly 75% while keeping accuracy on the hard cases.
The threshold is adjusted as both paths are monitored.
Fill in the value

Cost of a cascade

Exam skills 2.2.6 · 4.2.9

Calculate the cost saving of a two-stage cascade.

Log in to try this activity Interactive activities are free with an account.
Worked example

Document triage cost

An insurer classifies 1 million incoming documents a month with a large FM at high cost. Analysis shows that 80% are standard forms that a simple model classifies with high confidence.

  • Train a lightweight classifier (for example, BlazingText) on labelled documents.
  • Route documents with classifier confidence above 0.95 directly; send the rest to the FM.
  • Monitor accuracy of both paths and adjust the threshold.

The FM now processes about 20% of documents, cutting cost by roughly 75% while keeping accuracy on hard cases. Replacing the FM entirely with the small model would have lost accuracy on the difficult 20%.

Check yourself

Does bagging reduce bias or variance?

Show answer

Variance, as in random forests. Boosting reduces bias.

Exam Tips

Remember for the exam

  • Bagging reduces variance (random forest).
  • Boosting reduces bias (XGBoost, LightGBM).
  • Stacking learns how to combine diverse models.
  • Cascades send easy cases to cheap models to cut cost.
  • Diverse models with different errors give the best ensembles.