HackerPapers

arXiv:2112.09174cs.CL

Learning Bounded Context-Free-Grammar via LSTM and the Transformer:Difference and Explanations

Hui Shi, Sicun Gao, Yuandong Tian, Xinyun Chen, Jishen Zhao

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

Long Short-Term Memory (LSTM) and Transformers are two popular neural architectures used for natural language processing tasks. Theoretical results show that both are Turing-complete and can represent any context-free language (CFL).In practice, it is often observed that Transformer models have better representation power than LSTM. But the reason is barely understood. We study such practical differences between LSTM and Transformer and propose an explanation based on their latent space decomposition patterns. To achieve this goal, we introduce an oracle training paradigm, which forces the decomposition of the latent representation of LSTM and the Transformer and supervises with the transitions of the Pushdown Automaton (PDA) of the corresponding CFL. With the forced decomposition, we show that the performance upper bounds of LSTM and Transformer in learning CFL are close: both of them can simulate a stack and perform stack operation along with state transitions. However, the absence of forced decomposition leads to the failure of LSTM models to capture the stack and stack operations, while having a marginal impact on the Transformer model. Lastly, we connect the experiment on the prototypical PDA to a real-world parsing task to re-verify the conclusions

arXiv comments
Accepted By AAAI22
Journal reference
DOI
Subjects
cs.CLComputation and Language

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Mar 2023 to Mar 2023.

Comments linking this paper, per year.

Discussed in comments1 thread

  1. Caricaturing Noam Chomsky 1 comment
    • > A TM cannot learn an arbitrary CFG. It needs constraints. Well sure, because CFGs can have unbounded depth, and all real brains are finite. But they can learn bounded CFGs: https://arxiv.org/abs/2112.09174 > Our brains are much more complex than an artificial NN, though. Yes…

      naaskingView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.