2025-10-21 · 专家 · 计算机视觉 · 自然语言处理 · 机器学习

Glyph: Scaling Context Windows via Visual-Text Compression

这篇论文提出了一个名为Glyph的框架,通过视觉-文本压缩和视觉语言模型来扩展长上下文理解,实现了在保持较高准确率的同时显著压缩文本输入。

更新于 2025-10-23。作者:Jiale Cheng、Yusen Liu、Xinyu Zhang、Yulin Fei、Wenyi Hong、Ruiliang Lyu、Weihan Wang、Zhe Su、Xiaotao Gu、Xiao Liu、Yushi Bai、Jie Tang、Hongning Wang、Minlie Huang。

中文摘要

大型语言模型(LLMs)越来越多地依赖于长上下文建模来完成文档理解、代码分析和多步推理等任务。然而,将上下文窗口扩展到百万词级别带来了巨大的计算和内存成本,限制了长上下文LLMs的实用性。在这项工作中,我们采取了不同的视角——视觉上下文扩展——来应对这一挑战。我们不是扩展基于标记的序列,而是提出了一个名为Glyph的框架,该框架将长文本渲染成图像,并使用视觉语言模型(VLMs)进行处理。这种方法在大幅压缩文本输入的同时保留了语义信息,我们还进一步设计了一个由LLM驱动的遗传搜索,以识别平衡准确性和压缩的最优视觉渲染配置。通过广泛的实验,我们证明了我们的方法在保持与Qwen3-8B等领先LLMs在各个长上下文基准测试中相当准确性的同时,实现了3-4倍的标记压缩。这种压缩还导致预填充和解码速度提高约4倍,以及SFT训练速度提高约2倍。此外,在极端压缩下,一个128K上下文的VLM可以扩展以处理百万词级别的文本任务。此外,渲染的文本数据也有利于现实世界的多模态任务,如文档理解。我们的代码和模型已发布在https://github.com/thu-coai/Glyph。

英文摘要

Large language models (LLMs) increasingly rely on long-context modeling for tasks such as document understanding, code analysis, and multi-step reasoning. However, scaling context windows to the million-token level brings prohibitive computational and memory costs, limiting the practicality of long-context LLMs. In this work, we take a different perspective-visual context scaling-to tackle this challenge. Instead of extending token-based sequences, we propose Glyph, a framework that renders long texts into images and processes them with vision-language models (VLMs). This approach substantially compresses textual input while preserving semantic information, and we further design an LLM-driven genetic search to identify optimal visual rendering configurations for balancing accuracy and compression. Through extensive experiments, we demonstrate that our method achieves 3-4x token compression while maintaining accuracy comparable to leading LLMs such as Qwen3-8B on various long-context benchmarks. This compression also leads to around 4x faster prefilling and decoding, and approximately 2x faster SFT training. Furthermore, under extreme compression, a 128K-context VLM could scale to handle 1M-token-level text tasks. In addition, the rendered text data benefits real-world multimodal tasks, such as document understanding. Our code and model are released at https://github.com/thu-coai/Glyph.

解读

一句话总结

这篇论文提出了一个名为Glyph的框架,通过视觉-文本压缩和视觉语言模型来扩展长上下文理解,实现了在保持较高准确率的同时显著压缩文本输入。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt