By Manny Fernandez

July 19, 2026

Beyond the Prompt Series: Large Language Models – The Autoregressive Engine

How next-token prediction became the core of applied AI, and the 2026 shifts (MoE, reasoning, long context) that actually matter in production.

Four Faces of the Transformer – Part 1 of 4

Part 1 of four in Four Faces of the Transformer, a series on the model families behind applied AI in 2026.

An LLM is the family everyone means when they say AI in 2026, and it is also the simplest to describe mechanically: a next-token predictor run in a loop. Everything layered on top, the reasoning, the tool use, the coding, is that one loop at scale. Here is what is actually happening underneath, and the three architectural shifts that separate a 2026 frontier model from a 2023 one.

Who this is for

You understand systems, architecture, and tradeoffs, but you are not an ML specialist. This guide skips the beginner framing and the math derivations, defines niche jargon on first use, and stays focused on the mental models and decisions that matter in production.

Core Architecture & Mental Model

An LLM is an autoregressive next-token predictor. Feed it a sequence of tokens, it outputs a probability distribution over the entire vocabulary for the token that comes next, you sample one, append it, and repeat. Every capability you have seen, reasoning, coding, translation, follows from that single mechanical loop run at scale. There is no separate knowledge base and no query planner underneath. It is one function called in a loop.

The engine is the transformer decoder. Its defining component is self-attention: a content-addressable lookup where every token computes how relevant every other token is to it, then pulls in a weighted blend of their representations. Think of it as an associative memory that runs fresh at every layer. The classic RNN mental model of a fixed hidden state marching left to right is the wrong picture. Attention sees the whole context at once and decides what to weight.

Mental model

A transformer layer is read, mix, refine. Read the current representation of each token, mix in relevant context via attention, refine through a feed-forward network. Stack that block dozens to over a hundred times. Depth is where abstraction accumulates.

The Mechanics (Under the Hood)

The data lifecycle inside an LLM runs in five stages:

  1. Tokenization. Text is split into subword units by a byte-pair-encoding tokenizer. cybersecurity might become cyber + security; a rare string fragments into many tokens. The tokenizer is a fixed dictionary decided before training, and it silently drives cost and context math.
  2. Embedding. Each token id maps to a learned vector. Position information is injected here (modern models use rotary position embeddings, RoPE, which encode relative position directly into the attention computation).
  3. Attention + feed-forward stack. Every token is projected into query, key, and value vectors. Query-key dot products produce attention weights; those weights blend the values. A feed-forward network then transforms each position independently. Repeat per layer.
  4. Output projection. The final layer’s representation is mapped back to a probability distribution over the vocabulary (the logits, after a softmax).
  5. Sampling. A decoding strategy picks the next token: greedy (argmax), or temperature and top-p sampling for controlled randomness. That token is appended and the loop runs again.

Training is a separate lifecycle with three phases. Pretraining on trillions of tokens teaches next-token prediction and, as a side effect, world knowledge and syntax. Supervised fine-tuning (SFT) on curated instruction-response pairs teaches the model to behave like an assistant. Preference alignment, RLHF (reinforcement learning from human feedback) or its cheaper AI-feedback and direct-preference variants, tunes the model toward responses humans prefer. Pretraining is where capability comes from; alignment is where usefulness and safety come from.

Three architectural shifts define frontier LLMs in 2026, and you should know all three:

  • Mixture-of-Experts (MoE). Instead of one dense feed-forward network activating every parameter for every token, the model holds many expert networks and a lightweight router that sends each token to a small subset. This decouples total capacity from per-token compute: a model can hold hundreds of billions of parameters but activate only tens of billions per token. By mid-2026 MoE is the default frontier design, not a novelty. A common refinement pairs always-on shared experts (global stability) with routed experts (aggressive specialization).
  • Test-time compute (reasoning models). Rather than answering in one pass, the model is trained to generate a long internal chain of reasoning before its final answer, spending more compute at inference on harder problems. This is a real architectural lever, not a prompt trick, and it comes with a hard ceiling: past a threshold, extra reasoning tokens stop buying accuracy and only burn latency and money.
  • Long context and sparse attention. Vanilla attention cost grows quadratically with sequence length, so million-token context windows are now normal only because of engineering around that wall: sparse and block attention patterns, latent-attention KV-cache compression (cutting cache memory by roughly an order of magnitude), and sliding windows. Long context is a design option in 2026, but retrieval (RAG) still wins when relevance and cost matter more than raw window size.

Key Technical Trade-offs

Decision Gains Costs
Dense vs MoE MoE gives far more capacity per unit of inference compute Routing complexity, memory to hold all experts, load-balancing and serving headaches
Longer context Fewer retrieval hops, whole documents in-window Quadratic-ish cost, latency, and diluted attention over irrelevant tokens
Test-time compute Large gains on hard reasoning and math Higher latency and token cost; diminishing returns past a saturation point
Greedy vs sampling Greedy is reproducible and factual-leaning Sampling is more creative but non-deterministic and harder to test
Bigger base model Higher ceiling on capability Superlinear training and serving cost; often beaten by a fine-tuned smaller model on narrow tasks

Real-World Implementation

Most production LLM use is an API call against an OpenAI-compatible endpoint. The pattern that matters is streaming plus an explicit reasoning-effort control, because in 2026 the same model name can map to different compute graphs depending on the mode you request.

from openai import OpenAI

client = OpenAI(base_url="https://api.your-provider.com/v1", api_key=KEY)

stream = client.chat.completions.create(
    model="frontier-moe-2026",
    messages=[
        {"role": "system", "content": "You are a network security assistant."},
        {"role": "user",   "content": "Explain why a /29 gives 6 usable hosts."},
    ],
    reasoning_effort="medium",   # low | medium | high -> test-time compute dial
    temperature=0.2,             # low temp for factual, deterministic-ish output
    stream=True,                 # tokens arrive as generated; do not block the UI
)

for chunk in stream:
    delta = chunk.choices[0].delta.content or ""
    print(delta, end="", flush=True)

Two production notes. Temperature near 0 does not guarantee identical outputs across runs, because batched GPU inference introduces small non-determinism; never assert byte-for-byte equality in tests. And budget by tokens, not requests: the tokenizer, the system prompt, the reasoning trace, and the output all bill against the same context window.

Common Pitfalls & Antipatterns

  • Treating the model as a database. It stores statistical patterns, not facts. It will produce fluent, confident, wrong answers (hallucinations) with no internal signal that it is guessing. Ground high-stakes output with retrieval or tools.
  • Context stuffing. Dumping everything into a huge context because you can. Relevant signal gets diluted, cost climbs, and accuracy on the needle in the haystack often drops. Retrieve the right 4K tokens instead of pasting 400K.
  • Ignoring the tokenizer. Character counts lie. Code, JSON, non-English text, and long identifiers tokenize inefficiently and blow past limits you did not budget for.
  • Trusting the model with untrusted input. Prompt injection is the SQL injection of this era: text pulled from a web page, email, or document can carry instructions the model then follows. Treat all retrieved or tool-returned content as hostile, and never let a model’s output trigger a privileged action without a deterministic guardrail in between.
  • Assuming determinism. Non-deterministic sampling and batched inference make exact-match testing brittle. Test behavior and constraints, not exact strings.

The through-line

Every family in this series is the same machine: the 2017 transformer, modeling sequences of tokens. A token is whatever you make it (a subword, an image patch, a spacetime patch), and the objective is either predict the next token or denoise the whole set. Learn the machine once and every 2026 model release slots into a map you already own.

This is one of four. The others: multimodal models (teaching the same engine to see), small language models and edge AI (the same engine shrunk to run on-device), and diffusion video models (the same transformer, denoising instead of predicting).

 

 

 


Recent posts

  • If you've spent any time configuring user authentication on... Full Story

  • DNS is one of those technologies that quietly underpins... Full Story

  • BGP issues on FortiGate firewalls usually trace back to... Full Story

  • Every time your laptop talks to your router, a... Full Story

  • If you've spent any time configuring NAT on a... Full Story

  • If you have spent any time configuring firewall policies... Full Story

  • High availability on FortiGate is one of those features... Full Story

  • If you've configured SD-WAN on a FortiGate, you've almost... Full Story

  • FortiLink is the management protocol that turns a FortiSwitch... Full Story

  • FortiSwitches are pretty rock solid from Mean Time Between... Full Story

  • This is a quicky tip.  Have you ever gone... Full Story

  • DNS is one of those quiet pieces of internet... Full Story

  • This article is an updated version of the previous... Full Story

  • You will add ns2 as a secondary (slave) BIND9... Full Story

  • In the process of deploying my lab, I needed... Full Story

  • RFC 8805, used to be known as Self-Correcting IP... Full Story

  • Years back, I wrote an article about certificate pinning. ... Full Story

  • FortiGates have the ability to send alerts to Microsoft... Full Story

  • In this post, I am going to walk through... Full Story

  • Troubleshooting VoIP on a FortiGate can feel like trying... Full Story

  • Prior to FortiOS 7.0, there were three commands to... Full Story

  • In this post, I am going to go over... Full Story

  • What we are going to do:  We are going... Full Story

  • Choosing between FGCP (FortiGate Clustering Protocol) and FGSP (FortiGate... Full Story

  • Creating a VLAN on macOS (The "Pro" Move) A... Full Story

  • This blog post explores the logic behind how macOS... Full Story

  • Pretty Fly for a Wi-Fi Tell My Wi-Fi Love... Full Story

  • Part of my daily gig is creating BoMs (Bill-of-Materials)... Full Story

  • ICMP introduces several security risks, but careful filtering, rate... Full Story

  • The command diag debug application dhcps -1 enables full... Full Story

  • In the world of FortiOS, execute tac report is... Full Story

  • LLDP; What is it The Link Layer Discovery Protocol... Full Story

  • What it actually does When you run diagnose fdsm... Full Story

  • Monkey Bites are bite-sized, high-impact security insights designed for... Full Story

  • I have run macOS in macOS with Parallels but... Full Story

  • Don't be confused with my other FortiNAC posts where... Full Story

  • This is the third session in a multi-part article... Full Story

  • Today I was configuring key-based authentication on a FortiGate... Full Story

  • Netcat, often called the "Swiss Army knife" of networking,... Full Story

  • At its core, IEEE 802.1X is a network layer... Full Story

  • In case you did not see the previous FortiNAC... Full Story

  • This is our 5th session where we are going... Full Story

  • Now that we have Wireshark installed and somewhat configured,... Full Story

  • The Philosophy of Packet Analysis Troubleshooting isn't about looking... Full Story

  • 1. Executive Summary Objective: This guide walks you through... Full Story

  • Note: Version target: FortiOS 7.6.x on an NP6/NP7-class FortiGate.... Full Story

  • 1. Executive Summary Objective: This guide takes you from... Full Story