跳到主内容
@wquguru
精选88r/MachineLearning(Reddit)技巧与观点

循环Transformer在B200上的HBM流量与权重复用分析

Do looped transformers save HBM traffic? Profiling weight reuse in Huginn on a B200 [P]

原文
发到 X
推荐理由

做推理优化的同学必看,这篇用真实Profiling数据拆解了Looped Transformer的显存行为,直接验证了权重复用对HBM流量的实际影响,工程参考价值极高。

Do looped transformers, which reuse the same weights at every iteration, also save HBM traffic? In my new post I cover the looped architecture (Huginn), then model and measure its performance on a B200: how much data each iteration reads from memory, how long it takes, and why the shared weights usually don't stay on chip until the next iteration.

在每次迭代中复用相同权重的循环 Transformer,是否也能节省 HBM 流量?在我最新的文章中,我介绍了循环架构(Huginn),然后在 B200 上对其性能进行建模和测量:每次迭代从内存读取多少数据、耗时多久,以及为什么共享权重通常无法保留在芯片上直到下一次迭代。

A few results:

一些结果:

  • A chain of eight matmuls with one shared 72 MiB weight ran 24% faster than the same chain with eight identical copies, and read almost nothing from HBM. At 288 MiB, larger than L2, the difference disappeared.
  • In a full Huginn Core (teaching implementation, random weights), eight iterations took about eight times as long as one and read about eight times as much data from HBM.
  • Sharing saves storage, but by itself it doesn't stop the GPU from reading the weights from HBM again at every iteration.
  • 一个包含八个矩阵乘法且共享一个 72 MiB 权重的链,比拥有八个相同副本的相同链运行速度快了 24%,并且几乎不从 HBM 读取任何数据。当权重大小达到 288 MiB(大于 L2 缓存)时,这种差异消失了。
  • 在一个完整的 Huginn Core(教学实现,随机权重)中,八次迭代所花费的时间大约是一次迭代的八倍,从 HBM 读取的数据量也大约是八倍。
  • 共享可以节省存储空间,但仅靠它本身并不能阻止 GPU 在每次迭代时再次从 HBM 读取权重。

👀Post: https://dinara-dl.github.io/posts/looped-transformer/

👀文章:https://dinara-dl.github.io/posts/looped-transformer/

🤖Code and raw Nsight Compute data: https://github.com/dinara-dl/looped-transformer

🤖代码和原始 Nsight Compute 数据:https://github.com/dinara-dl/looped-transformer

I'd be curious whether anyone has tried keeping recurrent weights on chip across iterations, for example with a persistent kernel.

我很想知道是否有人尝试过跨迭代将循环权重保留在芯片上,例如使用持久化内核。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件