November 26, 2026

Inside the LLM (Part 1): How AI Models Learn to Understand Language

Key Takeaways

  • LLMs learn language patterns by predicting the next token in a sequence during training.
  • Tokenization converts human-readable text into smaller units called tokens and assigns each token a numerical ID.
  • Tokenizers influence processing efficiency, memory requirements, and the cost of running LLMs.
  • Embedding tables convert token IDs into numerical vectors that capture learned patterns and relationships.
  • Positional encoding helps LLMs understand the order of tokens in a sentence.
  • Combining embeddings and positional encodings creates the input matrix that prepares data for Transformer layers.
  • Understanding tokenization, embeddings, and positional encoding provides application consultants with a foundation for understanding how LLMs work.

When we type a question into a tool like ChatGPT, it feels almost magical. The system responds in natural language, seemingly understanding our intent, grammar, and even complex logic. But there is no magic inside the machine – only data pipelines, system architecture, and processing rules. To understand how Large Language Models (LLMs) work, we need to look beyond the conversational interface and examine what happens behind the scenes.

This article provides a high-level understanding of LLM mechanics for application specialists who may not have a deep mathematical background, or who simply need a clear conceptual overview rather than raw implementation details. It focuses on the architectural flow and data pipelines, avoiding complex calculus while providing the depth needed to understand how these models work under the hood.

We’ll follow a single sentence throughout the process: “The cars in the retail were waiting to be sold.” 

By tracing how this sentence moves through the various stages of LLM training, we can understand how raw human language is transformed into mathematical representations that a model can process.

1. What Is an LLM?

A Large Language Model (LLM) is an advanced artificial intelligence engine designed to process, reason over, and generate human-like text. LLMs can perform a wide range of tasks, from translation and code generation to multi-step problem-solving, by predicting what text should logically follow a given input, called a prompt.

LLMs are developed or “trained” to compress vast amounts of human text and knowledge into a mathematical model. This allows them to understand context, follow instructions, and perform complex language and reasoning tasks. But before an LLM can process human language, the text must first pass through a component called a Tokenizer. This is the bridge that translates human-readable words into system-readable data.

However, predicting the next token and understanding the context of a prompt does not necessarily mean that an AI system reasons like a human. The distinction between pattern prediction and the ability of AI tools to actually reason is an important consideration when evaluating LLM capabilities.

2. Understanding the Tokenizer

A tokenizer is a process that runs before the LLM sees any data. It converts raw text strings into discrete chunks called tokens and maps them to numerical IDs.

What Is a Token?

Depending on the tokenizer’s design, a token can represent:

  • A whole word (“car”)
  • A sub-word (“un”, “beat”, “able”)
  • A single character (“a”, “!”)
  • A byte sequence (useful for emojis, obscure scripts, or binary data)

For example, the sentence “Unbelievably fast!” might be broken down as follows:

Text Chunk Token ID Type
Un 2952 Sub-word prefix
believ 12450 Sub-word root
ably 1921 Sub-word suffix
fast 3211 Word with leading space
! 0 Punctuation

The important point is that an LLM does not directly process words as we see them. It processes numerical representations of tokens.

How Are Tokenizers Built?

Before an LLM is trained, its tokenizer must be built. One common approach to creating a vocabulary is based on an algorithm that repeatedly combines frequently occurring character sequences. The process works as follows:

Step 1: Start with a Base Vocabulary

Begin with individual characters (a, b, c, etc.).

Step 2: Count Frequencies

Scan a massive corpus of text and count which adjacent pairs of characters appear most frequently together.

Step 3: Merge the Most Frequent Pairs

If “t” and “h” frequently appear together, they can be merged into a single new token: “th”.

Step 4: Repeat

Repeat this merging process until the desired vocabulary size is reached—for example, 32,000, 50,000, or 100,000 tokens.

This process allows the tokenizer to build a vocabulary containing commonly occurring words, sub-words, and character combinations.

Tokenizing Non-English Text

When we interact with an AI model, the prompts we enter are tokenized using the same tokenizer used during the model’s training. Because many tokenizers are trained predominantly on English text, English words tend to be represented efficiently, often using one token per word.

However, when a tokenizer trained primarily on English encounters text in another language, it may fall back on smaller building blocks, eventually breaking words down into individual characters or character sequences.

Consider the Spanish word desafortunadamente (“unfortunately”).

A Spanish-optimized tokenizer might recognize it efficiently:

[“desafortunada”, “mente”] — 2 tokens

An English-trained tokenizer might break it down more aggressively:

[“des”, “a”, “fort”, “un”, “adam”, “ente”] — 6 tokens

The additional number of tokens can create three problems:

  1. Higher memory requirements: More tokens are required to represent the same amount of text.
  2. Higher processing costs: When an LLM is priced per token, more tokens mean higher costs.
  3. Slower processing: The model has more tokens to process.

These differences in token consumption have implications beyond processing speed and memory requirements. As organizations deploy LLMs and AI agents at scale, the number of tokens processed can directly influence operating costs. This is also driving a shift in how AI services are priced, with models increasingly exploring value-based billing approaches that focus on outcomes rather than token consumption.

3. How Are LLMs Trained?

Now that we understand how raw text is converted into tokens, let’s examine what happens when the LLM receives its first piece of training data. Remember our example sentence:

“The cars in the retail were waiting to be sold.”

When an LLM begins training, it does not possess pre-existing knowledge of English, grammar, or word meanings. It must learn patterns from the training data. The following steps illustrate how this happens.

