Contextual Decomposition

Description

Contextual Decomposition explains LSTM and RNN predictions by decomposing the final hidden state into contributions from individual inputs and their interactions. Unlike simpler attribution methods, it separates the direct contribution of specific words or phrases from the contextual effects of surrounding words. This is particularly useful for understanding how sequential models process language, as it can identify whether a word's influence comes from its individual meaning or from its interaction with nearby words in the sequence.

Example Use Cases

Explainability

Analysing why an LSTM-based spam filter flagged an email by decomposing contributions from individual words ('free', 'urgent') versus their contextual interactions ('free trial' together).

Understanding how a medical text classifier diagnoses conditions from clinical notes by separating direct symptom mentions from contextual medical reasoning patterns.

Transparency

Providing transparent explanations for automated content moderation decisions by showing which words and phrase interactions contributed to toxicity detection.

Limitations

  • Primarily designed for LSTM and simple RNN architectures, not suitable for modern transformers or attention-based models.
  • Not widely implemented in standard machine learning libraries, often requiring custom implementation.
  • Computational overhead increases significantly with sequence length and model depth.
  • May not scale well to very complex models or capture all types of feature interactions in deep networks.

Resources

Beyond Word Importance: Contextual Decomposition to Extract Interactions from LSTMs
Research PaperW. James Murdoch, Peter J. Liu, and Bin YuJan 16, 2018
FredericGodin/ContextualDecomposition-NLP
Software Package
Interpreting patient-Specific risk prediction using contextual decomposition of BiLSTMs: Application to children with asthma
Research PaperAlsaad R. et al.Jan 1, 2019
Towards Hierarchical Importance Attribution: Explaining Compositional Semantics for Neural Sequence Models
Research PaperXisen Jin et al.Nov 8, 2019
Efficient Automated Circuit Discovery in Transformers using Contextual Decomposition
Research PaperAliyah R. Hsu et al.Jul 1, 2024

Tags

Applicable Models:
Data Requirements:
Data Type:
Evidence Type:
Expertise Needed:
Explanatory Scope:
Technique Type: