Skip to main content
Explore our network
All sites

ChatGPT explained: the architecture and training loop behind the frontier-LLM race

ChatGPT explained: the architecture and training loop behind the frontier-LLM racePhoto: N43 and Hermes AI
N43 ANALYSIS
TECH . 8329
N43 ANALYSIS · Large language models

Next-token prediction, attention, and the training loop: the mechanics behind ChatGPT and the frontier-LLM release race, explained from first principles.

Source video: Let's build GPT: from scratch, in code, spelled out. · Andrej Karpathy · approximately ~8.4 million views, uploaded 2023-01-17, observed 2026-11-29. The lecture is an evergreen build-from-scratch walkthrough of exactly the mechanism behind every frontier release, and it is contextualized here against the 2026 release race. Independently researched by N43 and Hermes AI.

01 What a language model actually computes

Strip away the chat interface and a model like ChatGPT reduces to a single, almost banal operation: given a sequence of tokens, predict the distribution over what comes next. Everything else — reasoning, code, translation — emerges from repeating that operation across billions of parameters. The framing matters because it makes the system measurable: next-token prediction is formally equivalent to compression, and a model that predicts well is, by definition, a model that has learned a lot about its training distribution.

The vocabulary being predicted over is not words but tokens — subword units produced by a fixed tokenizer, typically three-quarters of a word or so in English. A prompt is tokenized, fed through the network, and the output is a probability vector over roughly 100,000 possible next tokens. Sampling from that vector, appending the chosen token, and repeating is the entire generation loop. Chat is a product decision layered on top of an autoregressive engine that never stops predicting the next token.

02 Pretraining: corpus, objective, and what scale buys

Pretraining is the phase where the model acquires almost everything it will ever know. The objective is unchanged from GPT-1: cross-entropy loss on next-token prediction, applied to trillions of tokens of web text, books, and code. What changed between generations is mostly scale — parameters, data, and compute moving up together roughly in line with the scaling laws that predicted loss would fall as a smooth function of all three.

Scale buys capability in lurches that researchers still argue about. Some abilities appear to improve predictably with size; others show abrupt jumps that earned the name emergent. What is not disputed is that the published curve flattened for no one: each successive generation of frontier models raised the compute bill by orders of magnitude. The chart below covers the last models whose parameter counts were publicly documented — since GPT-4, flagship sizes have become trade secrets.

Documented parameter counts of published models (billions) horizontal bar chart, log scale: documented parameter counts of published models in billions of parameters, from gpt-1 at 0.117b in 2018 to palm at 540b in 2022; current flagship parameter counts are undisclosed Documented parameter counts of published models (billions) 0.1 1 10 100 1000 GPT-1 (2018) 0.117B GPT-2 (2019) 1.5B GPT-3 (2020) 175B PaLM (2022) 540B parameters, billions (log10 scale)
Units: billions of parameters, log scale. Bars show the last publicly documented parameter counts of published models (GPT-1 in 2018 through PaLM in 2022); current flagship parameter counts are undisclosed.

03 Inside the transformer: attention, context windows, and the KV cache

The transformer, introduced in 2017, replaced recurrence with attention: every token can look directly at every earlier token and weigh how much each one matters. Stacking dozens of such layers lets the model build representations that track syntax, topic, and reference across long spans. The context window — how many tokens attention can span at once — has become a headline specification, climbing from a few thousand tokens in early GPT-3 to hundreds of thousands in current frontier systems.

Inference speed comes from an unglamorous optimization: the key-value cache. Because attention over previous tokens never changes once those tokens are processed, their keys and values are stored and reused instead of recomputed for every new token. The trick makes generation feasible but trades memory for speed — cached context grows linearly with conversation length, which is why long-context features arrive alongside heavier serving hardware rather than for free. Attention arithmetic still scales with sequence length squared in the naive form.

04 Post-training: instruction tuning, RLHF, and why alignment shapes voice

A freshly pretrained model completes text; it does not follow instructions. Post-training closes that gap in stages. Supervised fine-tuning first teaches the format with curated question-and-answer examples. Reinforcement learning from human feedback then optimizes against a reward model trained on human preferences, which is where the model learns to refuse, hedge, and adopt a consistent voice. The assistant persona users experience is largely a product of this stage, not of pretraining.

This is why competing assistants feel different despite similar raw capability: alignment choices are editorial. How deferential the model is, how it handles controversy, how much personality it projects — those are reward-model decisions with commercial stakes attached. Post-training also has costs. Reward models can be gamed, producing sycophancy or over-refusal, and the details of every major lab's recipe are closely held, which makes public reproduction of alignment behavior rare.

05 The 2026 frontier race: what releasing a model now means

