Modeladvanced
Cache language model
Also called Kuhn-De Mori cache model.
Interpolate a static language model with a unigram or bigram model of the recent words in the document, since words just used tend to recur.
A cache language model adds a short-term memory to a static language model. Text is not a sequence of independent draws: a word that appeared a moment ago, such as a name or the topic of a news story, is much more likely than usual to appear again. A static n-gram model cannot see this, because its counts come from the whole training corpus and its history is only the last words. The cache model keeps the last words of the current document, builds a unigram (or bigram) distribution from them, and mixes it with the static model at a fixed weight. Kuhn and De Mori introduced the idea for speech recognition in 1990, with one cache for each part-of-speech class.
The machine
Parts. A static model , trained once, with the last words; a cache size ; a weight .
State. The cache holds the last words of the current document and their counts , with .
The prediction. For the next word , with the last words,
Both parts are distributions over the vocabulary, so the mixture is one too. At the start of a document the cache is empty and is taken as 0.
The update. After is known, add one to , and if the cache holds more than words, subtract one for the oldest. This is a sliding window of counts. In evaluation is the true next word of the test text; in a speech recognizer it is the recognized word.
Variants of the cache part.
- A bigram cache uses for the previous word , often together with the unigram cache.
- A class cache, as in Kuhn and De Mori, keeps one cache for each part-of-speech class and mixes with the static inside a model over class trigrams.
- A decaying cache gives each past occurrence a weight that falls with its distance, in place of the hard window.
- A neural cache (Grave, Joulin and Usunier) stores the hidden state of a recurrent model at each recent position together with the word that followed, and weights each stored word by the similarity of its state to the current one.
An example. Let the static trigram give a rare name , and let the name occur 4 times among the last words, so . With ,
about 21 times the static value. A word that is not in the cache gets times its static probability. So the cache helps a word exactly when , and costs every other word the factor .
What it counts
The model is measured by its perplexity on test text, read in order, with the cache filled from the test words already seen, and in a speech recognizer by the word error rate. The cost of a prediction is the cost of the static model plus expected time for the cache: one hash table lookup for , and for the update when the count of the window is kept. A full distribution over the vocabulary costs more, or more if only the cached words are changed and the rest is scaled by . The memory is . The weight , and , are set on held-out documents, for example by the EM procedure of deleted interpolation.
Relation to other models
- Static n-gram model. With it is the static model.
- Linear interpolation. The cache model is a mixture of two models with a fixed weight, the same form as deleted interpolation and Jelinek-Mercer smoothing, but one of the two parts changes as the document is read.
- Adaptive models in compression. An adaptive model updates its counts after each symbol. Prediction by partial matching and context mixing do this for every context, which makes them caches of every order with no static part.
- Trigger models. A maximum entropy language model with trigger features, as in Rosenfeld (1996), generalizes the self-trigger of the cache: a word in the history can raise the probability of other related words, not only of itself.
- Topic models. A model such as latent Dirichlet allocation explains the same burstiness of words with a document-level topic mixture.
- Recurrent models. A recurrent neural network language model can in principle remember recent words in its state, but in practice an explicit cache still helps it, which is the point of the neural cache.
- Caches in computing. The name comes from the memory cache, which also keeps recently used items because they are likely to be used again. Here nothing is evicted by a policy; the window simply moves.
Known results in the model
- A proper distribution. For any the mixture of two distributions is a distribution, so perplexity is well defined.
- A gain on recurring words. The model gains exactly on the words whose cache probability exceeds their static probability, as in the example. For a good static model, most of these are content words of the current topic: names, numbers and the words of the subject.
- Perplexity against error rate. Caches give large perplexity reductions, but the reduction of the word error rate is often much smaller. One reason is that a recognizer fills the cache with its own output, so an error makes the same error more likely later in the document.
- Part-of-speech caches. Kuhn and De Mori tested a cache for each part-of-speech class on text of the LOB corpus and reported a lower perplexity than the same model without the cache. A correction to the paper appeared in 1992.
- Word models. Jelinek and colleagues (1991) put caches of the recent text into a word trigram model for speech recognition, so that the cache works on words directly and needs no tagger.
- Neural models. Grave, Joulin and Usunier (2017) showed that a cache of recent hidden states lowers the perplexity of LSTM language models, with no extra training, and that it can use a very large window.
References
- Roland Kuhn and Renato De Mori, A cache-based natural language model for speech recognition, IEEE Transactions on Pattern Analysis and Machine Intelligence 12(6), 1990, pages 570 to 583, the cache component for each part-of-speech class, mixed with the static word probabilities of a model over part-of-speech trigrams, tested on the LOB corpus
- Kuhn and De Mori 1992, the correction to the 1990 paper
- Jelinek, Merialdo, Roukos and Strauss 1991, a word trigram model interpolated with caches of the recent text
- Grave, Joulin and Usunier 2017, the neural cache, which stores recent hidden states with the words that followed them
- Goodman 2001, the section on caching, one of the improvements of n-gram models that the report compares on the same data
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag K67FPM Edit this page History Report an error Markdown