A reproducible research toolkit designed to audit explainability in decentralized machine learning reveals that discrepancies in local reference distributions can systematically distort post-hoc fairness evaluations, producing false disparities or masking genuine algorithmic bias across institutions. In a software paper published in SoftwareX, researcher Roy Saurabh introduces BA-FedSHAP, an open-source Python framework developed to measure, diagnose, and quantify background-induced attribution drift in federated Shapley Additive Explanations. Machine learning models are increasingly deployed to guide critical consequential decisions concerning individuals across domains including credit underwriting, hiring decisions, healthcare delivery, and criminal justice assessments. These high-stakes deployments create two pressing technical requirements: post-hoc model explainability, which assesses the numerical contribution of individual input features to specific model predictions, and algorithmic fairness auditing, which evaluates whether a trained predictive model treats demographic subgroups defined by protected attributes such as sex or race differently. The newly published toolkit provides formal metrics, standardized evaluation protocols, and differential privacy accounting to investigate how removal-based explanation frameworks behave when raw training data cannot be centralized.
The underlying technical challenge addressed by BA-FedSHAP stems directly from the core mathematical mechanics of removal-based feature attribution in federated operating environments. KernelSHAP, the model-agnostic formulation of the widely adopted SHAP framework, calculates the explanatory importance of an input feature by simulating its removal from a prediction instance. Because machine learning models cannot process missing inputs directly, the explainer operationalizes feature removal by replacing omitted features with alternative values drawn from an empirical baseline sample termed the background distribution. Consequently, any computed attribution score depends inherently on both the learned parameters of the predictive model and the specific reference background chosen for evaluation. In federated learning configurations, multiple participating institutions, termed clients, collaboratively train a shared global predictive model without exchanging their private raw data samples. In this distributed paradigm, no universally shared baseline sample naturally exists because each participating client observes a unique, non-identical local data distribution. As a result, an attribution summary that appears stable when calculated against one client distribution can shift markedly on another solely because the reference distribution changed, rather than reflecting differences in model behavior.
When individual client-level attribution summaries are aggregated across an entire network to conduct a group-level fairness audit, this background-induced attribution drift can fabricate artificial disparities where none exist or obscure real disparities that are present, ultimately invalidating the audit conclusions. To resolve this vulnerability, BA-FedSHAP establishes four distinct contributions: a structured federated audit protocol, a standardized quantitative disparity metric, a formal differential privacy accounting pipeline, and an end-to-end multi-dataset evaluation harness. The released audit protocol defines an architecture where local clients compute pooled and group-conditioned KernelSHAP attribution summaries against an aligned global background. While the pooled baseline summaries serve as an oracle-like reference point, the group-conditioned summaries deliberately expose the magnitude of background-induced drift across demographic divisions. The central server inspects incoming client summary norms using standardized z-scores to flag outlier clients experiencing severe attribution drift before aggregating the surviving client updates, weighted by local protected group sample sizes, into unified global group-mean vectors and an overarching global attribution profile.
To formally measure demographic attribution differences, the software defines the standardized Attribution Disparity Index, denoted as ADInorm. Given a binary protected attribute indexed by zero and one, the metric considers the estimated group-mean attribution vectors across the feature dimensions. The index is defined mathematically as the L1 distance between the two estimated group-mean attribution vectors divided by the standard deviation of their respective L2 norms, with a strict floor parameter fixed at 0.001 to prevent division by zero. This normalization standardizes the raw L1 gap by the empirical dispersion of the group-level L2 norms. To evaluate statistical reliability without centralizing raw observations, the framework implements a client-level bootstrap procedure with 500 resamples alongside permutation testing over demographic labels to produce empirical 95 percent confidence intervals and permutation p-values. The author emphasizes that ADInorm is designed to be interpreted strictly alongside its unstandardized numerator and raw attribution error metrics, rather than as an uncontextualized, standalone deployment score.
The software architecture of BA-FedSHAP is structured as a modular Python package released under the permissive MIT license, strictly pinned to Python 3.10 and 3.11 runtimes. The codebase isolates data ingestion, federated optimization, attribution computation, audit metric evaluation, and privacy accounting across dedicated subdirectories. Core libraries bundled into the framework include PyTorch 2.1.0, SHAP 0.44.0, Flower 1.5.0 for federated communication, Fairlearn 0.10.0 for demographic parity and equalized odds baselines, Folktables, scikit-learn, pandas, PyYAML, SciPy, and a compatibility shim supporting NumPy 2.x trapezoidal numerical integration. The package includes preprocessing pipelines and configuration schemas for six standard tabular algorithmic fairness benchmark datasets: Adult, COMPAS, German Credit, Bank Marketing, ACSIncome, and ACSPubCov. Federated training executes through a configurable FedAvg algorithm supporting customizable client sampling ratios, local epoch counts, learning rates, momentum parameters, and Dirichlet non-IID data partitioning driven entirely by reproducible YAML configuration files.
To rigorously isolate background distribution effects from model discrepancies, the framework implements an evaluation harness that compares the proposed protocol against five baseline attribution pipelines sharing an identical trained global model and KernelSHAP wrapper. These baselines comprise centralized oracle SHAP, local client-level SHAP, naive aggregated SHAP, shared-background SHAP, and k-means background SHAP, which condenses data points via federated clustering. Additionally, the protocol incorporates formal privacy safeguards implemented in its dedicated privacy module, applying per-client L2 norm clipping alongside calibrated Gaussian noise mechanism release, tracked analytically through Rényi differential privacy accounting. The evaluation suite assesses the protocol across five distinct privacy expenditure parameters: infinite budget representing zero noise, as well as finite privacy budgets of epsilon equal to 8, 4, 2, and 1, allowing researchers to map empirical privacy-utility trade-offs under formal mathematical guarantees.
The author demonstrates the operational capabilities of the software through an empirical stress test executed on the COMPAS benchmark using a designated low-compute profile tailored for commodity hardware. The test configuration specifies 10 participating clients, 10 federated training rounds, a coalition sample budget of M equals 64 in KernelSHAP, a background sample size of K equals 200, and a logistic regression classifier across thirteen input features. Across an evaluation grid defined by five pre-specified random seeds and three Dirichlet data heterogeneity levels, alpha values of 0.1, 0.5, and 1.0, all fifteen independent experimental cells completed execution on commodity central processing units. The raw experimental outputs, accompanied by SHA-256 cryptographic checksum manifests and ten automated audit reports validating software dependencies, preprocessing, and statistical runs, were archived openly on Zenodo under the version tag v1.0.1-softx.
The executed COMPAS experiments reveal critical structural nuances in how federated attribution summaries behave under resource-constrained conditions. In the zero-noise regime with epsilon set to infinity, the raw attribution vectors produced by the protocol closely match the centralized oracle baseline. Specifically, the protocol achieved an L1 attribution error of 0.024 plus or minus 0.010, closely tracking the baseline methods, which ranged from 0.021 plus or minus 0.006 for shared-background SHAP to 0.037 plus or minus 0.011 for k-means background SHAP, while maintaining a positive Spearman rank correlation of 0.503 plus or minus 0.078 with the oracle feature importance rankings. However, despite generating accurate underlying raw feature vectors, the protocol exhibited an absolute ADI estimation error of 12.54 plus or minus 8.14 relative to the oracle, an order of magnitude higher than any baseline, where errors remained at or below 0.88.
The study provides a mechanistic explanation for this disparity divergence, identifying three interacting mathematical factors inherent to the standardized estimator rather than degraded attribution vectors. First, the protocol intentionally computes group means under group-conditioned backgrounds, which expands the numerator of the metric because genuine inter-group background differences enter the calculation. Second, ratio instability arises in the denominator because server-side aggregation and L2 clipping tend to equalize the norms of the two group summaries, shrinking their standard deviation toward the 0.001 floor and drastically inflating the standardized quotient. Third, at a coalition budget of M equals 64, individual client summaries have high sampling variance, meaning noise does not average out over ten clients the way it does across thousands of centralized instances. This variance amplification also explains the impact of differential privacy: as Gaussian noise enters the numerator additively over a floored denominator, the ADI error escalates monotonically from 12.54 at infinite epsilon to 92.21 at epsilon 8, 97.04 at epsilon 4, 102.33 at epsilon 2, and 106.28 at epsilon 1, dropping bootstrap confidence interval coverage of the oracle to zero percent for all noisy settings.
Analysis across the Dirichlet distribution grid demonstrates that data heterogeneity primarily destabilizes the standardized disparity index rather than the underlying model attributions. While the oracle disparity index remained stable across alpha levels at 4.67 to 4.74, and the protocol raw attribution L1 error held steady between 0.022 and 0.026, the absolute disparity gap expanded from 8.16 plus or minus 7.06 at alpha 0.1 to 14.73 plus or minus 7.90 at alpha 1.0, with bootstrap confidence interval coverage never exceeding 20 percent. Computational timing measurements confirm that KernelSHAP evaluations dominate execution time, scaling linearly with coalition counts, background sizes, and explained instances. A full experimental cell required 194.7 plus or minus 5.9 seconds on central processing units, with the protocol taking approximately 29 seconds per run due to dual client-group and faithfulness evaluation passes, while differential privacy noise introduced less than 1 percent computational overhead. The author emphasizes that these numerical findings define the specific operational boundaries of the executed low-compute COMPAS regime, providing a reproducible diagnostic benchmark for future research into decentralized explainability.
Subject of Research: Auditing background-induced attribution drift in federated Shapley additive explanations
Article Title: BA-FedSHAP: A reproducible toolkit for auditing background-induced attribution drift in federated SHAP explanations
Article References: Saurabh, R. (2026). BA-FedSHAP: A reproducible toolkit for auditing background-induced attribution drift in federated SHAP explanations. SoftwareX, 36, Article 103166. https://doi.org/10.1016/j.softx.2026.103166
Image Credits: AI Generated
DOI: 10.1016/j.softx.2026.103166
Keywords: federated learning, SHAP explanations, KernelSHAP, algorithmic fairness, attribution drift, differential privacy, Rényi differential privacy, Attribution Disparity Index, machine learning audit, Flower framework, COMPAS benchmark, model explainability, Dirichlet partitioning, trustworthy AI, reproducible research, fairness auditing
News Source: Blake Davidson. (November 26, 2026). Federated SHAP Auditing Toolkit Exposes Disparity Drift Under Decentralized Background Distributions. Scienmag.



