TL;DR
PartPrompt is a novel selective prompt compression method that uses linguistic parse trees and global document structure to shorten long prompts without losing their "human logic." By transforming prompt compression into a tree-pruning problem, it achieves state-of-the-art performance, maintains better text coherence than existing methods, and can handle extremely long prompts that break traditional tools.
What Problem Does This Paper Address?
Large Language Models (LLMs) thrive on context, but "context" comes at a price. Most LLMs use the Transformer architecture, where computational costs grow quadratically with the input length. Furthermore, every model has a hard limit on how many tokens it can process at once.
To fix this, researchers use prompt compression. Current methods fall into two camps:
- Generative: An LLM rewrites the prompt. This often leads to "hallucinations" where the compressed version changes the original meaning.
- Selective: A smaller model calculates the "importance" (information entropy) of tokens and deletes the boring ones.
The authors argue that selective methods have a major flaw: they treat prompts like a "bag of tokens." They ignore linguistic rules (syntax) and the global structure of a document (how sentences form paragraphs and sections). This often results in "choppy" compressed text that loses the original "human writing logic," making it harder for the target LLM to reason correctly.
Methods
The authors introduce PartPrompt, which treats a prompt not as a sequence, but as a hierarchical tree. The process follows four main steps:
- Local Entropy & Parse Trees: The prompt is sliced into sentences. For each sentence, a linguistic parse tree is generated (using the Stanford CoreNLP toolkit), and a small LLM (like Llama2-7B) calculates the information entropy of each token. To save cost, entropy is calculated locally within each sentence rather than across the whole document.
- Global Tree Construction: These local sentence trees are linked into a "Global Tree" that mirrors the document's hierarchy: Tokens $\rightarrow$ Sentences $\rightarrow$ Paragraphs $\rightarrow$ Sections $\rightarrow$ Document.
- Value Propagation: To account for human logic, the authors use two new techniques:
- Root-ward propagation: Aggregates importance values from the leaves (tokens) up to the virtual nodes (paragraphs/sections).
- Leaf-ward propagation: Distributes importance back down. This allows the model to prioritize "anchor" content, like the first sentence of a paragraph, which humans typically use to establish context.
- Recursive Pruning: Finally, a recursive algorithm prunes the tree to meet the desired compression ratio while maximizing the total "value" of the remaining nodes. Because it follows the tree structure, if a "child" token is kept, its "parent" (the structural context) is also preserved.
Datasets
The researchers evaluated PartPrompt across a diverse set of benchmarks:
- Contextual Understanding: BBCnews and a truncated version of arXiv.
- Multilingual/Specialized: PeopleDaily (Chinese) and CodeNet (Programming code).
- Reasoning: HotpotQA (multi-hop questions) and GSM8K (math word problems).
- Long Context: RULER (the "Needle-in-a-Haystack" test) and LongBench.
- Extreme Scenarios: They used full arXiv papers exceeding 6,000 tokens to test limits where other selective compressors fail.
Key Insights and Ideas
- Syntax as a Safety Rail: By using parse trees, PartPrompt ensures that it doesn't just keep "important" keywords while deleting the verbs or connectors that make the sentence make sense. It preserves the "skeleton" of the language.
- The "First-Part" Bias: The authors found that emphasizing the first part of each hierarchy (the first sentence of a paragraph, etc.) significantly boosted performance. This aligns with how humans write—we put the most critical info upfront.
- Efficiency through Approximation: Calculating entropy for a 10,000-token prompt is computationally expensive. By calculating it sentence-by-sentence and then using the Global Tree to "fix" the loss of global context, PartPrompt is significantly faster and more scalable than its predecessors.
Key Results
- SOTA Performance: PartPrompt consistently outperformed baselines like LLMLingua and Selective-Context across BLEU, ROUGE, and BERTScore metrics. For example, on the BBCnews dataset at a 20% token constraint, PartPrompt achieved a BLEU score of 13.69, nearly double that of some competitors.
- Coherence: Qualitative analysis showed that PartPrompt produces much more readable text. While other methods might leave fragmented words (like "elling" instead of "selling"), PartPrompt’s alignment module ensures semantic integrity.
- The "Needle" Specialist: On the RULER (Needle-in-a-Haystack) benchmark, PartPrompt scored 69.0, vastly outperforming LLMLingua2 (24.0) and even the original uncompressed prompt (21.0). This suggests that by removing "noise" while keeping "structure," PartPrompt actually makes it easier for LLMs to find specific facts.
Limitations and Future Work
While powerful, PartPrompt has a few hurdles:
- Dependency on Parsers: The quality of the compression is tied to the accuracy of the linguistic parser. While great for English and Chinese, it might struggle with low-resource languages.
- Computational Overhead: Generating parse trees for every sentence adds a pre-processing step that simpler "token-dropping" methods don't have.
- Future Directions: The authors suggest exploring other prompt patterns beyond standard document hierarchies and investigating if specific LLM architectures (like Mamba or RWKV) respond differently to tree-based compression.
Summary updated