How it works
AI chatbots write their answers by repeatedly guessing what comes next.
A large language model is trained on enormous amounts of text to predict what comes next. Given "The capital of France is", it learns that "Paris" is very likely.
To answer you, it predicts a small chunk of text, adds it to the conversation and predicts again, hundreds of times, until the reply is complete.