PaTz β€” Physics-Aware Transformer with eXplainability
● API Offlinepatz_env

Model Interpretability

XAI SUITE

Complete explainability suite for PaTz. IG attribution and MC Dropout uncertainty are fully implemented. Real results available for all 525 test proteins.

πŸ’‘
β€”
Proteins Explained
IG + MC Dropout
βœ…
β€”
Low Uncertainty
H[p] < 0.20
⚠
β€”
High Uncertainty
H[p] > 0.40
πŸ”¬
3 live
XAI Methods
IG, MC Dropout, pair-IG
Interpretability Methods
DONE
Integrated Gradients (IG)

Per-residue attribution from Captum. Baseline: zero embedding. 50 Riemann interpolation steps. real residue_attributions stored in results/xai_results.json for all 525 test proteins.

β†’ Open Integrated Gradients (IG) page
DONE
MC Dropout Uncertainty

N=20 stochastic forward passes at inference. Predictive entropy H[p] per protein. Variance across MC samples per GO term. High-entropy proteins flagged as uncertain.

β†’ Open MC Dropout Uncertainty page
LIVE
Residue-Pair Attribution (Outer-Product IG)

LΓ—L pairwise importance matrix from outer product of per-residue IG scores. proxy for Pairformer attention. Live interactive visualization on the Attention page.

β†’ Open Residue-Pair Attribution (Outer-Product IG) page
NOT IN CODEBASE
SHAP Values (Kernel)

Shapley value estimation via Kernel SHAP. Not feasible on 6 GB GPU (5,000+ forward passes per protein). IG provides equivalent per-residue attribution with better axiomatic guarantees.

β†’ Open SHAP Values (Kernel) page
NOT IN CODEBASE
LIME (Local Explanations)

Local Interpretable Model-agnostic Explanations. Not implemented β€” perturbation sampling prohibitive for variable-length protein sequences. IG + MC Dropout covers local explanation needs.

β†’ Open LIME (Local Explanations) page
DESIGN READY
Probing Classifiers

Linear probes on intermediate Pairformer h_i (256-dim) and z_ij (64-dim) representations to decode what biological features are encoded. Secondary structure, solvent accessibility, contact number.

Predictive Entropy Distribution (n=0)
MC Dropout H[p] per test protein. Low entropy = confident prediction.
Loading entropy data…
Probing Classifier Design (Planned Experiment)
Secondary Structure (3-class)
Target: H (helix), E (strand), C (coil)
Input: h_i (256-dim), all 4 layers
Expected: Expected ~75–85%
Solvent Accessibility
Target: RSA binned 0–5 (relative)
Input: h_i post layer 4
Expected: Expected ~65%
Contact Number
Target: Low/Med/High CΞ± contacts
Input: z_ij row-mean (64-dim)
Expected: Expected ~70%
GO Namespace
Target: MF / BP / CC 3-class
Input: Protein emb (256-dim)
Expected: Expected ~80%

Probe classifiers train a 1-hidden-layer MLP on frozen Pairformer representations. Accuracy measures how much biological info is encoded at each layer.

IG Attribution β€” How It Works in PaTz
βœ“ Completeness

Ξ£α΅’ IG(xα΅’) = f(x) βˆ’ f(x_baseline). The sum of per-residue attributions equals the model output change from baseline. Guaranteed by Captum implementation.

βš™ Baseline Choice

Baseline = zero embedding vector (all-zero ESM-2 embedding). Represents an uninformative "null" protein. Attribution measures deviation from null prediction.

🏷 Per-GO Attribution

IG computed separately for each GO term prediction. Residue i importance for GO:XXXXXXX = βˆ«β‚€ΒΉ βˆ‚f_{GO}/βˆ‚xα΅’ Β· (xα΅’ βˆ’ xΜƒα΅’) dΞ±, 50 Riemann steps.