Concept icon
Concept

RNN Sequence Processing Complexity

In a recurrent neural network (RNN) processing a sequence of length nn, updating the dd-dimensional hidden state involves a multiplication with a dimesdd imes d weight matrix, leading to a computational cost of O(d2)\mathcal{O}(d^2) per step. Consequently, the total computational complexity for the entire recurrent layer is O(nd2)\mathcal{O}(nd^2). Because the hidden state must be updated iteratively one token at a time, there are O(n)\mathcal{O}(n) sequential operations that cannot be parallelized, and the maximum path length between any two tokens is similarly O(n)\mathcal{O}(n).

0

1

Concept icon
Updated 2026-09-07

Tags

D2L

Dive into Deep Learning @ D2L

Prep Sessions

Transformer Architecture and Large Language Model Capabilities @ University of Michigan - Ann Arbor

Ch.1 Transformer Architecture Fundamentals - Transformer Architecture and Large Language Model Capabilities @ University of Michigan - Ann Arbor

Sequential Computation Constraints in Recurrent Networks - Transformer Architecture and Large Language Model Capabilities @ University of Michigan - Ann Arbor