# How recurrent networks implement contextual processing in sentiment analysis

arXiv: https://arxiv.org/abs/2004.08013 · HTML: https://mlsanity.com/paper/2004.08013/

## Key facts

- Cited by 11 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 17 Apr 2020.

## Built on by (most cited first, 11 of 11)

- [Auxiliary Tasks and Exploration Enable ObjectNav](https://mlsanity.com/paper/2104.04112/) (2021)
- [Reverse engineering recurrent neural networks with Jacobian switching linear dynamical systems](https://mlsanity.com/paper/2111.01256/) (2021)
- [Bifurcations and loss jumps in RNN training](https://mlsanity.com/paper/2310.17561/) (2023)
- [An Operator Theoretic Approach for Analyzing Sequence Neural Networks](https://mlsanity.com/paper/2102.07824/) (2021)
- [Implicit N-grams Induced by Recurrence](https://mlsanity.com/paper/2205.02724/) (2022)
- [A Review of Hybrid and Ensemble in Deep Learning for Natural Language Processing](https://mlsanity.com/paper/2312.05589/) (2023)
- [Understanding How Encoder-Decoder Architectures Attend](https://mlsanity.com/paper/2110.15253/) (2021)
- [Category-orthogonal object features guide information processing in recurrent neural networks trained for object categorization](https://mlsanity.com/paper/2111.07898/) (2021)
- [From Data-Fitting to Discovery: Interpreting the Neural Dynamics of Motor Control through Reinforcement Learning](https://mlsanity.com/paper/2305.11107/) (2023)
- [Hyper Hawkes Processes: Interpretable Models of Marked Temporal Point Processes](https://mlsanity.com/paper/2511.01096/) (2025)
- [A Population-Level Analysis of Neural Dynamics in Robust Legged Robots](https://mlsanity.com/paper/2306.15793/) (2023)

## Abstract (arXiv)

Neural networks have a remarkable capacity for contextual processing--using recent or nearby inputs to modify processing of current input. For example, in natural language, contextual processing is necessary to correctly interpret negation (e.g. phrases such as "not bad"). However, our ability to understand how networks process context is limited. Here, we propose general methods for reverse engineering recurrent neural networks (RNNs) to identify and elucidate contextual processing. We apply these methods to understand RNNs trained on sentiment classification. This analysis reveals inputs that induce contextual effects, quantifies the strength and timescale of these effects, and identifies sets of these inputs with similar properties. Additionally, we analyze contextual effects related to differential processing of the beginning and end of documents. Using the insights learned from the RNNs we improve baseline Bag-of-Words models with simple extensions that incorporate contextual modification, recovering greater than 90% of the RNN's performance increase over the baseline. This work yields a new understanding of how RNNs process contextual information, and provides tools that should provide similar insight more broadly.
