Can Vision-Language Models Handle Long-Context Code? An Empirical Study on Visual Compression
On the map: Multimodal LLMs / vision-language models → Visual token pruning and efficiency
Abstract (arXiv)
Large Language Models (LLMs) struggle with long-context code due to window limitations. Existing textual code compression methods mitigate this via selective filtering but often disrupt dependency closure, causing semantic fragmentation. To address this, we introduce LongCodeOCR, a visual compression framework that renders code into compressed two-dimensional image sequences for Vision-Language Models (VLMs). By preserving a global view, this approach avoids the dependency breakage inherent in filtering. We systematically evaluate LongCodeOCR against the state-of-the-art LongCodeZip across four benchmarks spanning code summarization, code question answering, and code completion. Our results demonstrate that visual code compression serves as a viable alternative for tasks requiring global understanding. At comparable compression ratios (~1.7×), LongCodeOCR improves CompScore on Long Module Summarization by 36.85 points over LongCodeZip. At a 1M-token context length with Glyph (a specialized 9B VLM), LongCodeOCR maintains higher accuracy than LongCodeZip while operating at about 4× higher compression. Moreover, compared with LongCodeZip, LongCodeOCR drastically reduces compression-stage overhead (reducing latency from ~4.3 hours to ~1 minute at 1M tokens). Finally, our results characterize a fundamental coverage--fidelity trade-off: visual code compression retains broader context coverage to support global dependencies, yet faces fidelity bottlenecks on exactness-critical tasks; by contrast, textual code compression preserves symbol-level precision while sacrificing structural coverage.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Placed in Visual token pruning and efficiency, one of 16 directions in Multimodal LLMs / vision-language models. Builds on 34 of its 41 references that are in the map. First posted on arXiv 31 Jan 2026.
Builds on
34 of 41 references.
References · 34
- 2017Attention Is All You Needcited by 59,932
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,830
- 2020Big Bird: Transformers for Longer Sequencescited by 1,673
- 2020Rethinking Attention with Performerscited by 1,584
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
22 more
- 2023LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compressioncited by 443
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 346
- 2023LooGLE: Can Long-Context Language Models Understand Long Contexts?cited by 200
- 2024Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attentioncited by 194
- 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
- 2024xRAG: Extreme Context Compression for Retrieval-augmented Generation with One Tokencited by 123
- 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 110
- 2023ChatUniTest: A Framework for LLM-Based Test Generationcited by 94
- 2025SWE-Debate: Competitive Multi-Agent Debate for Software Issue Resolutioncited by 52
- 2025Glyph: Scaling Context Windows via Visual-Text Compressioncited by 49
- 2024Long Code Arena: a Set of Benchmarks for Long-Context Code Modelscited by 48
- 2023ALGO: Synthesizing Algorithmic Programs with LLM-Generated Oracle Verifierscited by 41
- 2025LongCodeZip: Compress Long Context for Code Language Modelscited by 38
- 2025LongCodeBench: Evaluating Coding LLMs at 1M Context Windowscited by 37
- 2024RepoQA: Evaluating Long Context Code Understandingcited by 35
- 2022Diet Code Is Healthy: Simplifying Programs for Pre-trained Models of Codecited by 24
- 2026AgentOCR: Reimagining Agent History via Optical Self-Compressioncited by 22
- 2025Vision-centric Token Compression in Large Language Modelcited by 21
- 2024Leveraging Visual Tokens for Extended Text Contexts in Multi-Modal Learningcited by 17
- 2025LONGCODEU: Benchmarking Long-Context Language Models on Long Code Understandingcited by 13
Built on by
Citing papers per year: 2026: 5.
5 papers.
- 2026Magnifying What Matters: Attention-Guided Adaptive Rendering for Visual Text Comprehensioncited by 1
- 2026When History Is Multimodal: Rethinking Context Management for Long-Horizon Agentscited by 1
- 2026Beyond Textual Repository Exploration: Dual-Modal Structural Reasoning for Agentic Issue Resolutioncited by 0
- 2026Pixels for Programs? A Cross-Provider Case Study of Input-Token Accounting for Source Code as Text and Imagescited by 0
- 2026Can Coding Agents Solve Repository-Level Issues with Rendered Code? An Exploratory Study of Visual Representationscited by 0
- 2026When History Is Multimodal: Rethinking Context Management for Long-Horizon Agents30 Aug 2026
- 2026Can Coding Agents Solve Repository-Level Issues with Rendered Code? An Exploratory Study of Visual Representations10 Aug 2026
- 2026Pixels for Programs? A Cross-Provider Case Study of Input-Token Accounting for Source Code as Text and Images23 Jul 2026
- 2026Beyond Textual Repository Exploration: Dual-Modal Structural Reasoning for Agentic Issue Resolution2 Jul 2026
- 2026Magnifying What Matters: Attention-Guided Adaptive Rendering for Visual Text Comprehension11 Jun 2026
Similar, not cited
Close in wording, no citation either way
- 2025LLMC+: Benchmarking Vision-Language Model Compression with a Plug-and-play Toolkit
- 2025VTCBench: Can Vision-Language Models Understand Long Context with Vision-Text Compression?
- 2026Seeing is Coding: On the Effectiveness of Vision Language Models in Code Understanding
- 2026VLZip: Unified Visual and Textual Compression for Interleaved Long-Context Modeling
- 2026VisCo: Leveraging Large Language Models as Intrinsic Encoders for Visual Token Compression
- 2026ZeroSense:How Vision matters in Long Context Compression
- 2025FCoT-VL:Advancing Text-oriented Large Vision-Language Models with Efficient Visual Token Compression
- 2026Training Long-Context Vision-Language Models Effectively with Generalization Beyond 128K Context