Skip to content

Add property-based CPU quantile summary tests#12151

Merged
RAMitchell merged 7 commits intodmlc:masterfrom
RAMitchell:quantile-test-strategy
Apr 10, 2026
Merged

Add property-based CPU quantile summary tests#12151
RAMitchell merged 7 commits intodmlc:masterfrom
RAMitchell:quantile-test-strategy

Conversation

@RAMitchell
Copy link
Copy Markdown
Member

Summary

This PR starts restructuring CPU quantile tests around property-style invariants instead of bespoke one-off cases.

The first step focuses on the summary layer in tests/cpp/common/test_quantile.cc:

  • add a shared quantile test helper header for deterministic case generation and reference rank checks
  • add anchor and sampled summary cases that exercise both exact-support and compressed regimes
  • validate summary-level invariants directly, including sorted unique support, exact retention when the support fits in the target bin count, and the summary query rank bound
  • keep the existing container/distributed tests in place for now
  • remove the old SetPruneInplace summary-only test

This is intended as the first step toward replacing the older ad hoc quantile tests in test_quantile.cc with layered property-based tests.

Testing

Ran locally:

  • ./build-cpu/testxgboost --gtest_filter='*QuantileSummary*'
  • ./build-cpu/testxgboost --gtest_filter='Quantile.*'

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Restructures CPU quantile summary tests toward property-based invariants by introducing shared deterministic case generation helpers and adding new invariant-focused summary tests.

Changes:

  • Added test_quantile_helpers.h with deterministic summary case generation and reference/rank-check utilities.
  • Added new parameterized summary tests validating support monotonicity, exact-retention when representable, and rank-error bounds.
  • Removed the legacy SetPruneInplace summary-only test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/cpp/common/test_quantile.cc Adds new property/invariant-based quantile summary tests and removes the old prune-inplace test.
tests/cpp/common/test_quantile_helpers.h Introduces shared utilities for generating deterministic summary inputs and computing reference/rank-error checks.

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

@RAMitchell RAMitchell marked this pull request as ready for review April 9, 2026 11:18
@RAMitchell RAMitchell requested a review from trivialfis April 9, 2026 11:22
@RAMitchell RAMitchell force-pushed the quantile-test-strategy branch from 64e7518 to 9e510d4 Compare April 9, 2026 15:05
@RAMitchell RAMitchell merged commit d6bcff3 into dmlc:master Apr 10, 2026
78 checks passed
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