Skip to main content
Back

IIT Bombay's XCount Finally Measures AI Bias in Credit and Medical Models

XCount uses algebraic decision diagrams and probabilistic counting to measure how much of a tree ensemble's input space is vulnerable to sensitive feature flips — with formal guarantees.

Pro

Paper, Full Access
  • XCount is the first tool to count how many input regions of a decision tree ensemble are vulnerable to sensitive feature changes, with certified (1±ε, 1−δ) guarantees.
  • The approach encodes each tree as an Algebraic Decision Diagram (ADD), decomposes the counting problem into subproblems per bitmask pair, then merges results using a Poisson-sampling union estimator.
  • On 3,194 benchmarks across 10 datasets, XCount solved 1,552 instances — 2× more than the monolithic ADD baseline and 33% more than the best model counter (Ganak), with a mean relative error of 0.1%.
  • The tool validates that L1 regularization reduces sensitivity: higher regularization parameters consistently produce fewer sensitive input regions, even when predictive accuracy is unchanged.
  • Scalability degrades beyond ~400 decision nodes per ensemble; completion rates drop below 50% for large ensembles, and very low gap thresholds slow performance significantly.
  • Code is implemented in C++ with CUDD; the paper and tool are available on arXiv from IIT Bombay and University of Toronto.

Decision tree ensembles , the XGBoost, LightGBM, and random forest models that power credit scoring, medical diagnosis, and fraud detection , are widely trusted precisely because they feel interpretable. But a nagging question has gone largely unanswered: how much of a model's input space is actually vulnerable to flipping a protected feature like race, age, or gender and getting a different prediction? A new paper from IIT Bombay and the University of Toronto introduces XCount, the first tool that can answer that question at scale, with certified accuracy.

The gap between "does it exist" and "how much"

Sensitivity is closely related to individual fairness or causal discrimination, since any sensitive pair , two inputs that differ only on protected features but receive different predictions , is a witness to unfairness when sensitive features are seen as protected attributes. Prior work could find one such pair, or prove none exists. This problem is quite different from the well-studied local robustness problem: while local robustness can be solved by searching around the neighborhood of a given input, sensitivity requires searching across the entire input space.

The trouble is that finding a single sensitive pair is NP-hard, and counting them is even harder , it sits in the complexity class #P, the counting analog of NP. Recent work has considered quantitative notions of robustness for neural networks, but to the best of the authors' knowledge, no prior work deals with quantitative versions of sensitivity or fairness in decision tree ensembles. XCount fills that gap.

What "sensitivity" means, precisely

The paper formalizes the problem by splitting features into sensitive (protected attributes like race or gender) and non-sensitive (everything else). A model is sensitive if there exist two inputs that are identical on non-sensitive features, differ only slightly on sensitive ones (within a Hamming distance d), yet receive predictions that diverge by more than a gap threshold G.

Rather than working over the continuous input space, the authors exploit a key structural property of decision trees: every tree ensemble partitions its input space into a finite number of discrete regions, one per combination of threshold comparisons. This turns the problem into counting Boolean vectors , a much more tractable representation. The formal counting objective is:

  • C(S, d, G): count the number of input regions b for which there exists another region b' such that non-sensitive features are identical, sensitive features differ by at most d bits, and the ensemble's output difference exceeds G.

This discretization is what makes the whole approach tractable. A financial institution, for example, could use this to verify that fewer than 1% of input regions exhibit sensitivity to a protected attribute , with a formal confidence bound attached.

The ADD trick: encoding trees as algebraic diagrams

The core representation is the Algebraic Decision Diagram (ADD) , think of it as a Binary Decision Diagram (BDD) but where leaf nodes store real numbers instead of booleans. Each decision tree maps naturally to an ADD, and the full ensemble's output is just the sum of its individual ADDs. The sensitivity problem then becomes: build a difference-ADD representing how much the ensemble output changes when sensitive features shift, then count the Boolean assignments where that difference exceeds G.

The naive approach , compile the whole ensemble into one monolithic ADD , collapses quickly as ensemble size grows. The key insight of XCount is to decompose the problem.

Cactus plot comparing XCount execution time against ADD-baseline, ApproxMC, and Ganak across 3194 benchmarks

