Implicit N-grams Induced by Recurrence

Xiaobing Sun, Wei Lu
5/5/2022
cs.CL
transformer-attention

Official code: richardsun-voyager/inibr (5 stars, Jupyter Notebook, last commit 2022-05-15).

Abstract

Although self-attention based models such as Transformers have achieved remarkable successes on natural language processing (NLP) tasks, recent studies reveal that they have limitations on modeling sequential transformations (Hahn, 2020), which may prompt re-examinations of recurrent neural networks (RNNs) that demonstrated impressive results on handling sequential data. Despite many prior attempts to interpret RNNs, their internal mechanisms have not been fully understood, and the question on how exactly they capture sequential features remains largely unclear.

Show full abstract

In this work, we present a study that shows there actually exist some explainable components that reside within the hidden states, which are reminiscent of the classical n-grams features. We evaluated such extracted explainable features from trained RNNs on downstream sentiment analysis tasks and found they could be used to model interesting linguistic phenomena such as negation and intensification. Furthermore, we examined the efficacy of using such n-gram components alone as encoders on tasks such as sentiment analysis and language modeling, revealing they could be playing important roles in contributing to the overall performance of RNNs. We hope our findings could add interpretability to RNN architectures, and also provide inspirations for proposing new architectures for sequential data.

View on arXivView PDF

Code Implementations(1)

Investigating how RNNs capture ngrams

50Jupyter Notebook, PythonApr 17, 20224 years ago

Similar Papers

Cite this paper

@article{sun2022implicit,
  title  = {Implicit N-grams Induced by Recurrence},
  author = {Xiaobing Sun and Wei Lu},
  year   = {2022},
  eprint = {2205.02724},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.02724}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2205.02724.svg)](https://codeofpaper.com/paper/2205.02724)

Discussion