Regression estimators and hierarchical players¶
leverage, kernel_banzhaf and proxy fit a model to masks and payoffs: every
coalition informs every player, and reanalyze refits from the archive. Each keeps the
empty and grand coalitions and draws pairs \((S, N\setminus S)\), so it needs
\(2n + 2\) masks or more. Benchmarks: Estimator benchmark.
Leverage SHAP¶
Shapley values solve
For \(n = 6\), one word gets \(k = 5 / (6 \cdot 1 \cdot 5) = 1/6\), three words \(5 / (20 \cdot 3 \cdot 3) = 1/36\). Size \(s\) totals \((n-1) / (s(n-s))\): 1 for size 1, 5/9 for size 3.
Code for this figure
from math import comb
import matplotlib.pyplot as plt
n = 10
sizes = range(1, n)
kernel = [(n - 1) / (comb(n, s) * s * (n - s)) for s in sizes]
fig, (one, total) = plt.subplots(1, 2, figsize=(7.2, 3.0), layout="constrained")
one.semilogy(sizes, kernel, marker="o", color="#2a78d6")
one.set(xlabel="coalition size s", ylabel="k(S) of one coalition", xticks=sizes)
total.plot(sizes, [comb(n, s) * k for s, k in zip(sizes, kernel)], marker="o",
color="#2a78d6")
total.set(xlabel="coalition size s", ylabel="sum of k(S) over size s", xticks=sizes,
ylim=(0, 1.1))
for ax in (one, total):
ax.spines[["top", "right"]].set_visible(False)
Kernel SHAP weight at n = 10
From the formula. A half-size coalition weighs 70 times less than a singleton, but there are many, so each size keeps over a third of the singleton total.
A size-\(s\) coalition has leverage score \(\binom{n}{s}^{-1}\) (Musco and Witter
2025): equal total per size. leverage splits pairs over sizes by that mass, enumerates
a size its share covers and samples the rest without replacement, with weight
\(k(S)\binom{n}{s} / m_s\) for \(m_s\) draws of size \(s\). Eliminating one
player enforces the constraint, so values add up at every budget and are exact on the full
table. Shapley only.
Kernel Banzhaf¶
Banzhaf values are the slopes of the least-squares linear fit of \(v\) on presence
under uniform coalitions (Liu et al. 2024; Wang and Jia 2023). kernel_banzhaf draws
distinct uniform pairs and fits \(v(S) \approx \beta_0 + \sum_i (\mathbf 1_{i \in S} -
\tfrac12)\beta_i\). The centred columns are orthogonal on the full table, so it is exact
there. Banzhaf only.
ProxySHAP¶
proxy (extra mllm-shap[proxy]) is ProxySHAP of order 1 (Thies et al. 2026):
gradient-boosted trees (100 trees, depth 3, fixed seed) fit to leverage-sampled masks. A
leaf is the game \(c\,[P \subseteq S,\ A \cap S = \emptyset]\), with \(P\) present
and \(A\) absent on its path, \(p = |P|\), \(a = |A|\). Its Shapley values are
\(c\,(p-1)!\,a!/(p+a)!\) on \(P\) and \(-c\,p!\,(a-1)!/(p+a)!\) on \(A\);
its Banzhaf values \(\pm c / 2^{p+a-1}\). Summing leaves gives the proxy’s exact
values. Under 30 players or from 16 masks per player, stratified means of the residual
\(v - \text{proxy}\) are added back (Witter et al. 2025): exact on the full table.
Both estimands.
The efficiency option of mc¶
mc (Stratified SVARM, Kolpaczki et al. 2024) need not add up on a partial sample.
explanation.efficiency: additive shifts all Shapley values equally until they do. This
projects onto the efficiency hyperplane, which holds the exact values, so the
\(\ell_2\) error never grows.
Illustrative. Two players; the arrow is the equal shift.¶
Example: \(v(N) - v(\emptyset) = 3\) moves \(\hat\phi = (2.0, 2.2)\) to \((1.4, 1.6)\); against exact \((1.0, 2.0)\) the error falls from 1.02 to 0.57.
Hierarchical players¶
With players: sentences, explain_hierarchical() runs two
games with one estimator and budget rule. The coarse game has a player per paragraph (or
message, hierarchical.group_by). In the keep_fraction of groups with the largest
absolute values, sentences become players; other text stays present. Paragraph scores
approximate sums of sentence scores (Liu et al. 2025), so top sentences usually sit in kept
groups, for a fraction of the flat game’s calls. Fine values belong to the second game;
each game has its own run id.
References¶
Musco, C., Witter, R. T. (2025). Provably Accurate Shapley Value Estimation via Leverage Score Sampling. ICLR 2025. https://arxiv.org/abs/2410.01917
Liu, Y., Witter, R. T., Korn, F., Alrashed, T., Paparas, D., Musco, C., Freire, J. (2024). Kernel Banzhaf: A Fast and Robust Estimator for Banzhaf Values. arXiv:2410.08336. https://arxiv.org/abs/2410.08336
Wang, J. T., Jia, R. (2023). Data Banzhaf: A Robust Data Valuation Framework for Machine Learning. AISTATS 2023, PMLR 206. https://proceedings.mlr.press/v206/wang23e.html
Thies, S. M. A. R., Baniecki, H., Witter, R. T., Hüllermeier, E., Muschalik, M., Fumagalli, F. (2026). ProxySHAP. NeurIPS 2026. https://arxiv.org/abs/2605.22738
Witter, R. T., Liu, Y., Musco, C. (2025). Regression-Adjusted Monte Carlo Estimators for Shapley Values and Probabilistic Values. NeurIPS 2025. https://arxiv.org/abs/2506.11849
Kolpaczki, P., Bengs, V., Muschalik, M., Hüllermeier, E. (2024). Approximating the Shapley Value without Marginal Contributions. AAAI 2024 38(12). https://doi.org/10.1609/aaai.v38i12.29225
Liu, F., Kandpal, N., Raffel, C. (2025). AttriBoT: A Bag of Tricks for Efficiently Approximating Leave-One-Out Context Attribution. ICLR 2025. https://arxiv.org/abs/2411.15102