Depth that grows with the sequence.
Each token extends the recurrent path through the full decoder. After \(t\) tokens, that path traverses \(tL_D\) decoder blocks while the per-token block count stays fixed.
原始链接: https://yifanzhang-pro.github.io/recurrent-looped-tranformer/
该架构引入了一种混合模型,结合了并行**因果编码器**与**循环解码器**,实现了随序列长度线性扩展的深度。 通过利用循环路径,模型的有效深度随着序列的推进而增加——在处理 $t$ 个标记后会经过 $tL_D$ 个解码器块——同时保持每个标记的计算成本恒定。该模型通过对已知标记进行编码器任务批处理,并对解码器执行独立的迭代更新,从而优先保证硬件效率。 关键技术特征包括: * **统一状态转换:** 系统维护一个由循环输出 ($s_t$) 和局部滑动窗口注意力 (SWA) KV 缓存 ($C_t^D$) 组成的持久状态。 * **内存效率:** 全局编码器内存为交叉注意力提供受限的前缀,而解码器注意力在局部窗口内运行,确保状态在服务边界内保持一致。 * **资源共享:** 该模型采用 48 层编码器和 48 层解码器,通过权重共享来平衡深度推理能力与高效的浮点运算 (FLOP) 利用率。 这种设计使模型能够高性能地处理长序列,从而实现连接提示词处理与标记生成之间的连续状态转换。
Each token extends the recurrent path through the full decoder. After \(t\) tokens, that path traverses \(tL_D\) decoder blocks while the per-token block count stays fixed.
Batch known-token encoder work and independent decoder updates. Reuse weights and memory, and checkpoint activations while preserving the reference computation.
Rebuild the full history under current parameters, including prompt states and decoder SWA KV. Keep recorded behavior probabilities tied to the actual sampler.
Causal encoderKnown-token parallelism · global KV memory
→
Recurrent decoderEncoder cross-attention · local decoder SWA
The previous output enters the next merge. Each SWA layer reads its own recent keys and values.
\[H_t=(s_t,C_t^D),\qquad H_0=(s_\star,\varnothing).\]
\[(s_t,C_t^D)=D_\phi\!\left(\operatorname{Merge}(e_t,s_{t-1});M_{\le t},C_{t-1}^D,t\right).\]
\[p_\Theta(x_{t+1}\mid x_{1:t})=\operatorname{softmax}\!\left(W_o\operatorname{RMSNorm}_o(s_t)\right)_{x_{t+1}}.\]
Here \(M_{\le t}\) is global encoder memory, \(s_t\) is the recurrent output, and \(C_t^D\) contains layerwise decoder KV. A SWA window of \(W\) includes the current token and retains at most \(W-1\) historical entries for the next update.
The concrete configuration uses 48 encoder layers and 48 decoder layers, with compatible attention and FFN weights shared across stages. The temporal path traverses \(48t\) decoder blocks after \(t\) tokens. Each token executes 96 logical blocks; decoder cross-attention means these blocks do not all have equal FLOPs.