06 · 2017 · The idea behind modern chatbots
An LSTM reads one letter at a time and hopes its memory holds on. A transformer lets every letter look at every earlier letter at once and decide which ones matter. That mechanism is called attention, and it is the core of nearly every large language model.
Type a sentence below. The picture shows, for each letter, how strongly it attends to the letters before it. This tiny model (2 layers, 4 heads each) was trained on the same text as the LSTM page, so you can compare the two.
How it works
Layer
Head
Next letter guesses