An LLM Is Just Two Files

4 min read

Karpathy's intro to LLMs starts with the most surprising fact in the whole talk: a large language model is just two files. File one is the parameters, the weights of the network. For Llama 2 70B, that file is 140 GB, 70 billion parameters at two bytes each. File two is the run code, about 500 lines of C, no dependencies, no internet needed. Compile the code, point it at the parameters, and you have a working model on your laptop. No cloud, no API, just two files.

Running the model is the easy part. Getting the parameters is where the work lives. Training takes roughly 10 TB of internet text, a cluster of about 6,000 GPUs, and around 12 days. The cost is roughly two million dollars. What those 12 days produce is a squeeze: 10 TB of text pressed down into 140 GB of weights. A lossy copy, not a perfect one. What survives the squeeze is the pattern of it all, the facts, the reasoning, the writing styles. And those are rookie numbers now. The best models cost tens or hundreds of millions to train, on clusters ten times bigger, with datasets ten times larger. Same idea, bigger squeeze.

What does the network actually do? One thing. It predicts the next word. Feed it a sequence and it outputs a probability for every possible next word. In the talk's example, after "cats sat on the", mat gets 97%, floor gets 1%, roof gets half a percent. That is all it does, and it turns out to be enough. Guessing the next word well takes world knowledge. "The capital of France is" needs geography. "The derivative of x squared is" needs calculus. Train on that one objective across the whole internet and the model has to build an internal picture of the world to keep up. Knowledge and reasoning show up as a side effect.

Next-word probabilities after 'cats sat on the'
mat97%floor1%roof0.5%
Data from the sources listed below.

Internet text gives you a base model. It can complete text but it is not an assistant yet, more like a knowledgeable person who can only finish your sentences. The second stage is fine-tuning, training further on curated conversations written by human labelers. The third is reinforcement learning from human feedback: generate several responses, have humans rank them, and train toward the top-ranked ones. Three stages: pre-training, fine-tuning, RLHF. That is the whole recipe.

Scaling laws are the strangest finding. Plot performance against parameters and training data and you get smooth, predictable curves, with no sign of leveling off. You can predict how good a model will be before training it. That is why companies race to build bigger models. It is not a gamble. The curves say it will work.

The talk also covers what comes after text. Tools, for one. A browser for current information, a calculator for maths, a code interpreter to run Python, image generators for visuals. The model learns when to use each one. Then multimodality: images and audio converted into tokens that flow through the same network, so the model can look at a photo or listen to speech. And the LLM operating system idea, the model as a kernel, with tools, memory, and apps on top and natural language as the interface.

Karpathy ends with security. Jailbreaks bypass safety training with clever prompting. Prompt injection hides instructions in pages the model reads, even white text on a white background, and can steal data through crafted links. Data poisoning plants a trigger phrase in training data that corrupts outputs when it appears. These are not bugs to patch. They are baked into how these models work.

Try this

bash
pip install transformers
python -c "import transformers; print(transformers.__version__)"

Sources

Source: Karpathy's Intro to LLMs - The Complete Visual Breakdown (2026) - Hyperautomation Labs