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.