LALatent SpaceAug 3, 2026· 1:42:54

Next 100x in AI: Inference, Networking, & Self-Optimizing Models — Philip Kiely & Ali Taha, Baseten

Philip Kiely and Ali Taha of Baseten join Swyx to explain what actually happens when a 200,000-token request hits a production inference system, arguing that stacking quantization, speculative decoding, and disaggregated prefill/decode can make open models like GLM-5.2 up to 10x faster. They detail cache-aware routing, training traffic-specific speculators, and why quantization errors can cancel out so a more-quantized model beats a less-quantized one. They also reveal how Baseten grafted Kimi's vision encoder onto GLM-5.2, discuss NVIDIA Dynamo as a toolkit rather than a turnkey speedup, and explain why they are bearish on mega kernels. The conversation covers video generation's compute barriers, the trend toward ASIC-like GPUs, and the emerging loop where GLM-5.2 writes the GPU kernels that serve itself.

  1. 0:00Inference Journey
  2. 12:38Model Onboarding
  3. 26:41Quantization Quality
  4. 33:56Speed & Speculation
  5. 51:43Parallelism & Kernels
  6. 1:01:24Hardware Horizons
  7. 1:14:19Video Diffusion
  8. 1:29:07Self-Optimization

Powered by PodHood

Transcript

Inference Journey0:00

Swyx0:00

GLM-5.2 is very, very good at writing GPU kernels. It was very funny: internally we had a GLM-5.2 endpoint that we were using to—like, that we plugged in in our cloud code harness so every engineering team uses—like, our GLM-5.2—and it will do a forward pass on the GLM-5.2 instance of the, you know, the node, and then it will get the profile trace, and it will analyze it, and it will find the kernels that are the bottlenecks in SGLang, and then it will write the new kernels, and then it will do another profiling trace, and when it's done it uploads the image to our thing, and then we can pull that image down and repeat the cycle.

Some of the GPU kernels that we run GLM-5.2 with in our inference engine are written by GLM-5.2.

Host0:40

Before we get into today's episode, I just have a small message for listeners. Thank you. We will not be able to bring you the AI engineering, science, and entertainment content that you so clearly want if you didn't choose to also click in and tune into our content.

We've been approached by sponsors on an almost daily basis, but fortunately enough of you actually subscribe to us to keep all this sustainable without ads, and we want to keep it that way. But I just have one favor to ask all of you: the single most powerful, completely free thing you can do is to click that subscribe button.

It's the only thing I'll ever ask of you, and it means absolutely everything to me and my team that works so hard to bring the InSpace to you each and every week. If you do it, I promise you we'll never stop working to make this show even better.

Now let's get into it.

Swyx1:28

Okay, we're here in the studio with Philip, an old friend from Inference Engineering, the book, as well as Baseten and everything that you've done, you and I have done before, as well as Ali. Welcome.

Ali Taha1:40

Pleasure to meet you.

Swyx1:41

Waterloo Intern.

Ali Taha1:41

Waterloo Intern, always.

Swyx1:43

When did you get Waterloo Intern as a—

Ali Taha1:44

As a handle?

Swyx1:45

Handle.

Ali Taha1:46

I think the rebranding happened, like, mid-March. When I saw it was open, I was like, I have to take it. I'll free grabs.

Swyx1:51

The problem is that Ali is really good at his job and is not going to be an intern much longer, so we have to figure out, you know, who's going to get the handle.

Ali Taha1:59

Pass the torch over to him.

Swyx2:00

Oh, okay. It can be—like, you just pass it to another Waterloo Grad.

Ali Taha2:03

It's another Waterloo Intern.

Swyx2:04

Another Grad.

Ali Taha2:04

Yeah, yeah.

Swyx2:05

Intern.

Host2:05

Intern, yeah.

Swyx2:06

You're not a Gettin intern from Waterloo.

Ali Taha2:07

Yeah, I've got a Gettin intern from Waterloo.

Swyx2:09

But you have to promise the person.

Ali Taha2:11

But it could come from Baseten, so it's like whoever Baseten gets from Waterloo has the title of Waterloo Intern.

Swyx2:16

It stays in their fist.

Ali Taha2:16

They have to pass your—

Swyx2:17

Exactly.

Ali Taha2:17

Halfway through a internship, you either get it or you're out.

Swyx2:20

You should also do, like, a big graduation ceremony where you change the handle.

Ali Taha2:24

Just say it like it.

Swyx2:25

I mean, you guys are good at ceremonies, clearly. You know, we had a nice launch of the book, very successful. But before we get into all that, I want to start off with a fun question for you. Okay, you're an expert inference engineer.

What happens when I send a long query, say, 200,000 tokens into Baseten's inference? What's the process of query through GPU, model routing, balancing, all that? What is all the stuff that we don't think about?

Ali Taha2:51

With a long query specifically, the first thing that I'm going to ask is, have you sent me this query before, or at least part of it? And I really hope you have, because it's going to be a lot easier for me and a lot cheaper for you.

So the first thing that we're going to look at is some kind of cache-aware routing where we're going to see we probably have a number of instances, a number of replicas up serving whatever model you're hitting. We want to send this one to something with, number one, available prefill workers, and number two, ideally some cached input already there so that we can skip prefill on at least part of these 200,000 tokens.

If you're doing 200,000 tokens, it's probably coding or a multi-tone agent or something where you would expect to have that cached. If you don't, we're going to have to send it to a prefill worker. We've, at least on certain models, disaggregated prefill and decode.

So you're going to have one set of GPUs that's solely going to process the input, create that KV cache, and get you your first token. And then that's going to be passed over to a separate set of GPUs which is going to run decode, we're going to iteratively make those tokens, we're probably going to have some kind of speculative model in front of that.

I'm going to assume that you're doing coding, and because of that, a speculative model which assumes you're doing coding is going to have a high draft token acceptance rate. If I'm wrong and you're asking me to summarize every Harry Potter book, it's going to be slower.

And then we stream that output to you and account for it, charge you, you know, some number of couple of pennies, and say, hey, would you like to send another one?

Swyx4:30

Except Baseten doesn't charge by pennies.

Ali Taha4:32

Well, yeah, we charge—we—I'm assuming that we're talking about the public model APIs. If you are, you know, setting up a dedicated deployment, then yeah, it's not pennies.

Swyx4:43

Yeah. I mean, one of the key differentiators when I was talking with Baseten initially was that actually people who want very, very high volume just need to rent by the box, because then it's up to you to figure out how to saturate the box.

Ali Taha4:56

And more often than not, it's like way cheaper if you're pushing, like, millions of tokens per hour, if you just pay per hour instead of paper token.

Swyx5:02

Yeah, they do. I think that we've increasingly seen a lot of demand for the sort of paper token APIs just because everyone wants to try open models, and then once they find a use case that's really sticky, then they move over to dedicated.

Ali Taha5:16

Is there a best practice on when it's time to swap over?

Swyx5:19

A couple reasons. Yeah, reliability, that's a big one,right?

Ali Taha5:22

Like, if they have a very specific use case, they want you to train something specifically for them. Like, they want their own spec deck, for instance, for their own traffic.

Swyx5:29

Spec deck is speculative decoding.

Ali Taha5:31

Speculative decoding, yeah, yeah.

Swyx5:32

You like to—

Ali Taha5:33

Sorry. Like, the way you spec—like, basically if you have a huge model,right, and so the model is going to be generating one token at a time every single turn, every single forward pass. So we attach, like, this little, like, kind of parasite, like this layer that goes on top of the model.

And this model just has to predict—it does three very fast autoregressive forward passes, and it will predict, like, you know, three certain tokens, and then you do one forward stage over the entire original model in order to see if those predictions were correct or not, and then you accept them or you reject them.

Now, this draft model is traffic-specific, so if you, like, you know, Philip said, if you're summarizing Harry Potter books, I can train exclusively that draft model on Harry Potter books, and I can guarantee you that I'm going to accept the three tokens every single time.

And so with that case, I increase your decode speed. I wouldn't be able to provide this to you if you were on a shared endpoint, because I have no idea if you're doing Harry Potter, if you're doing coding, if you're doing English.

Like, we don't know. Also, there was a thing in the book that mentioned that they really cared about a specific threshold. Chapter 4, I think. Do you remember that?

Swyx6:31

Yeah, the things that you can do is you can set, you know, a specific, like, batch sizing, a specific, like, parallelism strategy if you're trying to optimize for, like, throughput versus latency. You can, you know, maybe a NVFP4 quant doesn't pass your benchmarks and you want to run a model at higher precision, you can do that.

There's just a bunch of reasons why you might want to have your own endpoint, and the biggest one, of course, just being, like, you don't have to deal with someone else throwing 100 million of tokens of benchmarking traffic at the endpoint when you happen to be trying to serve your users.

Ali Taha7:05

Yeah.

Swyx7:06

I think one thing that is—that is a classic journey, you know, it's basically Vivo is asking the, what happens when you type Google into the browser? Tool calling, is that just, you know, you're generating JSON or is there more complication beyond that?

Ali Taha7:23

Certain customers that we have, they have their own post-trained models, and so they demand tool calling that's not just, like, you know, parse a file or, you know, go find the weather. It's something that's very specific, and you have to do post-training on this.

And if the post-training on the model is not good, or if the quantization. After the post-training to get the inference to be fast, the model will struggle reading the JSON file and reading the tool calling. But it doesn't require its own, like, sandbox.

It's not like it's going to use that tool calling to, like, escape a sandbox or, like, it doesn't have to be contained. It can just be a normal dedicated deployment. The challenge with tool calling more and more seems to be that the companies want certain tool calling, which is a very sensitive thing to train.

And because you're dealing with all of the JSON outputs, if it doesn't, like, close the end of the request in a very certain manner, you end up with a model that did the tool calling and, like, the thinking.

And so as a result of that, it didn't see the result and just hallucinated the result as it decoded. That seems to be the most challenging thing with tool calling, not really the sandbox as well.

Swyx8:22

Yeah, that's a challenge on the training side. And then on the inference side, there's work that you can do to scope the possible output. So we published this, actually, at this point, close to two years ago, the solution to this problem, which is you basically make a state machine and you use that to constrain the output to a specific format.

So this is the structured output problem. If you remember back in—

Ali Taha8:52

Yeah, the specific grammars, GML had this thing.

Swyx8:56

Yeah. So it's like the old-school, like, make sure this is only JSON, return only JSON, oh my grandma's going to die type of box.

Ali Taha9:04

Is this BNF grammar?

Swyx9:06

At some point, OpenAI released a thing that was like, yeah, if you want to constrain your output, write BNF grammar. Back is nowhere.

Ali Taha9:12

In our inference system, it's just a, yeah, specified output format, and you get the guarantee that your output's going to be structured along that format. And so applying that to tool calls can, like, help cut down on—obviously, you can still call the wrong tool or call no tool, it doesn't solve the certainty problem, but it at least solves the output structuring problem with the tool calls.

Swyx9:37

And MCP is just another form of tool,right?

Ali Taha9:40

Yeah, exactly.

Swyx9:40

There's no special thing there.

Ali Taha9:41

The thing I'm always, like, explaining to people is the LLM is actually not capable of doing anything. It's only capable of making suggestions of what to do. And then if those suggestions are formatted in a certain way and applied to a system that knows what to do with them, then an action occurs.

Swyx9:57

Yeah, yeah. Part of the fun stuff is, you know, this is solved outside of tool calling too. Like, in an agent loop, if the output is not correct or you'reright, like, reasoning—tool calling was done in the reasoning sale, just be like, oh, I don't know what to do, let me just try again.

And, you know, it might get there after a few tries. And on your point of training, sometimes this is harder in smaller models, so you don't have the same exact quality output when you just swap from a big model,right?

Ali Taha10:24

Yeah. I will say that before we—I think we need to go back to inference engineering proper. But I had expected that something would replace JSON, because it's hard to stream JSON, because JSON must be complete and you must have open and close brackets and everything.

So it's hard to parse something or validate something while it's being streamed. So people invented all sorts of things that are, like, I forget the name of some of these alternatives, but it's basically something like TOML, something like YAML.

But JSON seems to be dominant still.

Swyx10:55

The JSON output's not that long,right? Like, I guess you could have a long—because tool calls also contain the arguments in them, and perhaps for a certain tool you might pass, like, a very long argument. But my impression of the sort of median tool call is that it's a relatively small number of tokens,right?

So I would expect that speculators are generally fairly good at something as formatted as JSON. And so you would have, like, a pretty fast decode step there and that the streaming wouldn't be as valuable, but maybe I'm wrong about that.

