Also available in: Português

AI Fundamentals: AI, LLMs, Tokens and Parameters

Today, the most visible part of AI for developers is generative AI, especially LLMs, which process text as tokens, use a large number of parameters tuned during training, and generate outputs by predicting the most likely next unit of text given a context.

AI agents go one step further: they use a model as their “brain” and combine it with tools, memory and rules to carry out tasks, query external sources and take action in real systems. Quantization, in turn, is a technique for reducing a model’s size and computational cost, which is especially important when you want to run AI locally on limited hardware.

Artificial intelligence is an umbrella term for systems that perform tasks normally associated with human intelligence, such as recognizing patterns, classifying information, predicting outcomes, understanding language or generating content. Not all AI is “conversational”: there are AIs for computer vision, recommendation, fraud detection, forecasting and automation.

Within AI, you will often hear about these levels:

  • AI: the general field.
  • Machine Learning: models that learn patterns from data.
  • Deep Learning: a subfield of ML based on neural networks with many layers.
  • Generative AI: models that generate text, images, audio or code.

Diagram of the levels of AI: Artificial Intelligence contains Machine Learning, which contains Deep Learning, which contains generative AI, where LLMs are

What is an LLM?

LLM stands for Large Language Model. It is a model trained on large volumes of text to understand language patterns and generate answers, summaries, code, translations and other text outputs.

In practice, an LLM does not “think” like a person. It learns statistical relationships between parts of the text and uses those relationships to continue a sequence in a way that is consistent with the context it received.

How does an LLM work?

Modern LLMs are built on the transformer architecture, which was designed to handle sequences well, such as sentences and documents. These models have many neural network layers and an attention mechanism, which helps the system focus on the most relevant parts of the input text when generating the response.

The simplified flow looks like this:

  1. Your text is broken into tokens.
  2. These tokens become numbers.
  3. The model analyzes the relationships between them within the context window.
  4. It calculates which next token is most likely.
  5. It repeats this many times until the response is complete.

Diagram of how an LLM works: the text is broken into tokens, the tokens become numbers, the model analyzes the relationships between them within the context window, calculates that the most likely next token is “blue” and repeats the process

How does it “predict”?

The most important verb here is predict. An LLM generates text because it was trained to predict the next token based on the previous tokens. That sounds simple, but when you do it at scale, with lots of data, many layers and many parameters, the model starts producing surprisingly useful and coherent answers.

A simple example:

  • Input: “The sky on a cloudless day is usually”
  • Likely next token: “blue”

In long answers, the principle is the same, just repeated many times. So when it seems like the model “understood”, often what it actually did was use learned patterns to continue the text in a statistically strong way.

What are tokens?

A token is not exactly the same thing as a word. A token can be a whole word, part of a word, a symbol or a small piece of text.

This matters because models do not “read words” directly. They read tokens, and processing cost is usually measured in tokens, not in sentences or characters.

What is a context window?

The context window is the number of tokens the model can take into account at the same time. You can think of it as the model’s “working memory” during that conversation or task.

If the window is small, the model loses older parts of the conversation or document. If it is larger, it can better handle long texts, multiple instructions and larger files, but that usually increases cost and processing.

What are parameters?

Parameters are the internal values adjusted during the model’s training. Put simply, they represent what the model has learned about language patterns.

A useful analogy: parameters are like millions or billions of internal “fine adjustments”. In general, more parameters increase the capacity to represent complex patterns, but they also require more data, more memory and more computing power. More parameters do not automatically mean better results at everything.

When you see something like 7B, 8B, 13B or 70B, it usually means billions of parameters. A 7B model has about 7 billion parameters; a 70B model has about 70 billion.

In practice, this affects:

  • Potential quality: larger models tend to capture more complex patterns.
  • RAM/VRAM cost: larger models need more memory.
  • Speed: larger models tend to be slower.
  • Local use: smaller models are easier to run on your PC.