Stacking: refit base models on the full training data or average the fold models at inference?

Quick Overview

Compare two ways to serve a stacked ensemble: refit each base model on all training data, or average the cross-validation fold models at inference. Tests understanding of out-of-fold predictions, the mismatch the meta-learner sees, serving cost, and how to validate the final pipeline.

Stacking: refit base models on the full training data or average the fold models at inference?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

After building a stacked model, should you refit the base models on the full training data or average the fold models at inference time? The meta-learner was trained on out-of-fold predictions from k-fold cross-validation, so for each base learner you already have k fold models. Explain the two options for producing base predictions on new data and when you would pick each. ```hint Training versus inference inputs Compare the predictions the meta-learner saw during training with the ones it would receive at inference under each option. ``` ```hint Serving cost Count how many models each option puts into production and how much data each of those models was trained on. ``` ### What a Strong Answer Covers - Whether both options are valid, and which one common libraries use by default - What each option gains: data per base model, serving cost, variance reduction - The mismatch between the meta-learner's training inputs and its inference inputs under each option - A decision rule based on latency budget, training cost and model stability - How to validate the final pipeline ### Follow-up Questions - A gradient-boosted base model used early stopping in each fold. How do you set the number of trees when you refit on all the data? - How would you test whether the refit models' extra confidence hurts the meta-learner? - Should the meta-learner be retrained on the refit base models' predictions of the training data? - What changes when the base models are neural networks with random initialization?

Overview: Compare two ways to serve a stacked ensemble: refit each base model on all training data, or average the cross-validation fold models at inference. Tests understanding of out-of-fold predictions, the mismatch the meta-learner sees, serving cost, and how to validate the final pipeline.

PracHub logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

After building a stacked model, should you refit the base models on the full training data or average the fold models at inference time?

The meta-learner was trained on out-of-fold predictions from k-fold cross-validation, so for each base learner you already have k fold models. Explain the two options for producing base predictions on new data and when you would pick each.

What a Strong Answer Covers Guidance

  • Whether both options are valid, and which one common libraries use by default
  • What each option gains: data per base model, serving cost, variance reduction
  • The mismatch between the meta-learner's training inputs and its inference inputs under each option
  • A decision rule based on latency budget, training cost and model stability
  • How to validate the final pipeline

Follow-up Questions Guidance

  • A gradient-boosted base model used early stopping in each fold. How do you set the number of trees when you refit on all the data?
  • How would you test whether the refit models' extra confidence hurts the meta-learner?
  • Should the meta-learner be retrained on the refit base models' predictions of the training data?
  • What changes when the base models are neural networks with random initialization?