Understanding the encoder-decoder model in AI