← All links
Theme
Using automatic theme
Back to top

Article notes

Intro to Large Language Models

By Andrej Karpathy

Read the original

Listen

Audio version

A direct reading of the notes, with clickable timestamps throughout the article.

Total length: 8:04
8:04 remaining

In one sentence

Large language models are neural networks trained to compress patterns from enormous text datasets into their parameters, then generate responses by predicting the next token. Their surprising capabilities emerge from scale and general-purpose training, but their reliability, safety, and usefulness depend heavily on post-training, interfaces, tools, and human oversight.

Overview

Karpathy presents the talk as a general-audience “busy person’s” introduction, recorded in November 2023 and based on an earlier AI-security talk. He begins with a concrete mental model: an LLM can be viewed as two files—a large parameters file containing learned weights and code that runs those weights. He then explains pretraining, tokenization, neural-network computation, inference, fine-tuning, model ecosystems, and security concerns. The talk’s broader framing is that LLMs may function like a new operating-system layer: users express intent in language, while models coordinate knowledge, reasoning-like behavior, and tools behind the interface.

Core ideas

The two-file mental model

A trained model consists conceptually of parameters plus runtime code. The parameters are not a database of neatly stored facts; they are a vast numerical representation learned during optimization. The runtime interprets tokens, applies the network, and samples or selects the next token.

Pretraining is compression through prediction

The model reads a huge corpus and repeatedly predicts the next token. Errors update the parameters. Over time, the network compresses statistical structure from text—including facts, styles, procedures, code patterns, and social conventions—into a reusable prediction system.

Tokens are the model’s native currency

Text is converted into token IDs, often subword chunks rather than words. The model only operates on these tokens, which explains context-window limits, token-based pricing, odd behavior with spelling or unusual strings, and why long inputs consume finite working memory.

Capabilities come from scale, not a hand-written rulebook

The same general training objective can produce increasingly broad abilities as data, parameters, and compute grow. The network is not explicitly programmed with a separate module for every task; useful behaviors emerge from learned relationships distributed across the parameters.

Inference is sequential and probabilistic

At use time, the model receives a context, calculates a probability distribution for the next token, chooses one, appends it, and repeats. This makes generation flexible but also means outputs are constructed continuations—not guaranteed retrievals of verified truth.

Pretraining and post-training do different jobs

Pretraining builds a broad world model and language competence. Post-training—such as supervised instruction tuning and human-feedback methods—makes the system more cooperative, conversational, safer, and better aligned with user requests. A base model and an assistant model should not be treated as identical products.

The operating-system analogy

Karpathy compares LLMs to a new computing substrate. Traditional programs operate on bytes through rigid interfaces; LLM applications operate on tokens through natural-language context. The model may become a general-purpose coordinator that invokes specialized tools, software, APIs, or other models.

Models are powerful but jagged

An LLM can perform sophisticated tasks while failing at seemingly trivial ones. Fluency is not the same as dependable reasoning, perception, memory, or verification. Capabilities vary sharply by task, prompt, model, context, and tool access.

Practical takeaways

Caveats and counterpoints

Questions worth revisiting

Return to this when…

Return when you need a compact conceptual map of LLMs: parameters versus runtime, pretraining versus post-training, tokens and context, inference, the operating-system analogy, or the main security and reliability risks. Pair it with newer material before making decisions about current models, pricing, benchmarks, or deployment practices.

References

  1. glasp.co
  2. 01 Jan 2023. Intro to Large Language Models  |  Schumann Resonance Harmonics auf Patreon
  3. upcarta.com
  4. bilibili.com
  5. andrejkarpathy.ruclips.net
  6. ytscribe.com
  7. tzamtzis.gr
  8. karpathy.ai
  9. t.co
  10. videohighlight.com
  11. summify.io
  12. mykalmachon.com
  13. youtube.com
  14. arxiv.org