Ali Taha11:27

I think you're also bounded by the software, or that the model is going to integrate with if the software is built with JSON for the tool calls, or if the company that you're, you know, if your customer says that this is how our software works and our tools are interfaced with JSON, you can ask them to, like, you know, change their software and say, like, yeah, this is going to be better for the model.

But, like, with the wet training shouldn't be that much of a difference. Also more profitable if it outputs more tokens, probably.

Swyx11:50

Depends on your business model. It really depends. But I will say that, you know, as a writer with, like, experience a lot with AI-generated output, I do try to move from text to JSON text, which is very long JSON,right?

Like, there's paragraphs in every field because I'm trying to structure it,right? I want you to first make factual statements, then make opinions, then make bullet point summaries, have dates, have entity references, have your sources for references, all these things.

Anyway, so these are things that, like, I think people who really, really experiment with structured output have to really care about. But let's sort of recurse up the stack a little bit. Before we started recording, you actually mentioned something which is really cool, which is that there's a lot of engineering, like inference engineering, that goes on when a new model provider releases a new model,right?

Model Onboarding12:38

Swyx12:38

So let's call it GLM-5.2, Kimi K3. I had previously assumed, especially if it's like, well, GLM-5 to 5.1 to 5.2, like, you know that you've supported them before. Is it that much work?

Ali Taha12:52

It's a lot of work.

Swyx12:53

Yeah. Okay, so, like, you know, a lot of people, all you guys,right, whenever a new model launches, like, people rush to say, like, oh, Hugging Face supports this, Fireworks supports this, Base10 supports this. And I'm like, yeah, of course it's supported.

But what goes into that? What goes behind?

Philip Kiely13:05

I think it's more than just supported too,right? It benefits the consumer a lot. Like, I think it was with Kimi K2.5 or GLM-5.2, the latest, there was sort of an inference war,right? X provider is at 90 tokens a second.

The next day we're at 150.

Swyx13:20

I kind of kicked that off with GLM-5.2. I wrote a Twitter article about it, got like half a million views.

Ali Taha13:27

Based on being number one.

Swyx13:29

Yeah.

Ali Taha13:29

Yeah, which then got everyone really excited about, hey, how can we, you know, benchmark a little bit further? And there was a difference between support the model as in, like, I can make a token out of this model and support a model as in I have a production-ready API from this model.

Getting to the point of I can make a token out of this model is not that hard because generally the open-source inference engines, you know, VLMs, SGLangs of the world, oftentimes even receive weights ahead of time maintainers do or the people making the model merge PRs to ensure support.

So you generally can, you know, just kind of get it working on the standard open-source stack without too much pain in most cases. The challenge is, you know, every inference company is going to have its own proprietary stack.

You know, some open-source components, some in-house stuff. And for any arbitrary model, there's going to be some new stuff. Sometimes you get lucky, like K2.5 to 2.6 was, like, pretty similar. Yeah, it was pure continued post-train, if I remember correctly.

Swyx14:44

Even in those cases, there's still stuff you have to do. You have to redo the quantization work. You're taking the model from, generally these models are not released in NVFP4, and we want them to be in NVFP4 for maximum blackwell compatibility.

So we have to perform that quantization and, you know, calibrate the quantization to make sure that we're not causing any kind of regression in the model's intelligence. And then we also have to train the speculator, as we've talked about.

Generally, we have, obviously we have ZDR, zero data retention, on our model APIs, so we don't know exactly the traffic that people are sending us, but we know what's popular. We know that coding use cases are popular. We know that agentic use cases are popular.

So we can get public data sets that are representative of that kind of traffic and train general speculators. Now, with speculators today, you need to train the speculator using the base model itself because you're getting hidden states out of the model from running inference on these specific prompts, and that is the training data you use to create the speculator.

So there's that process which you need the real model weights for. And then there's, of course, just the process of, you know, standing up all the infrastructure behind it, loading all the stuff in, testing it. And then when there's a new model with a newer architecture, I think that, like, obviously the DeepSeek models tend to be the most challenging as they have, like, the most novel architectural stuff going on, model over model.

But every new model has something. I mean, Kimi K2 had, oh, sorry, GLM-5.2 had.

Ali Taha16:18

Sparse.

Swyx16:19

Yeah, the DSA.

Ali Taha16:20

Right.

Swyx16:21

Which is brought from DeepSeek. Yeah. Yeah. And, you know, we.

Ali Taha16:24

So you can copy-paste it.

Swyx16:26

I don't know how this works. You know, so, like, we had to, like, build support for that into our runtime. And you'reright. Like, it actually is really interesting the way that all of these open-source labs borrow from each other.

For example, like, GLM-5.2 doesn't have vision. So something that Hailey, a guy on our team, if we could take a look at this, he, like, kind of grafted the Kimi vision encoder onto GLM-5.2.

Ali Taha16:52

While we're training the projector.

Swyx16:54

Exactly. So if you think about, like, the encoder, there's the encoder, which is the part that looks at the image and turns it into latent information. And then there's the projector, which kind of, like.

Ali Taha17:03

You can say it in space, it's okay.

Swyx17:06

And then there's the projector that maps it onto the model itself, and then there's the model weights. You don't want to mess with the model weights because you run a chance of making the model demo at something else for the purpose of giving it vision.

So instead, Hailey started with just a projector, which is only a handful of millions of parameters.

Ali Taha17:26

Yeah.

Swyx17:27

Yeah. And.

Ali Taha17:28

Can you show the training one? Like, the way it graphs is very, very interesting.

Swyx17:31

Yeah. And maybe, you know, maybe Ali, you should take it from here. You've got a better understanding of this than I do.

Ali Taha17:37

Yeah. You can see, like, the way he trained this is really, really cool. At the beginning, he was training it using just, like, here's a picture of a mountain. Can you describe what's in this mountain? And that caused it just, like, the first, you know, learning loss.

Like, here, you can see this. All we're trying to teach it is to translate the encoded. Like, it's already taken the encoder from Kimi K. It's taken the image. It's.

Swyx17:56

Yeah. Frozen, frozen.

Ali Taha17:57

Frozen, frozen.

Swyx17:57

With adapters.

Ali Taha17:58

Exactly. So the understanding, the brain is frozen, and the eyes are frozen. It's just we're trying to.

Swyx18:03

Align.

Ali Taha18:03

Interconnect between the eye and the brain,right? So the projector. And so you take the tokens, and then he's like, oh, can you describe what's in this image? And he's like, oh, it's a mountain, or it's a person, or it's a human, whatever the case is.

But that didn't cause complete understanding. So he changed it such that every image was associated with a data set of questions. Like, does this image have a white male? Does this image have birds in the top corner? Does this image have a scientist in it?

All that stuff. And it would have to answer questions correctly. And using not just training on describing an image, but being able to answer question, answer question, answer question, like, question answer over time. Like, you can see the graphing, which was, like, genuinely insane that retrofitting vision into a large LLM can learn to that extent.

And even for images that it doesn't perform well on, for instance, if you ask it a picture of, like, Stephen Hawking, who is this? Maybe it doesn't get it, but it will say something like, this is Albert Einstein.

Like, it still understands.

Swyx18:50

Close enough.

Ali Taha18:51

This is a scientist who is a man who has, you know, done significant achievements, all that stuff. So that's, like, really, really cool.

Swyx18:57

Yeah. And so we've covered Houtian before, who was the author of the LAVA paper that did this a while ago. And I think that that's very foundational work for anyone who hasn't done vision work before.

Philip Kiely19:07

Same with CLIP and MetaCLIP, where you go from just captioning to building out questions off the image and how much better you can get performance.

Swyx19:15

Right,right,right. Yeah. But what's so exciting about this is if you look at a model like this, now obviously this is a little bit more of a research project. It's not, you know, it got to 56% on MMLU Pro, I think.

So not quite Funteo. But if you're running this model, you haven't suffered any loss on your GLM-5.2 quality. If you don't have an image, it'll just behave exactly the way it used to. And.

Ali Taha19:39

Ultimately, in the inference code, you literally do not include the other part,right?

Swyx19:43

Yeah. I mean, you would just skip the encoder if you don't have an image input.

Ali Taha19:47

Okay.

Swyx19:48

Just confirming.

Philip Kiely19:48

Does it affect a lot on the overall inference side? Like, you're not adding much. You're adding a very small vision encoder. These are typically, like, less than a billion parameters.

Swyx19:57

Yeah. It's, I mean, there's a little bit less standardization among vision encoders. So the sort of support matrix can be a little bit sparser. But overall, yeah, it's a pretty minor component of the overall system. And ultimately, what you get out of the system is all of a sudden you have Kimi vision, GLM weights, and DeepSeek attention all in one model.

And that's, I think, a lot of the power and beauty of open source is that you can take all of these different components and combine them together into a system that's better than anyone can be individually.

Ali Taha20:31

People used to say that you would also do Franklin merges, where you would take, like, layers from each model. Does anyone do that anymore?

Host20:38

Well, to your point previously, when you were mentioning, like, the work that goes into supporting a model when it first comes out, like GLM-5.2 or Minimax M3 or whatever the case is, sometimes you do have to, like, you do have to switch out some things.

Like, for instance, the Minimax M3 head uses full attention. And with full attention, you end up with this, like, insane bottleneck inspector because you're doing autoregressive token generation for three tokens, and you're doing this, like, O(n2) over all of the tokens that are in your sequence.

Your KV cache is, like, very large because it's not sparse. It's not top K. So we find it better to, like, okay, we're going to replace this, you know, we're going to replace this layer with a layer from another model that's using, like, GQA, for instance.

And then just with theright training, you can get it to have the same acceptance rate. So it is very possible to retrofit layers from other models and very much needed, actually, if a layer is, like, inefficient. The training just becomes the challenge.

Like, how do you ensure that you train it properly? Which, again, to your earlier point, is, like, the mesh between training and inference. As in, like, you need very good training in order to do fast inference. That's, like, I feel like more and more becoming true.

Ali Taha21:46

Yeah. Anything else on the support side when you say, like, get it to fully production-ready?

Swyx21:51

Yeah. I think that there's also a question of just, you know, we can test a model to a pretty extensive degree, but we're trying to get it out quickly. And then you see a bunch of other people test it, and you get interesting results.

There was an issue with GLM briefly where we had some, like, mode collapses where it would just output the same token over and over again for certain prompts on certain temperatures. Like, once you expose an endpoint to the real world, there's going to be, you know, so many more varieties of things given to it that you're able to, you know, discover and patch things.

So it's not just a, you know, day zero process. It's then, like, for the first week, for the first month, if a model remains popular, like, how do you both fix bugs and then continue to push the envelope on performance?

Ali Taha22:46

What do you mean you don't want your model outputting SSSSSS?

Host22:50

Is there loop detection on that stuff, by the way? It still happens, like, quite a lot, which is surprising.

Ali Taha22:55

We have, like, in our endpoint, like, if a model were to output the same exact token, like, four plus times, we just caught the generation. We say, like, oh, sorry, let's try again. Or, like, we will reprocess the request.

Because we know then, like, if it, like, yeah, it's four times the same token, it's probably collapsed.

Host23:10

Yeah. Is there a way to opt out in case I really actually want that?

Ali Taha23:13

You're actually going to opt out. I think there's a way that we have to handle it. I'm not exactly certain. But I feel like in certain models, like, when they output something, like, you can imagine a, like, a table, for instance.

And so they want to draw, like, 12 dashes and 12 dashes. Yeah, I think there's a way for that to happen. I think we only do it on certain tokens. Like, we exclude certain special characters.

Swyx23:32

Yeah.

Ali Taha23:32

So we only do it on, like, certain, like, S is the most common almost, GLM-5.2. And I think it was DSV4 as well? Like, you just have, like, looping issues where, like, we just have, like.

Host23:43

Yeah. Is there something special about S? No, just so everyone knows.

Ali Taha23:47

It just seems to be the one token that.

Swyx23:48

Yeah. And it's only temperature zero or even at other temperatures.

Ali Taha23:53

0.9 or whatever, it will still collapse.

Swyx23:55

That's weird,right?

Ali Taha23:55

It's an inference problem, to be honest. It's like a software problem. Like, oftentimes, the image you run will, like, NVIDIA will release an image, for instance. And if we will upstream the changes from the latest RTLM image into our stack, we'll find that it fixes it.

Or oftentimes, this will only happen in an inference engine that you're using, like, SGLAN. But if you were to switch to VLM, that isn't the case. So it seems to be, like, an extremely, like, nondeterministic kind of software issue and not really a model issue.

