Mapping Text to Multiplex Graph: Prompt Compression as Lévy Walk-Guided Graph Pruning

Yaxin Gao, Yao Lu, Jinhong Deng, Jiaqi Nie, Zhe Tang, Jian Zhang, Zhaowei Zhu, Shanqing Yu, Qi Xuan, Joey Tianyi ZhouarXiv 2026

TL;DR

Large language models (LLMs) struggle with long prompts due to high computational costs and memory overhead. This paper introduces RAGP (Redundancy-Aware Graph Pruning), a novel method that models prompts as multi-layered graphs rather than flat text sequences. By using a physics-inspired "Lévy walk" algorithm, RAGP efficiently navigates these graphs to prune redundant words while preserving critical local and global context, achieving state-of-the-art prompt compression.

What Problem Does This Paper Address?

Long, information-rich prompts are essential for complex LLM tasks, but they introduce severe practical bottlenecks: high inference costs, increased latency, massive memory consumption, and performance degradation (such as the "lost-in-the-middle" phenomenon).

Existing prompt compression methods typically treat text as a flat sequence of tokens and prune them based on isolated importance metrics like raw attention scores. The authors argue that this approach ignores the structured, distributed nature of information in long documents. Important details are intricately linked through both local syntax (within a sentence) and global semantics (across sentences). By ignoring this structure, traditional methods often make suboptimal decisions—either retaining locally salient but globally redundant tokens, or discarding individually unremarkable tokens that are collectively essential to the document's meaning.

Methods

The authors propose RAGP, which transforms prompt compression into a structure-aware graph pruning problem.

  1. Multiplex Graph Construction: RAGP maps the input text into a two-layer ("multiplex") graph to capture multiple granularities of text structure:
  2. Intra-layer (Local Structure): Word-level nodes connected by edges based on token-level attention scores from a pretrained language model. This forms dense local subgraphs within individual sentences.
  3. Inter-layer (Global Structure): Sentence-level nodes connected by semantic similarity embeddings, creating a sparse network that maps long-range relationships across the document.
  4. Lévy Walk-Based Importance Estimation: Standard random walks tend to get trapped in the dense local clusters of a single sentence. To overcome this, RAGP utilizes Lévy walks—a type of random walk characterized by a heavy-tailed step-length distribution. This mathematical property allows the walker to alternate between thorough local exploration (navigating words within a sentence) and occasional long-range "jumps" (transitioning to semantically related sentences elsewhere in the document).
Figure 1. Framework of the proposed approach. Textual redundancy is converted into graph redundancy pruning on a multiplex graph, where multi-round L´evy walks estimate node importance for text compression.

The importance of each word node is calculated based on its visit frequency across multiple independent walks. Nodes that act as local hubs or global semantic bridges are visited more often and prioritized for retention.

  1. Graph Pruning: Finally, RAGP formulates prompt compression as a budget-constrained optimization problem, selecting the highest-scoring subset of nodes that fits within the target token limit and projecting them back into their original textual order.

Datasets

RAGP was evaluated on LongBench, a comprehensive bilingual benchmark designed for long-context understanding. It includes a variety of tasks:

  • Single-document QA (e.g., Qasper, NarrativeQA)
  • Multi-document QA
  • Summarization (e.g., QMSum, GovReport)
  • Few-shot learning
  • Synthetic reasoning
  • Code-related tasks

The authors also utilized MultiFieldQA-En to conduct practical latency and inference cost analyses.

Key Insights and Ideas

  • Text as a Multiplex Graph: Modeling text hierarchically prevents the loss of context that occurs when treating documents as flat token streams. It explicitly balances local syntactic coherence with global semantic flow.
  • The Foraging Analogy: Just as animals in nature use Lévy flights to optimally forage for sparsely distributed food in heterogeneous environments, a graph traversal algorithm can use Lévy walks to efficiently forage for non-redundant, high-value information scattered across a massive document.
  • Avoiding the Local Trap: Standard random walks or PageRank variants suffer from slow mixing on text graphs because they get stuck in the high-density attention loops of individual sentences. The heavy-tailed jumps of the Lévy walk naturally resolve this bottleneck.

Key Results

  • State-of-the-Art Compression: On the LongBench benchmark, RAGP achieved an average score of 49.3 under a 4× compression ratio (3,000 token budget), outperforming the leading LLM-based baseline, LongLLMLingua, which scored 48.8 despite using a lower 3× compression ratio.
  • Extreme Compression Resilience: Under a tighter 2,000-token constraint (6× compression), RAGP maintained a dominant average score of 48.1.
  • Superiority Over Vision-Based Methods: RAGP significantly outperformed vision-based text compression models (like Glyph), particularly on precision-heavy tasks like code analysis, where RAGP led by nearly 10 points (58.8 vs 48.9).
Figure 2. Illustration of L´evy walk traversal. Solid edges show local exploration, dashed edges represent long-range jumps. Edge intensity reflects attention strength, and darker nodes are visited more frequently and retained after compression.
  • Real-World Cost Savings: When deployed practically on MultiFieldQA-En, RAGP reduced input tokens by 19.6%, translating directly to an 18.3% reduction in monetary API costs with negligible impact on final accuracy.

Limitations and Future Work

Despite its strong performance, the authors note a few limitations:

  • Computational Overhead: Constructing the multiplex graph and running multi-round stochastic walks introduces additional preprocessing latency.
  • Summarization Bottleneck: RAGP's performance on pure summarization tasks was slightly lower than some specialized baselines (22.7 vs 27.2).
  • Hyperparameter Sensitivity: Key parameters, such as the graph sparsity threshold ($\delta$) and the Lévy exponent ($\mu$), currently require manual tuning depending on the document domain.

For future work, the authors plan to investigate adaptive, task-specific compression strategies and extend the multiplex graph framework to support multi-modal inputs.

Summary updated

Abstract

Existing prompt compression methods treat text as flat token sequences, failing to capture the distributed nature of important information, which is often spread across multiple locations and connected through both local syntactic dependencies and global semantic relations. Such relational structure is naturally represented as a graph, where tokens or sentences become nodes and their dependencies become edges. To this end, we propose RAGP, which formulates prompt compression as Redundancy-Aware Graph Pruning on a multiplex graph that jointly models fine-grained attention-based dependencies and coarse-grained semantic relations. To efficiently identify non-redundant nodes in this heterogeneous structure (dense local subgraphs and sparse global connections), we employ Levy walks whose heavy-tailed step distribution naturally balances local exploitation with global exploration. Experiments on LongBench show that RAGP achieves an average score of 49.3 under a 4x compression ratio, outperforming existing LLM-based compression methods, such as LongLLMLingua, which attains 48.8 at a 3x compression ratio. Besides, RAGP also surpasses state-of-the-art vision-based text compression paradigms on multiple tasks. The code is available at https://anonymous.4open.science/r/RAGP-B0CB.
BibTeX
@misc{gao2026mapping,
  author = {Yaxin Gao and Yao Lu and Jinhong Deng and Jiaqi Nie and Zhe Tang and Jian Zhang and Zhaowei Zhu and Shanqing Yu and Qi Xuan and Joey Tianyi Zhou},
  title = {{Mapping Text to Multiplex Graph: Prompt Compression as Lévy Walk-Guided Graph Pruning}},
  year = {2026},
  eprint = {2607.01241},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.01241},
}
Figure