Files
myWiki/concepts/lazyar.md

1.9 KiB
Raw Permalink Blame History

title, created, updated, type, tags, sources
title created updated type tags sources
LazyAR (Lazy Autoregressive Decoder) 2026-06-28 2026-06-28 concept
generative-recommendation
inference-optimization
decoder-architecture
GR4AD

Lazy Autoregressive Decoder (LazyAR)

LazyAR 是 GR4AD 提出的懒惰自回归解码器架构释放逐层自回归依赖以提升多候选生成吞吐量。在保持推荐效果的前提下LazyAR 将近翻倍推理 QPS。

动机

标准自回归解码中UA-SID 的每一级 token 的生成都需要完整的 L 层解码器计算,即:

m_t(1), m_t(2), ..., m_t(L) = \text{Decoder}(s_{<t})

T 级 UA-SID 下,总计算量为 T \cdot L 层。

观察发现:第一级 UA-SID$s_1$)的损失最大,承载了最关键的语义信息;后续级别($s_2, s_3, ...$)的解码可以在不显著影响效果的前提下共享计算。

架构

LazyAR 将 L 层解码器分为两段:

  • K 层(共享段):计算与 s_{t-1} 无关的 trunk 表示 $m_t(K)$,所有 UA-SID 级别共享
  • L-K 层(注入段):在第 K 层注入 s_{t-1} 的嵌入,仅这些层需逐级重算
m_t(K) = \text{Decoder}^{1:K}(s_{<t} \setminus \{s_{t-1}\}) \hat{m}_t = \text{Decoder}^{K+1:L}(m_t(K) \oplus \text{Emb}(s_{t-1}))

速度优势

m_t(K) 不依赖 $s_{t-1}$,因此前 K 层的结果可以在所有 UA-SID 级别间复用。总计算量从 T \cdot L 降至 $1 \cdot K + T \cdot (L-K)$

  • 若 $K=6, L=9, T=3$:计算量从 27 降至 $6 + 3 \times 3 = 15$,节省 ~44%

与 DeepSeek MTP 的区别

DeepSeek MTP 也为所有后续 token 复用前几个 transformer 层,但 MTP 在每个位置都进行融合投影。LazyAR 直接复用 trunk 表示,延迟到第 K 层才注入前级 token——这种"延迟注入"设计在短序列多候选场景中更高效。

配置GR4AD 使用 $L=9, K=6$,共享前 6 层。

参考