It's not like a weights problem. Like, we'll say, like, oh, it's a problem with the quantity. We did PTQ wrong. Right? But that isn't, that doesn't make sense because the same exact weights used with a different inference engine does not repeat the problem.

And sometimes it's the kernels that are being used in the backend have, like, these very subtle, sometimes race conditions where if you were to use this model hosted on one cluster, you will never get this problem.

Swyx24:44

Oh my God.

Ali Taha24:44

But if you host it on a different cluster, you will. And the reason is the KV cache transfer from a node to node in that one cluster is using a slower interconnect than the node to node in another cluster.

So that exposes the race, whereas in another cluster, it doesn't. So then you end up just like, okay, this model is not going to be hosted on this cluster. We're going to host it on, you know, another cluster because that cluster exposed that problem.

But then it ends up with, like, okay, is it the software? Is it the model weights? Or is it the hardware?

Philip Kiely25:08

There is a thing about this with temperature zero still not being deterministic,right? Mostly because of hardware. Even at temperature zero, same model, you won't always get the same output.

Swyx25:17

Even, but I'm surprised by the race condition one because I thought PyTorch was a graph that, like, guarantees that you at least, you know, execute things in theright order.

Host25:27

Well, they aren't true. Like, I guess I'm not saying that there's a risk. Like, I guess, well, you have things like PDL optimizations where, like, you can start a kernel before the end of the previous kernel. And that's, like, you want to do that.

Swyx25:37

Like pipeline expense.

Host25:38

Exactly, exactly. But you don't do it cleanly. Like, you overlap a little bit of the execution. No, I guess. It is very possible that the kernel itself, like that one block that is supposed to be running in this instance of time, that kernel itself has a race condition.

For instance, like a missing barrier. Like, often if you're designing a kernel and you want it to be very fast, if you don't test it extensively, you'll have certain threads access data points from registers before they've been written to by other threads, for example.

Because, like, your barrier is wrong or your synchronization is wrong. But yeah, like, the testing itself is very, very difficult in those. Like.

Swyx26:08

And there's no, like, borrow checker for.

Host26:10

What does that mean?

Swyx26:11

Like Rust. Like that if you're trying to have, like, memory safety, it sounds like a comparable problem.

Host26:17

Well, I guess, but you're working in code,right? NVIDIA GPUs. It's like.

Swyx26:20

You just need a higher level language. Like modular. Maybe that's what modular is supposed to do. I don't know.

Philip Kiely26:25

How do you see keeping quality of the model? So you talked about all these steps of, okay, you got to do quantization, train your own speculative decoder, run on different hardware. Looking at other model providers, okay, you kicked off an inference speed race.

On the consumer end, what goes into keeping quality the same across them,right? Sure, you can run benchmarks, but, like, how do you determine how much quantization? Are there standards? What actually goes into?

Quantization Quality26:41

Swyx26:53

There's a few things on quality. Most inference optimizations are lossless. KV caching, for example, you are just recomputing or preventing recomputing the same values. Speculation, of course, if a draft token is wrong, it gets rejected. The main lossy optimization is quantization.

And that really comes down to, number one, data format. Number two, which parts of the model you choose to quantize, which layers. And number three, like, doing a lot of calibration on the quantized weights to ensure that you're sort of preserving all the outliers.

There's other sort of tricks that you can do, though. A big one is long context. Because one thing you askedright at the beginning is, oh, what's going to happen if I send a 200,000 token request in? So obviously, with a long input sequence, you need to

store a lot more information. You need to process a lot more tokens. And so even if a model has a context of a certain length, you might, as an inference provider, choose to build an API with a shorter context length and, of course, a full-length one as well.

Because if someone doesn't need the full million token context, for example, you can get them better performance. I don't know if that's exactly, like, quality of the model. The way that I think about quality is to what degree are we faithfully serving the original model?

If you think of a sort of golden implementation of a model that performs exactly the way the model is designed to perform, I think of quality as how close are we getting to that, you know, 100% fidelity of the model?

You can also, of course, think about quality from the training side and how do you push yourself past 100%. But when I think about purely inference optimizations, it's getting faster while staying as close to that 100% fidelity mark as possible.

And certainly, our standard internally is that, like, you should not be able to tell the difference between our API and a, you know, sort of official API. I think Kimi in particular does a good job of vendor benchmarking here.

Philip Kiely29:06

Yes. They released an actual vendor benchmark.

Swyx29:09

Exactly. Yeah.

Host29:09

Because they accused some people, Amazon. There was some provider that was not doing very well on Kimi's benchmark.

Swyx29:16

Yeah. So it would reflect what we were talking about.

Philip Kiely29:18

This was a long time ago,right?

Swyx29:19

No, like, like, three, four, five, five months ago.

Philip Kiely29:22

This also happened with, I don't remember which model, but they pulled out quite a few and then they started a whole chart about this. It might have been.

Swyx29:28

Kimi vendor verifier.

Philip Kiely29:29

Yeah.

Host29:30

Yeah. Because you'd be pissed,right? Like, if you're.

Swyx29:32

Yeah.

Host29:32

If, like, if I'm a consumer and I'm using, like, Amazon's endpoint, for instance, and I'm using Kimi and I'm like, oh my God, like, this is bad. I'm not going to say Amazon quantized the model in a bad way.

I'm going to say, oh, Kimi sucks. Right? So it seems like that.

Swyx29:44

Yeah, they care. They care.

Philip Kiely29:46

Justifiably.

Host29:47

Yeah, justifiably.

Swyx29:48

This is probably a stupid question, but just checking. Has anything improved from being quantization? Like, is quantization always strictly words?

Host29:56

Well, technically, it's a lossy. Quantization is a lossy. It's a lossy implementation.

Philip Kiely30:01

Speed improves.

Host30:01

Speed improves. Obviously, like.

Swyx30:04

I always look for inverse scaling laws. This is something I learned from Noam Brown, where, like, things that normally act in one direction, sometimes they. Well, technically, when you run a benchmark because these models are nondeterministic, sometimes your, you know, NVFP4 quant is, like, you know, two basis points higher than your.

Host30:21

That's noise. That's noise.

Swyx30:22

Exactly. Yeah. It's within, that's why I always say within margin of error. And I actually stopped saying that because everyone assumes that what I mean is, well, within some margin of error, we're barely inside of that to the worst.

So we're saying, but yeah, sometimes it's just, like, gives you a higher output score. But like, like Ali said, that's noise. To my knowledge, you're not necessarily making the results better. You're just trying to, again, like, keep your fidelity as close to 100% to the original model.

Ali Taha30:52

There is, to your point, research that we did on MP. I don't know if you are able to pull a tweet. We did one of our research interns, Joshua. I think it's a tweet on how we have 20% better quantized JLM-5.2 than NVIDIA.

Essentially, what we found throughout, like, this two-month research is, okay, quantization is a lossy. It's you're compressing the data from, you know, occupying 16 bits to occupying, you know, four bits, for instance. And so you're obviously losing some information and you're trying to minimize that.

And so when I say that I'm going to quantize the model, my job becomes how do I find the layers that I can quantize and how to find the layers to not, for instance, with image models, I don't quantize modulation layers and I don't quantize out projections because those two were, like, out projection is what you see as the user.

Modulation is what the model sees or understands. Right. Exactly. And so I guess to his paper, do you have the, I guess it doesn't have the, yeah. It's a long paper. I don't know if I can find.

Philip Kiely31:50

If there's a part to search or it's probably in the thread.

Ali Taha31:53

It's probably in the thread. Yeah. But basically, the long, the short is it is very possible that quantizing more of the model makes the results. Like, if I have a model that I quantize layers 1, 5, and 10, and another model where I only quantize layers 1 and 2, it is possible that the model in which I quantized more information is going to perform better because the quantization errors have canceled out.

And so what Joshua showed in his mathematical proof where he had, like, a verifier in is that you can predict which layers are going to have quantization errors that will cancel out with each other and you choose to quantize those layers.

And so the result of doing this mathematical quantization is you end up with a model that's 20% more quantized than another provider. So you get 20% more throughput of it because there's more layers that are running in NVFP4 and your quality is better than that other quant because the layers that you chose to quantize have their errors cancel out.

Like, one layer skewed to theright, one layer skewed to the left, one layer skewed to theright. Your final logits distribution is more similar to the original distribution of the model. So you have better fidelity. And so the way we proved this was with KL diversion.

So instead of just scoring on the benchmarks, we scored the KL diversions between the logit distribution of the quantized model and the logit distribution of the original full precision model. And we showed that with this technique, we get, if your, you know, if your probability distribution on the logit switch token it wants to select is more of the same as the original model, you're probably going to end up staying true to the original model.

So yeah, so it seems like, like, previously before this, it seemed like the industry was, well, the more you quantize, the worse it's going to be because the more loss you introduce. That's not exactly, not necessarily true. So yeah, doesn't improve it, but can cancel out.

Philip Kiely33:22

I think it might be this, but it reminds me a good bit about pruning, actually, where you can prune off certain layers. But very interesting. Didn't know this was a whole paper you guys put out.

Host33:32

It's a fun fact. It was originally 72 pages, this paper. And then we decided we can't tell. We couldn't release it. So it's now 45.

Swyx33:40

Still, still 39 pages. Very, very substantive. We talked about evals and all these things. And, like, what's possible in terms of speed up, I guess, like, it's like probably, like, the number one thing that people do want to care about and it's something that you wrote about in your post.

Like, official API, 70 tokens per second and you push it up to 90. Is that, like, a normal thing?

Speed & Speculation33:56

Philip Kiely34:01

So what's cool about working in inference, the reason that I think inference is going to be a useful place to do engineering for a long time is that if you look at highly optimized domains, like, say finance, if you're in finance, you measure how much better you got in basis points.

It's like, oh, I got five basis points better, like 120th of 1% better. That's huge news because everything is so optimized. When we publish optimizations, it's 20%, it's 100%, it's 200%. So there's still probably, like, a lot further to go, honestly.

Like, you'll know that inference is pretty much solved when researchers start publishing about how they got 1% faster at something.

Swyx34:44

Which, by the way, because I am from the finance background, in the 70s, that was the margin at the time. When you did quantitative finance research, you would find.

Host34:53

And like the 20%, 10%.

Swyx34:55

Yes. Yeah.

Philip Kiely34:56

And now it's a tiny fraction.

Swyx34:57

For those people interested, look up Andrew Lowe's paper. He had a really interesting illustration, a quant stat arbitration narrowing down from, like, those kinds of 20% differences in the 70s down to nothing today, which is very cool.

Philip Kiely35:13

Exactly. And what the beginning of the same type of thing. Now, benchmarking is hard. I think anyone will tell you that. And benchmarking provider speeds is hard because there's so many variables that go into it. What hardware are you using?

How much load do you have on the system? What's the exact nature of the prompts and input and output sequencings, all that kind of stuff. But overall, when you start stacking these improvements, you're looking at multiples. You can look at it.

The most common form, of course, is TPS, tokens per second, which is bad naming by us in the industry because there's actually two tokens per second. There's tokens per second, the throughput number, and the latency number. Like, total tokens per second out of the GPU as a throughput number.

Most people only care about tokens per second as the latency number, which we should call ITL, inter-token latency, but we don't. Anyway, so you can imagine a sort of standard API without many optimizations for one trillion parameter model operating somewhere in the 30 to 50 tokens per second range for a reasonable traffic profile.

And we generally see the goal of, you know, pushing to 10X that. But, you know, not necessarily day zero, but by stacking enough optimizations, if you have, say, like, four optimizations, each of which doubles performance, or sorry, three optimizations, each of which doubles performance, then you stack that up, that's an 8X gain.

That's kind of the order of magnitude that we're working with in this space. We're trying to make things substantially faster, not just go from, like, 70 to 90.

Host37:04

Are you saying you have done that?

Philip Kiely37:05

So let's say you have, as a reasonable baseline, 30 or 40 tokens per second. You can achieve 10X that. So, like, on GLM-5.2, if you're running it unquantized, perhaps on hopers even, and you're just using an off-the-shelf inference engine with no particular optimizations, no speculator, nothing extra around, like, KV routing, no disaggregation, you're probably, yeah, looking at that, like, 30 to 40.

You think that's, like, a reasonable baseline.

Host37:37

Right. Right.

Philip Kiely37:38

To get to something like 10X, there's a lot of trade-offs that you're making. If we're running at sort of more like a 300, 400 tokens per second range, obviously, you are using the best hardware possible. You have an optimized speculator.

