paper-with-me

홈 › Papers

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

2021-12-16 · Hui Shi, Sicun Gao, Yuandong Tian, Xinyun Chen, Jishen Zhao

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

📄 PDF Abstract BibTeX arXiv:2112.09174

Code (1)

shihui2010/learn_cfg_with_neural_network 공식 구현 pytorch

Methods 이 논문이 사용한 방법론

Multi-Head Attention 설명 없음
Attention 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Label Smoothing Label Smoothing is a regularization technique that introduces noise for the labels. This accounts for the fact that datasets may have mistakes in them, so maximizing the…
Absolute Position Encodings Absolute Position Encodings are a type of position embeddings for [Transformer-based models] where positional encodings are…
Residual Connection 설명 없음
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Tanh Activation 설명 없음

Similar Papers 제목 키워드 기반

An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars

2026-06-16 · Vinoth Nandakumar, Qiang Qu, Pramod Thebe, Sakshi Khachariya 외 arxiv

Deep neural networks are widely believed to derive their expressive power from their ability to form \textbf{hierarchical representations}, capturing progressively more abstract and compositional features across layers. …

Stay Within Your Bounds: Distance-Guided Decoding for Guaranteed Context-Free Grammar Compliance

2026-08-28 · Vincenzo Collura, Karim Tit, Eleonora Giunchiglia, Mike Papadakis 외 arxiv

Grammar-constrained decoding helps large language models produce syntactically valid structured outputs, such as code, JSON, and SQL. For context-free grammars, many practical decoders enforce local prefix feasibility: e…

Marginal Inference queries in Hidden Markov Models under context-free grammar constraints

2022-06-26 · Reda Marzouk, Colin de la Higuera

The primary use of any probabilistic model involving a set of random variables is to run inference and sampling queries on it. Inference queries in classical probabilistic models is concerned by the computation of margin…

On the Computational Complexity and Formal Hierarchy of Second Order Recurrent Neural Networks

2023-09-26 · Ankur Mali, Alexander Ororbia, Daniel Kifer, Lee Giles

Artificial neural networks (ANNs) with recurrence and self-attention have been shown to be Turing-complete (TC). However, existing work has shown that these ANNs require multiple turns or unbounded computation time, even…

Unsupervised Grammar Induction with Depth-bounded PCFG

2018-02-23 · TACL 2018 1 · Lifeng Jin, Finale Doshi-Velez, Timothy Miller, William Schuler 외

There has been recent interest in applying cognitively or empirically motivated bounds on recursion depth to limit the search space of grammar induction models (Ponvert et al., 2011; Noji and Johnson, 2016; Shain et al.,…