Abstract
Glyph compresses long textual inputs into images using vision-language models, achieving significant token compression and improved performance in long-context tasks.
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.
Community
🪶 Glyph: Scaling Context Windows via Visual-Text Compression
Glyph introduces a new paradigm for long-context LLMs through visual-text compression — rendering text as images and processing them with VLMs to boost information density.
🧩 Efficient compression:
Achieves 3–4× token reduction with minimal accuracy loss on long-context benchmarks.
⚡ Faster inference & training:
Up to 4× faster inference and 2× faster SFT training.
📏 Extreme compression capability:
Enables 128K-context models to handle 1M-token tasks through highly compact visual representations.
🌐 Open-source soon:
Code and models are on the way to foster vision-driven context scaling.
~3-4× token compression with comparable accuracy on long-context benchmarks; faster inference/training; aim to handle up to ~1 M token-level tasks via extreme compression.
Hugging Face
Primary domain: more general “document understanding / long text” rather than strictly OCR or converting arbitrary scanned docs into text. The image representation is a strategy for long-context LLMs.
similar ideas, but this implementation is more practical for inference and training and practical tasks.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- MARC: Memory-Augmented RL Token Compression for Efficient Video Understanding (2025)
- CCF: A Context Compression Framework for Efficient Long-Sequence Language Modeling (2025)
- UniGist: Towards General and Hardware-aligned Sequence-level Long Context Compression (2025)
- ViCO: A Training Strategy towards Semantic Aware Dynamic High-Resolution (2025)
- Seeing More, Saying More: Lightweight Language Experts are Dynamic Video Token Compressors (2025)
- Growing Visual Generative Capacity for Pre-Trained MLLMs (2025)
- ModernVBERT: Towards Smaller Visual Document Retrievers (2025)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper