How Generative AI Creates Text
- Author: Georgi Papucharov
- Created at:
- Time to read: 5 min.
When you ask an AI assistant such as ChatGPT a question, the language model builds its answer one token at a time. A token is a unit of text: it can be a word, part of a word, a punctuation mark, or a fragment that includes a space. The model scores possible continuations based on the context, selects the next token, and repeats. Many modern language models use this approach to produce text. It is called autoregressive generation.
Start with an unfinished sentence: “We sent the client a quote for a new …”. “Website,” “store,” and “contract” are all plausible continuations. If the conversation was about a product catalogue and online payments, some become more likely than others. The token splits, scores, and diagrams below are illustrative.
1. What is a token, and how is text split into tokens?
A tokenizer converts text into a sequence of numeric identifiers. The word “website” might be one token or several, depending on the tokenizer. A leading space can be part of a token too. That is why a word count and a token count are different.
2. How do tokens become vectors?
A token ID identifies the text fragment. The model looks up a learned list of numbers for that ID, called an embedding. Its layers then transform that representation using position and context. The representation of “store” in a conversation about checkout can end up different from the representation of the same word in a conversation about renting retail space.
3. What does attention do in a language model?
Attention lets the model combine information from different positions in the available context. For example, “product catalogue” and “online payments” may matter more for completing the sentence about the quote than the client’s name. The arrows in the diagram illustrate the idea. They are not measurements from an actual model, or proof of why it produced a particular answer.
4. What do Transformer layers do?
A Transformer uses layers with attention and other mathematical operations to refine token representations. Think of the representation of “new” gaining useful information about what the conversation is about. The diagram shows a sequence of transformations. Individual layers do not have to map neatly to tasks such as grammar or logic.
5. How does the model select the next token?
After processing the context, the model assigns scores to candidate next tokens. Those scores can be turned into probabilities used to choose the continuation. In our example, a continuation like “website” might be more likely than “contract” because the discussion concerns online sales. A full word may take several choices to generate. A high probability tells you what fits the context according to the model. It tells you nothing by itself about what the team actually quoted.
6. What do temperature and top-p change?
When sampling is used, temperature controls how strongly the selection favors higher scoring tokens. A lower temperature concentrates the distribution. Top-p restricts sampling to the most likely tokens whose probabilities add up to the chosen threshold. Both settings can change variety. Neither verifies a fact, and whether these controls are available depends on the model and interface.
7. How does one token become a full answer?
The selected token becomes part of the context for the next choice. That is how “a quote for a new” might grow into “a quote for a new website with an online store.” This is called autoregressive generation: what has already been generated helps determine what comes next. An early wrong assumption can therefore carry through the rest of the answer. Showing the reply on screen in pieces is a choice made by the application delivering it.
Why can language models sound confident and still be wrong?
Fluent text is not evidence that a fact was checked. Given a mention of a quote, a model may produce a plausible price or delivery date even when neither was supplied. An application can retrieve relevant records from search, documents, or a business system and give them to the model as context. The result still depends on retrieving the right record and representing it accurately.
The model learns patterns during training that help it summarize, classify, and write code. Using information supplied in an ordinary conversation is different from updating the model’s trained parameters.
What does this mean for AI in business software?
When we discuss an AI integration at Sirius Software, my first question is: What does the person handling this task check before they send a reply today? That helps us decide what the model can handle, which checks belong in the software, and when a person should make the call.
Take the quote for an online store. The language model can draft the email, but the price and delivery date should come from the approved quote. If the date is missing, the system should send the draft for review rather than make a promise to the customer. The same principle applies when extracting data from invoices: the software checks the fields against rules and routes ambiguous cases to a person.
For me, the most useful test is to deliberately give the system an incomplete quote: leave out the date, include two versions of the price, or add a discount that has not been approved. If the system stops and tells the reviewer exactly what needs checking, it is closer to being useful in everyday work.
If the model also needs to take actions, see what an AI agent is and how businesses can use one. If you have a workflow in mind, contact Sirius Software for a free initial consultation. Tell us what data goes in, what result you need, and what someone currently checks by hand.
Sources
Other articles
Read more articles from Sirius Software
AI Agent for Ecommerce: Managing Products and Auto...
- Created at: 2026-11-25