• All the colored branches are based on the Transformer neural network architecture. If we allow for a lot of handwaving, a transformer allows each word to look at other words in the sequence in order to make decisions/produce output.

      In a decoder transformer architecture, each word can only look at the words that come before it in the sequence. Such models are naturally suited for the task of next word prediction: you can ask each word to predict what word comes next, and they can look at all the words before them, but cannot “cheat” by looking ahead. These models are used for text generation: start with an empty sequence, and repeatedly predict what word should come next.

      On the other hand, in an encoder architecture, each word can look at every other word, in front of and behind it. You can’t use these for next word prediction, since they can cheat, but they are commonly used for masked language modeling, a task where we delete some words from the input and then try to predict which words were deleted. It isn’t straightforward to generate text with these models, but they can learn a lot of deep statistical properties of text, which can then be used for other tasks/models.

      Some model architectures might use both encoders and decoders, but I am not too familiar with how they are used for language modeling. The classic example of such a model is a translation system, which would use an encoder to “encoder” the source language text, and the decoder to generate target language text from that encoding.