Skip to main content
QUICK REVIEW

[Paper Review] Improving Neural Language Models with a Continuous Cache

Édouard Grave, Armand Joulin|arXiv (Cornell University)|Dec 13, 2016
Topic ModelingComputer Science98 citations
TL;DR

This paper adds a lightweight continuous cache of past hidden states to neural language models, enabling online adaptation to recent context without retraining, and shows significant perplexity gains across multiple datasets including LAMBADA.

ABSTRACT

We propose an extension to neural network language models to adapt their prediction to the recent history. Our model is a simplified version of memory augmented networks, which stores past hidden activations as memory and accesses them through a dot product with the current hidden activation. This mechanism is very efficient and scales to very large memory sizes. We also draw a link between the use of external memory in neural network and cache models used with count based language models. We demonstrate on several language model datasets that our approach performs significantly better than recent memory augmented networks.

Motivation & Objective

  • Motivate the need for adapting neural language models to recent history in dynamic contexts.
  • Propose a lightweight neural cache that stores past hidden activations and retrieves predictions via dot-product matching.
  • Show that the neural cache can be added on top of a pre-trained LM with little cost and no memory transformer training.
  • Evaluate the approach on multiple language modeling benchmarks to quantify perplexity improvements.

Proposed method

  • Store recent hidden states h_i and the corresponding next word x_{i+1} as memory entries (h_i, x_{i+1}).
  • Compute p_cache(w | h_{1..t}, x_{1..t}) by a dot-product based lookup over stored keys h_i, with a temperature-like parameter theta controlling sharpness.
  • Define final prediction as either a linear interpolation p(w|h_{1..t},x_{1..t}) = (1-λ)p_vocab(w|h_t) + λ p_cache(w|h_{1..t},x_{1..t}) or a global softmax over vocabulary and cache entries with alpha controlling cache weight.
  • Train the base recurrent LM as usual; apply the cache only at test time; tune theta and alpha/λ on validation.

Experimental results

Research questions

  • RQ1Does a continuous neural cache improve word prediction when added to a pre-trained neural LM without retraining?
  • RQ2How does cache size affect perplexity across small to large datasets?
  • RQ3How does linear interpolation compare to global normalization for combining cache and base LM predictions?
  • RQ4Can large caches (thousands of entries) be practically used with negligible computational cost?

Key findings

  • Neural cache improves perplexity across multiple datasets compared to baselines and memory-augmented nets.
  • On Penn Tree Bank, linear interpolation with the neural cache yields a test perplexity of 72.1 versus 86.9 base and 74.6 best interpolation with other methods.
  • On wikitext2, neural cache achieves 81.6 (size 100) and 68.9 (size 2,000) perplexity, outperforming the base LSTM and smaller caches.
  • On wikitext103, neural cache with large cache size achieves 40.8 perplexity (size 2,000).
  • On the Lambada dataset, neural cache substantially improves performance over the LSTM baseline; dev perplexity ≈ 138 and control perplexity ≈ 129 for the neural cache model.
  • The cache approach scales to thousands of memory cells with minimal computational overhead and can be applied on top of pre-trained models without fine-tuning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.