Paper · Visualizing and Understanding Recurrent Networks
Open the sourceThis paper, co-authored by Karpathy with Justin Johnson and Li Fei-Fei, uses character-level language models as an interpretable testbed to study what LSTMs actually learn. It shows interpretable cells that track long-range structure (line length, quotes, brackets), traces LSTM gains over n-gram baselines to long-range dependencies, and breaks down remaining errors with a sequence of oracles, finding that scaling up mostly fixes short-range n-gram errors.
- The authors argue that judging models only by final test-set perplexity hides where performance comes from and limits better architecture design. - Character-level language modeling on War and Peace and Linux Kernel source serves as a controlled, interpretable testbed spanning low and high structure. - LSTMs contain interpretable cells, such as a line-length counter and quote or indentation trackers, even beyond the 100-character truncated backprop horizon. - Comparisons with n-gram and n-NN baselines show LSTMs win mainly on structural characters needing long-range reasoning, like closing braces and carriage returns. - Training dynamics suggest the LSTM 'grows' competence from short to longer dependencies over training. - Oracle-based error breakdown shows scaling the model 26x almost entirely fixes n-gram errors, suggesting new architectures rather than just scaling may be needed.
Based on Andrej Karpathy's public content. Not affiliated with or endorsed by Andrej Karpathy.
Supports these rules
Quotes from this video
“we break down the performance into interpretable categories and study individual error types.”
“We believe that this type of error breakdown is a valuable tool for isolating and understanding the source of improvements provided by new proposed models.”
“we use character-level language models as an interpretable testbed for illuminating the long-range dependencies learned by LSTMs.”
“Our goal is not to compete with previous work but rather to study recurrent networks in a controlled setting”
“it could be argued that even if the LSTM is in principle capable of using these operations, practical optimization challenges (i.e. SGD dynamics, or approximate gradients due to truncated backpropagation through time) might prevent it from discovering these solutions.”
“In this section we test this hypothesis by comparing an LSTM with baseline models that can only utilize information from a fixed number of previous steps.”
“This analysis provides some evidence that it might be necessary to develop new architectural improvements instead of simply scaling up the basic model.”
“The sizes of hidden layers of the other models were carefully chosen so that the total number of parameters in each case is as close as possible to these 4 settings.”