Skip to content

Unify and fix min_child_weight.#12296

Merged
trivialfis merged 2 commits into
dmlc:masterfrom
trivialfis:fix-min-child-weight
Jul 10, 2026
Merged

Unify and fix min_child_weight.#12296
trivialfis merged 2 commits into
dmlc:masterfrom
trivialfis:fix-min-child-weight

Conversation

@trivialfis

Copy link
Copy Markdown
Member

Currently, the CPU hist does a pre-check using IsValid to prevent a candidate from being evaluated, which is correct.

However, the GPU performs a post-check in ExpandEntry::Update that can allow an invalid candidate to win the evaluation over other valid candidates, only to be discarded afterward; hence, a bug.

The PR centralizes the handling of min child weight in the gain calculation and removes these pre- and post-checks.

Currently, the CPU hist does a `pre-check` using `IsValid` to prevent a candidate from
being evaluated, which is correct.

However, the GPU does a post check, which can let a invalid candidate to win the
evaluation against other valid candidates, but only to be discarded after evaluation,
hence, a bug.

The PR centralizes the min child weight handling to the gain calculation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes inconsistent min_child_weight handling between CPU and GPU tree methods by enforcing the check inside split gain computation (so invalid candidates can’t “win” evaluation and be discarded later), and removes redundant pre-/post-validation in split enumeration/update paths.

Changes:

  • Centralize min_child_weight (+ non-zero Hessian) validation in TreeEvaluator::SplitEvaluator::CalcSplitGain.
  • Remove CPU Hist-side pre-checks (IsValid) and GPU-side candidate update checks, relying on -inf gain for invalid splits.
  • Add a focused regression test ensuring consistent split/stat behavior across CPU/GPU updaters.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/cpp/tree/test_tree_stat.cc Adds a regression test covering min_child_weight behavior across multiple updaters (CPU + CUDA).
src/tree/updater_gpu_common.cuh Removes min_child_weight filtering from GPU split-candidate update, preventing post-hoc invalidation patterns.
src/tree/split_evaluator.h Enforces min_child_weight/positive-Hessian validity directly in split gain computation via -inf return.
src/tree/hist/evaluate_splits.h Removes local validity pre-checks and always evaluates candidates, relying on evaluator gating.
src/tree/gpu_hist/evaluate_splits.cu Updates call sites to match the simplified GPU candidate update API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RAMitchell RAMitchell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch and fix looks good.

@trivialfis trivialfis merged commit 2f16003 into dmlc:master Jul 10, 2026
81 checks passed
@trivialfis trivialfis deleted the fix-min-child-weight branch July 10, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants