# Oral 31737

- Kind: Oral
- Talk page and recording: https://iclr.cc/virtual/2025/oral/31737

> Transcript of the talk's recording (session_asr), made by speech recognition or taken from the host's captions. It may contain errors. The words are the speakers'; listen to the recording on the talk's page before quoting it.

So scale has sort of emerged as the central driver of progress in modern deep learning, and I'm excited to share with you guys today some work we've done on a very specific kind of scaling law, scaling laws for precision. My name is Tanishq, and this was joint work with my collaborators Zach, Ben, Blake, Nicholas, Manchij, and supervised by Cengiz, Chris, and Aditi. Fair warning, I'm aware people are getting off flights and we're almost at lunchtime, so I've taken the liberty of replacing half the equations with pictures of llamas in an attempt to boost engagement. We'll see how well that works. So to set the scene, modern deep learning is really a story of flops, and there's generally two ways in which we scale up models. The first one is by increasing the size of our models, the parameter count n. Alternatively, people scale up the number of tokens on which language models are trained, the data set size. But increasingly, there's a third lever that people are using to increase the compute that goes into language models. Modern language model pre-training is so competitive that no flop can afford to be wasted. This is evinced by the fact that modern NVIDIA GPUs are adding support for incessantly lower precision with every generation. There's wonderful work being done pushing quantization during training to its absolute limits at scale. And to set the scene overall, we're going to be covering two conceptually different ways that quantization is used in scaling with respect to both. They can be combined. We'll cover them separately and then together. First of all, we'll talk about post-train quantization, which is what we do before we serve models in production so that they're cheaper. The key result here is going to be that post-train quantization doesn't really play that well with large amounts of data. We're going to find something that I personally find relatively astonishing, the fact that in some cases, like we'll see here, more pre-training flops do not always result in better models. In the second section, we're going to study training. And there, we'll have more traditional scaling law-like results where we see that the effects of quantization on loss are predictable. And a consequence of this is that we'll be able to quantitatively predict both loss and compute budget in advance and do some what I think are interesting compute optimality calculations. As promised, we have llama number one. So let's start with post-train quantization. So typically, when people are pre-training language models, they train them to what's called chinchilla optimal. And colloquially, chinchilla optimal means training to a number of tokens that's roughly 20 times the number of parameters in your language model. This varies from 10 to 100, but it's generally not too large a number. Nowadays, what we're seeing in what I call the modern inference-heavy language modeling regime is that the token to parameter ratio for production language models is closer to 1,000 a lot of the time. Often, it reaches things as high as 10,000. This is the overtrained regime, and people do this primarily to make inference cheaper because inference is the primary cost in modern foundation model pipelines. So the main result here that I'm going to talk about is actually the fact that post-train quantization becomes harder as you train for longer and longer. What you're seeing on this plot here is the degradation induced by quantizing your weights after pre-training. The gray line is the base model as it's trained for longer and longer. That's the x-axis, the token to parameter ratio. And then the colored lines are the validation loss of the language model after you quantize it, before you serve it. The key thing here is that the gap between the colored lines and the gray lines is increasing as we train on more data. It's not just increasing, it's increasing in a predictable way. So on the bottom, I've plotted just the degradation in loss induced by quantization. And the key thing is that it's linear on a log-log scale, which means that the degradation, the delta that I've put on the y-axis here, is approximately a power law on the x-axis, which is the token to parameter ratio. The upshot of this is that we can fit a scaling law. So now we can predict the quantization-induced degradation in advance using a functional form like this. There's a lot of constants here, and the details aren't so important. The key thing is that the degradation increases as the data increases and, of course, depends on the precision too. That's what you're seeing here. And a striking consequence of this is that the loss curves can actually be U-shaped if you're looking at the loss after post-trained quantization, so that more pre-training flops can result in worse models at inference time. Okay, so that was post-trained quantization. Let's turn our focus to quantized training. When we're talking about low precision and quantized training, the hypothesis that we're going to be working with here and the sort of spirit of the paper is that we can measure and predict the effect of quantizing the weights during training purely through their effect on the parameter count by basically introducing a new concept, the effective parameter count, that generalizes the traditional parameter count we see in loss scaling laws. This is the extremely iconic chinchilla scaling law, so iconic, in fact, that a few weeks ago I saw someone in San Francisco wearing it on a T-shirt on the street, which was surprising to me. And all we're going to be doing is substituting n in this equation with some generalized n effective that now depends on the precision in which we're training. This is the functional form we're using. It turns out to be the best fit to the data, and we try a bunch of things in the paper. And if you step back a minute, it's sort of intuitive. It just says that when you're training in high precision, you're training with all n parameters that you have. And as you go to lower and lower precision, the effective number of parameters you have sort of vanishes. This fits the data well. You can see the dots here represent the actual loss at the end of training runs in various precision with various model sizes. Those are the empirical values. And then the lines are the predictions of our fitted functional form. The sort of subtlety here is that we've only talked about weights, but to actually save compute during modern pre-training, you have to do low precision matrix multiplications, which on GPUs require both the weights and activations and other things like the cache to be in the same precision. So really, we need to be fitting a similar form for other parts of the model. It turns out that maybe the most naive thing you can do when you're deriving a scaling law for all parts of the model is to assume that everything behaves in this way. And to even further assume that things are so well behaved that they interact independently, which leads very naturally to a functional form like this. And it turns out this is a very good fit to the data, perhaps surprisingly, perhaps not. And it leads us to be able to predict model capacity in advance when you are training your language models in any precision and not just their weights, but any part of the model or any combination thereof. So here you can see the weights are the least sensitive. Capacity decreases slowest in blue as you reduce precision, and activations are the most sensitive. So the upshot of all this tomfoolery is really that we can predict the loss given a parameter count, data budget, and precision in advance. We also know we can write down the compute cost as a function of these three things because GPUs give us twice the flops when we have the precision. This leads very naturally to us being able to set up a minimization problem that seeks to minimize loss under a certain compute budget. There's a bunch of algebra in the paper that I'll spare you the details of, but immediately the theory makes a few falsifiable predictions that we test at scale. They're all interesting, but one to me is particularly striking, and it's the fact that if you are training in a regime where your model size is constrained, suddenly this independence ceases to be true. So the compute optimal precision, if you are told by an executive at some big tech company that you must be training small models for the open source community, it actually turns out that the compute optimal precision for pre-training is now increasing in the compute budget that you have. So sort of summarizing, our paper goes through the post-training scaling laws, the pre-training scaling laws, and then at the end weaves them together into a unified scaling law that lets you make predictions about the loss degradation incurred by not just quantizing at the end or during training, but arbitrary combinations of the two. There's limitations to the analysis that we articulate in the paper, perhaps the most significant being that we study one type of architecture and an academic scale compute budget. In the future, I hope people will scale this up, see if these conclusions hold at scale, and also design architectures that are aware of quantization noise, leading to compute optimal precisions that are markedly lower. I'll be presenting a poster. I hope all of you come along and ask the difficult questions there. And as promised, here is the final llama. Perhaps we can work towards a future where our quantization methods don't hurt our models as much. Yeah, feel free to scan the QR code, take a look at the paper, and thank you for your attention. Great. Thank you for the great talk. Yeah, so we have time for one or two questions. Hi, thank you for the great talk. Very interesting. I have a question. So how agnostic are your observations depending on the formats in which you do quantization? That's a good question. So typically there's two types that people quantize to, either integer or floating point. The experiments we do are primarily an integer type, but we do ablations and look at floating point quantization. And the short answer is basically the same functional forms hold in
