Save this video free

But what is cross-entropy? | Compression is Intelligence Part 2

3Blue1Brown · 33:51 · Watch on YouTube

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

3Blue1Brown explains cross-entropy, a core concept in information theory and machine learning, by connecting it to file compression and language model training. The video demonstrates how cross-entropy quantifies the inefficiency of using a compression scheme optimized for one probability distribution (Q) when applied to another (P), mirroring how language models are trained to minimize the difference between their predicted token distributions and the true data distribution. This principle is applied to language tree discovery via file compression and forms the basis for training modern language models, with distillation offering a richer training signal by comparing model distributions.

Key takeaways

Chapters

0:00 Compression as a Tool for Discovering Linguistic Structure
2:34 Introduction to Cross-Entropy and Its Role in Language Models
5:02 Information Content and Optimal Encoding
8:41 Defining Cross-Entropy: Performance of One Code on Another Distribution
21:48 Cross-Entropy as a Measure of Pattern Difference
25:00 Cross-Entropy Loss in Language Model Training

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 There's a kind of wild paper from 2002 called Language Trees and Zipping, which shows how you can find structure between languages just by using very general file compression. For example, let's say I give you a bunch of text documents in many different languages, and your goal is to automatically cluster them by language. And actually, you can aim even higher than that. Suppose you also want to recover which languages are most closely related to each other in a way that lets you rediscover the tree of shared lineage between them, and all you can do is write a function that processes the text in each one. There's no pre-baked knowledge of linguistics. Now keep in mind, this is almost a quarter century ago, so nothing like modern language models is available. What's crazy is how the authors showed that you can do this just by using gzip, basically the same operation that you might use on your computer to make files a bit smaller.

0:49 Here's the basic idea. Given two documents, A and B, append a small snippet of B to the end of A, and compress the result. Now compare that file size to what you get just by compressing A on its own. One way to think about this difference is it's telling you how well a little snippet of B gets compressed when the compressor is mostly optimized for A. You'd expect that result to be small when the linguistic patterns of B are similar to those in A, but larger when B is more different from A. The authors used this general idea to define a specific metric for how far away two documents are, based exclusively on how well they compress together. And then, evidently, this co-compression-based distance was enough to recover the tree of language lineage.

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, 3Blue1Brown.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.