How do gradient-boosted tree libraries like XGBoost or LightGBM handle missing values without explicit imputation?

Quick Overview

Asks how gradient-boosted tree libraries such as XGBoost and LightGBM train and predict on rows with missing feature values without imputing them first. Tests knowledge of split finding, gain computation and the risks when missingness changes between training and serving.

How do gradient-boosted tree libraries like XGBoost or LightGBM handle missing values without explicit imputation?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How do gradient-boosted tree libraries like XGBoost or LightGBM handle missing values without explicit imputation? ```hint One split at a time At a single split, a row with a missing value still has to go left or right. What does the training procedure already compute that could pick a side for it? ``` ```hint Training versus serving Think about a row that is missing a feature at prediction time when that feature was never missing in the training data. ``` ### What a Strong Answer Covers - The mechanism that decides where rows with a missing value go at each split, and how it is applied at inference - How split candidates are scored when some rows lack the feature, and why this is cheap - Why native handling can do better than a single imputed value - What each library counts as missing (NaN, a declared sentinel, zeros) - Failure modes when missingness differs between training and serving ### Follow-up Questions - If a feature is rarely missing in training, how much can you trust the learned default direction, and what would you do about it? - When would you still impute or add a missing-indicator feature, even with a library that handles missing values natively? - How does LightGBM's treatment of zeros in sparse input interact with its missing-value handling? - How would you monitor a deployed boosted model for changes in missingness?

Overview: Asks how gradient-boosted tree libraries such as XGBoost and LightGBM train and predict on rows with missing feature values without imputing them first. Tests knowledge of split finding, gain computation and the risks when missingness changes between training and serving.

General logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How do gradient-boosted tree libraries like XGBoost or LightGBM handle missing values without explicit imputation?

What a Strong Answer Covers Guidance

  • The mechanism that decides where rows with a missing value go at each split, and how it is applied at inference
  • How split candidates are scored when some rows lack the feature, and why this is cheap
  • Why native handling can do better than a single imputed value
  • What each library counts as missing (NaN, a declared sentinel, zeros)
  • Failure modes when missingness differs between training and serving

Follow-up Questions Guidance

  • If a feature is rarely missing in training, how much can you trust the learned default direction, and what would you do about it?
  • When would you still impute or add a missing-indicator feature, even with a library that handles missing values natively?
  • How does LightGBM's treatment of zeros in sparse input interact with its missing-value handling?
  • How would you monitor a deployed boosted model for changes in missingness?