You have done all of your quantization work. You are seeing a pretty high cache hit rate. You are running with a reasonably small batch size and a parallelism configuration that is tuned for latency versus throughput. But it is possible.

So the spreads that you see if you, like, go on artificial analysis or you go on open router and you look at, you know, the worst provider to the best provider, oftentimes can hit that kind of range. 10X is, of course, very aggressive.

It's oftentimes maybe more of a four to six times improvement. But that's the kind of performance that makes us really excited is when we can get these huge gains, not just go from 70 to 90 tokens.

Ali Taha38:44

It's also, like, hardware dependent. Like, if you obviously have a thing where you're serving it on just, like, a node of H100s and then you throw, like, you know, you shard the model across, like, four nodes of B200s, like, you can definitely increase the speed with just throwing more hardware at it.

But, like, normalizing for the same exact hardware and the same number of GPUs.

Philip Kiely39:00

Yeah. Then you're looking at, like, a two to four X improvement depending on the inference optimizations. So yeah, some of it's, you know, what's the call and some of it's who's the driver.

Swyx39:11

If you break down the two to four X, say the example is run GLM-5.2 on B200s, a single node,right? What's, like, the cost trade-off for effort to get, like, the last bit of juice out versus what should people just think of,right?

Ali Taha39:27

Specta quantization.

Swyx39:28

Specta quantization.

Ali Taha39:30

That's, like, 95%.

Swyx39:32

And how far does that get you? And how easy is that for the average person to do? So sayright now, I want to throw the weights of GLM-5.2 on a node of B200s. How easy is it to find speculative decoder model or already quantized model?

How much work goes into it?

Philip Kiely39:48

If you're doing it upfront, it's quite a lot of work. If you're doing it today, there's going to be people who have published things that you can just grab some NVFP4 weights. You can grab a speculator. Yeah, if we're thinking about, like, what are the two Xs we're stacking, going from BF16 to NVFP4, it's not quite a two X,right?

It's like, I think it's about, like, 30 to 40% from 16 to 8 and then another 30 to 40% multiplied from 8 to 4. So that doesn't quite get you a two X, but, like, roughly a two X.

Speculator, roughly a two X. Disag on top of that, if you're able to get enough hardware and put enough traffic through it, another roughly a two X. And then you add in some, you know, double digit percent increase from having just a better runtime with, you know, the latest kernels and stuff behind it.

And that's kind of how it stacks up. So building each of those, like, building the quantized weights is, for someone who really knows what they're doing, hours to days of work. Building the speculator, again, like, hours to days of work.

And the disag setup, hours to days. Well, okay. Once you have it.

Swyx41:05

Yeah, yeah.

Philip Kiely41:06

Getting disag working for the first time, I'm saying, of course, is very difficult, but the marginal implementation is.

Ali Taha41:13

If you're just grabbing, like, if you are a person, like, just a normal consumer who has access to, like, a node of B200s and you're wondering, how can I just host it myself? You don't need to quantize the model yourself.

There's always going to be, like, an open source quantized checkpoint. NVIDIA is going to push one out if no one else does. Usually, the providers will have their own spec deck that they've trained as well. You don't need to train your own spec deck.

You can just use that as well.

Philip Kiely41:34

Yeah. Like, Kimi GLM-5.2 has its own MTP.

Ali Taha41:38

Right. Right. Many times.

Host41:40

Multi-token prediction.

Philip Kiely41:41

Yes.

Host41:41

I'm just going to explain. I can do it for you in case I get it wrong, you know?

Swyx41:46

Actually, you should correct if we're wrong, but their multi-token prediction can be used for self-speculative decoding.

Host41:52

I'm actually not sure.

Swyx41:53

Okay. I'm semi-confident in the paper, but someone can check. But, you know, it's useful to paint the story of, okay, not just the average person, but say a company wants to switch from serverless inference to, I want to throw this up on, you know, I want to run some GPUs, throw it up.

These are the steps you take to do significantly faster than just put it behind VLMA.

Ali Taha42:14

Right. I was waiting for a mention of Dynamo. I feel like that's supposed to be the baseline that you measure against.

Philip Kiely42:20

I would think of Dynamo as less of a sort of out-of-the-box system and more of a toolkit for building with. So when we talk about doing KV-aware routing, when we talk about doing KV offloading, when we talk about doing PD disaggregation, Dynamo fundamentally is, by the way, Dynamo is an open source library from NVIDIA.

Host42:42

We've done a pod with Kyle.

Philip Kiely42:44

Cool. Cool. So then your listeners know then that it supports all the different inference frameworks and it actually is kind of multi-hardware, which is interesting.

Ali Taha42:53

But it's just a router. It's not like an optimizer layer.

Philip Kiely42:55

Yeah. All it does, like, what Dynamo is good at, it is a library for moving information around your cluster, around your hardware. So if you have, you know, KV cache on one place and you need it to be somewhere else, Dynamo coordinates Nixel for you to move that around.

That doesn't mean that, like, out of the box, you just say, you know, pip install Dynamo and then you get, like, a massive performance speed up. It's more of a developer toolkit.

Ali Taha43:26

Yeah.

Host43:27

I would have said it comes with a set of defaults that you can then swap out.

Philip Kiely43:31

It does. If the industry at large, I think, was, like, rolling out all of these deployments standard, then I think it would be, like, a credible baseline. But

we've got a benchmark against, like, what we're seeing in the wild.

Ali Taha43:48

I did want to talk a little bit more about PD disag because that's probably, like, number three after quantized and speculative decoding. In your book, though, I was just going to pull out the book.

Philip Kiely43:57

Yeah.

Ali Taha43:57

Like, section 522 on Medusa, 523 on Eagle.

Philip Kiely44:00

Yeah.

Ali Taha44:01

524 on NVAM.

Philip Kiely44:03

It's 55

would be disaggregation.

Ali Taha44:07

Yeah. Well, no, I just wanted to dwell a little bit on the other. Like, so what do you choose to include? What do you choose to not to include? Because there was all these other techniques, I guess.

Philip Kiely44:16

Yeah.

Ali Taha44:16

Are these still relevant? Because I think they came out, like, a year and a half ago maybe.

Swyx44:20

Medusa is quite old.

Philip Kiely44:22

Yeah, Medusa is old.

Swyx44:23

But is it in the book as a good, here's the baseline for new understanding?

Philip Kiely44:28

Like, you should know this.

Swyx44:28

Like, I read the paper. I'm like, ah, it makes so much sense.

Philip Kiely44:30

Yeah. So with the book, I had a couple goals. One was to give people just a working vocabulary for the space as a whole. And the other was to give them some intuition about how each of these techniques works.

As I mentioned in my AI engineer talk, which is kind of the first public addendum to this, the speculation space has moved much faster than everything else. So yeah, even at the time that I wrote the book, Medusa, I very much included as a way for people to understand how

the space evolved rather than what the most modern technique is. And now, of course, there's DFlash, DSpark, there's newer techniques even than Eagle, although Eagle is still very commonly used.

Ali Taha45:16

Spec-spec-spec.

Philip Kiely45:17

Yes. Speculative decoding.

Host45:19

What can you.

Ali Taha45:21

It's a paper by Trudeau and it's like, it's basically doing speculative decoding.

Philip Kiely45:25

Uh-huh.

Ali Taha45:26

For the speculative decoding.

Philip Kiely45:27

Oh my God.

Ali Taha45:28

It's literally just another, it's like, yeah, that's the most important way to explain it. And it seems like he got non-trivial speed ups there, but it seems that the complexity with training, it's almost like, like in our mind at least, it's almost as complex as training gains.

Like, it's like a very delicate balance and oftentimes you, it's just, but yeah, it's literally speculative decoding on speculative decoding.

Swyx45:47

Speculative decoding.

Ali Taha45:48

Yeah. We saw this paper.

Swyx45:49

It's interesting,right? I wouldn't even expect it to be very particular to train. The naive part of me is like, okay, train speculative decoding.

Ali Taha45:58

It makes sense. Like, the whole idea of speculative decoding is you, it's like, almost like the iPhone auto-project version, but for a normal model,right? Like, you're just, you know, generating three tokens and you're like, okay, do prefill on them.

And so you saved those three turns for your original model. Now your speculative decoder is doing three turns of auto-regression. So why not just have an even smaller model?

Swyx46:19

I guess the other question there is, what are the size of speculators? So say for GLM.

Philip Kiely46:24

It's like a billion tokens, a billion parameters.

Ali Taha46:26

Like for Minimax, it's, yeah, yeah, it's like one layer. It's like one sixteenth of the original model, usually.

Philip Kiely46:31

Yeah. Actually, I think we should do a paper when we get back to the office. Speculative, speculative, speculative decoding.

Ali Taha46:38

No, it does seem like, like, how, when do you stop? But then it also seems like kind of, like, if you're able to train spec-spec decode, for instance,right? Like, if you're able to have a small model that accurately predicts what the intermediate speculator is going to predict, that is able to predict what the original target model is going to predict, then why not just use that smallest model directly,right?

Swyx46:59

Yeah, this is adjacent to the routing problem.

Ali Taha47:01

Right. Yeah. Right.

Philip Kiely47:02

The thing with speculators is one of the practical constraints on using them is that you do have to run a small model on the same hardware that you're running the big model on. There is an orchestration and resource competition problem inherent in that.

And that is one of the sort of constraints on speculation in general is that draft tokens cost resources to create and cost software complexity to manage. And so if you have sort of like infinitely recursive speculators, you add in quite a bit of that complexity on the actual implementation within the inference engine as well, not just in the training process.

Swyx47:42

I was going to say, I would wonder if you could do similar, like, distillation and pruning of, you know, it's the same thing. It's just a model. Can we not just distill a lot of the way to quantize the speculator, but out of my domain.

I guess the question that also comes up is, this is all for big server workloads,right? How much of this applies to, say, I have this MacBook, I want to run Gemma really efficiently. Similar problems, not the same?

Philip Kiely48:10

Pretty different. I talked to Sailo about this on his podcast a couple weeks ago. The difference between inference engineering for the data center and for production workloads versus inference engineering for local AI is that we start with fundamentally, like, different constraints and different goals.

With local AI, it's how do I fit this model onto my hardware and then make it less dumb? And with data center inference, it's how do I load this model and then make it less slow? And obviously, you know, we care about less dumb and they care about less slow.

But the local AI inference engineering ecosystem, I think, actually has a lot for us to learn from in the data center space. They are experts in various forms of quantization, including dynamic quantization that we just kind of don't touch.

In the pruning, in the distillation, in the, you know, layer removal.

Ali Taha49:08

Layer removal matters less.

Philip Kiely49:09

Yeah.

Ali Taha49:09

No less pruning, really.

Philip Kiely49:10

Yeah, but the.

Ali Taha49:11

Which is surprising,right? But that's.

Philip Kiely49:13

Just to fit something on the laptop.

Ali Taha49:15

Right. Right.

Philip Kiely49:16

So yeah, I mean, it's an interesting, it's an interesting space. Not necessarily that, like, their techniques make sense for us to do in the data center because obviously we have different resources and different goals, but more that the process as well as the openness of that field is something to, you know, admire.

Ali Taha49:37

Yeah, like to your point, like certain optimizations that would, like, for instance, TurboQuant, I'm sure you've heard, like, it made such huge hype on Next and we did like a whole deep dive on Twitter and I was like, what is it, how does it work, why is it good or not?

And it took off and it was implemented on local devices because your memory bandwidth is so slow on like a MacBook, for instance. But try putting the same thing on like an NVIDIA GPU on a B200. TurboQuant would not be, like, it would not be used.

Like NVIDIA, like NVIDIA made it clear that this is not a good optimization and we've seen it firsthand where the overhead of doing dequantization, quantization of, you know, in the kernel itself, the TurboQuant kernel eats into and is actually much, much slower than the time that you save from doing the bandwidth.

Because on a B200, you have like 3.5 terabytes per second. You don't need to, you know, decrease the storage that much. You don't need to do, you know, FP4 KV cache. You don't need to use TurboQuant. There's better optimizations to be made.

But on edge devices, it's extremely important. It's extremely useful. So, you know, it seems to be like different optimizations there. But then they're all uniquely combined with like, oh, you want to quantize the model. You want to do speculative decoding.

Like certain common prefixes.

Host50:44

Principles.

Ali Taha50:44

Yeah, exactly. Exactly. Exactly.

Philip Kiely50:45

They also do a lot of work on model parallelism, especially over, you know, heterogeneous topology where you have, you know, some spikes and they're wired together with, you know, Ethernet, DGX spikes.

