← Back to Pull requests

predictor: skip array layout setup for small batches #12614

Closed
unknown closed this pull request without merging on Sep 25, 2026 17:18 UTC
View on GitHub
unknown unknown commented on Sep 24, 2026 22:42 UTC
Author

This change skips array-tree layout setup for small CPU prediction batches where the setup cost is larger than the traversal work it saves.

Previously, any prediction batch with more than one row prepared tree-depth metadata and enabled the array-layout path.

For small batches, this setup cost can dominate prediction latency.

The change:

  • derives a small-batch threshold from the block size and thread count

  • skips tree-depth preparation below that threshold

  • falls back to the existing non-array traversal path for those small batches

  • keeps the existing array-layout path unchanged for larger batches
  • Correctness:

  • 25/25 predictor tests passed

  • 779 C++ tests run

  • 776 passed

  • 3 skipped

  • 0 failed

  • 1 disabled

  • prediction hashes matched exactly in all benchmark runs
  • Benchmark:
    500 trees, max_depth=6, 100 features, Windows x64 Release build.

    Paired 10-round results against upstream/master:

    | Threads | Rows | Paired median change | Wins |
    | ---: | ---: | ---: | ---: |
    | 1 | 2 | -53.38% | 10/10 |
    | 1 | 8 | -38.97% | 10/10 |
    | 1 | 32 | -29.97% | 10/10 |
    | 2 | 2 | -44.80% | 10/10 |
    | 2 | 16 | -19.23% | 10/10 |
    | 2 | 32 | -19.28% | 10/10 |
    | 2 | 64 | -25.76% | 10/10 |
    | 4 | 2 | -22.29% | 10/10 |
    | 4 | 8 | -18.08% | 10/10 |
    | 4 | 16 | -13.05% | 10/10 |
    | 4 | 32 | -15.45% | 10/10 |
    | 8 | 2 | -10.11% | 10/10 |
    | 8 | 16 | -9.20% | 10/10 |

    The threshold is clamped to the prediction block size and scales with the configured thread count, so larger batches continue to use the existing array-layout path.

    Diff: 196 lines (+147 / -49) across 2 files Reviewer: RAMitchell Review duration: 1116m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 196 lines diff across 2 files
    0.36
    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.316
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #12614"
    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: 36.1% (MEDIUM) · Higher = larger blast radius
    36.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.2% · Safe to merge
    14.2%
    Repository