Inferensys

Glossary

SHAP

A unified framework based on Shapley values from cooperative game theory that assigns each genomic feature an importance score for a particular prediction.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
SHAPLEY ADDITIVE EXPLANATIONS

What is SHAP?

A unified framework for interpreting model predictions by assigning each input feature an importance value for a particular prediction, based on cooperative game theory.

SHAP (SHapley Additive exPlanations) is a unified framework that assigns each genomic feature an importance score for a particular prediction by computing its marginal contribution across all possible feature subsets. It is grounded in Shapley values from cooperative game theory, ensuring a fair distribution of credit among input nucleotides or regions.

The framework satisfies three desirable properties: local accuracy, missingness, and consistency. In genomic models, SHAP values quantify exactly how much each nucleotide position or motif changes a prediction from the baseline, providing a theoretically rigorous alternative to gradient-based methods like Integrated Gradients or DeepLIFT for regulatory compliance and model debugging.

Axiomatic Foundations

Core Properties of SHAP

SHAP (SHapley Additive exPlanations) is a unified framework that assigns each genomic feature an importance score for a specific prediction, grounded in the rigorous axioms of cooperative game theory.

01

Local Accuracy (Completeness)

The sum of all feature attributions must equal the difference between the model's output for a specific instance and the average model output over the dataset. This axiom guarantees that the prediction is fully and fairly decomposed among the input features.

  • Mathematical Form: f(x) = φ₀ + Σᵢ φᵢ
  • Genomic Context: For a variant effect predictor, the sum of all nucleotide-level SHAP values exactly accounts for the predicted functional score, leaving no unexplained residual.
  • Practical Implication: This property is critical for regulatory compliance, as it provides a complete accounting of a model's decision logic for any single genomic sequence.
100%
Attribution Coverage
02

Missingness

A feature that is absent from the input—often represented by a baseline or reference value—must receive an attribution of zero. This ensures that non-existent information does not artificially influence the explanation.

  • Implementation: In genomic models, missing features are typically represented by replacing the original nucleotide with a reference token or a neutral embedding vector.
  • Edge Case: When analyzing a structural variant, genomic regions that are deleted in the alternate allele are assigned zero importance, preventing spurious attributions to absent sequence.
0
Attribution for Absent Features
03

Consistency (Monotonicity)

If a model changes so that a feature's marginal contribution increases or stays the same regardless of other features, the SHAP value for that feature must not decrease. This axiom guarantees that attribution methods are faithful to the underlying model's reliance on features.

  • Model Comparison: When comparing two genomic models—one that relies more heavily on a splice site motif and another that does not—the SHAP values for the splice site region will be strictly higher in the first model.
  • Sanity Check: This property is tested during Attribution Sanity Checks by randomizing model layers; SHAP values for a randomized model must degrade appropriately, confirming sensitivity to learned parameters.
04

Symmetry

Two features that contribute identically to every possible subset of other features must receive identical SHAP values. This ensures that the attribution method treats functionally equivalent features without bias.

  • Genomic Example: Two perfectly redundant transcription factor binding motifs in a promoter region that always have the same effect on gene expression predictions will be assigned equal importance scores.
  • Contrast with Heuristics: Unlike perturbation-based methods that may arbitrarily favor one redundant feature over another due to ordering effects, SHAP's symmetry axiom guarantees deterministic, fair allocation of credit.
05

Additivity

When a prediction is the sum of multiple model outputs, the SHAP value for a feature is the sum of its SHAP values from each component model. This property enables the decomposition of complex ensemble predictions.

  • Ensemble Genomics: For a gradient-boosted tree ensemble predicting pathogenicity, the SHAP value for a missense variant is the sum of its SHAP values across all individual decision trees.
  • Layer-wise Relevance: In deep genomic networks, this axiom allows attributions to be propagated backward through layers, connecting DeepSHAP approximations to the exact Shapley value framework.
06

Efficiency in Coalition Sampling

Exact SHAP computation requires evaluating all 2^N feature coalitions, which is intractable for high-dimensional genomic sequences. KernelSHAP addresses this by solving a weighted linear regression on a sampled subset of coalitions, prioritizing those with few or many features present.

  • Sampling Strategy: For a 1000-base pair sequence, KernelSHAP samples coalitions according to a Shapley kernel weighting scheme, dramatically reducing computation while preserving the theoretical guarantees.
  • DeepSHAP Alternative: For deep learning models, DeepSHAP leverages DeepLIFT's backpropagation rules to approximate SHAP values in a single forward and backward pass, achieving linear-time complexity for genomic sequences with millions of nucleotides.
2^N
Exact Coalition Count
O(N)
DeepSHAP Complexity
COMPARATIVE ANALYSIS

SHAP vs. Other Genomic Attribution Methods

A feature-level comparison of SHAP against Integrated Gradients, DeepLIFT, and In-silico Mutagenesis for interpreting genomic sequence models.

FeatureSHAPIntegrated GradientsDeepLIFTIn-silico Mutagenesis

Theoretical Foundation

Shapley values from cooperative game theory

Path integral of gradients along a baseline

Backpropagation with reference activation comparison

Systematic perturbation of every nucleotide position

Axiomatic Completeness

Model Agnostic

Nucleotide-Level Resolution

Computational Cost (per variant)

High (exponential in features)

Medium (50-300 integration steps)

Low (single backward pass)

Very High (4 x sequence length)

Handles Saturation Effects

Requires Baseline Selection

Captures Feature Interactions

SHAP EXPLAINER

Frequently Asked Questions

Clear, technically precise answers to the most common questions about Shapley Additive Explanations and their application to genomic sequence models.

SHAP (SHapley Additive exPlanations) is a unified framework for interpreting machine learning model predictions by assigning each input feature an importance score—called a Shapley value—for a specific prediction. It is grounded in cooperative game theory, where each feature is treated as a 'player' contributing to a 'payout' (the prediction). The Shapley value for a feature is computed as the weighted average of its marginal contribution across all possible feature coalitions. Formally, for a model f and input x, the SHAP value φ_i for feature i is:

code
φ_i = Σ_{S ⊆ N \ {i}} [|S|! (|N|-|S|-1)! / |N|!] * [f_x(S ∪ {i}) - f_x(S)]

where N is the set of all features and f_x(S) is the model's prediction conditioned on the feature subset S. This formulation guarantees three desirable properties: local accuracy (the sum of SHAP values equals the difference between the prediction and the average prediction), missingness (absent features have zero impact), and consistency (if a model changes so a feature's contribution increases, its SHAP value does not decrease). In genomic applications, SHAP quantifies exactly how much each nucleotide position or motif contributed to a prediction such as variant pathogenicity or transcription factor binding.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.