← Back to Pull requests

Separate learner model inputs from model state #12443

Closed
unknown closed this pull request without merging on Aug 13, 2026 11:50 UTC
View on GitHub
unknown unknown commented on Aug 11, 2026 14:07 UTC
Author

Summary

  • rename LearnerModelParam to LearnerModelState to reflect that it is authoritative runtime/model state rather than a user parameter object

  • move user inputs (base_score, num_class, num_target, and boost_from_average) into LearnerTrainParam

  • materialize feature count, output shape, and intercept state when the learner first sees training data

  • preserve empty learners in memory snapshots while requiring initialized state for ordinary prediction and model export

  • remove GradientBooster::ModelFitted() as a proxy for learner initialization
  • The serialized learner_model_param key remains unchanged for model compatibility. Loading older snapshots also restores pending model inputs from that object when they are absent from learner_train_param.

    This PR intentionally retains need_configuration_ and the existing deferred component-configuration calls. It separates model initialization from that state machine first; configuration lifecycle cleanup can follow independently.

    Why

    LearnerModelParam mixed user-provided construction inputs with model-derived, authoritative state. That made ordinary configuration responsible for creating a provisional model before training data was available and required booster internals to report whether the learner had been fitted. Separating the two lets configuration remain parameter handling while the first training operation creates a valid model state from both parameters and data.

    Validation

  • ./build/testxgboost (750 tests)

  • focused learner/model-state and intercept tests after pre-commit formatting (11 tests)

  • pytest tests/python/test_basic_models.py tests/python/test_pickling.py tests/python/test_model_io.py tests/python/test_model_compatibility.py tests/python/test_multi_target.py (61 passed, 1 skipped)

  • pre-commit run --files <34 changed files>
  • Diff: 233 lines (+174 / -59) across 2 files Reviewer: RAMitchell Review duration: 2743m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 233 lines diff across 2 files
    0.37
    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.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #12443"
    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: 37.1% (MEDIUM) · Higher = larger blast radius
    37.1%
    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: 14.6% · Safe to merge
    14.6%
    Repository