Step 1: Tokenization

The first thing the model does is convert the raw text into discrete numerical IDs using a tokenizer, a fixed vocabulary lookup table. For our example sentence, the tokenizer breaks the text into tokens and maps them to vocabulary IDs.

Raw Token Token ID (Example)
The 464
cars 3797
in 287
the 262
retail 8291
were 547
waiting 3308
to 284
be 307
sold 3484
. 13

At this stage, the sentence has been transformed from human-readable text into a sequence of numerical identifiers. However, these IDs do not yet tell the model what the tokens mean. The next step is to create mathematical representations of them.

Step 2: Input Embedding Lookup

The Embedding Table

The model takes each token ID and uses it to retrieve a corresponding vector from a large lookup matrix called the Embedding Table (E). The Embedding Table has:

  • One row for every token supported by the model’s vocabulary.
  • Multiple columns, or dimensions, used to store the numerical representation of each token.

Each row contains a vector of numbers that represents the token in a mathematical space.

How Are Tokens Described?

We can think of each value in the Embedding Table as representing some characteristic or pattern associated with a token. For example, imagine dimensions that represent concepts such as:

  • Is a fruit?
  • Is a verb?
  • Is a noun?
  • Is plural?
  • Is a preposition?
  • Is an article?

The token “cars” might have a simplified representation, such as:

[0, 0, 1, 1, 0, 0]

This could indicate that it is not a fruit, not a verb, is a noun, is plural, and is neither a preposition nor an article. In reality, embedding values are not simply 0s and 1s.

They are floating-point numbers, with positive and negative values, that represent learned weights.

To understand what a weight represents, imagine a column (dimension) in the Embedding Table called “Is a Car?”

Now consider a token such as “Honda”.

The weight for the “Is a Car?” dimension would probably be very high, although not necessarily 100%, because Honda could refer to a car, truck, or motorcycle.

A token such as “Apple”, on the other hand, would probably have a much lower value.

The important distinction is that these dimensions do not necessarily represent complete, human-readable concepts. They represent patterns that help the model predict text effectively, including grammar, syntax, tone, associations, and physical properties.

Step 3: Positional Encoding

The order of words in a sentence can completely change its meaning. Consider these two sentences:

  • “The cars in the retail”
  • “In retail, the cars”

Both sentences contain similar tokens, but their meaning and structure differ because the words appear in a different order. The model therefore needs a way to understand the position of each token in a sentence.

This is where Positional Encoding comes in. A Positional Encoding Vector provides information about the position of a token in the sequence. Its values are calculated using mathematical formulas, such as sinusoidal wave functions, that provide information about the relative positions of tokens.

The values in different dimensions change at different rates:

    • Values in the first dimensions change quickly.
  • Values in the last dimensions change much more slowly.

If we imagine an example with four dimensions, the Positional Encoding Vector might contain a combination of values for each token position. These values do not represent the meaning of a token. Instead, they act as coordinates that help the model distinguish one position from another. Positional encodings represent sequence order and distance, while token similarity and semantic information are primarily represented through the Embedding Table.

Combining the Input Vectors

At this stage, the input sentence has been tokenized, and each token occupies a specific position in the sentence. Each position now has two vectors associated with it:

  1. Embedding Vector: Retrieved from the Embedding Table based on the token ID. This represents the token’s learned characteristics.
  2. Positional Encoding Vector: Determined by the token’s position in the sentence (Slot 0, Slot 1, Slot 2, and so on).

The model adds the values in corresponding dimensions of these two vectors to generate a Combined Input Matrix. This matrix now contains both token-related information and positional information. The values in the actual matrix are floating-point numbers, not simply 0s and 1s.

At this point, the model has transformed the original sentence into a mathematical representation that captures both what the tokens represent and where they appear in the sequence. But this is only the beginning.

The next stage is where the real contextual processing happens. The Transformer architecture takes these combined vectors and allows tokens to interact with one another, helping the model understand how words relate to each other within a sentence.

We’ll explore this process in Part 2 of the blog.

Frequently Asked Questions (FAQs)

  1. What is a Large Language Model (LLM)?
    An LLM is an AI model trained on vast amounts of text to understand language patterns and generate human-like responses.
  2. How are LLMs trained?
    LLMs learn by predicting the next token in a sequence, calculating prediction errors, and adjusting their internal weights through repeated training.
  3. What is tokenization in an LLM?
    Tokenization breaks text into smaller units called tokens and converts them into numerical IDs that the model can process.
  4. What are embeddings in LLMs?
    Embeddings are numerical vectors that represent tokens and capture learned patterns and relationships.
  5. Why is positional encoding important?
    Positional encoding helps the model understand the order of tokens within a sentence.
  6. How does tokenization affect LLM costs?
    More tokens require more processing, potentially increasing memory usage, response time, and API costs.
  7. Why should application consultants understand LLMs?
    Understanding LLM fundamentals helps consultants evaluate AI capabilities and make informed decisions when integrating AI into enterprise applications.
Marcelo Albajari
Marcelo Albajari Marcelo Albajari is the Development Services Strategic Consulting Director at IT Convergence, bringing over 30 years of experience in ERP and CRM enterprise applications, automation and cloud integrations. A former Oracle Corporation manager, Marcelo has led technical implementations for over 100 enterprise clients across the US and LATAM, helping organizations navigate complex digital transformations with tailored, high-impact technical solutions.

Related Blogs