グリフ:視覚的テキスト圧縮によるコンテキストウィンドウのスケーリング
Glyph: Scaling Context Windows via Visual-Text Compression
October 20, 2025
著者: 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
cs.AI
要旨
大規模言語モデル(LLMs)は、文書理解、コード分析、多段階推論などのタスクにおいて、長文脈モデリングにますます依存するようになっている。しかし、コンテキストウィンドウを百万トークンレベルまで拡張することは、計算コストとメモリコストが膨大になり、長文脈LLMsの実用性を制限している。本研究では、この課題に取り組むために、視覚的コンテキストスケーリングという異なる視点を採用する。トークンベースのシーケンスを拡張する代わりに、Glyphというフレームワークを提案し、長文を画像としてレンダリングし、視覚言語モデル(VLMs)で処理する。このアプローチは、テキスト入力を大幅に圧縮しながら意味情報を保持し、さらに、精度と圧縮のバランスを取るための最適な視覚レンダリング設定を特定するために、LLM駆動の遺伝的探索を設計する。広範な実験を通じて、我々の手法が、Qwen3-8Bなどの主要なLLMsと同等の精度を維持しながら、3-4倍のトークン圧縮を達成することを示す。この圧縮により、プリフィリングとデコードが約4倍速くなり、SFTトレーニングが約2倍速くなる。さらに、極端な圧縮下では、128KコンテキストのVLMが1Mトークンレベルのテキストタスクを処理できるようにスケールする。また、レンダリングされたテキストデータは、文書理解などの現実世界のマルチモーダルタスクにも役立つ。我々のコードとモデルはhttps://github.com/thu-coai/Glyphで公開されている。
English
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.