Early-bird price on the GenAI & Agentic AI Engineer Bootcamp batch. Grab a seat →

Generative AI is software that produces new text, images, audio or code by learning patterns from very large amounts of existing material. A large language model (LLM), the kind behind chat assistants, does one thing at its core: given the text so far, it predicts what should come next, one small piece at a time. That single mechanism explains both why these tools write so fluently and why they sometimes state false things with confidence.

Key takeaways

  • An LLM writes by predicting the next token (a word or part of a word) again and again. It does not look answers up in a database unless a tool gives it one.
  • Training builds the model once, from a huge body of text. Inference is what happens every time you send a prompt. Your chat does not retrain the model as you type.
  • The context window is the model's working memory for one conversation. Everything the model can use at that moment must fit inside it.
  • Confident wrong answers, often called hallucinations, are a natural result of the design. Giving the model source documents and asking for citations reduces them but does not remove them.
  • Before a team adopts an AI tool, check four things on your own material: what happens to your data, how accurate it is on your cases, what it costs at your volume, and who can access what.

What is generative AI, and what is a large language model?

Older AI systems mostly sorted or scored things: is this email spam, will this customer leave, what is in this photo. Generative AI produces new content instead. You give it an instruction, called a prompt, and it returns a draft, a summary, an image or a block of code.

A large language model is the text-producing kind. Anthropic's glossary describes LLMs as "AI language models with many parameters" that are trained on vast amounts of text and can generate text, answer questions and summarise information. Parameters are the numbers inside the model that training adjusts. You can think of them as millions of tiny dials that together store what the model has picked up about language and the world.

Three points are worth holding on to from the start:

  • An LLM is a prediction system. It has no built-in list of facts that it checks before answering.
  • It works on text you give it now plus patterns it absorbed during training. It does not know about your company, your files or yesterday's news unless that information is put in front of it.
  • The products you use (a chat app, a coding assistant, a search feature) wrap the model in extra parts: instructions, tools, search, file access. Much of the difference between products comes from those parts, not only from the model.

How does an LLM predict the next token?

A model does not read letters or whole sentences. It reads tokens, which are small units of text. A token can be a whole word, part of a word, a single character or a punctuation mark.

When you send a prompt, four things happen in a loop:

  1. Your text is split into tokens.
  2. The model looks at all the tokens so far and gives every token in its vocabulary a score for how likely it is to come next.
  3. One token is chosen, usually one of the likely ones.
  4. That token is added to the end of the text, and the loop runs again until the answer is complete.

A four-step loop shows a language model reading the text so far, scoring possible next tokens, picking one and adding it before repeating.

Here is a small made-up illustration. The numbers are invented to show the idea and are not measurements from any real model. Suppose the text so far is "The capital of France is":

Possible next tokenIllustrative likelihood
Parisvery high
alow
locatedlow
Lyonvery low

The model picks "Paris", adds it, and then predicts what follows "The capital of France is Paris". A full paragraph is this step repeated a few hundred times.

Two consequences follow from this design.

Fluency is not the same as truth. The model is trained to produce a likely continuation. For well-covered facts, the likely continuation is also the correct one. For an obscure question, a likely-sounding continuation may be wrong.

The same prompt can give different answers. A setting called temperature controls how much randomness is used when picking the next token. Anthropic's glossary explains that higher temperatures give more varied output and lower temperatures give more predictable output. It also notes that even at temperature 0 results are not fully deterministic, so identical inputs can still produce different outputs. If you need the same answer every time, an LLM alone is the wrong tool; you need rules, checks or stored results around it.

What is the difference between training and inference?

These two words describe two separate phases of a model's life, and mixing them up causes most beginner confusion.

Training is how the model is built. In pretraining, the model is shown a very large body of text and repeatedly asked to predict the next word. Each time it is wrong, its parameters are nudged slightly. Anthropic's glossary notes that models at this stage "are not inherently good at answering questions or following instructions". A second stage, fine-tuning, trains the model further on additional data so that it behaves like a helpful assistant, follows instructions and declines harmful requests. Training takes a great deal of computing power and is done by the model's maker, not by you.

Inference is the model being used. Every time you send a prompt and receive an answer, that is inference. The parameters are fixed at this point. The model reads your prompt, runs the prediction loop and returns text.

A left-to-right flow shows a model going through pretraining, fine-tuning and release before being used for inference each time someone sends a prompt.

TrainingInference
When it happensBefore release, over a long periodEvery time you send a prompt
Who does itThe model's makerYou, through an app or an API
What changesThe model's parametersNothing inside the model
Where knowledge comes fromThe training textThe training text plus whatever is in your prompt

This has practical effects:

  • A model only "knows" what was in its training text up to a certain date. For anything newer, it needs search or documents supplied at inference time.
  • Correcting a model in a chat does not teach it permanently. The correction lives in that conversation only. Some products add a memory feature, but that works by saving notes and feeding them back in as text, not by changing the model.
  • Whether a provider may later use your conversations to train future models is a policy question, and it differs between products and plans. That is one of the first things to check when you evaluate an AI tool before your team adopts it.

What are tokens and context windows?

Tokens are also the unit used to measure and bill AI usage. OpenAI's help centre gives a rule of thumb for English: one token is roughly four characters, and 100 tokens are roughly 75 words. Google's documentation gives a similar figure for Gemini models, about four characters per token. The ratio changes with the model and the language, so treat it as an estimate.

The context window is the amount of text a model can work with at one time. Anthropic's documentation calls it a "working memory" and makes clear that it includes everything: instructions, the conversation so far, any documents you attach, and the answer the model is writing. If something is not in the context window, the model cannot use it in that reply.

Context windows have grown large. As of November 2026, Anthropic's documentation lists a context window of one million tokens for many current Claude models, and Google's documentation lists the same order of size for current Gemini models. Bigger is not automatically better, though. Anthropic's documentation says plainly that as the token count grows, accuracy and recall degrade, an effect it calls context rot. A long, cluttered conversation can give worse answers than a short, focused one.

The article on tokens and context windows works through a token count and a cost estimate step by step.

Why do models make things up?

A hallucination is a confident answer that is false or not supported by the material the model was given. The US National Institute of Standards and Technology (NIST) uses the term confabulation and defines it as "the production of confidently stated but erroneous or false content". NIST also explains the cause in one sentence: confabulations "are a natural result of the way generative models are designed", because the model produces a statistically likely continuation, not a verified fact.

So this is not a bug that a future version will simply delete. It can be reduced. The most effective method is grounding: giving the model trusted source material at inference time and telling it to answer from that material. When the material is fetched automatically from a document store, the technique is called retrieval-augmented generation (RAG). Asking the model to quote and cite the passages it used makes each claim checkable by a person.

Vendors are clear that this helps but does not finish the job. Anthropic's guidance on reducing hallucinations ends with a caution that the techniques "don't eliminate them entirely" and that critical information should always be validated.

For the causes, a worked example and a checklist, see why AI models hallucinate and how grounding reduces it. If you want to build a grounded system, the guide to retrieval-augmented generation covers the engineering.

How do I get better answers from a prompt?

Because the model continues from the text it is given, the quality of that text matters a great deal. A vague prompt leaves the model to guess the audience, the length, the tone and the facts.

A prompt that works usually has four parts:

  • Role: who the model should act as, for example a careful HR adviser.
  • Context: the background and source material it needs, and why the task matters.
  • Examples: one or more samples of the output you want.
  • Format: the shape of the answer, such as a table, three bullets or a 120-word email.

Compare "Write about our leave policy" with "You are an HR adviser. Using only the policy text below, write a 120-word email to new joiners explaining how to apply for annual leave. Use plain English and end with the HR contact address." The second prompt removes most of the guessing.

Anthropic's prompting guide offers a useful test: show your prompt to a colleague who has little context on the task. If they would be confused, the model will be too.

The article on how to write a prompt that works has a full before-and-after example and a reusable template.

What are LLMs good at, and where do they fall short?

Usually works wellNeeds care or checking
Drafting, rewriting and changing toneFacts, figures, dates, names and quotations
Summarising text you provideLegal, medical and financial conclusions
Extracting fields from documents into a tableArithmetic and counting without a calculation tool
Explaining a concept at a chosen levelAnything after the model's training date, without search
Generating first-draft code and testsDecisions that affect people, such as hiring or lending
Brainstorming optionsLong tasks where early mistakes carry forward

A sensible working rule: use the model freely where a mistake is cheap and easy to spot, and add human review where a mistake is costly or hard to see. NIST's generative AI profile names over-reliance and automation bias, the habit of trusting a system's output too readily, as risks in their own right.

Models can also be connected to tools, so that they search, run code or update records, and work through a task in several steps. Systems built this way are called agents. They raise the stakes of every point above, because the model's output becomes an action. The guide to AI agents explains how they work and when a simpler design is enough.

How should a team choose an AI tool?

Vendor demonstrations show the best case. Your own documents and questions show the real case. A short, structured trial tells you more than a feature list.

Check four things:

  1. Data use. Is what you type used to train future models? How long is it kept, and who can see it? Policies differ between consumer and business plans from the same provider.
  2. Accuracy on your cases. Collect 20 to 30 real examples with known good answers, run them, and score the results.
  3. Cost. Per-seat subscriptions are simple to predict. Usage-based pricing is charged per token, and output tokens usually cost more than input tokens.
  4. Security and access. Who can sign in, which files and systems the tool can reach, and what it does if a document contains hidden instructions.

For a structure that risk and compliance teams will recognise, the NIST AI Risk Management Framework is a good reference. It is voluntary, was first released in January 2023, and organises the work into four functions: Govern, Map, Measure and Manage. NIST published a companion profile for generative AI in July 2024.

The full checklist, with a scoring sheet, is in how to evaluate an AI tool before your team adopts it.

Common questions

Does an LLM understand what it writes?

It models patterns in language well enough to summarise, translate, explain and write code. Whether that counts as understanding is still debated among researchers. For practical purposes, treat it as a capable drafter whose work needs checking, not as an authority.

Does the model learn from my conversations?

Not while you are chatting. The model's parameters do not change during inference. Whether your conversations are stored and later used to train a future version depends on the provider and the plan, so read the data policy for the product you actually use.

Why did I get a different answer to the same question?

Token selection includes some randomness, and vendors state that outputs are not fully deterministic even at the lowest temperature setting. Ask twice for anything important. If the two answers disagree on a fact, check it.

Is a bigger context window always better?

No. A larger window lets you include more material, but vendors document that accuracy and recall fall as the context fills up. Give the model the material that matters for the task, not everything you have.

Do I need to code to use generative AI at work?

No. Writing clear prompts, supplying good source material and checking output are the core skills, and none needs code. Coding becomes useful when you want to automate a task or connect a model to your own data.

Free download: The AI fundamentals field guide

How large language models work, why they get things wrong, how to write a prompt that works and how to judge a tool before your team adopts it. Plain English, no coding. See what’s inside.