Papers › How recurrent networks implement contextual processing in sentiment analysis

How recurrent networks implement contextual processing in sentiment analysis

17 Apr 2020ICML 2020 1arXiv:2004.08013archive 2025-07-28

Niru Maheswaranathan, David Sussillo

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.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2004.08013")

Code

Syntology Ran 0 of 19 code samples harvested from 1 repository linked to this paper; 19 have no recorded run.

By repository: community (archive-listed): 19 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

google-research/computation-thru-dynamics mentioned on GitHubjaxApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

19 samples harvested; 0 ran; 0 honoured the contract we drafted; 19 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

19unverified

Licence: 0 of the 19 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from google-research/computation-thru-dynamics. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

affine google-research/computation-thru-dynamics/integrator_rnn_tutorial/rnn.py community (archive-listed) unverified Apache-2.0 (permissive) · aced411c40f5de2f · report
diag_gaussian_log_likelihood google-research/computation-thru-dynamics/lfads_tutorial/distributions.py community (archive-listed) unverified Apache-2.0 (permissive) · 896edacf34bb8bd8 · report
diag_gaussian_sample google-research/computation-thru-dynamics/lfads_tutorial/distributions.py community (archive-listed) unverified Apache-2.0 (permissive) · 0b1d13b86e3d6a9e · report
get_fp_loss_fun google-research/computation-thru-dynamics/fixed_point_finder/fixed_points.py community (archive-listed) unverified Apache-2.0 (permissive) · 34a73dab2ffc9aa7 · report
get_kl_warmup_fun google-research/computation-thru-dynamics/lfads_tutorial/optimize.py community (archive-listed) unverified Apache-2.0 (permissive) · 2cc94ae064dc4dd7 · report
get_total_fp_loss_fun google-research/computation-thru-dynamics/fixed_point_finder/fixed_points.py community (archive-listed) unverified Apache-2.0 (permissive) · c873384736c6ede9 · report
gru google-research/computation-thru-dynamics/fixed_point_finder/rnn.py community (archive-listed) unverified Apache-2.0 (permissive) · 3976c1f7c4e6dab7 · report
keygen google-research/computation-thru-dynamics/fixed_point_finder/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 295c6b5c69a5cfa0 · report
merge_losses_dicts google-research/computation-thru-dynamics/fixed_point_finder/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 3fad852c8d126922 · report
plot_data_example google-research/computation-thru-dynamics/lfads_tutorial/plotting.py community (archive-listed) unverified Apache-2.0 (permissive) · 23408171ea05d4c3 · report
plot_data_pca google-research/computation-thru-dynamics/lfads_tutorial/plotting.py community (archive-listed) unverified Apache-2.0 (permissive) · 5f40340057d4af85 · report
plot_data_stats google-research/computation-thru-dynamics/lfads_tutorial/plotting.py community (archive-listed) unverified Apache-2.0 (permissive) · ae64d899719d4eb9 · report
poisson_log_likelihood google-research/computation-thru-dynamics/lfads_tutorial/distributions.py community (archive-listed) unverified Apache-2.0 (permissive) · a80bb6e1b393fe43 · report
read_file google-research/computation-thru-dynamics/fixed_point_finder/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 670f241a0a278e35 · report
sigmoid google-research/computation-thru-dynamics/fixed_point_finder/rnn.py community (archive-listed) unverified Apache-2.0 (permissive) · deee5acedc65539b · report
sigmoid google-research/computation-thru-dynamics/lfads_tutorial/lfads.py community (archive-listed) unverified Apache-2.0 (permissive) · 48f60e785be2e858 · report
spikify_data google-research/computation-thru-dynamics/lfads_tutorial/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 846c9d4c4a3c7b6c · report
split_data google-research/computation-thru-dynamics/lfads_tutorial/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 1f5c168fff169bd8 · report
vrnn google-research/computation-thru-dynamics/integrator_rnn_tutorial/rnn.py community (archive-listed) unverified Apache-2.0 (permissive) · 61a25573238a87a1 · report

Tasks

NegationSentiment AnalysisSentiment Classification

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections