用代理令牌压缩长序列,让模型高效生成超长文本和高分辨率内容。
ProxyFormer: A Dual-Stream Proxy Architecture for Ultra-Long Context and High-Resolution Generation

- 通过双流架构将局部特征压缩为少量代理状态,仅在代理空间计算全局交互。
- 压缩比64时训练长度达70万词元,100万词元检索任务准确率仍保持92%以上。
- 适合需要处理超长上下文的场景,如文档生成、长视频理解、高分辨率图像生成。
注意力计算与键值缓存随序列长度呈二次增长,是超长上下文语言模型和高分辨率生成模型的核心瓶颈。我们提出ProxyFormer,一种基于代理令牌的通用双流架构。每层中,细粒度局部特征自底向上压缩为少量代理状态;仅在压缩后的代理空间进行昂贵的全局交互;全局上下文化的代理再自顶向下解压缩并注入局部流。由于局部流跨层保留,单次压缩未捕获的细粒度信息仍可后续优化,缓解了传统一次性压缩的不可逆信息损失。我们进一步引入分层因子化压缩/解压缩、逐层动态压缩比、非对称双嵌入及仅代理的键值缓存推理方案。在16GB GPU、批大小为1的条件下,标准解码器模型仅能训练约2万词元序列,而压缩比为64的ProxyFormer将可训练长度扩展至约70万词元。使用64K窗口训练的模型在1048576词元多针检索任务中保持92%-95%准确率,使用8K窗口训练的模型外推至256K词元时准确率超过94%。初步图像生成实验表明ProxyFormer适用于像素空间与潜在空间的流匹配。
原文摘要 · Abstract (English)
The quadratic growth of attention computation and key-value (KV) cache with respect to sequence length is a central bottleneck for ultra-long-context language models and high-resolution generative models. We propose ProxyFormer, a general dual-stream architecture built upon proxy tokens. In each layer, fine-grained local features are compressed bottom-up into a small set of proxy states; expensive global interactions are performed only in the compressed proxy space; the globally contextualized proxies are then decompressed and injected top-down back into the local stream. Because the local stream persists across layers, fine-grained information that is not captured by one compression step remains accessible for later refinement, alleviating the irreversible information loss of conventional one-shot compression. We further introduce factorized multi-level compression/decompression, layer-wise dynamic compression ratios, asymmetric dual embeddings, and a proxy-only KV-cache inference scheme. On a 16GB GPU with batch size 1, a standard decoder-only model can train sequences of only about 20K tokens, whereas ProxyFormer with a compression ratio of 64 extends the trainable sequence length to about 0.7M. A model trained with a 64K window retains 92%-95% retrieval accuracy on a multi-needle retrieval task with 1,048,576 tokens, and a model trained with an 8K window exceeds 94% accuracy when extrapolated to 256K tokens. Preliminary image-generation experiments demonstrate the feasibility of ProxyFormer for both pixel-space and latent-space flow matching.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。