给Transformer加了个固定大小的3D记忆体,解决长视频理解难题
Tensor Memory: Fixed-Size Recurrent State for Long-Horizon Transformers

- 用固定尺寸3D张量做可学习的记忆体,持续存储空间特征
- 在视频任务上显著提升长时序建模能力,尤其在遮挡场景更优
- 模块轻量易插拔,适合需要持久状态的视觉推理任务
Transformers通过将空间和时间展平为长序列来处理图像和视频。尽管注意力机制和键值缓存能保留过去特征,但其记忆随序列长度增长,且缺乏显式的持久空间状态,导致长时序视频理解和遮挡敏感推理困难。我们提出Tensor Memory,一种轻量级模块,为Transformer块添加固定大小的3D循环记忆张量:令牌通过可微软写操作将内容以高斯加权体积形式沉积到预测的连续3D位置,记忆通过高效的局部交互算子与门控递归动态更新,并通过门控残差融合连续采样读取上下文。由于记忆张量大小恒定,Tensor Memory实现了状态容量与输入长度的解耦,同时保留空间归纳偏置。我们在标准语言、图像和视频基准以及一个可控的诊断套件上评估该模块,该套件专门用于分离持久状态带来的益处;其可无缝集成至标准Transformer训练流程中,可附加或移除现有块而无需其他架构改动。
原文摘要 · Abstract (English)
Transformers process images and videos by flattening space and time into long token sequences. While attention and KV caching preserve past features, their memory grows with sequence length and they lack an explicit, persistent spatial state, making long-horizon video understanding and occlusion-sensitive reasoning difficult. We propose Tensor Memory, a lightweight module that augments Transformer blocks with a fixed-size recurrent 3D memory tensor: tokens write into a voxel grid via a differentiable soft write that deposits content as a Gaussian-weighted volume around a predicted continuous 3D location, the memory is updated with an efficient local interaction operator and gated recurrent dynamics, and tokens read back context via continuous sampling with gated residual fusion. Because the memory tensor has a constant size, Tensor Memory decouples state capacity from input length while preserving a spatial inductive bias. We evaluate the module on standard language, image, and video benchmarks and on a controlled toy diagnostic suite designed to isolate when persistent state is beneficial; it integrates with standard Transformer training pipelines and can be attached to or removed from existing blocks without other architectural changes.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。