Latest / Heliox: Where Evidence Meets Empathy 🇨🇦 / Folding Giant AI Brains Into Your Pocket
Transcript
- 0:25So right now, the smartest artificial intelligence in the world is essentially this giant brain.
- 0:31Right.
- 0:32And it's trapped in a billion dollar just massive energy guzzling vat.
- 0:37Yeah, that's a good way to put it.
- 0:39Like we're talking about these minds...
- 0:41that are capable of writing elegant code, passing the bar exam, composing symphonies, solving complex logic puzzles, you name it.
- 0:49Absolutely.
- 0:49But there's a massive catch.
- 0:51Always a catch.
- 0:52Right.
- 0:52If you want to ask this brain a question, you can't just carry it with you.
- 0:56You have to send a message across the internet to that VAT.
- 1:00Right, to some sprawling data center.
- 1:02Exactly.
- 1:02A data center filled with thousands of screaming cooling fans and racks of silicon, and then you just have to wait for a response.
- 1:09Yeah.
- 1:10So today our mission on this deep dive is to understand how a global community of researchers is basically trying to shrink that vat.
- 1:17Yes.
- 1:17We're tracing the journey to take these massive brain-sized AI models and fold them down so they can actually fit on the computers, the laptops, and even phones we already own.
- 1:27Which is huge.
- 1:28And crucially, how to do it without lobotomizing the AI in the process.
- 1:35Right, without making it dumb.
- 1:36Exactly.
- 1:37So we have this really fascinating stack of sources for this.
- 1:41spanning from hands-on production engineering guides to these cutting-edge, almost theoretical physics-level math papers.
- 1:48It really is a remarkable stack of research, and it tells a story that kind of runs counter to the main narrative we hear every day.
- 1:55How so?
- 1:56Well, you know, in the public eye, the obsession is entirely about making AI bigger.
- 2:00Right, right.
- 2:01We constantly hear about trillion parameter models, these massive training clusters, the unprecedented power demands, all of that.
- 2:08Yeah, the bigger the better, right?
- 2:09Exactly.
- 2:11Exactly.
- 2:10But behind the scenes, the real engineering marvel, I mean, the true revolution right now, is the quest to make these models smaller.
- 2:17Wow.
- 2:18And the science of doing that is called quantization.
- 2:20Quantization.
- 2:21Yeah.
- 2:22It isn't magic, though I have to say the results feel like it.
- 2:25I bet.
- 2:26At its core, quantization is just the highly precise science of reducing the precision of the numbers that make up an AI network.
- 2:33So we're talking about taking high resolution, say, 16-bit floating point numbers and squishing them down to 4-bit, 3-bit, or even 2-bit representations.
- 2:43Okay, let's unpack this.
- 2:45Because the journey we're going on today, it starts with a lot of frustration.
- 2:49Oh, totally.
- 2:49It begins with engineers essentially...
- 2:53Hitting the side of the machine with a wrench.
- 2:55You know, brute force trial and error.
- 2:57Yeah, just hacking away at it.
- 2:59Right.
- 2:59And it ends with this beautiful, grand unified mathematical theory known as the linearity theorem.
- 3:05Yes.
- 3:07But to understand the brilliance of that solution, I feel like we have to start with a really basic question.
- 3:11Okay.
- 3:23Okay.
- 3:12Why do we even need to shrink these models?
- 3:14Right.
- 3:14I mean, hard drive space is cheap.
- 3:16If an AI takes up 20 gigabytes, I have a thumb drive that can hold that.
- 3:19Exactly.
- 3:20Why go through all this complex math just to make the file size smaller?
- 3:24That right there is the fundamental misconception about running large language models or LLMs in productions.
- 3:31When people think about why an AI might be slow to answer a prompt, they assume it's because the AI is doing too much math.
- 3:39Right, like it's calculating too hard.
- 3:40Exactly.
- 3:41They think the processor, like the GPU, just can't calculate the numbers fast enough.
- 3:45We call that being compute bound.
- 3:47Compute bound, okay.
- 3:47But in reality, when an AI is actively generating text, which is the phase we call decode, it is almost entirely limited by memory bandwidth.
- 3:58Oh, memory bandwidth.
- 3:59Yeah.
- 4:00It is a physical logistics problem, not a math problem.
- 4:03So you're saying the bottleneck isn't the calculation itself.
- 4:06It's just moving the numbers around inside the computer.
- 4:09Precisely.
- 4:10Let me give you a very specific physical example from our production engineer.
- 4:14sources.
- 4:14Please do.
- 4:15Let's look at a relatively small model, say a 7 billion parameter AI.
- 4:20Okay.
- 4:21In standard 16-bit precision, that model's weights, so its memories, its knowledge, require 14 gigabytes of physical memory just to exist.
- 4:30Just to sit there on the chip.
- 4:31Just to sit there.
- 4:33Now, when you ask that AI to generate a single word, the computer has to physically shove all 14 gigabytes of those weights through the GPU's memory pipes into the actual processor core just to do a tiny bit of arithmetic.
- 4:47Wait, for every single word?
- 4:49For every single word.
- 4:50Wow.
- 4:51Yeah.
- 4:51Specifically, it does about 14 gigaflops of math.
- 4:5514 gigaflops sounds like a lot, though.
- 4:57It sounds like a lot, but it's actually a microscopic amount for modern hardware.
- 5:01Really?
- 5:01Yeah.
- 5:02An advanced GPU can perform those 14 gigaflops in a fraction of a millisecond.
- 5:06The math takes almost zero time.
- 5:08Okay.
- 5:09But physically dragging 14 gigabytes of data from the memory chips across the circuit board into the processor for every single word generated.
- 5:18That's the bottleneck.
- 5:19Yeah, that takes an eternity in computer.
- 5:21time. Man. So it's a massive bottleneck. Let me see if I can visualize this. It's like having a brilliant world-class chef. Okay. The chef is the processor. They have incredible knife skills. They can chop a vegetable at literal lightning speed. But this poor chef is stuck in a kitchen where they have to wait on a single incredibly slow conveyor belt. The memory bandwidth. Exactly. The memory bandwidth.
- 5:44and the belt brings them one carrot at a time the chef ends up spending 99% of their shift just standing there knife raised staring at an empty cutting board waiting for the conveyor belt to deliver the next vegetable I like that analogy yeah yeah but to make it totally accurate to the hardware you have to imagine the chef has to look at every single ingredient in the entire pantry just to decide how to chop that one carrot oh gosh So it's even worse.
- 6:12It is.
- 6:12The arithmetic intensity, which is the ratio of math operations performed to bytes of data moved, is incredibly low during text generation.
- 6:20Wow.
- 6:20The processor is literally starving for data.
- 6:23So if the conveyor belt is the bottleneck, how do you fix it?
- 6:27You can't easily build a faster conveyor belt.
- 6:29Because of physics.
- 6:29Right.
- 6:29You're limited by physics and the cost of hardware, so you make the vegetables smaller.
- 6:33Oh.
- 6:40Yeah.
- 6:34Enter weight only quantization.
- 6:36Exactly.
- 6:37If you can successfully shrink the numbers representing the AI's weights from a bulky 16-bit format down to a compressed 4-bit format, the total volume of data drops by a factor of 4.
- 6:50Suddenly, you are moving 4 times less data per token generated.
- 6:55The AI literally thinks faster.
- 6:58That is so cool.
- 6:59The processor didn't speed up at all, but the conveyor belt is carrying four times as many ingredients in the same amount of space.
- 7:06It sounds brilliantly simple.
- 7:07Just chop the numbers in half, round off the decimal points, and boom, your AI runs four times faster.
- 7:13Right, you would think.
- 7:14But looking at the history here, When engineers actually tried to do this a few years ago, it didn't work smoothly, did it?
- 7:20Not at all.
- 7:21They ran headfirst into a wall.
- 7:23They did.
- 7:23And what's fascinating here is that the wall was invisible at first.
- 7:27It's visible.
- 7:27Yeah.
- 7:28Early in the deep learning boom, researchers were successfully shrinking smaller models.
- 7:33Think of the early BERT models, which were maybe a few hundred million parameters.
- 7:37Okay, so relatively small.
- 7:38Very small by today's standards.
- 7:40Engineers could just round off the decimals and compress the 32-bit or 16-bit floats down to 8-bit integers, and the models worked perfectly.
- 7:48No issues.
- 7:49There was barely any loss in accuracy. The math seemed totally forgiving.
- 7:53Wow.
- 7:53But as the race for bigger LLMs heated up, they hit a very strange, very hard threshold.
- 7:59The 6.7 billion parameter threshold, right?
- 8:01That's at the 1.
- 8:02What exactly happened?
- 8:03there. Once researchers scaled LLMs past that specific size, around 6.7 billion parameters, the simple rounding tricks suddenly broke the models entirely. Just completely broke them.
- 8:15Completely. You would take a perfectly eloquent, highly intelligent AI, quantize its weights to eight bits using the exact same method that worked yesterday, and the AI would start spitting out absolute gibberish. Oh, me. Complete cognitive collapse. It couldn't even string a sentence to That's terrifying from an engineering perspective.
- 8:33Oh, absolutely.
- 8:34The gremlins in the machine just woke up.
- 8:37So what was happening inside the network? Why did scaling up the size cause the math to break?
- 8:43This was a massive mystery that plagued the field.
- 8:46And it wasn't solved until researchers like Tim Detmers published the LLM.in8 paper.
- 8:52Right. I saw that one in our stack.
- 8:54Yeah.
- 8:55Detmers and his team essentially took a microscope to the data flowing through these massive models and they discovered a phenomenon they called emergent outliers.
- 9:04Emergent outliers.
- 9:05Right. As models get larger and take on more complex reasoning tasks, they naturally begin to develop massive anomalous numbers in their activation.
- 9:15Activations, meaning the data that is actively flowing between the layers of the AI while it's thinking, as opposed to the weights, which are the static memories.
- 9:23Correct. So in these activations, Detmers found numbers that were astronomically large.
- 9:29How large?
- 9:29Sometimes 100 times larger than the vast majority of the other numbers in the world.
- 9:33the network.
- 9:33A hundred times.
- 9:34Just massive spikes in the data.
- 9:36Why are they there?
- 9:37Are they bugs?
- 9:38Not at all.
- 9:39That's the wild part.
- 9:39They are highly systematic and they are absolutely crucial for the AI's predictive performance.
- 9:45Wait, really?
- 9:45Yes.
- 9:46They seem to act almost like massive attention beacons, telling the model, hey, this specific feature is incredibly important right now.
- 9:55Interesting.
- 9:55But while they are great for the AI's intelligence, they are an absolute nightmare for quantization.
- 10:01Because of the scale, I think I get this. Let me try an analogy. Let's say you're trying to take a photograph of a dimly lit room.
- 10:08Okay.
- 10:09You want to capture all the subtle details of the shadows and the furniture.
- 10:14But there's someone standing in the corner shining a massive high-powered laser pointer directly into the camera lens.
- 10:20I see where you're going.
- 10:21Right. If the camera adjusts its exposure to handle the blinding light of that laser pointer, the rest of the room goes pitch black.
- 10:28you lose every single subtle detail.
- 10:31That captures the essence of it beautifully.
- 10:33Though technically it's a problem of discrete mathematical buckets rather than excosure.
- 10:38Buckets.
- 10:38Yeah.
- 10:39Think of it like this.
- 10:41When you quantize to 8-bit, you only have 256 buckets to put your numbers into.
- 10:46Right.
- 10:46Because of the binary math.
- 10:48Exactly.
- 10:48If all your numbers range from negative 1 to positive 1, You can space those 256 buckets very close together, capturing incredible nuance.
- 10:58Okay, yeah.
- 10:59But if a single outlier spikes to 100, your scale has to stretch to cover everything from negative 100 to positive 100.
- 11:07Oh, wow.
- 11:07Right.
- 11:08Now your 256 buckets are spaced really far apart.
- 11:12All the delicate, nuanced numbers between negative one and one get dumped into a single bucket right around zero.
- 11:17Oh, no.
- 11:19Yeah.
- 11:19The network literally forgets all of its subtle details.
- 11:23The nuance is just mathematically crushed.
- 11:25So how did the engineers fight back?
- 11:28Because looking at the timeline, they didn't have the grand mathematical theory yet.
- 11:33They just needed the models to work right then.
- 11:35The early solutions were incredibly clever, but they were definitely engineering workarounds.
- 11:39You called it hitting the machine with a wrench earlier.
- 11:41I might call it high tech alchemy.
- 11:43High tech alchemy.
- 11:44I like that.
- 11:44So Detmer solution, the LLM dot in 8.1.
- 11:47It was essentially a quarantine strategy.
- 11:50Right.
- 11:50Yeah.
- 11:51They isolated the outliers.
- 11:53The algorithm looks at the matrix math and says, OK, we'll do 99.9% of the calculations in fast, cheap, 8-bit precision.
- 12:02Makes sense.
- 12:03But we will surgically extract those 0.1% outlier gremlins and process them separately in a full 16-bit precision.
- 12:11Which works, but mechanically it feels clunky.
- 12:14Very.
- 12:14It's like trying to sort your laundry item by item while the washing machine is already spinning.
- 12:19It interrupts the smooth flow of the calculation.
- 12:21It did add some latency, yes.
- 12:23Which led to other clever alchemy like smooth quant.
- 12:26Smooth quant, yeah, I read about that.
- 12:28The researchers behind smooth quant observed that the static weights of the AI are generally pretty uniform and easy to quantize.
- 12:34The chaos, the outliers, mostly live in the activations.
- 12:38Right, the flowing data.
- 12:39So they introduced a mathematical trick, a migration strength parameter they called alpha.
- 12:43An alpha.
- 12:44By setting alpha around 0.5, they used simple division and multiplication to essentially push some of the mathematical difficulty from the erratic activations.
- 12:54over to the stable weights.
- 12:56They mathematically smoothed out the spikes before quantization happened.
- 13:00Okay, that is super clever.
- 13:02I marvel at human ingenuity.
- 13:03I really do.
- 13:04It's impressive.
- 13:05But as we dig into these sources, this whole era really does feel like we were hacking our way to smaller models.
- 13:11Oh, totally.
- 13:23Totally.
- 13:12We were finding these tricks to patch the problems without necessarily understanding the deep underlying laws of physics governing the neural networks.
- 13:22We needed a bridge to get from these clever hacks to actual foundational mathematical theory.
- 13:29And that transition really kicked off when the industry realized 8-bit wasn't small enough.
- 13:34Right. They wanted more.
- 13:35The holy grail was 4-bit or even 3-bit quantization.
- 13:39And at that level of extreme compression, simple rounding, even if you quarantine the outliers, simple rounding.
- 13:44simply causes too much damage.
- 13:46So what do they do?
- 13:47This ushered in what we call the data aware era.
- 13:49Researchers realized they couldn't just blindly round numbers, they had to look at how data actually flowed through the model to decide how to round them.
- 13:57Right, they started using calibration data.
- 13:59Meaning, before you shrink the model, you feed it a few thousand pages of text, You watch exactly how the model processes those words, you see which pathways light up, and you map out where the rounding errors are going to cause the most catastrophic damage.
- 14:13Exactly. And that strategy led to two major heavyweight techniques in the field, AWQ and GPT-Q.
- 14:21Okay, let's break those down, Shaka.
- 14:22Sure. AWQ stands for activation-aware weight quantization. It's a very pragmatic approach.
- 14:28Pragmatic, how?
- 14:29AWQ basically monitors the network and notices which specific channels or pathways are the loudest, like the most salient to the final output.
- 14:37Yeah.
- 14:38It then mathematically scales those important weights up before the shrinking process.
- 14:42It's like putting a protective mathematical bubble wrap around the most important memories so they survive the crushing process of quantization.
- 14:49That's a great way to put it.
- 14:50And AWQ is very fast to run.
- 14:53But on the other side of the aisle, you had GPTQ.
- 14:55And GPTQ took a much more intense, rigorous mathematical approach.
- 15:00Instead of just scaling up important weights, GPTQ uses a complex mathematical construct called a Hessian matrix to navigate the errors.
- 15:09Okay, let's unpack the Hessian matrix because this is where the math starts to get deep.
- 15:14What is a Hessian actually doing here?
- 15:16To understand the Hessian, you have to think about the landscape of errors.
- 15:20When you round a number in a neural network, you introduce an error.
- 15:24Right, because it's less precise.
- 15:25But not all errors are created equal.
- 15:28Imagine you are hiking down a mountain in a dense fog Okay, I'm hiking That's standard gradient descent The gradient tells you which way is downhill But the Hetchin matrix is the second derivative It tells you the curvature of the mountain The curvature Yeah, it tells you if you are walking down a wide, gentle bowl Or if you are balancing on the edge of a steep, narrow ravine Okay, so how does knowing the curvature help you compress the AI?
- 15:52Because it tells you how forgiving the network is If the Hessian shows that a specific weight is in a flat part of the mathematical landscape, you can aggressively round it, and the AI's final answer barely changes.
- 16:05Okay, that makes sense.
- 16:06But if the Hessian shows a weight is on a steep ravine, rounding it even a tiny bit will send the AI's logic tumbling off a cliff.
- 16:15Oh, wow.
- 16:15So GPTQ goes layer by layer, it rounds a weight, uses the Hessian to calculate the exact shape of the error that rounding just caused, and then crucially, it greedily updates all the remaining unquantized weights in that layer to compensate.
- 16:30So it's constantly self-correcting on the fly.
- 16:32exactly it says I just had to round this number down so I'm gonna nudge the next three numbers up slightly to offset the damage yes that's exactly it and it worked incredibly well GPTQ became an absolute standard in the open source community but reading through the historical context in these sources there is a crazy paradox here there is for years GPTQ was essentially a highly successful black box It worked beautifully, but why did it work so well?
- 16:59Why didn't all these tiny layer-by-layer self-corrections eventually snowball into a giant, catastrophic error at the end of the network?
- 17:08This raises an important question, and it was a question that bothered theorists immensely.
- 17:12I bet.
- 17:13GPT-Q was proposed purely as a sequence of algebraic operations.
- 17:18It worked empirically, but it lacked a geometric meaning.
- 17:21We didn't have the proof.
- 17:22We didn't have the proof for why it was stable, until a fascinating paper came out,"The Geometry of LLM Quantization." Oh, yeah.
- 17:31This paper finally cracked the black box wide open.
- 17:35They prove mathematically that when you execute the GPTQ algorithm back to front, processing from the last dimension to the first, the algebra maps perfectly to something called Ba Ba's nearest plane algorithm.
- 17:47Here's where it gets really interesting.
- 17:49Ba Ba's nearest plane algorithm.
- 17:51What are we talking about here?
- 17:52Because this sounds like we're leaving computer science and entering classical geometry.
- 17:55We absolutely are.
- 17:56We are talking about geometry on a lattice.
- 17:58A lattice.
- 17:59Imagine a multidimensional grid of points.
- 18:01A lattice.
- 18:04A lattice.
- 18:02When you are quantizing an AI to four bits, you are essentially taking a continuous high precision point floating in space, and you are trying to find a fixed point on that rigid, low precision, four bit grid that is as close as possible to the original.
- 18:16That sounds difficult.
- 18:17It is a famous, remarkably difficult mathematical challenge called the closest vector problem.
- 18:22So finding the nearest dot on a multidimensional grid.
- 18:25Yes.
- 18:26And Babi's algorithm is a well-known, highly respected method from the 1980s for navigating these exact lattices to find a very close, if not the closest, point by projecting vectors onto orthogonal hyperplanes.
- 18:39So let me get this straight.
- 18:40Okay.
- 18:41AI engineers in the 2020s built a clever algebraic hack to compress a neural network.
- 18:46Yes.
- 18:47And years later, mathematicians looked under the hood realized the engineers had accidentally reinvented a 40 year old geometric algorithm for navigating multi-dimensional lattices that is precisely what happened they proved that the stepwise greedy rounding decisions of GPTQ were mathematically identical to Bob I's algorithm That is just wild. It's like discovering that someone who invented a really good recipe for baking bread had accidentally derived the laws of thermodynamics without realizing it.
- 19:16Right.
- 19:17They just knew the bread tasted good, but they didn't know they were acting out fundamental physics.
- 19:21It's a beautiful moment of scientific synthesis, and it was important because it placed GPTQ on a firm, rigorous theoretical footing.
- 19:30So it wasn't just magic anymore.
- 19:31Exactly.
- 19:32Bob I's algorithm has proven math.
- 19:34Right.
- 19:34It's huge.
- 19:35It's dozens and dozens of layers stacked on top of each other, sometimes up to 100 layers deep.
- 19:40Up until late 2024, researchers could optimize a single layer brilliantly using tools like GPTQ.
- 19:47But they had absolutely no theoretical proof connecting that tiny microscopic layer-by-layer error to the macroscopic error of the entire AI.
- 19:58And macroscopic error means how much dumber the AI gets overall.
- 20:02The term in the literature is perplexity, right?
- 20:04Yes. Perplexity is the standard measure of an AI's confusion or uncertainty when predicting the next.
- 20:10So lower is better.
- 20:12A lower perplexity means a smarter, more accurate, more confident AI.
- 20:16So engineers were essentially flying completely blindfolded.
- 20:20They would mathematically compress layer one, compress layer two, compress layer three, and just cross their fingers.
- 20:25Just hoping for the best.
- 20:26Hoping that when they turned the whole massive 70 billion parameter model back on, the total accumulated brain damage across all layers wouldn't be too severe.
- 20:35And the only way to know if they ruined the model was to literally run it.
- 20:39They had to boot up the massive compressed model, run gigabytes of text through it, and check its final perplexity score.
- 20:45Which takes an immense amount of time, computation, and electricity.
- 20:49I can imagine.
- 20:49It's an incredibly tedious loop.
- 20:51You guess a compression strategy, you spend hours checking it, you realize it degraded the model too much, and you start all over again.
- 20:58It was a massive bottleneck in the research system.
- 21:00Enter the heroes of our story.
- 21:02Yeah.
- 21:03A team of researchers, including Malinovsky, Panferoff, and their colleagues, published the paper that is the primary focus of our deep dive today.
- 21:12Pushing the limits of large language model quantization via the linearity theorem, they decided to attack the blindfold problem head on.
- 21:20Yeah.
- 21:20How did they approach it?
- 21:22They stepped back from the empirical hacking and asked a fundamental theoretical question.
- 21:26Is there a mathematical law governing how errors propagate through an LLM? Right. And after rigorous mathematical derivation, they found something stunning.
- 21:36They proved mathematically that for reasonable bit widths, say, anywhere between 3 and 8 bits, there is a strict predictable relationship between a single layer's mean squared error, or MSE, and the total model's final perplexity increased.
- 21:51A strict relationship, meaning they found the map.
- 21:54They tied the microscopic error directly to the macroscopic brain damage.
- 21:58They proved the relationship is strictly linear.
- 22:01This is the linearity theorem.
- 22:02Wow.
- 22:02They showed that the total degradation of the AI is simply a linear combination of the errors from each individual layer.
- 22:09So it just adds up predictably.
- 22:10Exactly.
- 22:11If you calculate the MSE of the quantization at layer 12 and you multiply it by a specific pre-computable constant for that layer, you know exactly how much that specific compression will degrade the entire model's final perplexity.
- 22:26You just add up the damage from all the layers, and you have your final score.
- 22:29So what does this all mean?
- 22:31Why was this paper such a breakthrough?
- 22:33It's huge.
- 22:34It means we finally took the blindfold off.
- 22:36We don't have to guess and check anymore.
- 22:37Right.
- 22:38We don't have to compress the model, run it for an hour, and say, "Oops, we broke it." We can perfectly predict exactly how much a specific shrinkage strategy will hurt the AI using simple linear math without ever having to boot up the whole massive model.
- 22:52It is a profound theoretical result.
- 22:55It moves the entire field from empirical guesswork into predictive science.
- 22:59That is just incredible.
- 23:00And because they map the exact landscape of how errors compound, it immediately yielded two massive world-changing practical applications.
- 23:08Once you have the map of what causes the global error, you can build algorithms to optimize around it perfectly.
- 23:14So let's look at the first thing they built with this new map.
- 23:17It is an application with arguably one of the best acronyms in AI research, HIGGS.
- 23:23Yeah, great acronyms.
- 23:24Because of the linearity theorem, the researchers knew exactly what they needed to minimize.
- 23:28They needed to minimize the per-layer MSE to keep the overall model smart.
- 23:32Right.
- 23:33But they set themselves a massive secondary challenge.
- 23:36They wanted to optimize the model without using any calibration data.
- 23:40Right. No data at all.
- 23:41Now, earlier we said calibration data was the big breakthrough of the Data Aware era.
- 23:46Why is avoiding it suddenly the holy grail?
- 23:49I thought data was good.
- 23:50Calibration data is a highly effective crutch, but it comes with significant baggage.
- 23:55Like what?
- 23:55First, it's slow.
- 23:58Processing gigabytes of data through a model to calibrate it takes time.
- 24:03But more importantly, calibration data can severely bias the model.
- 24:07Why is it?
- 24:08If you calibrate your quantization process by feeding the AI thousands of pages of English Wikipedia, the mathematical rounding gets over-optimized for English facts.
- 24:18Oh, I see.
- 24:19Consequently, the model might get worse at writing Python code or speaking French or doing logic puzzles because those pathways weren't protected during calibration.
- 24:28That makes a lot of sense.
- 24:29True data-free quantization is the ultimate goal because it means you just look at the raw mathematical weights of the model and compress it universally, preserving all its capabilities without bias.
- 24:39But wait, if you don't use data to map out the network, how do you handle...
- 24:43Our old friends, the outlier gremlins.
- 24:45Ah, the gremlin.
- 24:46Without data showing you where the huge spikes in the math are going to happen, don't the gremlins just crush the scale again?
- 24:53They would if you didn't transform the weights first.
- 24:56To handle the outliers without data, the researchers turn to a mathematical technique called Hadamard rotations.
- 25:01Okay, I love this part of the paper.
- 25:03If the outliers in the AI's weights are giant, stubborn clumps of dry flour in our cake batter, The Hadamard rotation is the ultimate whisk.
- 25:13The ultimate whisk.
- 25:14It is a mathematical matrix that literally smears the weights out into a perfectly smooth Gaussian distribution.
- 25:22Beautifully described.
- 25:23It takes the extreme high numbers and the extreme low numbers and blends them together so that every single number in the layer is roughly the exact same size and importance.
- 25:34the spikes disappear.
- 25:35It's a very vivid way to visualize it.
- 25:37By applying this Hadamard whisk to the weights, you mathematically guarantee that the data loses its jagged spikes and smooths it out into a beautiful Belker, a Gaussian distribution.
- 25:48And this is where the magic happens.
- 25:50Once your data is perfectly Gaussian, mathematics has a pre-existing, flawlessly perfect solution for how to compress it.
- 25:58You use what theorists call Gaussian MSE optimal grids.
- 26:02You whisk the data until it's smooth, apply the perfect theoretical grid to compress it, and you're done.
- 26:07Exactly.
- 26:08Had a marred incoherence with Gaussian MSC optimal grids.
- 26:12That gives us HeyIGS.
- 26:13HeyIGS.
- 26:14And the empirical results from the paper are stunning.
- 26:18HeyIGS beat the pants off previous data-free standards like the widely used NF4 format.
- 26:23Wow.
- 26:24It achieved incredibly high accuracy without needing a single drop of training data.
- 26:29It is fast to compute, and because it doesn't use data, it is entirely unbiased.
- 26:34The model retains its ability to code, speak multiple languages, and reason, all while being vastly smaller.
- 26:40Okay, I have to push back here, though.
- 26:42Yeah.
- 26:42Because the math sounds elegant, but my logic alarm is ringing.
- 26:45Okay, what's ringing?
- 26:46If you take the precise...
- 26:47carefully trained knowledge of an AI, the specific weights that know the capital of France, or how to write a PyCon script, and you whisk them together into a smooth paste, don't you destroy the actual knowledge? How does the AI still know what a dog is if you've smeared all its data into a generic bell curve? Doesn't it just become mush?
- 27:06That is the exact right question to ask, and it highlights the brilliance of a Hadamard matrix.
- 27:11You are right, if you whisk a cake, you can't un-whisk it to get the eggs back.
- 27:15Exactly.
- 27:16But a Hedemard rotation isn't a chaotic mixing process.
- 27:19It is an orthogonal transformation.
- 27:22Orthogonal.
- 27:22That means it is a perfectly lossless, perfectly reversible rotation in multidimensional space.
- 27:29It's less like mixing a cake and more like shining a laser beam through a highly specific prism.
- 27:35A prism.
- 27:36The prism scatters the light into a smooth spectrum, but if you put an inverted prism on the other side, the light recombines perfectly into the original laser beam.
- 27:45Oh, wow.
- 27:46The knowledge isn't destroyed.
- 27:47It's just temporarily distributed across all the dimensions evenly so it can be safely compressed.
- 27:52Oh, wow. Okay, that makes perfect sense.
- 27:53It's a reversible prism. That is brilliant.
- 27:55It really is.
- 27:56But the linearity theorem...
- 27:57unlocked something even crazier than HIGGS.
- 28:06Let's look at the second major application they build with this new map: solving the non-uniform knapsack problem.
- 28:08Let's look at the second major application they build with this new map: This is where we reach the absolute frontier of optimization.
- 28:12Let's look at the second major application they build with this new map: If you think about the architecture of an LLM, not all layers are equally important to the final answer.
- 28:18Let's look at the second major application they build with this new map: Okay, how so?
- 28:19Let's look at the second major application they build with this new map: Some layers deep in the network are doing heavy, abstract, complex reasoning.
- 28:24Let's look at the second major application they build with this new map: Other layers, perhaps near the end, are just doing basic grammatical formatting or word selection.
- 28:29Let's look at the second major application they build with this new map: Right, so forcing every single layer to undergo the exact same level of compression is incredibly inefficient.
- 28:35Let's look at the second major application they build with this new map: Highly inefficient.
- 28:36Let's look at the second major application they build with this new map: If we have a memory budget and we want an AI to average, say, 3.5 bits per parameter, we shouldn't just force every layer to exactly 3.5 bits.
- 28:44Let's look at the second major application they build with this new map: No, you wouldn't want to.
- 28:45Let's look at the second major application they build with this new map: We should aggressively compress the dumb grammatical formatting layers down to 2 bits and save our memory budget so we can keep the smart, heavy reasoning layers at a high definition 4 or 5 bits.
- 28:55Let's look at the second major application they build with this new map: Precisely.
- 28:56Let's look at the second major application they build with this new map: The industry calls this non-uniform or mixed precision quantization.
- 29:06But historically, it presented a nearly impossible puzzle: combinatorial explosion.
- 29:07But historically, it presented a nearly impossible puzzle: Combinatorial explosion.
- 29:08But historically, it presented a nearly impossible puzzle: A modern LLM might have 80 layers.
- 29:11But historically, it presented a nearly impossible puzzle: For each layer, you could choose 2-bit, 3-bit, 4-bit, or 5-bit compression.
- 29:16But historically, it presented a nearly impossible puzzle: That results in billions of possible configurations.
- 29:20But historically, it presented a nearly impossible puzzle: Billions?
- 29:20But historically, it presented a nearly impossible puzzle: How do you find the one single perfect combination that fits your exact memory constraint, say exactly 12 gigabytes, but maximizes the model's overall intelligence?
- 29:30But historically, it presented a nearly impossible puzzle: before the linearity theorem, finding that exact configuration...
- 29:36But historically, it presented a nearly impossible puzzle: ...of the map provided by the linearity theorem.
- 29:39But historically, it presented a nearly impossible puzzle: Because of the theorem, we know that the total error of the AI is just the simple linear sum of the individual layer errors.
- 29:46But historically, it presented a nearly impossible puzzle: Right.
- 29:47But historically, it presented a nearly impossible puzzle: And that mathematical property acts like a magic wand.
- 29:49But historically, it presented a nearly impossible puzzle: It transforms this terrifying billion option complexity into a highly solvable classic computer science puzzle known as a dynamic programming problem.
- 29:58But historically, it presented a nearly impossible puzzle: specifically a knapsack problem.
- 30:00But historically, it presented a nearly impossible puzzle: A knapsack problem.
- 30:02But historically, it presented a nearly impossible puzzle: It's like packing a backpack for a multi-day hiking trip.
- 30:04But historically, it presented a nearly impossible puzzle: You have a strict physical weight limit for the bag, say 30 pounds.
- 30:08But historically, it presented a nearly impossible puzzle: You have a pile of gear on the floor.
- 30:11But historically, it presented a nearly impossible puzzle: You know exactly how much each item weighs and exactly how much survival value it brings you on the trail.
- 30:16But historically, it presented a nearly impossible puzzle: You can't take everything.
- 30:17But historically, it presented a nearly impossible puzzle: But because the values are linear, you don't have to guess and check every combination.
- 30:21But historically, it presented a nearly impossible puzzle: You just run a standard dynamic programming algorithm to figure out the mathematically optimal mix of gear to maximize your survival value without breaking the backpack straps.
- 30:32But historically, it presented a nearly impossible puzzle: That is a flawless analogy.
- 30:34But historically, it presented a nearly impossible puzzle: What used to be an unsolvable guesswork nightmare can now be solved by a standard linear solver algorithm in milliseconds.
- 30:41But historically, it presented a nearly impossible puzzle: Milliseconds. That's crazy.
- 30:42But historically, it presented a nearly impossible puzzle: You literally type into the program, "I have exactly 14 gigabytes of memory." And the solver uses the linearity theorem to spit out the mathematically perfect optimal bit width for every single layer.
- 30:54But historically, it presented a nearly impossible puzzle: It perfectly packs the AI's intelligence into the exact hardware constraint you have.
- 30:59But historically, it presented a nearly impossible puzzle: Okay, I have one more massive logistical pushback.
- 31:01But historically, it presented a nearly impossible puzzle: Bring it on! We're talking about applying Hadamard rotations scattering the data through a mathematical prism, and then running these complex mixed precision layers where layer 10 is 2-bit, layer 11 is 4-bit, and layer 12 is 3-bit.
- 31:15But historically, it presented a nearly impossible puzzle: If the processor is doing all this reversing of prisms and switching math formats on the fly while generating text, doesn't that require a ton of extra compute?
- 31:26But historically, it presented a nearly impossible puzzle: Aren't we right back where we started in Act 1, overwhelming the hardware and slowing the AI down?
- 31:31But historically, it presented a nearly impossible puzzle: You are hitting on the ultimate reality check for any quantization scheme.
- 31:35But historically, it presented a nearly impossible puzzle: Theoretical math is useless if it chokes the actual silicon.
- 31:39But historically, it presented a nearly impossible puzzle: Right.
- 31:39But historically, it presented a nearly impossible puzzle: But the answer is no, it does not slow the hardware down.
- 31:42But historically, it presented a nearly impossible puzzle: Let's take the Hadamard rotations first.
- 31:45But historically, it presented a nearly impossible puzzle: Because they are linear mathematical operations, they don't actually have to be calculated at runtime.
- 31:50But historically, it presented a nearly impossible puzzle: They can be fused or folded directly into the weights of the previous adjacent layers ahead of time.
- 31:54But historically, it presented a nearly impossible puzzle: Folded in, like pre-baking the mathematical prism directly into the glass of the lens before you even turn the machine on.
- 32:01But historically, it presented a nearly impossible puzzle: Exactly.
- 32:02But historically, it presented a nearly impossible puzzle: The transformation is pre-computed.
- 32:04But historically, it presented a nearly impossible puzzle: When you actually boot up the AI to generate text, the rotations are virtually invisible to the processor.
- 32:09But historically, it presented a nearly impossible puzzle: They require zero extra runtime compute.
- 32:13But historically, it presented a nearly impossible puzzle: And as for the non-uniform knapsack problem, jumping between 2-bit and 4-bit math, modern GPU programming, specifically the low-level kernels written by researchers, has been heavily optimized in recent years to support switching precision seamlessly on the fly.
- 32:29But historically, it presented a nearly impossible puzzle: So the hardware is ready for it.
- 32:30But historically, it presented a nearly impossible puzzle: The processor can handle it without breaking a sweat, so the AI stays blisteringly fast.
- 32:34But historically, it presented a nearly impossible puzzle: Which means we successfully solved the bottleneck.
- 32:36But historically, it presented a nearly impossible puzzle: We did.
- 32:37But historically, it presented a nearly impossible puzzle: We started by hitting a physical wall where our processors were starving for data because the memories were too massive.
- 32:43But historically, it presented a nearly impossible puzzle: We tried to shrink them, but we were attacked by the scale of our own models, those 100x multiplier outlier gremlins.
- 32:50But historically, it presented a nearly impossible puzzle: We fought back with clever duct tape solutions like LLM.int8, quarantining the outliers.
- 32:56But historically, it presented a nearly impossible puzzle: We got a little smarter with GPTQ, using Hessian matrices to navigate the error landscape, before a brilliant paper revealed we'd actually stumbled into the hidden classical geometry of Babi's nearest plane algorithm.
- 33:08But historically, it presented a nearly impossible puzzle: A remarkable trajectory from empirical hacking to recognizing the underlying geometry.
- 33:14But historically, it presented a nearly impossible puzzle: And finally, Malinowski, Panferov, and their team Took the blindfold off entirely.
- 33:20But historically, it presented a nearly impossible puzzle: Yeah, they really did.
- 33:21But historically, it presented a nearly impossible puzzle: They wrote the literal laws of physics for AI shrinkage with the linearity theorem.
- 33:26But historically, it presented a nearly impossible puzzle: They proved how microscopic errors map to macroscopic intelligence, allowing us to build unbiased, data-free models with HIGGs and mathematically perfect configurations using the Knapsack algorithm.
- 33:37But historically, it presented a nearly impossible puzzle: Yes.
- 33:38But historically, it presented a nearly impossible puzzle: We get the deep reasoning intelligence of a massive 70 billion parameter model.
- 33:42But historically, it presented a nearly impossible puzzle: but with a memory footprint so small it can run on standard consumer hardware.
- 33:46But historically, it presented a nearly impossible puzzle: That is the complete arc of the journey, and it represents a paradigm shift in how we handle these massive neural networks.
- 33:52But historically, it presented a nearly impossible puzzle: But let's bring this home for the listener.
- 33:55But historically, it presented a nearly impossible puzzle: If someone is listening to this on their commute or while walking the dog, why does this deep theoretical math journey matter to them?
- 34:02But historically, it presented a nearly impossible puzzle: Because it changes everything.
- 34:04But historically, it presented a nearly impossible puzzle: It matters because this precise math is the exact reason that an incredibly smart, highly capable AI will very soon live directly on your personal laptop or entirely locally on your smartphone.
- 34:18But historically, it presented a nearly impossible puzzle: Absolutely.
- 34:19But historically, it presented a nearly impossible puzzle: It will be completely private, meaning your data never leaves your device.
- 34:23But historically, it presented a nearly impossible puzzle: It will be incredibly secure and it will be lightning fast.
- 34:26But historically, it presented a nearly impossible puzzle: Right.
- 34:26But historically, it presented a nearly impossible puzzle: It won't be locked away in a trillion dollar corporate data center requiring an active internet connection and a monthly subscription fee.
- 34:33But historically, it presented a nearly impossible puzzle: Yeah, exactly.
- 34:34But historically, it presented a nearly impossible puzzle: It will be right there in your pocket functioning as a true local assistant and it is this specific geometry and linear math that makes that future physically possible.
- 34:44But historically, it presented a nearly impossible puzzle: And that leads to a final thought worth considering as we look at the landscape of technology right now. We have spent the first few years of the generative AI boom doing basically one thing, building bigger and bigger digital.
- 34:55But historically, it presented a nearly impossible puzzle: brains yeah it's been an arms race of scale the entire industry assumed that sheer brute-force scale building massive data centers erecting cooling towers consuming gigawatts of power was the only viable path to advanced reasoning and intelligence right but if elegant foundational mathematical theories like the linearity theorem can effectively fold these giant minds into a fraction of the space with almost zero loss of capability it forces us to ask a question What's the question?
- 35:25But historically, it presented a nearly impossible puzzle: What happens when we stop focusing solely on building bigger, more power-hungry data centers and start relying on better, more elegant math?
- 35:33But historically, it presented a nearly impossible puzzle: Wow.
- 35:34But historically, it presented a nearly impossible puzzle: If we can shrink today's giants to fit in our pockets, could the massive trillion-parameter supermodels of tomorrow eventually run seamlessly on the smartwatch of Nexos?
- 35:43But historically, it presented a nearly impossible puzzle: week. That is a genuinely exciting thought to chew on. The future of intelligence might not be giant energy-guzzling vats after all. And maybe not. It might just be really, really elegant geometry.
- 35:54But historically, it presented a nearly impossible puzzle: Thanks for joining us on this deep dive into the math behind shrinking AI. We'll catch you next time.