How XCount works, step by step

  1. Discretize sensitive features. Extract all threshold values for sensitive features from the ensemble's split nodes. Each feature with k thresholds yields k+1 valid bitmasks (monotonicity-constrained Boolean vectors representing which thresholds the feature value falls below).
  2. Generate subproblems. For every pair of bitmasks within Hamming distance d, create a subproblem. Each subproblem fixes the sensitive feature values for both inputs in a candidate sensitive pair.
  3. Prune and encode. For each subproblem, prune each tree by collapsing branches that are unreachable given the fixed sensitive-feature bitmask. Encode the pruned trees as ADDs. Compute the pairwise difference between the two pruned ADDs for each tree, then sum those differences across all trees , this gives a compact ADD encoding the ensemble output gap.
  4. Convert to BDD. Threshold the difference-ADD: leaf values above G become 1, others become 0. The resulting BDD's satisfying assignments are exactly the non-sensitive-feature configurations that witness sensitivity for this subproblem.
  5. Merge with PAC guarantees. Subproblem solutions overlap (the same non-sensitive-feature region can appear in multiple subproblems). XCount uses a streaming union-size estimator adapted from database theory , drawing Poisson-distributed samples from each subproblem's BDD and maintaining a downsampled reservoir , to estimate the union size with a provable (1±ε) approximation bound at confidence (1−δ).
Scatter plot and histogram showing XCount relative error vs Ganak exact counts, with mean error of 0.1%

Results: order-of-magnitude speedup, sub-1% error

The authors evaluated XCount on 3,194 benchmark instances drawn from 10 standard tabular datasets (Diabetes, Adult, Covtype, MNIST, Webspam, Wine-quality, Supersymmetry, Higgs, Fashion-MNIST, Protein Structure), with ensembles ranging from 10 to 100 trees and depths from 3 to 6. They compared against three baselines:

  • ADD-baseline: monolithic ADD exact counting
  • Ganak: state-of-the-art exact model counter via CNF encoding
  • ApproxMC: approximate model counter via CNF encoding

XCount solved 1,552 of 3,194 instances , about 1.15× more than the next best approach (Ganak at 721). Its PAR-2 score (a standard benchmark metric penalizing timeouts) was 1,937, a 33% improvement over Ganak and 43% over the ADD-baseline. On accuracy, 99% of XCount's counts fell within 10% of the exact Ganak answer, with a mean relative error of just 0.1%.

Where it struggles

Scalability degrades as the number of decision nodes ("guards") grows. The completion rate drops below 50% when an ensemble has more than ~400 guards total , roughly 50 trees of depth 4 or 25 trees of depth 6. The tool is also currently limited to additive ensembles (XGBoost, LightGBM, gradient boosted trees) and random forests; other architectures would need adaptation. Performance also slows noticeably at very low gap thresholds, since nearly all input regions become sensitive.

Heatmap showing XCount execution time by number of trees and tree depth, with darker colors indicating slower performance for larger ensembles

A real application: validating regularization

The paper demonstrates a practical use case: using sensitivity counts to validate whether L1 regularization is actually reducing model bias. The hypothesis is that stronger regularization should produce fewer sensitive regions. The authors trained XGBoost models on the Adult dataset with L1 parameters α ∈ {0, 1, 5, 10}, keeping accuracy essentially constant across all settings. XCount confirmed the hypothesis cleanly , higher α consistently reduced the count of sensitive regions across all feature-depth-tree-count configurations tested.

This opens a new evaluation axis for model selection: beyond accuracy and AUC, practitioners can now ask "which of these equally-accurate models has the smallest sensitive footprint?" and get a certified answer.

What's now possible

XCount is implemented in C++ using the CUDD library for ADD/BDD operations. It takes a JSON-serialized tree ensemble and outputs a count estimate with user-specified ε and δ parameters. The tool is available alongside the paper. The broader context matters here: prior work like sensitivity verification at ICLR 2025 could only answer yes/no for a single sensitive pair. SViM at ICLR 2026 scales the yes/no check to larger ensembles. XCount is the first to move from existence to measurement , turning a binary fairness check into a quantitative audit score that regulators, model developers, and auditors can actually act on.