Leveraging Visual Tokens for Extended Text Contexts in Multi-Modal Learning
Alex Jinpeng Wang, Linjie Li, Yiqi Lin, Min Li, Lijuan Wang, Mike Zheng Shou
TL;DR
This work tackles the high computational cost of extending in-context text in multimodal LLMs by introducing Visualized In-Context Text Processing (VisInContext), which renders long text as images processed by a lightweight vision encoder. By combining Token Masking with a Text-Centric Contrastive Loss (TCCL), VisInContext aligns rendered-text representations with traditional text embeddings, effectively creating a visual text tokenizer and enabling far longer in-context text without proportional FLOP increases. Empirically, extending in-context length from 256 to 2048 tokens yields measurable gains on multimodal few-shot benchmarks, and the approach enhances document understanding tasks such as DocVQA and OCR-VQA, while maintaining efficiency and enabling sequential multimodal retrieval. The method is shown to be compatible with existing MLLM architectures and exhibits potential for broader document understanding applications, albeit with limitations related to fixed image sizes and future work on dynamic rendering.
Abstract
Training models with longer in-context lengths is a significant challenge for multimodal model due to substantial GPU memory and computational costs. This exploratory study does not present state-of-the-art models; rather, it introduces an innovative method designed to increase in-context text length in multi-modality large language models (MLLMs) efficiently. We present Visualized In-Context Text Processing (VisInContext), which processes long in-context text using visual tokens. This technique significantly reduces GPU memory usage and floating point operations (FLOPs) for both training and inferenceing stage. For instance, our method expands the pre-training in-context text length from 256 to 2048 tokens with nearly same FLOPs for a 56 billion parameter MOE model. Experimental results demonstrate that model trained with VisInContext delivers superior performance on common downstream benchmarks for in-context few-shot evaluation. Additionally, VisInContext is complementary to existing methods for increasing in-context text length and enhances document understanding capabilities, showing great potential in document QA tasks and sequential document retrieval.
