将字节对编码拓展到多维,让图像生成更高效
Multidimensional Byte Pair Encoding: Shortened Sequences for Improved Visual Data Generation
- 将字节对编码从一维扩展至多维,按频次替换高频像素组合
- 压缩后序列更短且信息分布更均匀,空区域可合并为单个标记
- 可在消费级硬件上快速处理ImageNet,适合视觉Transformer模型
在文本处理中,变换器模型得益于将文本压缩。这通常通过更大的词汇表实现,以捕捉词片段而非原始字符,常用方法是字节对编码(Byte Pair Encoding)。在图像领域,视觉数据的标记化通常局限于量化得到的规则网格,缺乏全局内容感知。本文通过将字节对编码从一维推广至多维,作为现有压缩技术的补充,提升视觉数据的标记化效果。方法基于统计标记对的共现模式,将最频繁出现的标记对替换为新引入的标记。多维扩展仅使计算时间增加约2倍,使得在消费级硬件上分钟内完成ImageNet等大规模数据集的处理成为可能。该过程为无损预处理步骤。实验表明,通过压缩高频标记组合,生成的序列更短、信息分布更均匀,例如将图像中的空白区域压缩为单一标记,从而提升变换器模型在视觉任务上的训练与推理性能。此外,还提出一种通过聚类词汇表进一步增强压缩效率的策略。
原文摘要 · Abstract (English)
In language processing, transformers benefit greatly from text being condensed. This is achieved through a larger vocabulary that captures word fragments instead of plain characters. This is often done with Byte Pair Encoding. In the context of images, tokenisation of visual data is usually limited to regular grids obtained from quantisation methods, without global content awareness. Our work improves tokenisation of visual data by bringing Byte Pair Encoding from 1D to multiple dimensions, as a complementary add-on to existing compression. We achieve this through counting constellations of token pairs and replacing the most frequent token pair with a newly introduced token. The multidimensionality only increases the computation time by a factor of 2 for images, making it applicable even to large datasets like ImageNet within minutes on consumer hardware. This is a lossless preprocessing step. Our evaluation shows improved training and inference performance of transformers on visual data achieved by compressing frequent constellations of tokens: The resulting sequences are shorter, with more uniformly distributed information content, e.g. condensing empty regions in an image into single tokens. As our experiments show, these condensed sequences are easier to process. We additionally introduce a strategy to amplify this compression further by clustering the vocabulary.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。