Host51:00

Yeah, yeah. This is the ExoLabs.

Philip Kiely51:02

Yeah. You have, you know, a number of Mac Minis stacked up. There's, you know, the one thing that I think we both have to deal with, although they have to deal with a lot more, is the interconnect between machines, which is why, like, you know, one thing that we do a lot is work with Tensor parallelism.

And that's where you are using all of the, you know, all eight GPUs and sharding the model across it. Tensor parallelism is not a good fit for local AI because it assumes a very high bandwidth interconnect like NVLink was, you know, they might be forced to do something like pipeline parallelism, which we're never going to do unless we're doing some kind of multi-node inference.

Parallelism & Kernels51:43

Host51:43

But since you mentioned it, I actually wasn't sure if we were going to cover it, but let's briefly explain Tensor parallelism and Expert parallelism since you have very nice images.

Ali Taha51:51

Do you want to pull the book?

Philip Kiely51:52

Yeah, let's go through.

Ali Taha51:53

So I just want to show off your images.

Philip Kiely51:54

Yeah. Shout out, shout out to Luke from Basetens Design Team for making these beautiful images. Oh, that's actually, before we get into this, just one other difference is we talk a lot about the active parameters of a mixture of experts model.

And for local inference folks, that matters a lot because if you have a batch size of one, you're only activating that many parameters. When we do.

Host52:16

Yes. I was going to say the diffusion conversation.

Philip Kiely52:20

Yeah. When we go through like a MOE model and we host it for an API, we assume that all parameters are going to be active because.

Host52:31

You're batching.

Philip Kiely52:32

You're batch. You're going to hit everything. Cool. So broadly, Tensor parallelism you can do with any model. Expert parallelism you can only do with MOE models. Effectively, all models today are MOE models that are, you know, at least all models large enough that you would care to parallelize them across multiple GPUs.

So that nuance is less important now. With Expert parallelism, the idea is you put the entire expert on a GPU. Generally, you have more experts than GPUs. So you might put like N experts per GPU, like eight experts per GPU or whatever.

And then you replicate the router, which the router is very small across each of the GPUs. And then by moving the generation from expert to expert with each expert being inside a GPU, they're not competing for resources. You massively increase the throughput that you're capable of doing.

And the GPU to GPU connection is not as important because there's not as much communication. Tensor parallelism requires that you are able to do this like all gather, all reduce. So you basically shard the model across the GPUs entirely.

And then for each step, you're combining the results of each of the GPUs, which is why the interconnect matters a lot. And it is generally, of course, this is a very high-level generalization. There's a lot of places where this is not correct.

But generally, TP is helpful for latency. And in many cases, you will use some combination of these two parallelisms across the model rather than just like picking one or the other. Do you want to add some color there?

Ali Taha54:16

Like, in a model, they're not mutually exclusive. You do Tensor parallelism and you'll do Expert parallelism. Pipeline parallelism less solely. It seems to me that we never use VPN.

Philip Kiely54:24

Yeah. The only reason you would have to do pipeline parallelism, which is where you separate like different layers and you put like half the layers on one hardware and half on another, is if you are forced to do multi-node inference because a model is bigger than you have the, like, let's say, let's say you're doing a deployment on H100s for whatever reason and you're putting a trillion parameter model on there, you have to use multiple nodes of H100.

And so because the interconnect is so slow between the nodes, the only viable way to parallelize there is pipeline. But then you would do Expert and Tensor within each node.

Host55:01

And the limiting factor for H100s is HBM?

Philip Kiely55:04

Yeah. They just don't have enough.

Host55:06

How much? What's the magic numbers that we need to?

Ali Taha55:08

Like on a B200, it's 180 gigabytes per GPU. And then a node of eight, you're talking like 180 times eight. And the FP4, so each parameter takes half a byte. So that's 800 gigabytes. On a H100, it's like 140?

Philip Kiely55:21

It's 80.

Ali Taha55:22

It's 80.

Philip Kiely55:22

Yeah.

Host55:23

Oof.

Philip Kiely55:23

Yeah.

Host55:24

Did you see me stand up there?

Philip Kiely55:25

I'm old, I've been doing this a long time. I actually remember H100s best.

Host55:29

Yeah.

Philip Kiely55:30

So one thing about the T4, let me tell you what it was like to run a model on a T4 back in the day.

Host55:38

One thing I was surprised to see that more people didn't do Jamba. I don't know if you guys remember Jamba from AI21. They would actually specifically pick a hardware and then they designed the arc dimensions for the hardware.

And then it would obviously saturate the hardware. Like, it makes sense. And like, somehow all these models don't do that.

Swyx55:58

Don't they do this for the training side though?

Host56:00

I don't know.

Philip Kiely56:01

The what? Sorry.

Host56:02

Training. For training.

Ali Taha56:03

Like deciding which GPU, which GPU.

Host56:04

Yeah.

Philip Kiely56:05

Yeah.

Ali Taha56:05

Yeah, yeah. They do. And with training, it's more of like a math. Like, you can run the math and see the flops and maximize it. With inference, it's more of like an auto-tuning. I'm sure you've probably heard of like GPU kernel auto-tuning.

But like, it's basically like you define that, oh, I have two GPUs. I can do TP1, TP2, EP1, EP2, for instance,right? And you, so that gives you like a total of like two squared combinations. And then you just like, you shadow the same traffic, like real product traffic.

And you just see which configuration gives you the best TPM, TPS, and then you just use that. I don't like the fact that it's, you cannot reason about which one's going to give you the best performance or that there isn't one specific configuration that's always best.

But it seems like auto-tuning is just the way that you find the best one. And with kernels and GPU kernels, it's much of the same. After you design your kernel and you design your configuration, how many threads do you launch?

How many, you know, how much shared memory do you use? You just auto-tune. You just sweep the parameter space on the side and this is the best one empirically. But yeah, but they are combined. They're not just inherent like separation.

Philip Kiely56:59

There's a few bits of training that are kind of like hardware targeted. If you look at, for example, NVIDIA Nemo Tron models, they run very, very well on Blackwell. That's unsurprising. So there's some degree of that, but I think that most open labs are trying to make models that can be run on as wide of hardware as possible rather than targeting just like a single chip.

Host57:21

I see. For usefulness.

Philip Kiely57:23

Yeah.

Host57:24

Okay. One more thing while this chart is still up. All gather, all reduce is expensive. One of the things that is a movement in Silicon Valley is mega kernels. Just keep fusing kernels. I don't know. Is it that simple?

Ali Taha57:38

Well, I mean, like a fused kernel can't save you. Like here with Tensor parallelism, you're the half the matrix is one GPU and the other half is on another. And if I need the entire matrix in order to do like a nonlinear operation in the next step, which is, for instance, like if I'm doing attention, I need the softmax or I need to do like exponentiation, I need to have the entire row.

So I need to know what that partial result was from GPU 2 and what the partial result was from GPU 1 in order to be able to do the softmax in the next stage. So I, like, I have to make them communicate with each other, even if I had a fused kernel, because of the nonlinearities within each one.

Also with, like, mega kernels, like, honestly, I'm very bearish on.

Host58:14

Ooh.

Ali Taha58:14

I'll be honest.

Host58:15

Please, please, please.

Ali Taha58:16

No, it's just like mega kernels, it was a good research direction and it seems like a very, like, intuitively, theoretically, it's nice. Like, oh, like, you have a lot of launch overhead from launching one kernel.

Host58:26

Yeah, just keep fusing them.

Ali Taha58:27

Just fuse everything together. But yeah, but like, the kernel complexity itself is very difficult to write a very optimized mega kernel. It's very, very difficult to do so. And even the, like, not to name any companies, but like even the companies that I've worked at or people that I've spoken to who work at companies that do fused mega kernels, they very, very often don't end up running those in production because the TRTLM modular kernels that launch are faster because you can optimize each individual component and you can just have them parallelized with each other.

With the Rubins, I don't know if you guys saw the Rubins Twitter posts yesterday, but they're also.

Host59:06

Rubins?

Ali Taha59:07

No, no, like Rubin, like the GPU.

Host59:08

Yeah, GPU. Do you have a Twitter account for Rubins only?

Ali Taha59:11

No, no, no, no, no. I was like, what are you talking about? Sorry. One of the tech leads at NVIDIA launched a Twitter post, like, we're pulling the curtain on Rubin and here's the specs. And the third tweet showed, like, not to get too technical into it, I need to read it much more, but the GPU is designed in such a way that it basically kills mega kernels.

You don't need to use mega kernels that much anymore. So it seems like that entire research field goes into, like, won't be continued. But yeah.

Philip Kiely59:38

Can I speculate about Rubin for a minute?

Ali Taha59:40

Please.

Host59:40

Go.

Philip Kiely59:42

You know, I've been through now.

Host59:44

And by the way, they are covered in the book.

Philip Kiely59:45

Yeah. Well, I mean, they're covered in the book in the sense that, like, I'm aware of the blog post that Rubin is going to happen in the future.

Host59:54

You even had the name of the one, Feynman.

Philip Kiely59:56

Yeah. It's like, hey, this is going to be a hit.

Host59:58

This is very up to date.

Philip Kiely59:59

I'm trying to future proof this thing, okay? I don't want to publish a new one until, like, next year or something. Anyway, so we were discussing the degree to which I am old. And, you know, I've now been through three hardware launch cycles.

I've been through the Ampere launch cycle, the Hopper launch cycle, and the Blackwell launch cycle. Now, when I say launch cycle, I don't necessarily mean, like, the actual shipping of the hardware. Like, Ampere's were racked up well before I got in this industry.

But there's a lot of time between hardware being racked up and hardware being sort of feasible for inference. So if you look at, like, the original VLM and SGLAN, or VLM especially, like, that was written targeting Ampere and then had to be updated for Hopper, updated for Blackwell.

With each of these cycles, it becomes faster and moreurgent, but also substantially more complicated. When I look ahead to, you know, what's going to be new with Rubin, I think that, like, Dynamo gives me a lot of technical hints around, like, what kinds of work is going to be very valuable.

Obviously, we're continuing some trends from Blackwell,right? NVFP4 is big. The amount of compute that they have behind NVFP4 Tensor cores is massive. We're going to talk about video, I think, at some point, and that's the big barrier there.

Hardware Horizons1:01:24

Philip Kiely1:01:24

You've got, you know, much, much faster memory bandwidth, but which was the same thing that made Blackwell so good. But the big thing is more systems thinking. You have more emphasis on the CPU to GPU interconnect, more emphasis on the interconnect between GPUs.

And when you look at Dynamo, it's a system entirely designed around how do I move the KV cache to where it needs to be when it needs to get there. So I think that themes around, like, KV cache offloading, KV-aware routing, and disaggregation are going to be substantially more important in the Rubin era, which means that inference engineering becomes not just a, like, CUDA kernel problem, but also, like, a very traditional hardware infrastructure problem, which is something, you know, we've been building toward for a long time and something that's, like, very exciting to me because we're going to see sort of multiple domains colliding and the ability to reason from the kernel level, like, up to the hardware level and back down is going to be very valuable.

Ali Taha1:02:30

I will take what Philip said one step further, actually, into that. It's, I think, trending towards becoming exclusively an infrastructure problem, or, like, problems of PD, DSAC, training, SPECTAC. But writing kernels is not going to be much of a problem because the GPU is moving more towards being an ASIC, where you're just trying to orchestrate what happens on the GPU, but you're not actually controlling it thread by thread level.

And you see this with, like, QTel, QDSL. Like, you're just working at levels of, like, tiles of data, but you're no longer working at controlling what each thread does on the GPU. That's being taken care of for you.

So I guess, do you agree that a GPU and future GPUs are trending more and more towards becoming ASICs that just need to be launched and then do the data operation based on your conversations with other people?

Host1:03:16

Oh, I mean, yeah, no, that is a section of the market.

Ali Taha1:03:20

Right.

Host1:03:20

And obviously, ASICs can do a lot more performance for only their workload.

Ali Taha1:03:26

Right.

Host1:03:26

And the G and GPU makes them continue to be very general.

Ali Taha1:03:30

Yeah.

Philip Kiely1:03:32

I think that there's like a spectrum.

Host1:03:33

Actually, it's graphics, but.

Ali Taha1:03:35

Yeah.

Host1:03:35

I keep saying this, I have to correct myself in case people comment me for getting the G wrong.

Philip Kiely1:03:40

Yeah. It's like a spectrum,right, of very, very general purpose compute to something like a Talus where you've got the hardware built for a specific set of model weights.

