Estimands: Shapley vs Banzhaf

An estimand is the quantity a run targets; mllm-shap records it apart from the estimator that samples coalitions. Shapley, Banzhaf and two semivalues differ only in their coalition-size weights. How to choose comes last.

Shapley value

The Shapley value \(\phi_i\) (Shapley values and axioms) weights a coalition \(S \not\ni i\) of size \(k\) by

\[w_{\mathrm{Shapley}}(k, n) = \frac{k!\,(n-k-1)!}{n!}\]

Implemented in ShapleyAggregator.

Banzhaf index

The Banzhaf index (Banzhaf–Coleman power index in voting) weights all coalitions equally, \(w_{\mathrm{Banzhaf}}(k, n) = 2^{-(n-1)}\):

\[\beta_i(v) = \frac{1}{2^{n-1}} \sum_{S \subseteq N \setminus \{i\}} \bigl(v(S \cup \{i\}) - v(S)\bigr)\]

In a threshold game it is the chance that \(i\) is pivotal when each other player joins with probability \(1/2\). It need not add up. Banzhaf (1965) introduced it for weighted voting; Dubey & Shapley (1979) studied it. Implemented in BanzhafAggregator.

Semivalues

A semivalue mixes Banzhaf-type weights over an inclusion probability \(t\), so one coalition sample serves all of them.

  • Weighted Banzhaf: each other player joins with probability \(p \in (0, 1)\), \(w(k, n) = p^k (1-p)^{n-1-k}\); \(p = 1/2\) is Banzhaf. Option p, default 0.3.

  • Beta Shapley (Kwon and Zou, 2022) draws \(t \sim \mathrm{Beta}(\beta, \alpha)\): \(w(k, n) = B(k + \beta,\, n - 1 - k + \alpha) / B(\alpha, \beta)\). \(\alpha > \beta\) favours small coalitions; \(\alpha = \beta = 1\) is Shapley. Options alpha (default 4) and beta (default 1).

Implemented in BetaShapleyAggregator and WeightedBanzhafAggregator; usage: Using estimand aggregators.

Weight per coalition size

Size \(k\) holds \(\binom{n-1}{k}\) coalitions without \(i\), so its total weight is \(\binom{n-1}{k}\,w(k, n)\). Each aggregator with default options:

Code for this figure
from math import comb

import matplotlib.pyplot as plt

from mllm_shap import (
    BanzhafAggregator,
    BetaShapleyAggregator,
    ShapleyAggregator,
    WeightedBanzhafAggregator,
)

n = 10
fig, ax = plt.subplots(figsize=(6.4, 3.2))
for aggregator, label, color in (
    (ShapleyAggregator(), "Shapley", "#2a78d6"),
    (BanzhafAggregator(), "Banzhaf", "#eb6834"),
    (BetaShapleyAggregator(), "Beta Shapley (4, 1)", "#1baf7a"),
    (WeightedBanzhafAggregator(), "weighted Banzhaf (0.3)", "#6250d6"),
):
    total = [comb(n - 1, k) * aggregator.coalition_weight(k, n) for k in range(n)]
    ax.plot(range(n), total, marker="o", color=color, label=label)
ax.set(xlabel="coalition size k", ylabel="total weight of size k", xticks=range(n))
ax.spines[["top", "right"]].set_visible(False)
ax.legend(frameon=False, loc="upper left", bbox_to_anchor=(1, 1))

Total weight per coalition size, n = 10

Shapley flat at 0.1; Banzhaf a bell at sizes 4 and 5; Beta Shapley falling from 0.31 at size 0; weighted Banzhaf peaking at sizes 2 and 3.

Shapley weighs sizes evenly, Banzhaf favours half-size coalitions, the semivalue defaults favour small ones.

When Shapley and Banzhaf diverge

Additive games give \(a_i\) under both. In the three-player majority game (lattice) player 1’s marginals are 0, 1, 1, 0 at sizes 0, 1, 1, 2:

Estimand

Per-player value

Shapley

\(\tfrac13 \cdot 0 + \tfrac16 + \tfrac16 + \tfrac13 \cdot 0 = \tfrac13\)

Banzhaf

\(\tfrac14 (0 + 1 + 1 + 0) = \tfrac12\)

The test suite locks this divergence on identical coalition samples.

Sampling and labels

Averaging sampled marginals without Shapley weights targets a Banzhaf-type quantity, yet is often labelled Shapley (Štrumbelj & Kononenko 2014; Fryer et al. 2021). Here every ExplainResult carries an Estimand, stored in the archive’s RunManifest. Aggregators follow the EstimandAggregator protocol (mllm_shap.estimation.estimands). On partial samples they use per-size means: What the aggregator computes from partial samples.

Choosing an estimand

Need

Estimand

Attributions sum to the utility change

Shapley

Classical fairness axioms, SHAP-style reporting

Shapley

Pivotal (swing) influence per token

Banzhaf

Uniform coalition averaging, voting-power study

Banzhaf

More weight on small or sparse coalitions

Beta Shapley or weighted Banzhaf

References

  • Shapley, L. S. (1953). A value for n-person games. In H. W. Kuhn & A. W. Tucker (Eds.), Contributions to the Theory of Games II (pp. 307–317). Princeton University Press. DOI:10.1515/9781400881970-018

  • Banzhaf, J. F. (1965). Weighted voting doesn’t work: A mathematical analysis. Rutgers Law Review, 19(2), 317–343.

  • Dubey, P., & Shapley, L. S. (1979). Mathematical properties of the Banzhaf power index. Mathematics of Operations Research, 4(2), 99–131. DOI:10.1287/moor.4.2.99

  • Kwon, Y., & Zou, J. (2022). Beta Shapley: a unified and noise-reduced data valuation framework for machine learning. AISTATS 2022, PMLR 151. arXiv:2110.14049

  • Štrumbelj, E., & Kononenko, I. (2014). Explaining prediction models and individual predictions with feature contributions. Knowledge and Information Systems, 41(3), 647–665. DOI:10.1007/s10115-013-0679-x

  • Lundberg, S. M., & Lee, S.-I. (2017). A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems, 30. ML Anthology; arXiv:1705.07874

  • Fryer, D. V., Strümke, I., & Nguyen, H. D. (2021). Shapley values for feature selection: The good, the bad, and the axioms. IEEE Access, 9, 144352–144360. arXiv:2102.10936

  • Ethayarajh, K., & Jurafsky, D. (2021). Attention flows are Shapley value explanations. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers) (pp. 49–54). ACL Anthology; arXiv:2105.14652