Regularizing and Optimizing LSTM Language Models
Paper · 2017 · Stephen Merity, Nitish Shirish Keskar and Richard Socher
Summary
LSTM language models overfit easily. Many earlier recurrent regularizers change the cell itself, so they cannot use fast fused kernels such as NVIDIA cuDNN. The authors build a recipe, AWD-LSTM, that leaves the standard LSTM untouched. Its core is the weight-dropped LSTM: a DropConnect mask is sampled once per forward/backward pass and applied to the hidden-to-hidden matrices, so the same recurrent weights stay disabled at every timestep. Training uses NT-ASGD, a form of averaged SGD with a constant learning rate. It starts averaging automatically once validation perplexity has stopped improving for several checks. Other additions are randomized BPTT lengths, embedding dropout, activation regularization (AR), temporal activation regularization (TAR), weight decay and tied, reduced-size embeddings. On Penn Treebank and WikiText-2 the model reached state-of-the-art perplexities of 57.3 and 65.8. Adding a neural cache lowered these to 52.8 and 52.0. The work shows that a plain, well-regularized and well-optimized LSTM can beat custom recurrent cells while staying cheap to run.
Key points
- Headline test perplexities are 57.3 on PTB and 65.8 on WikiText-2. With a continuous cache pointer they drop to 52.8 (PTB) and 52.0 (WikiText-2).
- NT-ASGD adds two hyperparameters: a logging interval L, set to one epoch of iterations, and a non-monotone interval n = 5. The same setting worked across models and datasets.
- Ablations show that removing weight-dropping hurts most, raising perplexity by up to 11 points (WT2 validation 78.4). Without NT-ASGD, PTB validation reaches 66.3.
- Making embeddings as large as the hidden state grows the model to 43M (PTB) and 70M (WT2) parameters and costs almost 8 perplexity points. Fixed BPTT lengths cost about one point. Dropping embedding dropout, AR/TAR or weight decay costs 2–6 points.
- Per-word analysis of the cache on WikiText-2 shows that most of its gain comes from <unk> and rare names such as Meridian (161 occurrences), Churchill and Sonic. It hurts frequent tokens like punctuation and stop words.
Interesting ideas
- I1. Regularize the recurrent weights rather than the hidden states, so a fast black-box kernel can still be used unchanged; this keeps speed and regularization from competing.
- I2. Make an irreversible training switch, such as starting weight averaging, only after the validation metric has failed to improve over a window of several checks, not at the first bad reading; this keeps noise from forcing a premature decision.
- I3. Randomize the length of training windows so that no position always lands at a window edge and gets starved of context; fixed slicing quietly wastes data.
- I4. Assess a component by summing its loss change per word type, which shows exactly where it helps (rare names) and where it hurts (frequent function words).
- I5. A memory of recently seen words pays off mainly for rare proper names that recur within a document, which argues for mixing a local memory with a general model according to their relative strengths.
For Mova
How these ideas could serve Mova, our small open language model — its files, stages and tests:
- I1 (tree): gparse could apply DropConnect-style masks to its weight matrices before each pass, without leaving optimized GPU kernels.
- I2 (learn): the same patient trigger could decide when to start averaging perceptron weights or when to freeze a model trained on silver data.
- I3 (learn): when batching treebank or silver text for the transformer parser, jittering chunk boundaries would give every token varied left context.
- I4 (learn): evaluation could report per-lemma or per-deprel gains and losses for each new repair rule, with frequent-token rows acting as a negative control.
- I5 (world): entity tracking could favour recently mentioned rare names when resolving mentions, and leave frequent words to the general model.
Fields, topics and concepts
Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksArtificial Intelligence · 18,805 worksArts and Humanities · 17,959 worksLanguage and Linguistics · 17,789 works
Topics 1Research subjects and languages the work is about.Language models & pretraining · 4,145 works
Cite
Cite as Stephen Merity, Nitish Shirish Keskar and Richard Socher. 2017. Regularizing and Optimizing LSTM Language Models. arXiv:1708.02182.
@misc{merity2017regularizing,
title = {{Regularizing and Optimizing LSTM Language Models}},
author = {Stephen Merity, Nitish Shirish Keskar and Richard Socher},
year = {2017},
doi = {10.48550/arxiv.1708.02182},
eprint = {1708.02182},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.1708.02182}
}References
- Arjovsky, M., Shah, A., and Bengio, Y. Unitary evolution recurrent neural networks. In International Conference on Machine Learning, pp. 1120–1128, 2016. our card
- Ba, J., Kiros, J., and Hinton, G. E. Layer normalization. CoRR, abs/1607.06450, 2016. OpenAlex ↗ · Scholar ↗
- Balduzzi, D. and Ghifary, M. Strongly-typed recurrent neural networks. arXiv preprint arXiv:1602.02218, 2016. OpenAlex ↗ · Scholar ↗
- Bottou, L., Curtis, F. E., and Nocedal, J. Optimization methods for large-scale machine learning. arXiv preprint arXiv:1606.04838, 2016. our card
- Bradbury, J., Merity, S., Xiong, C., and Socher, R. Quasi-Recurrent Neural Networks. arXiv preprint arXiv:1611.01576, 2016. our card
- Cooijmans, T., Ballas, N., Laurent, C., and Courville, A. C. Recurrent batch normalization. CoRR, abs/1603.09025, 2016. OpenAlex ↗ · Scholar ↗
- Duchi, J., Hazan, E., and Singer, Y. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 120 (Jul):0 2121–2159, 2011. OpenAlex ↗ · Scholar ↗
- Földiák, P. Learning invariance from transformation sequences. Neural Computation, 30 (2):0 194–200, 1991. OpenAlex ↗ · Scholar ↗
- Gal, Y. and Ghahramani, Z. A theoretically grounded application of dropout in recurrent neural networks. In NIPS, 2016. our card
- Goyal, P., Dollár, P., Girshick, R., Noordhuis, P., Wesolowski, L., Kyrola, A., Tulloch, A., Jia, Y., and He, K. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017. our card
- Grave, E., Joulin, A., and Usunier, N. Improving neural language models with a continuous cache. arXiv preprint arXiv:1612.04426, 2016. our card
- Hardt, M., Recht, B., and Singer, Y. Train faster, generalize better: Stability of stochastic gradient descent. arXiv preprint arXiv:1509.01240, 2015. OpenAlex ↗ · Scholar ↗
- Hinton, G. E. Connectionist learning procedures. Artificial intelligence, 400 (1-3):0 185–234, 1989. OpenAlex ↗ · Scholar ↗
- Inan, H., Khosravi, K., and Socher, R. Tying Word Vectors and Word Classifiers: A Loss Framework for Language Modeling. arXiv preprint arXiv:1611.01462, 2016. our card
- Ioffe, S. and Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. OpenAlex ↗ · Scholar ↗
- Jing, L., Shen, Y., Dubček, T., Peurifoy, J., Skirlo, S., Tegmark, M., and Soljačić, M. Tunable Efficient Unitary Neural Networks (EUNN) and their application to RNN. arXiv preprint arXiv:1612.05231, 2016. OpenAlex ↗ · Scholar ↗
- Jonschkowski, R. and Brock, O. Learning state representations with robotic priors. Auton. Robots, 39:0 407–428, 2015. OpenAlex ↗ · Scholar ↗
- Keskar, N. and Saon, G. A nonmonotone learning rate strategy for sgd training of deep neural networks. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on, pp. 4974–4978. IEEE, 2015. OpenAlex ↗ · Scholar ↗
- Kim, Y., Jernite, Y., Sontag, D., and Rush, A. M. Character-aware neural language models. In Thirtieth AAAI Conference on Artificial Intelligence, 2016. our card
- Kingma, D. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. our card
- Koehn, P., Hoang, H., Birch, A., Callison-Burch, C., Federico, M., Bertoldi, N., Cowan, B., Shen, W., Moran, C., Zens, R., Dyer, C., Bojar, O., Constantin, A., and Herbst, E. Moses: Open source toolkit for statistical machine translation. In ACL, 2007. OpenAlex ↗ · Scholar ↗
- Krueger, D., Maharaj, T., Kramár, J., Pezeshki, M., Ballas, N., Ke, N., Goyal, A., Bengio, Y., Larochelle, H., Courville, A., et al. Zoneout: Regularizing RNNss by randomly preserving hidden activations. arXiv preprint arXiv:1606.01305, 2016. OpenAlex ↗ · Scholar ↗
- Luciw, M. and Schmidhuber, J. Low complexity proto-value function learning from sensory observations with incremental slow feature analysis. Artificial Neural Networks and Machine Learning–ICANN 2012, pp. 279–287, 2012. OpenAlex ↗ · Scholar ↗
- Mandt, S., Hoffman, M. D., and Blei, D. M. Stochastic gradient descent as approximate bayesian inference. arXiv preprint arXiv:1704.04289, 2017. OpenAlex ↗ · Scholar ↗
- Melis, G., Dyer, C., and Blunsom, P. On the State of the Art of Evaluation in Neural Language Models. arXiv preprint arXiv:1707.05589, 2017. OpenAlex ↗ · Scholar ↗
- Merity, S., Xiong, C., Bradbury, J., and Socher, R. Pointer Sentinel Mixture Models. arXiv preprint arXiv:1609.07843, 2016. our card
- Merity, S., McCann, B., and Socher, R. Revisiting activation regularization for language rnns. arXiv preprint arXiv:1708.01009, 2017. OpenAlex ↗ · Scholar ↗
- Mikolov, T. and Zweig, G. Context dependent recurrent neural network language model. SLT, 12:0 234–239, 2012. OpenAlex ↗ · Scholar ↗
- Mikolov, T., Karafiát, M., Burget, L., Cernocký, J., and Khudanpur, S. Recurrent neural network based language model. In INTERSPEECH, 2010. OpenAlex ↗ · Scholar ↗
- Panageas, I. and Piliouras, G. Gradient descent converges to minimizers: The case of non-isolated critical points. CoRR, abs/1605.00405, 2016. OpenAlex ↗ · Scholar ↗
- Polyak, B. and Juditsky, A. Acceleration of stochastic approximation by averaging. SIAM Journal on Control and Optimization, 300 (4):0 838–855, 1992. OpenAlex ↗ · Scholar ↗
- Press, O. and Wolf, L. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016. our card
- Semeniuta, S., Severyn, A., and Barth, E. Recurrent dropout without memory loss. In COLING, 2016. OpenAlex ↗ · Scholar ↗
- Seo, M., Min, S., Farhadi, A., and Hajishirzi, H. Query-Reduction Networks for Question Answering. arXiv preprint arXiv:1606.04582, 2016. OpenAlex ↗ · Scholar ↗
- Srivastava, N., Hinton, G., Krizhevsky, A., Sutskever, I., and Salakhutdinov, R. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:0 1929–1958, 2014. our card
- Sutskever, I., Martens, J., Dahl, G., and Hinton, G. On the importance of initialization and momentum in deep learning. In International conference on machine learning, pp. 1139–1147, 2013. OpenAlex ↗ · Scholar ↗
- Tallec, C. and Ollivier, Y. Unbiasing truncated backpropagation through time. arXiv preprint arXiv:1705.08209, 2017. OpenAlex ↗ · Scholar ↗
- Tieleman, T. and Hinton, G. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 40 (2):0 26–31, 2012. OpenAlex ↗ · Scholar ↗
- Wan, L., Zeiler, M., Zhang, S., LeCun, Y, and Fergus, R. Regularization of neural networks using dropconnect. In Proceedings of the 30th international conference on machine learning (ICML-13), pp. 1058–1066, 2013. OpenAlex ↗ · Scholar ↗
- Wilson, A. C, Roelofs, R., Stern, M., Srebro, N., and Recht, B. The marginal value of adaptive gradient methods in machine learning. arXiv preprint arXiv:1705.08292, 2017. OpenAlex ↗ · Scholar ↗
- Wisdom, S., Powers, T., Hershey, J., Le Roux, J., and Atlas, L. Full-capacity unitary recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 4880–4888, 2016. OpenAlex ↗ · Scholar ↗
- Zaremba, W., Sutskever, I., and Vinyals, O. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014. our card
- Zilly, J. G., Srivastava, R. K., Koutník, J., and Schmidhuber, J. Recurrent highway networks. arXiv preprint arXiv:1607.03474, 2016. OpenAlex ↗ · Scholar ↗
- Zoph, B. and Le, Q. V. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016. our card
This page in Markdown https://md.research.elamur.ai/free/en/papers/merity-2017-regularizing-optimizing-lstm-language-models/