How is hardware reshaping LLM design?

Why can an NVIDIA H100 GPU theoretically generate 62,000 tokens per second when in practice even the best inference engines struggle to reach 200 tokens per second?

*https://www.youtube.com/watch?v=BSzhrZOp2x8
**https://300.ya.ru/summary

таймкоды

00:00:00 Проблема «стены памяти»

  • Пиковая производительность графического процессора NVIDIA H100 — 1000 терафлопс.
  • Традиционные модели с 8 миллиардами параметров генерируют до 62 000 токенов в секунду, но на практике — всего 200 токенов в секунду.
  • «Стена памяти» — дисбаланс между увеличением вычислений и объёмом памяти, который стал узким местом для логических выводов LLM.

00:00:57 Инженерная оптимизация и новые методы моделирования

  • Обсуждение инженерной оптимизации работы с большими языковыми моделями.
  • Новые методы моделирования, такие как диффузия, борются с нехваткой памяти.
  • Графические процессоры используют SRAM и HBM для хранения весов моделей.

00:01:51 Память графических процессоров

  • SRAM быстрая, но дорогая и занимает много пространства.
  • HBM имеет большую ёмкость, но меньшую скорость.
  • H100 оснащён 80 ГБ HBM, что недостаточно для современных LLM.

00:02:43 Процесс работы модели

  • Веса модели передаются из HBM в встроенную память по запросу.
  • Процессор выполняет операции и выдаёт выходные активации.
  • Для каждого сгенерированного токена вся модель должна пройти путь от HBM до процессора.

00:03:43 Пропускная способность памяти

  • Пропускная способность памяти — ключевое препятствие для производительности.
  • Производительность NVIDIA H100 — чуть более 3,2 терабайт в секунду.
  • Передача данных между HBM и встроенной памятью ограничивает производительность.

00:05:37 Модель Roofline

  • Модель Roofline объясняет разницу между памятью и вычислениями на многоядерных процессорах.
  • Арифметическая интенсивность показывает, сколько полезной работы выполняет процессор на каждый байт данных.
  • Производительность равна арифметической интенсивности, умноженной на пропускную способность памяти.

00:08:31 Этапы вывода LLM

  • Вывод LLM состоит из двух этапов: предварительная заливка и декодирование.
  • Предварительная заливка связана с вычислениями, декодирование — с памятью.
  • Оптимизация этапа декодирования важна для повышения производительности.

00:10:29 Пакетная обработка

  • Пакетная обработка позволяет обрабатывать несколько запросов одновременно.
  • Сервер логического вывода группирует запросы в пакеты и отправляет на графический процессор.
  • Вычислительный граф легко модифицируется для поддержки пакетной обработки.

00:11:26 Пакетная обработка и её преимущества

  • При пакетной обработке x — это матрица с одним столбцом для каждого запроса.
  • Хранение более объёмного x в оперативной памяти оказывает давление на её ёмкость.
  • Потоковая передача весов модели из HBM выполняется только один раз, что увеличивает арифметическую интенсивность.

00:12:19 Непрерывное пакетирование

  • Пакет перестраивается после каждой итерации, обработанные экземпляры сразу заменяются новым запросом.
  • Это предотвращает образование «пузырей» в конвейере.
  • На следующей итерации все элементы пакета обновляются дополнительным выходным токеном.

00:13:17 KV-кэш и его влияние

  • KV-кэш хранит активации из ранее сгенерированных токенов.
  • По мере увеличения размера пакета увеличивается и кэш KV, что частично нивелирует преимущества пакетной обработки.
  • Дополнительные оптимизации помогают эффективно использовать память.

00:14:08 Спекулятивное декодирование

  • Спекулятивное декодирование использует компактную черновую модель для быстрых прямых проходов.
  • Более крупная LLM выступает в качестве верификатора.
  • Математически спекулятивное декодирование выгодно только при стратегическом выборе черновой модели.

00:16:00 Диффузионные LLM

  • Диффузионные LLM генерируют черновики ответов, а не отдельные токены.
  • Они выполняют фиксированное количество итераций, что позволяет регулировать соотношение скорости и качества.
  • Диффузионные LLM имеют более высокую арифметическую интенсивность и часто ограничены вычислительными ресурсами.

