← Lab
shapcast
confirmedupstream bugPython · captum / PyTorchSystems & data structuresJuly 25, 2026
the question
Does captum's ShapleyValueSampling accumulate attributions in the model's output dtype?
what came out
captum's ShapleyValues and ShapleyValueSampling build total_attrib with hardcoded dtype=torch.float, downgrading float64 models to float32, while the sibling FeatureAblation reads the forward dtype. Under a large dynamic range (A=1e8) completeness is 100% violated: exact [1,1] collapses to [1,0]. The fix is dtype=attrib_type.
method & receipts
- Result: confirmed
- Reproducible — one script re-runs the whole thing from scratch.
- Tested — a correctness/benchmark suite ships alongside the code.
→ read the code and re-run it
github.com/v-code01/shapcast