Host1:03:51

The weights burned into the chip.

Philip Kiely1:03:53

Yeah.

Host1:03:53

No loading.

Philip Kiely1:03:54

I wouldn't say that, like, that we're going all the way there. It's more like along the spectrum, it's a step in the direction of more specialization within the hardware.

Host1:04:05

Yeah.

Ali Taha1:04:06

I'm curious. I feel like he was driving towards something.

Host1:04:08

I guess my point is being bearish on, like, you say, you say, like, everything else apart from burning the weights into the chip. Burning the weights into the chip is, like, impractical because you want to fine-tune, you want to optimize, you want to quantize, you want to release new checkpoints of the model.

If it's burned into the chip, the chip's useless in, like, a month or two,right? I guess my point is, how can you not, like, seeing NVIDIA more and more specialized, like, take its GPUs from a general programming paradigm where you're just, it's a general computer that you can use to program threads.

And with every new generation, you're putting more and more specialized instructions, specialized Tensor cores, specialized, you know, UMMA instructions, things that will allow you to just control it almost as an ASIC, almost as a collection of ASICs. How can you look at this trend and then still be bullish on companies that are coming up with ASICs for AI?

In the sense that.

Ali Taha1:04:56

Yeah, because they're sort of evolving towards that direction.

Host1:05:00

They're almost evolving towards an, like, as in Rubin, I guess, like, compared to Ampere or, you know, T4, Rubin is basically an ASIC. It's basically just the thing that is used.

Ali Taha1:05:12

Programmable ASIC?

Host1:05:13

It's like, yeah, like, you can program, obviously, obviously, like, I guess, like, it's very controversial to call it an ASIC. It is a GPU. It is general. It does have threads. I can write CUDA to control it and change its operations.

But it has the solid cores and Tensor cores and TMAs and Tensor memory. And it has these things that are almost exclusively useful for loading model weights. It has, you know, Tensor core instructions that are almost exclusively shaped around the head dimensions of models that exist in the market today.

To say that you're going to come up with an ASIC and you're going to etch something into it, well, with the next architecture is basically going to be useless. Yeah, I don't know. I don't know.

Philip Kiely1:05:45

I think that the thing to remember is just how long these hardware cycles are. So if a chip is coming out today, that means the design process for it was kicked off years ago. And they've, at NVIDIA, they've done a very good job of predicting where the market is going to go and, you know.

Host1:06:04

I mean, they have the most information for sure.

Philip Kiely1:06:06

Of course. But if you look at, you know, there being public open source model architectures that look more or less like early versions of the one today, Rubin's honestly the first chip that was fully built in that world.

And so you can see a lot of the understanding of the shape of the workload that this chip's going to be asked to do in the way it's designed.

Host1:06:29

Yeah. Okay. So I'm not going to be the best person to directly answer those questions. I think these are very fair questions that are, obviously, the first one that's based on Rubin that, like, I've heard articulated so well.

I do think that I will make a case for vertically integrated model lab ASICs. So, like, the OpenAI Broadcom, whatever, jalapeño chip, which, like, totally makes sense. Like, so we first had this on the pod with Martín Casado, where he was like, look, if you have a trillion dollar or $500 billion training run, then take $50 billion of that and make it ASIC.

Like, it's fine. Like, you will get more than 10% efficiency from the ASIC. And, like, that makes sense,right? So, like, a model specific chip, yes. But ASIC companies, the interesting thing is, I feel like you are focused, you're hyper-focusing on, like, like you say, like the Tals stuff.

They are doing a lot more sort of, like, surface area engineering or, like, the actual allocations of memory and hardware and, like, the communication between chips that probably still won't be touched by Rubin, but I don't know the details.

Ali Taha1:07:39

I see. I see.

Host1:07:40

Typically, they often talk about things that I would expect to have bigger orders of magnitude than would be programmably accomplished by whatever Rubin does, but who knows?

Ali Taha1:07:51

No, I see, I see, I see. Yeah. It seems.

Host1:07:54

Yeah, like, I mean, you know, like, think about what are the real blockers to 10x to 1000x faster inference. It is not the stuff that can be rearranged just within the existing GPU design.

Ali Taha1:08:06

Intercommunication.

Host1:08:07

Yeah. Like, these guys are aiming for 300,000 tokens per second. They're not fucking around.

Ali Taha1:08:14

Multiple programs on basics.

Philip Kiely1:08:16

Maybe. I think, you know, it is interesting to me that you're so bearish on so much of this kernel engineering work, given how much of it you've been doing recently.

Ali Taha1:08:24

Right,right. Like, the more I do it, the more it just seems to me that.

Host1:08:27

It's not mega. I would also add, like, there's generations of models being out,right? I think on your guys' end, you see a lot of, okay, one day it's GLM, KIMI, DeepSeek, MiniMax, throw in the others. Some are doing completely different stuff,right?

Gemma, no encoder, the latest thinking machines is all from scratch. But when you look at the other side, like, how long have we been on the GPT-5 generation,right? They've been serving that thing for quite a while. Sure, there's maybe more pre-training, there's different checkpoints, but, like, you actually can squeeze quite a bit out in, you do a multi-billion dollar train run.

If you can make it X percent more efficient, they serve it for a while. Same with, say, the Cloud 5 family,right?

Ali Taha1:09:09

Like, they release a new model, like, they release GPT-6 now or whatever, and they release a new model every year. And we, well, we don't know, but if we assume that they're changing some bits of the architecture and not just doing, like, post-training, like, you're going to be spending $50 billion a year every single year coming out with new ASICs for the model and throwing out the ASICs of the previous year away.

Host1:09:28

Yeah. Yeah. Easy. So, so I think, okay, I will slightly disagree based on my comment. Again, it's all secondhand on the longevity of a model. There's still people out there using 4.0.

Ali Taha1:09:39

Yeah.

Philip Kiely1:09:39

Yeah, Llama, not Llama 2, but Llama 3. I still see Llama 3 workloads.

Ali Taha1:09:43

Yeah.

Host1:09:43

Because if it's done, if it's trusted, don't change it.

Ali Taha1:09:47

If it works.

Philip Kiely1:09:49

Which is one of the promises of open source,right? Like, the whole 4.0, save 4.0 movement. Like, you don't got to have a save Llama 3 movement. You just got to have an 8.100 somewhere.

Host1:10:00

I think at some point, there's also the question of, okay, if a model can do enough and use enough tool calls and be agentic enough, can it just web search, tool search, write code? Do you really need to keep squeezing more?

We will, because you guys will make it cheap and fast and smaller, and I can swap it in. But at some level, like, you give me 5.2 today or, say, whatever, 120B model, I can run with it for quite a while,right?

Ali Taha1:10:24

This is assuming, like, you don't need intelligence.

Host1:10:27

I think there's a lot of intelligence.

Ali Taha1:10:28

You need reliability and predictability. Like, I'm in enterprise. Like, this is tried and tested. It is signed off by, like, my 5,000 stakeholders. Like, I'm not touching it.

Philip Kiely1:10:37

It runs a batch job every day, and I like the results. The results are predictable.

Ali Taha1:10:43

Yeah.

Host1:10:43

Yeah, yeah, yeah. It doesn't make sense to keep using them. Like, stuff gets sparser, cheaper, better.

Ali Taha1:10:48

Right.

Host1:10:48

But that doesn't mean that old models, GLM-5.0 isn't usable,right? If we hit a stall, say, for whatever reason, there's still a lot that can be squeezed out.

Ali Taha1:10:59

We're going to run out of time. I did want to also make sure, yeah, yes, actually, we happen to have this diagram. Pull, compare this versus any Cerebras diagram,right? I don't think Edge and Metax have put out public charts yet, but the complete, the real estate is very different.

The size is very different,right? This is not wafer scale,right? This is, there's probably, like, I don't know, a few hundred of these on a wafer. I don't know how big the comparison is, but, like, it is a very, like, real estate allocation difference.

Philip Kiely1:11:27

Few dozen, I would say.

Ali Taha1:11:28

Few dozen, yeah.

Host1:11:28

Before we move from hardware, I have two quick questions. One, the latest KIMI, which is really big, 3 trillion.

Ali Taha1:11:34

Yeah.

Host1:11:35

Doesn't fit on most hardware on single node.

Ali Taha1:11:37

Yes.

Philip Kiely1:11:38

You need GB300 to fit it on all the single nodes.

Host1:11:41

Or AMD.

Philip Kiely1:11:43

Ah. It's simple math. NVFP4, 2.8 trillion parameters, 1.4 terabytes. The GB300s have 288 gigabytes each. So across eight of those, you have enough room for the model. And honestly, like, so the other thing with GPU VRAM math is you have to leave space for the KV cache.

And that's going to depend on, to some degree, on the context length. So when a model both has a very large number of parameters and a very long context length, you're kind of like fighting over space, which is why, you know, the KV cache offloading would become like a more salient topic, I think, with these huge models, because you just, you're very crunched for space.

Host1:12:35

With the Rubins, you now have what, NVL-72 rack of 20 terabytes of.

Philip Kiely1:12:41

Yeah. Now, you still have NVL-72 on Blackwell as well, but you can't necessarily assume you're going to do inference on that. There's a whole lot more 8x racks in the world than there are NVL-72s.

Host1:12:55

Yeah. I guess my last quick question on hardware was, do you notice anything with hardware generations for new pre-trained base models? So one of the things you said for efficiency is you can swap hardware. That's one of the 2x gains.

When we see new stuff coming out training-wise on Rubins, any changes on logs? Does this affect what type of models we will be seeing when these are more available? And can you.

Philip Kiely1:13:22

They get bigger. Like, people understand the ceiling that you have in terms of how many parameters of a model you can run given the sort of latest inference hardware. And that kind of forms a ceiling. And so, for example, when DeepSeek R1 came out, it was, you know, it was 671 billion parameters, which at the time was really huge.

And I think did a lot to push us to really quickly adopt Blackwell and get good at serving on Blackwell. So, yeah, it's mostly in my mind about model size and then about matching the architecture and the native quantization to the target hardware, like we talked about with, like, you know, all Nemotron models of NVFP4, for example.

Host1:14:07

So we talked a lot about LLMs. You have a lot more in the book. What about audio, video? What's the other side of inference engineering? Ali, you're pretty big in video diffusion.

Ali Taha1:14:19

Video diffusions, I think, are, like, they're just shaped. A lot of the stuff that you can think about, reason about with LLMs being autoregressive. With video diffusion, it's not the case. For instance, you don't do batching. Every request just comes in on one GPU, and it serves on one GPU.

Video Diffusion1:14:19

Ali Taha1:14:33

You don't have to shard. The models are a lot smaller, like 1.2, for instance, is a 20 billion parameter model. You don't need to worry about, it's like orders of magnitude smaller than the best LLMs. And it's one of those spaces where the open source models are, like, with LLMs, we see Kimi K3 is almost comparable to, you know, Mithos or like GPT-5.5.

The difference between the best open source LLM and the best closed source LLM is very small. Like, it used to be six months. I don't think it's six months anymore. I think it's like basically almost unparalleled. Video models are definitely not.

There's a huge gap. If you look at the best video that you can generate today with an open source model like 1.2 versus something like with Kling or Veo, the difference is night and day. So it creates this disparity where media companies will choose to go most of the time to closed source models, for instance.

And I were to tell you, hey, I can generate an entire three-hour movie for you with this model and I'll optimize it so that you only have to pay me $10. But if they were to do it on closed source, they'd have to pay $1,000, which is 100x, like, I'm 100x cheaper, but it's still $1,000.

They're still going to choose to do all of their cuts with Veo and Kling. So it's like a chicken and egg cycle where less demand causes less innovation in the field, causes, you know, less open source checkpoints to be released.

And some of the labs that were releasing open source models, like one, will have closed source their latest models. Like 1.2.7 is not open source. We're still on 1.2. The challenge with video models, especially, is the number of tokens.

So, so, so, so video models, you want to generate a high-quality model, a high-quality video. So let's say you're doing 16 frames per second. That's like the absolute minimum you'll do. And let's say you'll do like 480p video.

So you can think about your, like, dimensions. And I think I have like a good, just like a diagram that shows the number, the sheer number of tokens,right? Let's say you're looking at like just one video of like, you know, Sparta, Sparta 300 or whatever.

So let's say we're looking at like four frames,right? Those four frames of that video, if you go just, if you're doing full attention, if you go a little bit up. Like, you're looking at 480p by 720 by 81 frames in just five seconds, because 16 fps by five,right?

