rules/xgboost/removed-gpu-hist.md

XGBoost 3.1 removed the gpu_hist tree method. Training a tree booster with that value raises an error.

diff
1-model = xgb.XGBClassifier(tree_method="gpu_hist")
2+model = xgb.XGBClassifier(tree_method="hist", device="cuda")

What the rule reports

The rule checks literal gpu_hist values on XGBoost estimator constructors and in dictionaries passed directly as params to train or cv. It recognizes adjacent string literals such as "tree_" "method" and "gpu_" "hist", including raw and Unicode prefixes. A later literal tree_method key overrides the earlier value. A later unrelated plain string key leaves it in effect.

The matcher reads source text. It cannot decode Python escapes such as \x5f into underscores. An escaped key, a computed key, or a dictionary unpack after tree_method can make the effective value uncertain.

How to fix it

Use xpd check --fix --unsafe-fixes to migrate an estimator constructor whose only argument is tree_method="gpu_hist". For other cases, edit the configuration by hand. Use tree_method="hist" with device="cuda" for GPU training. If the old configuration selected a specific GPU with gpu_id, use the corresponding device string, such as device="cuda:1", in single-node training.

3.1 release notes · Device and tree method parameters