What backpropagation through time keeps
complexity▲▲△A batch of sequences of length trains a layer of width in float32. Under the storage scheme of I.10.B05, how many bytes of activations does a plain tanh layer keep for the backward pass, and how many does an LSTM layer keep? How do both scale with , and what does inference need instead?
Hint
The plain cell stores one -vector per step and sequence; the LSTM stores six.
Solution
The plain layer stores bytes, MiB. The LSTM stores six times as much, bytes, MiB. Both grow linearly in : doubling the sequence doubles the storage.
Streaming inference keeps only the current state: for the plain cell, and for the LSTM, about numbers, independent of . The distinction of I.9 holds for gated cells too: constant inference memory says nothing about training memory. Truncated backpropagation or checkpointing reduces the training figure at the costs I.9 described.