← Back to Pull requests

Exact intercepts for absolute error and quantile objectives #12557

Closed
unknown closed this pull request without merging on Sep 16, 2026 09:22 UTC
View on GitHub
unknown unknown commented on Sep 11, 2026 09:09 UTC
Author

Summary

Replace the approximate intercept estimation for reg:absoluteerror and
reg:quantileerror with exact float32 weighted quantile selection.

The implementation introduces an objective-local radix-selection kernel with
separate CPU and CUDA implementations. Other devices use the existing CPU
kernel fallback.

Motivation

The optimal intercept for absolute error is a weighted median. More generally,
each quantile objective has a weighted quantile as its optimal intercept.

The previous implementation approximated these intercepts using a mean followed
by one gradient/Hessian update. The result was not generally the optimum.

Sorting the labels would find the optimum, but requires O(n log n) work and is
awkward on GPUs and distributed workers. Since labels are stored as float32, the
selected value can instead be recovered in four 8-bit radix passes.

Each pass:

1. Builds a weighted 256-bin histogram for the next byte of each candidate.
2. Sums the histogram across distributed workers.
3. Selects the bin containing the requested cumulative weight.
4. Retains that prefix and refines the remaining rank.

After four passes, the selected 32-bit key identifies the exact input value.
The input is never sorted or modified.

The output count is passed independently of the local label shape. This allows
workers holding an empty, label-less DMatrix to allocate matching histograms
and participate in every collective operation.

Performance

Measured on 20 million rows with one feature. Intercept cost is the difference
between one-round training with automatic estimation and training with an
explicit base_score.

| Device | Label distribution | Objective | Intercept cost |
|---|---|---|---:|
| GPU | Clustered in [100, 1000) | reg:absoluteerror | 15 ms |
| GPU | Clustered in [100, 1000) | reg:quantileerror, 3 alphas | 18 ms |
| GPU | Spread, N(0, 1e10) | reg:absoluteerror | 7 ms |
| CPU, 32 threads | Clustered in [100, 1000) | reg:absoluteerror | 27 ms |
| CPU, 32 threads | Clustered in [100, 1000) | reg:quantileerror, 3 alphas | 65 ms |

The clustered distribution is a difficult case for the CUDA implementation
because many rows contend for the same pass-0 histogram bins.

Tests

  • CPU and CUDA radix-selection tests

  • Weighted and unweighted quantiles

  • Multiple columns and quantile levels

  • Zero total weight

  • Distributed selection with an empty worker

  • Distributed absolute-error initialization with a 0 x 0 label matrix

  • CPU and GPU absolute-error and quantile intercept tests

  • Python adaptive-tree intercept tests
  • Diff: 324 lines (+243 / -81) across 4 files Reviewer: RAMitchell Review duration: 7212m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 324 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.346
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #12557"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.0% (MEDIUM) · Higher = larger blast radius
    42.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%
    Repository