Lesson 8.5ModelCode~1 h 25 min
A neural language model
Swap the count table for a network that sees several letters at once — and train it here.
Module 8 · 0/8 done
More context, smarter guesses
The bigram model only sees one letter. Seeing three would help enormously — after “emm”, the next letter is very likely “a”. But a count table for 3 letters of context needs 27 × 27 × 27 × 27 ≈ half a million cells, most of them never seen even once. Counting doesn’t scale.
In 2003, Yoshua Bengio and colleagues proposed a neural network instead. Each context letter is turned into an embedding; the embeddings are joined together and passed through a hidden layer; a softmax at the end gives the probability of every possible next letter.