And then you compress it down to latent space, but you're still doing 30 by like 50 by 21 tokens.

Host1:16:48

Yeah.

Ali Taha1:16:48

Which means that for attention, for just five seconds, you're running attention on 35,000 tokens,right? So the attention becomes such a huge bottleneck. And because it's open squared, if you're doing like, if you extend that to like 10 seconds, well, it's just squared.

20 seconds, 30 seconds. So to generate a good cut scene of like one minute, it's almost impossible to do within the same compute time. And it just, it becomes unfeasible. You can't do it. And so you end up with moving towards two directions.

Either you decide to do attention on the entire video at once, in which case you are forced to do sparse attention. So if you scroll back down to the original, the video image, like you can see whereas on the left, for instance, I would be doing full attention where every single token in that Sparta 300 scene attends to every single other token.

And you can see the sheer number of like red patches. On theright, I'm only attending to each token only attends to like the top K, a top 12.5% that's important to it, which can be like spatial. So like, you know, the token that represents the crown attends to like the head, the face, and then the head on the other frame and the previous frame, temporal locality, spatial locality, that kind of thing.

This results in terrible video quality. And the whole point of the post or the article here is to show like how you can train and you can do all of these things, but you will still suffer your quality a little bit.

So you end up with one of two things. Either you bite the bullet, you have huge compute, and you do full attention over like a million tokens because you're trying to generate like two minutes of video, or you move towards autoregressive video.

Autoregressive video seems to me like that is the bet that the future is going to be making, but there are no good open source autoregressive video models out there today. And that seems to be the, if you want to get like an hour movie, if you want to see video models generating like an, like, you know, Hollywood-level movies, they have to be autoregressive in order to exceed the five-second frame, or there has to be some insane leap that happens in compute that allows us to do full attention over like millions of tokens at the same time in an efficient manner.

Host1:18:33

Even millions of tokens, it's like you're quadratic, so you're going to get there really quick. I think, can you explain the pros and cons trade-offs of autoregressive? So one that comes to mind is, you know, the consistency across frames.

You will, 10 minutes into generating autoregressive diffusion, you're going to forget. But what are the pros and cons of this?

Ali Taha1:18:52

Well, like, like autoregressive LLMs, you can take a lot of your, sorry, autoregressive diffusion models. You can take a lot of your optimizations that we discussed with LLMs, like SpecTec and stuff like that, and you can apply it there.

And you can, if you have a very high-quality scaled-up model, there is no reason why I can't stream the outputs as in I can show you the first frame and then I'm like, like kind of like GPT back in like 2023 when you're like, now it's just almost like one shot spec.

Back then, you could read and it's generating as you read. With video models, you can watch and it's generating as you watch. It generates the frames. And so token-by-token generation will allow us to scale a lot up and apply the attention mechanisms there.

The downside is every single autoregressive video model is shit. It's just terrible quality. If you, like, it's just if you put, if you put the quality of any opens like 1.2 versus any other autoregressive model, you can see like, like a video generated by 1.2 is like, you know, a cat and dog fighting.

Autoregressive model will give you like degraded Tom and Jerry quality. The solution to generating long output then becomes, okay, we're not going to use autoregressive model. We're going to, if you look at some of the things that like, like Grok Imagine or Grok Video does, and they do it really, really well, is they'll try to stitch these, you know, seven-second chunks together.

And so you generate seven seconds and then you're like, okay, I'm going to, can you extend this video? And they'll chunk two videos together. Open source doesn't seem to have the tricks that they have there. And by definition, it's closed source.

We don't know what they're doing. But the closest you can get is taking the last frame of a video and feeding into like a text and image to video where it will take the text, the prompt, and it will take the image of the last frame.

And you'll ask it to generate the next five seconds. And that's kind of like how you can extend this level of a model to generate like a move where you're constantly streaming frame by frame. But you get drift.

So you start with like, you take the image and then you generate a video. And then that next five-second video is like lower quality. And the third chunk's like even lower. And the fourth chunk's even lower. And like, sometimes you'll see things where like the new video is like just ever so slightly darker than the first one.

And the next one is darker than the second one until like 25 seconds and you have black screen. Like, it's just, it's, it's, it's a, we tried to have a demo that would show this, but it was like, it was, it was extremely embarrassing to show.

Like, we just decided not to because it seemed to like, but it is, it is, I think models will get there. They just need to, in my mind, scale up significantly and move towards being autoregressive. But the training techniques don't seem to be clear there.

Host1:21:13

For those who are interested in Grok Imagine, we did a pod with Ethan Huh from that team.

Ali Taha1:21:17

Right.

Host1:21:18

Who dropped a few hints, but not enough that we can fully reconstruct everything.

Philip Kiely1:21:23

Specifically on this part. He explains a bit about it.

Host1:21:25

Yeah, I said we talked about memory and longer context and all these things.

Ali Taha1:21:29

But as far as I know, it's not autoregressive. Like, no one in the industry that's autoregressive.

Host1:21:33

Yeah.

Ali Taha1:21:34

It seems to be, yeah.

Philip Kiely1:21:35

The key thing to understand between an autoregressive model and a diffusion model is that diffusion attention goes in both directions, while autoregression, it only goes forward in the sequence. So that's why you see this sort of like going off the rails behavior, both in if you sort of naively construct a video generation model as simply generating a linear sequence of frames, you can't then go back in that sequence and fix something to make the whole thing consistent.

Well, of course, the reason that we need all this latent space for the video model is, like you said, we keep all the tokens in memory. We iterate over that full sequence and you can adjust the past in order to make the future make sense.

So if we think about the architecture that's going to get us there to these longer, richer sequences, it's probably, like you said, going to be a mix of the autoregressive and the diffusion working together to do what each piece is good at.

Ali Taha1:22:33

But like you get, like you intuitively get why it's like English, for instance, or just writing in language, it's like it's just left toright. You can stream your tokens, you can stream your chain of thought, just even as a human, you write like, you just, you write and then you think about what's the next thing you're going to generate.

And then you write that and then you think about your ideas and then you generate forward. And sure, you can argue that as you write, you need to go back and you want to edit some things, but you need to do that, you know, less softened than you think.

Whereas with video, there is no sequential, you know, the pixel in the top left corner of the video and the pixel in the bottomright corner of the video, they both need to attend to each other to understand how the video quality is going to be almost as equally.

Whereas with text, you don't need that as much.

Host1:23:10

Is there a parallel to audio? Like, I'm not 100% confident on this, but there was a point about a year ago where there was audio LLM, there's diffusion for audio and autoregressive. And for the points you mentioned, mostly on the inference side, even though they're shorter clips, you know, most music is three to five minutes, we've basically swapped over to autoregressive.

Philip Kiely1:23:31

Yeah, I can't speak to music, but speech is autoregressive. You effectively, I mean, this was even back with like the Orpheus architecture a year and a half ago. You just add a bunch of waveforms to the vocabulary so that the LLM can output tokens that represent those waveforms.

And then you construct speech and that's how you stream it.

Host1:23:51

That's it. Wow.

Philip Kiely1:23:52

That's my AIE talk from 2025.

Host1:23:54

Oh, nice, nice, nice, nice.

Ali Taha1:23:56

But it's not, with audio, it's not the same challenge, does it? Because you, like audio is sold with an LLM that generates everything. Like, like with audio, it's still a transcript that you can generate with an LLM. So your audio model just needs to like transcribe it, text to speech.

Philip Kiely1:24:10

For music, there was a phase of a trade-off between diffusion for music and autoregressive. And they were both pretty on par. There's probably more pros and cons to either. I just wanted to poke and see if you had takes.

Host1:24:22

Yeah, I don't know about music specifically, you know.

Philip Kiely1:24:25

With what you said about editing, you're writing, you know, obviously, I think my editor would tell me I actually need to do that more often and go back and fix things. I can imagine music or poetry, for example, where you have a rhyming scheme and you might want to go back and make a change to make it, to make it easier to set up a rhyme that you want to make later on.

There being some advantage to being able to attend in both directions. But yeah, to my knowledge, you know, I very much bifurcate this influence problem into the autoregressive models, which have a set of constraints and techniques, and the diffusion models, which have a set of constraints and techniques.

And I think of text embedding, voice in and voice out as being in the autoregressive side, and then image and video being in the diffusion side. There's some overlap between the two. It's not a perfect split, but that's the broad categorization I use.

Host1:25:24

I should point out, I think it's confirmed,right? Nano Banana and GPT Image are autoregressive image.

Philip Kiely1:25:30

It's kind of this blended approach that we're talking about, but in the image space, it hasn't like made its way over to the video space, at least in the open source world.

Host1:25:41

Yeah, but like I assume that's not too far away. If that is possible on the, at least the Quen Image guys are trying it.

Philip Kiely1:25:49

Yeah, yeah. With the, I'm really excited for Quen Image 3. I hope they open source it.

Host1:25:54

And then I'll also mention on the diffusion for text side, there's been some movement, not a lot.

Philip Kiely1:25:59

Yeah, we've got Mokuli.

Host1:26:01

You host Mercury?

Philip Kiely1:26:02

Yeah.

Host1:26:03

Nice, nice.

Philip Kiely1:26:04

Gemma as well,right? Diffusion Gemma?

Host1:26:06

Diffusion Gemma is open source.

Philip Kiely1:26:07

Yeah.

Host1:26:08

And then.

Philip Kiely1:26:09

And we were on the science pod, we just have been releasing some virtual cell models that use diffusion as well. Yeah, they have built, it's definitely still in the sort of cheap fast tokens world.

Host1:26:23

Yeah.

Philip Kiely1:26:24

We're trying to.

Host1:26:26

I think it's the wrong marketing. And I've told them this before. I was like, look, like you're not going to beat the optimizations that, you know, the other LLMs are going to do. But you can have different APIs.

Like you should be able to use it differently than chat response, chat response.

Philip Kiely1:26:42

Mm-hmm.

Host1:26:42

Because it's diffusion. Because you can do like, what does like context-free guidance for diffusion look like for text? Like give me a poem, give me a plot structure that like diffuses into place.

Philip Kiely1:26:56

Exactly. So that's where, you know, like I mentioned with poetry, for example, where you might want to ensure consistency across you. I've done a lot of LLM sonnets. It used to be one of kind of my go-to benchmarks.

And even models today.

Host1:27:09

They can have times.

Philip Kiely1:27:10

Yeah. They don't get the syllablesright. And if you can attend across all of the different tokens, you can get the syllablesright.

Host1:27:18

Yeah. And David Holtz from Midjourney was investing in text diffusion. I don't think anything came out of it, but like the idea was that you can storyboard a long movie and then you can generate the scenes with video, normal video gen.

But the idea of like coherence across a thing that would just appear where like the end should attend to the start and you should not have this autoregressive path dependency. Does make sense in principle. Just the API should be different.

The marketing should be different.

Ali Taha1:27:46

One of the most heavily used open source or closed source models used diffusion. But isn't that like, doesn't that point to almost like a.

Host1:27:54

It's chicken and egg because what if you just give it more scale?

Ali Taha1:27:59

What's the largest diffusion LLM?

Host1:28:01

I don't think it's very big.

Philip Kiely1:28:03

I don't know the parameter count on this one, but diffusion Gemma is.

Host1:28:06

Under 20B.

Philip Kiely1:28:06

Diffusion Gemma is not long.

Host1:28:07

I think it's a 20-something.

Philip Kiely1:28:08

Yeah, yeah. You know.

Host1:28:10

Oh, it's like you haven't actually tried.

Philip Kiely1:28:11

You haven't given it a big one and you haven't.

Host1:28:14

So it's like very unfair.

Philip Kiely1:28:14

Diffusion Gemma is a 25B and.

Host1:28:17

And that's what I'm saying. It's like for its size, it does pretty well in terms of quality.

Ali Taha1:28:24

It's almost like the same challenge with video models to have the same size. It's like you're comparing it to models that are much larger in scale.

Host1:28:29

Yeah, well, unless you do the whole thing where you have a text backbone and then you like glom some kind of decoder thing that does that. Like, you know, we started off the podcast doing this for the inverse direction from image to text.

Ali Taha1:28:45

Right.

Host1:28:46

And I think like it's roughly intuitive that you can do the opposite direction.

Ali Taha1:28:50

I agree. I see it. I see it.

Host1:28:52

Yeah, I mean, we're speculating on research in general. One part that we can end off with this is the topic of your talk where inference engineering used to just be like, let's take an open model, make the GPU go burr, and then that's it.

That's the job of base 10. Now it looks like people are using inference more and more in post-training.

