How does XGBoost handle missing values during split finding?

Quick Overview

Asks how XGBoost deals with missing feature values while it searches for tree splits. Tests sparsity-aware split finding, how a default direction is learned at each node, why the method is cheap on sparse data, and what happens to missing values at inference.

How does XGBoost handle missing values during split finding?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does XGBoost handle missing values during split finding? ```hint Where can they go Think about which rows the threshold scan actually needs to sort, and where the rows without a value for that feature could be sent. ``` ```hint Avoid the scan A node already knows the total gradient and hessian sums of its rows. What can you get from those without visiting the missing rows at all? ``` ### What a Strong Answer Covers - How rows with a missing value are assigned while a split is evaluated, and how the default direction is chosen - Why the procedure costs time proportional to the number of non-missing entries - What XGBoost treats as missing for dense and for sparse inputs - How missing values are routed at inference, and what happens at a node that saw no missing values in training ### Follow-up Questions - A feature that was never missing in training arrives as NaN in production. What does the model do with it? - When would you still impute values or add a missingness indicator instead of relying on the learned default direction? - How do explicitly stored zeros in a sparse matrix differ from entries that are absent, and what does setting `missing=0` change? - Missingness turns out to be one of the model's strongest signals. How would you decide whether that is a real pattern or leakage?

Overview: Asks how XGBoost deals with missing feature values while it searches for tree splits. Tests sparsity-aware split finding, how a default direction is learned at each node, why the method is cheap on sparse data, and what happens to missing values at inference.

Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How does XGBoost handle missing values during split finding?

What a Strong Answer Covers Guidance

  • How rows with a missing value are assigned while a split is evaluated, and how the default direction is chosen
  • Why the procedure costs time proportional to the number of non-missing entries
  • What XGBoost treats as missing for dense and for sparse inputs
  • How missing values are routed at inference, and what happens at a node that saw no missing values in training

Follow-up Questions Guidance

  • A feature that was never missing in training arrives as NaN in production. What does the model do with it?
  • When would you still impute values or add a missingness indicator instead of relying on the learned default direction?
  • How do explicitly stored zeros in a sparse matrix differ from entries that are absent, and what does setting missing=0 change?
  • Missingness turns out to be one of the model's strongest signals. How would you decide whether that is a real pattern or leakage?