How does ChatGPT work? ChatGPT is based on the transformer architecture, which includes an encoder and a decoder. The encoder takes in the input text and encodes it into a set of hidden states. The decoder then uses these hidden states to generate the output text.