Self-Optimization1:29:07

Ali Taha1:29:13

Yes. And training and inference.

Philip Kiely1:29:15

Yes, it's training for inference and inference for training both have become big topics.

Ali Taha1:29:21

Well, inference for training in the sense that like obviously you just need, you need to do, you know, you need to do rollouts when you're doing like RL training runs. And so if your rollouts are taking a long time, if like, you know, you're using a VLM, for instance, over as opposed to CRTLM, or if the model that you're trying to train is not supported in CRTLM and you have to fall back to an older inference engine, your rollouts are going to be slow and you don't want to do training on rollouts that are too off policy.

So you have to wait for them. So you bottleneck your entire training pipeline. And so like obviously the techniques that we do inference optimizations for will help them there. The training for inference mostly comes down to like just the spec tech training, ego head training, and sometimes post-training.

For instance, if you want to quantize a model, you'll quantize it down to like NVIDIA FP4. How do you, like sometimes, sometimes you get lucky and you can just do PTQ and that works. Sometimes you quantize it down to NVIDIA FP4 and the model is terrible.

Like the quality is too bad. And you have to do post-training on the model in order to make it understand that it's going to now be an NVIDIA FP4 and let it still output the same logits. You can do this with normal SFT, you know, quantization of our training, all of that stuff.

But more and more so we're seeing techniques like NVIDIA released a quantization of our distillation paper where you establish a version of the model that's in NVIDIA FP4 and a version of the model that's in full precision. And then you'll do distillation training based on the logits of the two models in order to make the FP4 model understand.

And so more and more of the team, the engineers, like of the inference engineers that work on our team, they have to be very familiar with like training techniques and just being fine, writing training pipelines for it. Yeah, it just seems like they're meshing together in a sense.

Host1:30:59

Well, it's like coming together.

Philip Kiely1:31:01

Yeah, absolutely. I mean, if you think about the ultimate goal potentially of having a continuous improvement system, yeah, I mean, it's kind of funny, but at the same time, it's also kind of happening. And I think within a few months to a couple of years, like a lot of leading agent builders are going to have these loops like really up and running in production where you are doing inference, learning from the inference.

We obviously for a long time have been sort of like learning from inference as it's live and dynamically adjusting the system. You know, any kind of dynamic adjustment is going to beat a static configuration across, you know, your exact config, across your speculator, across that kind of thing.

And then the, you know, you can take the traces that you're generating from your product, continuously post-train the model, roll those out, A/B test, get better signal, get better model, get better product. That loop is really promising. The technologies and the infrastructure to build it are coming along quickly.

And so the sort of unification between training and inference, I think, is only going to accelerate.

Host1:32:24

I actually was chuckling, but I wasn't, I didn't think it was funny. Like it's actually real. Like one of the big things for AIE World's Fair was that, you know, we have RSI into AGI is the rough tagline, which like, yeah, I mean, we have, I saw you pull up parameter golf.

Like we have models training models and the next step is obviously models training, optimizing their own inference, which is kind of funny. I wonder if models will be like on policy better at training themselves than training models that they are unfamiliar with.

These are all like very interesting open areas of research.

Philip Kiely1:32:59

One big part of my job a couple of years ago was for any arbitrary model that came out on Hugging Face, writing a config foot and kind of getting it up and running. And now the get it up and running config is one-shotable.

And so, you know, I don't have to do that anymore. Yeah, I mean, that's not exactly a model optimizing its own inference so much as a model like being able to read the SG-Lang docs. But yeah, I mean.

Ali Taha1:33:24

But we do see it. We do see it like with JLM52, for instance. JLM52 is very, very good at writing GPU kernels. And so for like, it was very funny internally, we had a JLM52 endpoint that we were using to, like that we plugged in in our cloud code harness.

So every engineering team uses like our JLM52 and it will do a forward pass on the JLM52 instance of the, you know, the node. And then it will get the profile trace and it will analyze it and it will find the kernels that are the bottlenecks in SG-Lang.

And then it will write the new kernels and it will do another profiling trace. And when it's done, it uploads the image to our thing and then we can pull that image down and repeat the cycle. And so for quite a bit of time, we had like literally JLM52.

Philip Kiely1:34:07

Writing itself on the JLM52.

Ali Taha1:34:09

And like some of the GPU kernels that were on JLM52 within our inference engine is written by JLM52. And the trace and the kernels were guided by JLM52 as the driver. So it seems like I do see, I do see that circle being there.

I think a bit more time is needed. There's definitely a lot of things that it can't do. The models just aren't there yet, even though they're like really, really smart. Like they still try to like robot act away into like the cheapest or like they're very, like they're not good at like decision making almost, it seems.

But yeah, I do, like yeah, like the model optimizing its inference is already a thing that happens.

Philip Kiely1:34:42

Do you think GLM52 was uniquely good at optimizing itself or did it just happen to be the best coding model that we had access to? And it would do an equally good job of optimizing a DeepSeek or a Kimi or something.

Ali Taha1:34:56

Well, to succinct this point, maybe it's going to be off policy when it tries to optimize another model.

Philip Kiely1:35:00

Will this deeply hurt DeepSeek?

Ali Taha1:35:03

To try to reverse itself?

Host1:35:04

No, for what it's worth, I don't believe that.

Ali Taha1:35:06

Yeah.

Host1:35:07

But it's just, let's just find out.

Ali Taha1:35:08

It's interesting. Yeah.

Host1:35:10

Just, you know, you have more compute than me. Just go try it. Yeah. Any other upcoming trends in inference engineering that we didn't cover? Likeright now, you know, because you guys are so close to it, you can obviously see it that the rest of the world doesn't know about.

Philip Kiely1:35:23

The big ones are obvious. Models get bigger, hardware gets more powerful, users get used to a certain level of speed and demand a higher one. I think that some things I'm excited about are systems level. You know, we still have a lot to think about in terms of composing multiple models together.

If you think about a voice agent, there's three to five models involved in that and the communication between those models. There's a lot of new modalities that are coming out. There's like the Cosmos, the new world model. There's more research.

Speech to speech is still like not entirely a thing, but it's getting closer. There's going to be just a lot of new modalities to build around, which is going to be exciting. And then, yeah, I think that the other thing to solve, which is something we've been solving for a long time and are not done with yet, is just going to be continuing to operate at another 10x, another 10x, another 10x scale as an industry.

If you think about the degree of usage that AI has worldwide compared to, you know, some of the more mature technologies, both on consumer and business, it's pretty clear that there could be multiple 10x more of demand. If you look at the infrastructure work industry wide, obviously it's been stood up very, very quickly to meet an unprecedented spike in demand.

And that is like not stopping. So yeah, there's just a lot of problems to solve around like long tail reliability and figuring out where we're going to get the next like 10x and 100x of tokens from.

Ali Taha1:37:12

I'm going to say it's going to be a really boring answer, but I think the answer is just faster next, like faster network chip communications. It seems to me that like more and more memory is the bottleneck. You want to have larger models.

Right now, when you're doing serving at large, you have to transfer KV cache from one node to another. But the way that you do that is you find the KV cache, you find where it is, you transfer it to another node, you put it on that node's memory, and then you transfer it from that node's memory into the GPU and like into the sensor cores of the GPU.

So there's like a two-stage transfer here that makes it such that you're very bottlenecked with just KV cache transfers at large, which affects the time of decode and PDSI. You have to do this because the HBM is so much, it's like extremely fast, like 4.5 terabytes per second as opposed to, like which is like magnitudes better than Nick communication speed.

If you were to somehow be able to, like this theoretical dreamland, have extremely fast next, you could in theory spare that HBM and you could just transfer KV cache like directly from one node to another. This would give you like almost 100x speed up when you're doing this aggregated serving between nodes and nodes.

I'm not familiar with the technical challenges of making Nix faster. I'm certain there's a reason why they're like orders of magnitude smaller, like slower than like HBM. But if someone were to figure that out, it would literally be like two orders of magnitude faster to do decode.

That would be my tech.

Host1:38:34

Bigger chip, cool. I don't know if you have a nomination for things that are trends. I go on.

Ali Taha1:38:41

Cool.

Host1:38:42

So I think inference engineering for continual learning. So what if you just, like if you just had the idea that you are supposed to learn from everything that you ever process, do you do anything differently? Or do you just have the same paradigm of like, well, stick it in a memory.md and then like it somehow gets consuming KV cache and like this system works, it's not broken?

Or like how do you like reshape inference so that it learns while you inference?

Philip Kiely1:39:10

Yeah, I think maybe one relevant topic though is your absolute best friend in the entire world's work on KV compaction.

Ali Taha1:39:18

Correctly.

Host1:39:18

Like what changes?

Ali Taha1:39:19

What changes when you're trying to continue to learn? There's two takes and there was like Charlie and I had this Twitter sort of argument where we like continual learning could take one of two paths. It could either be that the model learns and so it's continuously pushing its new knowledge into its weights.

In that case, you just need to have like your inference just needs to continually fetch new weights or yeah, like you just literally need to do fetch new writes and reads of weights. Or the other path, which is you do KV cache compaction.

Host1:39:51

And there's a LoRA layer if you just only update LoRAs.

Ali Taha1:39:54

Yeah, exactly. Exactly.

Host1:39:54

Which is, that's the NGRAM approach we covered.

Ali Taha1:39:57

The argument against doing weight pushing is that you can only fix one hop knowledge as in, as in you can only feed it a new feature of like, oh, what is the best university in the world? The best university in the world is Waterloo.

But then a second derivative.

Host1:40:09

That's not changing.

Ali Taha1:40:10

That's not changing. That's not changing. But like a second derivative question of which university should I hire an intern from? So if you know that the best university in the world is Waterloo, then the answer should be Waterloo.

But if I wasn't just one-shotting the question and I was to ask it to like use its knowledge to think and then give me a second answer over like, should I hire an intern from Waterloo or MIT? It'd be like, oh yeah, both are good.

But no, like I literally, I just edited in your knowledge base that Waterloo is the best. Why didn't you use that to do reasoning? So that's the fundamental problem with trying to change a fact in an MLP within the way.

KV cache compaction fixes that. With KV cache, or like rather not KV cache compaction, but like if you're able to have something like the still paper, which we came out with, which is you're able to sort of make your KV almost infinite and you're able to compact in such a way that you don't lose any of the knowledge.

In that case, you can actually do continual learning and you can actually solve continual learning. And it's a result of this argument that Charlie and I had, that I do concede that his point was correct. And I do see that KV cache is the way forward.

And in that case, I don't think inference is going to change that much because we still use KV cache in inference. You're just going to update the KV cache. It's going to be like an additional step, but nothing changes in the weights.

Nothing changes in inference time. Nothing changes the spec that I had.

Host1:41:21

Okay. Surprisingly great answer. We have it up on the blog. It's a relatively recent blog. So we can, people can go see it.

Ali Taha1:41:29

Yeah.

Host1:41:30

Otherwise, this is super enjoyable chat. I know we've already gone two hours.

Philip Kiely1:41:34

Oh wow. I didn't realize.

Host1:41:36

Time flies. Yeah.

Philip Kiely1:41:37

So much we didn't even cover.

Host1:41:38

Yeah. Listen, like we also wanted to talk about the book and all that, but you've covered it.

Philip Kiely1:41:41

Oh yeah. I mean, everyone knows about the book.

Host1:41:44

Yeah. Highest ROI thing in the history of Base 10,right?

Ali Taha1:41:48

Without a doubt. Without a doubt.

Host1:41:51

Absolutely. So congrats on that. You know, and we've covered that in our meetup, which we can publish separately. But no, thank you to you guys for being so generous to sharing. I think it's a fun conversation that we don't get to have enough.

I think inference engineering, we never really covered head on. And so to have you guys come on is a treat.

Philip Kiely1:42:10

That was amazing. Yeah. Thanks. Thanks for having us. And, you know, hopefully in a year, everything shifts and we can come back and say everything we were wrong about.

Host1:42:19

Yeah. Yeah, yeah. I'm excited for this mega kernels comment to get out there. See what people say.

Philip Kiely1:42:23

We got to start stuff.

Ali Taha1:42:25

So they're going to Hugging? I know I'm going to get like the mega kernel community after me.

Philip Kiely1:42:28

Yeah. One thing I really respect about you is you are not willing, oh, you are not scared to kick the hornets' nest ever.

Host1:42:35

It's not. I don't think it's that controversial. I don't know. We'll see.

Ali Taha1:42:40

We'll see. Allright. Thanks, guys.

Host1:42:44

Thank you so much.