00:18:53 Оптимизация диффузионных LLM

  • Модель фокусировки сокращает количество бесполезных вычислений, декодируя только токены с высокой степенью уверенности.
  • Динамическая корректировка контекстного окна позволяет адаптировать его размер в процессе уточнения.
  • Блочная диффузия сочетает преимущества диффузии и авторегрессии, позволяя досрочно останавливать декодирование и использовать оптимизации традиционных моделей.

00:21:49 Движки логического вывода

  • Проекты с открытым исходным кодом, такие как XDIT, WeDLM и DInfer, разработаны в китайских лабораториях.
  • Inception создала движок логического вывода для диффузионных LLM, позволяющий обрабатывать более тысячи токенов в секунду.
  • Mercury 2 — первая диффузионная модель рассуждения, которая в 10 раз быстрее других моделей на рынке.
  • Инженерная оптимизация и смена парадигмы — два наиболее заметных способа решения проблемы нехватки памяти и ускорения логического вывода LLM.

In this video

Chapters
Transcript
Search transcript
Chapter 1: Intro
0:00
0 seconds
One quadrillion floating point operations per second, or 1000 TFLOPs per second.
0:06
6 seconds
That’s the peak compute throughput of an NVIDIA H100 GPU.
0:11
11 seconds
In theory, this should enable a traditional large language model with 8 billion parameters to generate up to 62,000 tokens per second.
0:20
20 seconds
But somehow, even the fastest inference engines are stuck at 200 tokens per second. Clearly we’re leaving a lot of compute on the table, so what’s going on?
0:30
30 seconds
This problem can be traced way back.
0:32
32 seconds
For decades, Moore’s Law kept doubling transistor density and implicitly raw compute. Memory, however, has been improving a lot more slowly.
0:41
41 seconds
This imbalance became known as the memory wall.
0:45
45 seconds
Around 2019, when AI model sizes exploded, the memory wall became a bottleneck for LLM inference.
0:52
52 seconds
In this video, we’ll see why that’s the case and what the industry is doing about it.
0:57
57 seconds
We’ll look at the engineering optimizations behind serving large language models and new modeling techniques like diffusion, which are fighting the memory bottleneck.
1:06
1 minute, 6 seconds
This video is sponsored by Inception, a company building diffusion based large language models and the infrastructure to serve them.
Chapter 2: High-level GPU architecture
1:13
1 minute, 13 seconds
You can think of an AI model as a computational graph where the nodes are operations, mostly matrix multiplications, and the edges are the operands.
1:23
1 minute, 23 seconds
It’s basically an algorithm that can be executed by a GPU processor.
1:28
1 minute, 28 seconds
The secret sauce is in the model weights or parameters, which are learned during training. They’re real valued matrices, usually stacked in layers.
1:37
1 minute, 37 seconds
In this diagram, there are four layers, but normally they’re in the hundreds. So the weights need to be stored somewhere.
1:45
1 minute, 45 seconds
GPUs typically come with their own on-chip memory. This is static RAM or SRAM.
1:51
1 minute, 51 seconds
It’s fast but expensive to manufacture and takes a lot of physical space, which is why there’s only so much of it.
1:59
1 minute, 59 seconds
NVIDIA’s H100 GPU has a bit over 50 megabytes of SRAM. That’s not nearly enough for state-of-the-art LLMs.
2:07
2 minutes, 7 seconds
Open weight models go up to hundreds of gigabytes of storage and proprietary ones must be even larger.
2:14
2 minutes, 14 seconds
To support this demand, GPUs come with yet another level of memory placed near the processor, but not on the same chip.
2:22
2 minutes, 22 seconds
It’s called high bandwidth memory or HBM. This is typically what people refer to when they say «GPU memory».
2:30
2 minutes, 30 seconds
Unlike SRAM, it uses a stacked die architecture that trades some speed for much greater capacity.
2:37
2 minutes, 37 seconds
An H100 comes with 80 gigabytes, much more suitable for storing the model weights.
2:43
2 minutes, 43 seconds
Granted, that’s still not enough for state-of-the-art LLMs, but we’ll pretend to be working with an 8 billion parameter model that fits comfortably.
2:52
2 minutes, 52 seconds
So from the HBM, the weights can now be streamed to the processor on demand.
2:58
2 minutes, 58 seconds
Say we get a user query, which we’ll serve with a traditional auto-regressive LLM that generates output tokens one by one.
3:06
3 minutes, 6 seconds
Conceptually, the model operates layer by layer. For each layer, the corresponding weights are streamed from HBM into on-chip memory.
3:14
3 minutes, 14 seconds
For each operation within this layer, the operands make their way into the processor registers.
3:20
3 minutes, 20 seconds
The processor executes the operations and produces the output activations for that layer.
3:25
3 minutes, 25 seconds
When it runs out of space, the on-chip memory discards the cached weights to make room for the next set of weights.
3:32
3 minutes, 32 seconds
And the cycle repeats until the forward pass is completed.
3:36
3 minutes, 36 seconds
For auto regressive LLMs in particular, the result of a forward pass is a single next token prediction.
3:43
3 minutes, 43 seconds
In practice, model weights are copied in smaller chunks than entire layers, but layers are just easier to visualize.
3:50
3 minutes, 50 seconds
The important takeaway is that for every single token generated, the entire model, all billions of parameters, must complete this journey from the HBM to the processor.
4:02
4 minutes, 2 seconds
Throughout the video, I’ll refer to this journey as a «model stream» or «model copy». Just remember, it’s not a one-time atomic transfer.
4:10
4 minutes, 10 seconds
It’s a continuous pipeline of bytes being copied.
Chapter 3: The memory bottleneck
4:14
4 minutes, 14 seconds
Today, the biggest performance bottleneck is specifically the data transfer between the HBM and on-chip memory.
4:21
4 minutes, 21 seconds
The rate of this transfer is what we call memory bandwidth.
4:25
4 minutes, 25 seconds
NVIDIA’s H100 comes with a bit over 3.2 terabytes per second, which sounds plenty at first.
4:32
4 minutes, 32 seconds
In theory, even for a model of hundreds of gigabytes, we should be able to transfer it in less than a second.
4:39
4 minutes, 39 seconds
However, a single model transfer serves a single forward pass, and, in an auto-regressive LLM, a single output token.
4:48
4 minutes, 48 seconds
So an average size response of 1000 tokens requires 1000 full model streams.
4:56
4 minutes, 56 seconds
With this perspective, the latency we saw earlier is less surprising. An 8 billion model roughly takes 16 gigabytes of storage.
5:04
5 minutes, 4 seconds
With a memory bandwidth of 3.2 terabytes per second, we can afford to make exactly 200 transfers in a second.
5:12
5 minutes, 12 seconds
Assuming a negligible GPU runtime, that’s a throughput of 200 tokens per second.
5:18
5 minutes, 18 seconds
This shows that model inference is heavily bottlenecked by memory bandwidth.
5:23
5 minutes, 23 seconds
My initial rough math showed that the GPU processor at its peak could handle hundreds of times more operations than this.
5:31
5 minutes, 31 seconds
Yet it’s sitting idle, waiting for parameters to arrive. Now there are two things we could do about it.
5:37
5 minutes, 37 seconds
Option one, just wait for NVIDIA to improve memory bandwidth, but that’s not very high agency.
5:44
5 minutes, 44 seconds
Option two is to reconsider the LLM inference algorithms to take better advantage of the available resources.
Chapter 4: The roofline model
5:52
5 minutes, 52 seconds
To help us reason how an algorithm relates to the hardware utilization, we can use an established framework called the roofline model.
6:00
6 minutes
As we’ll see soon, it literally looks like the roofline of a house. It was introduced back in 2009.
6:06
6 minutes, 6 seconds
At the time it was developed specifically to reason about the gap between memory and compute on multi-core CPUs, a problem that turned out to be the defining hardware tension of the next 15 years.
6:19
6 minutes, 19 seconds
Today, the roofline model is particularly relevant for gauging the efficiency of LLM inference on GPUs.
6:27
6 minutes, 27 seconds
The X axis corresponds to a quantity called arithmetic intensity, measured in FLOPs per byte.
6:33
6 minutes, 33 seconds
It shows how much useful work the processor performs for each byte of data transferred from the main memory.
6:41
6 minutes, 41 seconds
Increasing arithmetic intensity is equivalent to amortizing the inevitable cost of memory access.
6:48
6 minutes, 48 seconds
I like to think of it in terms of personal travel.
6:51
6 minutes, 51 seconds
Whenever I fly from the US to Europe, there’s an inevitable cost and time and money. But what is under my control is the duration of the trip.
7:00
7 minutes
So if I stay for a single day, then it’s a very expensive trip, but if I stay for a couple of weeks, then the cost is starting to be worth it.
7:09
7 minutes, 9 seconds
The Y axis measures the performance or compute rate in FLOPs per second. Basically, how many operations are executed per unit of time.
7:19
7 minutes, 19 seconds
The relationship between X and Y is linear. Y equals X times the memory bandwidth.
7:26
7 minutes, 26 seconds
In other words, performance equals arithmetic intensity times memory bandwidth. It’s easy to verify if we write down the units.
7:35
7 minutes, 35 seconds
FLOPs per byte times bytes per second gives us FLOPs per second.
7:40
7 minutes, 40 seconds
Another way to think of it is that memory bandwidth is the slope of the performance line. Now performance can’t grow to infinity.
7:48
7 minutes, 48 seconds
It’s capped by the capabilities of the accelerator. As we saw earlier, the H100 peaks at a thousand TFLOPs per second.
7:56
7 minutes, 56 seconds
On this plot, we’ll work with an A6000 GPU instead, following the paper where I took the benchmarks from.
8:04
8 minutes, 4 seconds
With this hard ceiling, we now have a roofline model, which enables us to reason how well an LLM inference algorithm is utilizing the available resources.
8:14
8 minutes, 14 seconds
If it falls to the left of the ridge point, the algorithm is memory bound. What caps its performance is the slope of this line, which is the memory bandwidth.
8:23
8 minutes, 23 seconds
In contrast, the region to the right of the ridge point is compute bound, since the limiting factor is the processor speed.
8:31
8 minutes, 31 seconds
This is the better place to be since the ceiling is higher. Overall, auto-regressive language models are memory bound.
Chapter 5: Auto-regressive LLMs are memory-bound
8:38
8 minutes, 38 seconds
That was also the case for the models we discussed earlier, since their latency of 200 tokens per second is way under what an unconstrained GPU processor can deliver.
8:48
8 minutes, 48 seconds
But there’s a nuance to this generally true statement.
8:51
8 minutes, 51 seconds
The nuance comes from the fact that LLM inference is actually a two-staged procedure. Stage one processes the text prompt into real valued embedding vectors.
9:01
9 minutes, 1 second
This is called prefill. Stage two generates one token at a time conditioned on the previous ones. This is called decode.
9:10
9 minutes, 10 seconds
From a performance point of view, this distinction is meaningful because the two stages fall into different regions of the roofline.
9:18
9 minutes, 18 seconds
Decode is memory bound and prefill is compute bound.
9:22
9 minutes, 22 seconds
The root cause of this discrepancy is the fact that, during prefill, all the prompt tokens are readily available.
9:30
9 minutes, 30 seconds
And thanks to the design of the Transformer architecture, they can all be processed simultaneously. Let’s assume the prompt has three tokens.
9:39
9 minutes, 39 seconds
With a single forward pass through the model, and therefore a single model stream, we manage to process all of them.
9:45
9 minutes, 45 seconds
So during prefill, the ratio of tokens to model streams is three to one. This arithmetic intensity grows linearly with the sequence length.
9:55
9 minutes, 55 seconds
So for typical prompt lengths of hundreds or thousands of tokens, prefill easily crosses the ridge point.
10:01
10 minutes, 1 second
In contrast, during the decode stage, we need three separate forward passes in order to output three tokens.
10:08
10 minutes, 8 seconds
The ratio now is three tokens to three model streams.
10:13
10 minutes, 13 seconds
In other words, the arithmetic intensity is three times lower than prompt processing, and it doesn’t change for longer responses.
10:22
10 minutes, 22 seconds
That’s why LLM inference engines put a lot of thought into optimizing the decoding step, which is the bottleneck . You might be familiar with vLLM, SGLang or TensorRT.
10:33
10 minutes, 33 seconds
All these frameworks increase the arithmetic intensity of LLM inference with smart engineering hacks.
Chapter 6: Batching
10:40
10 minutes, 40 seconds
When the inference algorithm itself limits parallelism for a single query, the most obvious fix is to serve multiple queries in parallel.
10:49
10 minutes, 49 seconds
That’s known as batching. An inference server, which is a software component that exposes an API, receives requests with text prompts.
10:59
10 minutes, 59 seconds
It groups them into batches and then ships them off to the GPU.
11:03
11 minutes, 3 seconds
Decoding still happens iteratively one step at a time, but a single forward pass through the model is now extending all responses by an output token.
11:13
11 minutes, 13 seconds
The good news is that it’s very easy to modify the computational graph to support batching. Most operations multiply a weight matrix W by an activation x.
11:24
11 minutes, 24 seconds
Without batching, x is a vector. With batching, x is a matrix with one column per query.
11:30
11 minutes, 30 seconds
Now storing a larger x in the on-chip memory does put some pressure on its capacity.
11:36
11 minutes, 36 seconds
But crucially, the really expensive part, which is streaming the model weights from the HBM, still only happens once.
11:44
11 minutes, 44 seconds
From an arithmetic intensity point of view, the numerator increases while the denominator stays constant.
11:51
11 minutes, 51 seconds
This pulls the inference algorithm upwards on the roofline. When implemented naively, batching comes with an opportunity cost.
12:00
12 minutes
Some responses are longer than others. A binary yes or no question requires fewer iterations than an AI slop article, yet it takes up space in the batch until all instances are complete.
12:13
12 minutes, 13 seconds
That’s why most inference engines today do continuous batching, also called iteration level scheduling.
12:19
12 minutes, 19 seconds
That means the batch is reconfigured after every iteration, so finalized instances are immediately swapped out for a new query.
12:28
12 minutes, 28 seconds
This way, there are no instances sitting idle in the batch and no bubbles in the pipeline.
12:34
12 minutes, 34 seconds
On the next iteration, all the members in the batch are updated with an extra output token and the cycle repeats.
12:41
12 minutes, 41 seconds
So batching involves some overhead, but it’s worth it because it increases arithmetic intensity. How far can we push it though?
12:49
12 minutes, 49 seconds
Can we choose the batch size in a way that maximizes the GPU utilization?
Chapter 7: How KV caching caps batching
12:55
12 minutes, 55 seconds
At first glance, it might seem that the limiting factor is just the size of the activations X. But there’s another hidden memory cost that we haven’t discussed yet.
13:05
13 minutes, 5 seconds
Remember, auto regressive models make predictions based on the past.
13:09
13 minutes, 9 seconds
So to compute the next token, we need to cache activations from the previously generated tokens. This is called the KV cache.
13:17
13 minutes, 17 seconds
K stands for keys, V stands for values. These are activations specific to the Transformer architecture.
13:25
13 minutes, 25 seconds
The KV cache holds an entry for every previously generated token in the batch. Because of its size, it must be stored in the HBM.
13:34
13 minutes, 34 seconds
During a forward pass, the relevant keys and values are streamed all the way to the processor, alongside the model weights.
13:42
13 minutes, 42 seconds
But as the batch grows, so does the KV cache.
13:45
13 minutes, 45 seconds
While the goal of batching is to ease memory bandwidth pressure, its gains are partially offset by the KV cache.
13:53
13 minutes, 53 seconds
Because of this, we often cannot scale batch sizes enough to keep the processor fully busy.
14:00
14 minutes
Now there are further optimizations to ensure memory is used effectively and accommodates for as much data as possible.
14:08
14 minutes, 8 seconds
For instance, the vLLM inference engine came up with paged attention, a mechanism inspired by traditional operating systems to reduce memory fragmentation.
14:19
14 minutes, 19 seconds
But ultimately, memory capacity and bandwidth are still finite and so is the maximum batch size.
Chapter 8: Speculative decoding
14:25
14 minutes, 25 seconds
We are reaching a point where system level engineering optimizations have picked most of the low hanging fruit. It’s time to reconsider inference at a higher algorithmic level.
14:36
14 minutes, 36 seconds
The bottleneck there is, in auto regressive models, the fact that every output token requires a full forward pass through a model that has billions or trillions of parameters.
14:47
14 minutes, 47 seconds
But what if we could loosen that constraint? This is the intuition behind the speculative decoding.
14:53
14 minutes, 53 seconds
The decoding steps are delegated to a smaller draft model, which performs forward passes a lot faster.
15:00
15 minutes
The bigger LLM is repurposed as a verifier for the draft.
15:05
15 minutes, 5 seconds
Given that the draft tokens are readily available, it can now make multiple predictions in a single forward pass similar to the prefill stage we discussed earlier.
15:15
15 minutes, 15 seconds
The longest common prefix between the draft and verifier outputs is committed to the response and the disagreeing tokens are discarded.
15:25
15 minutes, 25 seconds
If we do some quick accounting for this particular example, speculative decoding costs us three light forward passes and a heavy one with an output of two tokens.
15:36
15 minutes, 36 seconds
Regular decoding would’ve cost us three heavy forward passes with a return of three tokens.
15:41
15 minutes, 41 seconds
So the math works out in favor of speculative decoding only when the draft model is chosen strategically.
15:48
15 minutes, 48 seconds
Too large and it loses its speed advantage over the verifier.
15:52
15 minutes, 52 seconds
Too small and its predictions are always discarded leading to more wasted computations. So it’s a tricky balance.
Chapter 9: Diffusion LLMs are compute-bound
16:00
16 minutes
What’s interesting about speculative decoding is that it makes the large model deal with multiple output tokens in parallel.
16:07
16 minutes, 7 seconds
Pushing this idea to the limit, why not have it deal with all of the output tokens in parallel? If you’ve been watching my channel for a while, you know where this is going.
16:17
16 minutes, 17 seconds
Diffusion LLMs do exactly that.
16:20
16 minutes, 20 seconds
As you already know, auto-regressive LLMs generate one token at a time until the end of sequence is produced, or a maximum token count is reached.
16:29
16 minutes, 29 seconds
So the number of iterations is dynamically determined by the model for each prompt. Diffusion LLMs are a completely new paradigm.
16:37
16 minutes, 37 seconds
They no longer generate one token at a time, but rather one draft at a time.
16:43
16 minutes, 43 seconds
They start with a fixed context window of complete nonsense and iteratively clean it up into a coherent response.
16:51
16 minutes, 51 seconds
Similar to auto-regressive models, they’re still sequential. Each draft needs to wait for the completion of the previous one.
16:58
16 minutes, 58 seconds
However, they perform a fixed number of iterations. This is a hyper parameter that acts as a knob between speed and quality.
17:06
17 minutes, 6 seconds
More iterations take more time, but also improve the response.
17:11
17 minutes, 11 seconds
In a previous video, I covered ways of bringing this number down to tens or hundreds without compromising the final output.
17:18
17 minutes, 18 seconds
For an average LLM response with a few thousand output tokens, a diffusion model will perform fewer iterations than a traditional one.
17:27
17 minutes, 27 seconds
But of course, in case of a yes or no answer, the diffusion chain is longer.
17:31
17 minutes, 31 seconds
An obvious difference between the two paradigms is the amount of work performed per iteration.
17:38
17 minutes, 38 seconds
Diffusion LLMs don’t just predict a single token, but update all the tokens in the draft.
17:43
17 minutes, 43 seconds
They still end up producing an end of sequence token somewhere in the context window.
17:48
17 minutes, 48 seconds
But in vanilla implementations, it has no effect until diffusion reaches the final iteration and the programmer throws away the subsequent tokens.
17:58
17 minutes, 58 seconds
So with a single forward pass, that is a single stream of the model weights, they perform more operations than a traditional LLM.
18:06
18 minutes, 6 seconds
That’s why diffusion LLMs generally have higher arithmetic intensity and are more likely to be compute bound, falling to the right of the ridge point.
18:15
18 minutes, 15 seconds
How far exactly, directly depends on their context window size. Now if we only judge diffusion LLMs by the roofline model, they look ideal.
18:25
18 minutes, 25 seconds
They fully utilize the available GPU parallelism.
18:29
18 minutes, 29 seconds
But the roofline model is an incomplete picture because it doesn’t capture productivity.
18:34
18 minutes, 34 seconds
We could game it by giving the processor busy work like repeatedly multiplying some matrices only to throw them away.
18:42
18 minutes, 42 seconds
In fact, if we look at the runtime measurements, early diffusion models like LLaDA were generally slower than traditional ones.
18:49
18 minutes, 49 seconds
And the larger their context window, the slower they become. So out of the box diffusion LLMs are not necessarily a silver bullet for speed.
Chapter 10: Reducing wasted diffusion computations
18:58
18 minutes, 58 seconds
They just make a different trade off and ask for different kinds of optimizations.
19:03
19 minutes, 3 seconds
We’re no longer dealing with the memory bandwidth, but we’re asking how can we reduce wasted computations?
19:10
19 minutes, 10 seconds
This recent paper called FOCUS claims that 90% of computations within a refinement step are wasted.
19:17
19 minutes, 17 seconds
The model can only confidently predict about 10% of the tokens. For instance, the model was confident that Harry must be followed by Potter.
19:26
19 minutes, 26 seconds
But the tokens surrounding the conjunction «and» were very ambiguous because a lot of tokens would’ve made sense here.
19:33
19 minutes, 33 seconds
The FOCUS model attempts to find these high confidence positions ahead of time and only decode those tokens.
19:40
19 minutes, 40 seconds
It’s a bit of a greedy strategy that minimizes risk at each step by focusing on low ambiguity positions first, and thus reducing wasted computations.
19:51
19 minutes, 51 seconds
Another source of waste is generating a full context window of thousands of tokens even for prompts that call for a short response.
19:59
19 minutes, 59 seconds
This paper dynamically adjusts the context window across refinements. On the first iteration, they start with a small context window of 64 tokens.
20:08
20 minutes, 8 seconds
Once tokens are decoded, they analyze the probabilities associated with the end of sequence token everywhere in the window.
20:17
20 minutes, 17 seconds
If they’re low across the board, they extend the window size for the next iteration.
20:23
20 minutes, 23 seconds
When the end of sequence token starts getting assigned reasonably high probabilities, they lock the response length and continue refining it during the subsequent iterations.
Chapter 11: Block diffusion
20:34
20 minutes, 34 seconds
While these tricks help, they’re not yet mature enough to compete with the years of optimization that have been poured into serving auto aggressive LLMs.
20:43
20 minutes, 43 seconds
To make the best of both worlds, the industry seems to be converging towards block diffusion, a mixture of diffusion and auto regression.
20:51
20 minutes, 51 seconds
Given a long context window, tokens are grouped into blocks.
20:54
20 minutes, 54 seconds
Within each block, tokens are decoded using diffusion, but the blocks themselves are processed sequentially, one after the other.
21:03
21 minutes, 3 seconds
Compared to vanilla diffusion models, this has two major advantages. First of all, decoding can stop early.
21:10
21 minutes, 10 seconds
Once a block produces the end of sequence token, the response can be finalized without diffusing the subsequent blocks.
21:17
21 minutes, 17 seconds
And second, bringing back auto regression allows us to repurpose most optimizations developed for traditional models, including KV caching or speculative decoding.
21:28
21 minutes, 28 seconds
But this time we’re less concerned with memory bandwidth since diffusion keeps us in the compute bound region.
21:35
21 minutes, 35 seconds
With block diffusion, we’re finally approaching an architecture that neither wastes memory bandwidth, nor leaves the processor idle.
Chapter 12: Diffusion inference engines
21:43
21 minutes, 43 seconds
We’re now starting to see the first inference engines that specifically target diffusion LLMs.
21:49
21 minutes, 49 seconds
On the open source side, there’s xDiT, WeDLM, and dInfer, all coming from Chinese labs.
21:57
21 minutes, 57 seconds
On the US side, Inception built their own proprietary inference engine, which enables them to serve diffusion LLMs at more than a thousand tokens per second.
22:07
22 minutes, 7 seconds
They also recently launched Mercury 2, the first diffusion reasoning LLM, which is 10 times faster than other reasoning models on the market.
22:17
22 minutes, 17 seconds
Engineering optimizations and paradigm shifts like diffusion LLMs are two of the most notable ways of dealing with the memory bottleneck and speeding up LLM
22:27
22 minutes, 27 seconds
inference, but there are other techniques as well, including distillation, mixture of experts or quantization on which I have an entire series.
22:37
22 minutes, 37 seconds
For this video and others, you can find my entire reading list on Patreon for free. Thanks for watching, and I’ll see you next time.
Sync to video time

Поделиться: