SHAP vs LIME vs Gradient Methods: Choosing the Right Technique
SHAP Strengths and Weaknesses
Strengths: Theoretically sound (Shapley values). Consistent: identical features get identical attributions. Additive: contributions sum to prediction minus baseline. TreeSHAP is exact and fast (10-50ms) for tree models. Weaknesses: Computationally expensive for non-tree models. KernelSHAP approximation can be unstable. Assumes feature independence, which rarely holds.
LIME Strengths and Weaknesses
Strengths: Model-agnostic. Faster than SHAP (10-50ms). Intuitive output (linear coefficients). Works for tabular, text, and images. Weaknesses: Inconsistent: similar inputs may get different feature rankings. Depends on perturbation strategy. No theoretical correctness guarantee. Can miss non-linear boundaries.
Gradient-Based Methods
For neural networks, compute how each input affects output via partial derivatives. Integrated Gradients: Accumulates gradients along path from baseline to input. Satisfies completeness. Fast (single forward/backward pass, 5-20ms). Saliency maps: Gradient magnitude. Very fast but noisy. Best for deep learning where SHAP/LIME are too slow.
Decision Framework
Tree models: TreeSHAP (fast, exact). Regulatory requirements: SHAP for theoretical soundness. Real-time latency: LIME or gradients. Neural networks: Integrated Gradients. Need consistency: Avoid LIME. Need speed: LIME or distilled models.