大模型手撕 · 中等 · Attention、高效 Attention
实现非因果的线性注意力(Katharopoulos et al. 2020)。用特征映射 \phi(x) = \mathrm{elu}(x) + 1 代替 softmax:
在 RagCodes 上用 Python / C++ / Java 在线编写并提交,核心代码模式与 ACM 模式均可评测。