By 2026, releasing a frontier model is a product launch with a standard checklist. Published benchmark scores — MMLU-style knowledge tests, coding suites, math — anchor the announcement. Agentic evaluations that score multi-step tool use have joined them, because the commercial story has shifted from chat to agents that complete work. Pricing tiers, context-window sizes, and rate limits ship in the same press release, because each model now arrives as a segmented product line rather than a single endpoint.

The race itself has changed shape. Release gaps between the major labs have compressed to months, and each launch now targets a specific competitor's pricing tier as much as its benchmark numbers. Open-weight releases from Chinese and European labs have added a second axis of competition: capability per dollar rather than capability alone. For buyers, the practical question is no longer which lab is ahead in the abstract, but which model clears a workload's quality bar at the lowest serving cost.

OpenAI API list price per 1M output tokens at launch (USD) horizontal bar chart, log scale: openai api launch list price in us dollars per 1m output tokens, from 60 dollars for gpt-3 davinci in 2020 to 2 dollars for gpt-3.5 turbo in 2023 and 0.15 dollars for gpt-4o mini in 2024 OpenAI API list price per 1M output tokens at launch (USD) $0.10 $1 $10 $100 GPT-3 Davinci (2020) $60 GPT-3.5 Turbo (2023) $2 GPT-4o mini (2024) $0.15 USD per 1M output tokens at launch (log10 scale)
Units: US dollars per 1M output tokens, log scale. Bars show OpenAI API launch list prices (GPT-3 Davinci in 2020 to GPT-4o mini in 2024), illustrating the cost collapse; later repricing is not shown.

06 Inference economics: per-token costs, serving infrastructure, and the price-collapse curve

Frontier capability would matter less if serving it stayed expensive, and the defining economic fact of the decade is that it did not. Between GPT-3's Davinci endpoint in 2020 and GPT-4o mini in 2024, the list price of a million output tokens fell from sixty dollars to fifteen cents — a 400-fold decline in four years, charted above on a log scale and achieved through distillation, quantization, speculative decoding, and brutal infrastructure competition.

The decline reshapes product strategy. Applications that were uneconomic at Davinci pricing became trivial at GPT-4o mini pricing, and each collapse wave created new categories overnight. The frontier tier stays expensive — that is where the margin funds the next training run — while last year's flagship becomes this year's bulk tier. Serving economics, not research headlines, increasingly decide which models actually get deployed at scale.

07 Limits: hallucination, context debt, and why evaluation is hard

The core failure mode is hallucination: fluent, confident output that is simply false. It follows directly from the objective — a model trained to produce plausible continuations has no built-in notion of truth, only of likelihood. Retrieval augmentation and tool use reduce the exposure by grounding answers in checked sources, but the underlying mechanism is unchanged, and no released frontier model has solved it.

Evaluation is harder than it looks. Benchmarks leak into training data, so headline scores drift upward partly through contamination; models can be tuned toward known test formats. Long conversations add context debt — earlier errors and stale premises accumulating in the window, degrading later output in ways single-turn tests never measure. Careful buyers therefore evaluate on private, task-specific suites that mirror their real workload, and treat public leaderboards as a first filter rather than a verdict.

N43 and Hermes AI is an independent analytical publication. Numbers are identified as measured, estimated, or illustrative where appropriate.

References

  1. Wikipedia: Large language model
  2. Wikipedia: Transformer (deep learning architecture)
  3. Brown et al.: Language Models are Few-Shot Learners (GPT-3)
  4. Source video: Let's build GPT: from scratch, in code, spelled out. (Andrej Karpathy, ~8.4M views, observed 2026-11-29)
N43 ANALYSIS

N43 and Hermes AI · Independent Analysis

By N43 and Hermes AI for DutyStation News.

📰 Related Stories

How microchips are made: the manufacturing pipeline behind the AI boom
📰 technology

How microchips are made: the manufacturing pipeline behind the AI boom

N43 and Hermes AI11m ago
iPhone 18 Pro Max review: Apple's chip-first upgrade cycle, dissected
📰 technology

iPhone 18 Pro Max review: Apple's chip-first upgrade cycle, dissected

N43 and Hermes AI11m ago
Model Context Protocol, explained: how AI agents plug into the real world
📰 technology

Model Context Protocol, explained: how AI agents plug into the real world

N43 and Hermes AI11m ago
November's AI Breakthrough Wave, Audited: What Actually Shipped
📰 technology

November's AI Breakthrough Wave, Audited: What Actually Shipped

N43 and Hermes AI2h ago
Pixel 11 Impressions: Google's Hardware Bet, Reviewed Honestly
📰 technology

Pixel 11 Impressions: Google's Hardware Bet, Reviewed Honestly

N43 and Hermes AI2h ago
Has Google Taken the Frontier Lead? A Competitive Accounting
📰 technology

Has Google Taken the Frontier Lead? A Competitive Accounting

N43 and Hermes AI2h ago
← Back to News