用汉字图像替代分词嵌入,模型性能提升21%且训练更快。
Full Glyph Images Beat Token Embeddings: A Controlled Study for Transformers

- 用字符图像输入替代传统分词,通过视觉编码器处理
- 最高准确率0.429,比基线高出21%,训练速度翻倍
- 适合中文语言建模,尤其对字形结构敏感的任务
现代语言模型通常将文本表示为离散分词嵌入序列,这一假设虽普遍但少被质疑。本文针对中文,完全用字符序列的栅格化图像替代基于索引的分词嵌入,由共享的ResNet和浅层Vision Transformer构成的视觉编码器处理。为隔离输入表示的影响,构建双分支控制框架:视觉模型与基于索引的基线共享相同的解码器主干、训练目标、优化器和数据流程。所有性能差异仅源于输入模态。在所有测试的解码器主干上,视觉模型始终优于基线,最高准确率达0.429,较基线0.355提升21%,且训练周期缩短约一半。优势在前五轮(不足总数据量21%)即显现,并在中等字符损坏下仍保持领先:损坏的视觉模型表现等同于干净的基线。消融实验表明,该优势需依赖空间连贯输入及带二维位置编码的ViT。跨脚本对比显示,英文中未观察到相同优势,说明中文字符的均匀视觉密度与部件结构是关键促成条件。研究提示,Transformer比常认为的更具模态无关性,而离散分词并非中文语言建模的必要前提。
原文摘要 · Abstract (English)
Modern language models generally represent text as sequences of discrete token embeddings, an assumption deeply rooted in current practice but rarely questioned. We challenge this representation, especially for Chinese, by replacing index-based token embeddings entirely with a single rasterized image of the character sequence, processed by a vision encoder composed of a shared ResNet and a shallow Vision Transformer. To isolate the role of input representation, we construct a dual-branch controlled framework in which both a Vision-based model and an index-based baseline share an identical decoder backbone, training objective, optimizer, and data curriculum. Any performance difference is therefore attributable to the input modality only. Across all tested decoder backbones, the Vision-based model consistently outperforms the baseline, reaching a peak accuracy of 0.429 versus 0.355 for the index-based baseline,that is, a 21% relative improvement, while converging in about half the number of training epochs. The advantage emerges especially within the first five epochs (under 21% of total data) and persists under moderate character corruption: the corrupted Vision model matches the clean index-based baseline. Ablation studies reveal that the advantage requires both spatially coherent input and a ViT encoder with 2D positional encodings. A cross-script comparison on English shows the advantage does not transfer directly to alphabetic writing systems, suggesting that the uniform visual density and radical structure of Chinese characters are enabling conditions. These findings suggest that transformers are more modality-agnostic than commonly assumed, and that discrete tokenization is not a fundamental requirement for Chinese language modeling.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。