DiffuMask: Diffusion Language Model for Token-level Prompt Pruning
Organizations: University of Washington · Oracle AI
Abstract
In-Context Learning and Chain-of-Thought prompting improve reasoning in large language models (LLMs). These typically come at the cost of longer, more expensive prompts that may contain redundant information. Prompt compression based on pruning offers a practical solution, yet existing methods rely on sequential token removal which is computationally intensive. We present DiffuMask, a diffusion-based framework integrating hierarchical shot-level and token-level pruning signals, that enables rapid and parallel prompt pruning via iterative mask prediction. DiffuMask substantially accelerates the compression process via masking multiple tokens in each denoising step. It offers tunable control over retained content, preserving essential reasoning context and achieving up to 80% prompt length reduction. Meanwhile, it maintains or improves accuracy across in-domain, out-of-domain, and cross-model settings. Our results show that DiffuMask provides a generalizable and controllable framework for prompt compression, facilitating faster and more reliable in-context reasoning in LLMs.
Figures & tables
| Methods | Full | Random | Llmlingua | Llmlingua2 | CI | HP | DiffuMask |
|---|---|---|---|---|---|---|---|
| Token Counts | 5399.1 | 1061.3 | 1153.2 | 1155.2 | 1644.4 | 660.4 | 1113.8 |
| EM Accuracy | 76.49 | 60.89 | 67.32 | 70.89 | 76.90 | 75.83 | 77.07 |
| Pruning Inference(min) | - | 0 | 0.1 | 0.1 | 0.5 | 1440 | 0.75 |
| Dataset | Shots | Token Counts | Accuracy | ||
| Full | DiffuMask | Full | DiffuMask | ||
| Yelp5 | 1 | 877.7 | 285.4 (↓67.5%) | 61.88 | 62.93 (+1.05) |
| 5 | 4800.7 | 149.6 (↓96.9%) | 50.79 | 62.91 (+12.12) | |
| Yahoo | 1 | 533.3 | 224.8 (↓57.8%) | 60.56 | 63.44 (+2.88) |
| 5 | 2484.4 | 759.8 (↓69.4%) | 51.96 | 63.99 (+12.03) | |
| AG’s News | 1 | 227.0 | 224.3 (↓1.2%) | 80.28 | 80.23 (-0.05) |
| Model | Full | DiffuMask |
|---|---|---|
| GPT4o | 90.57 | 92.39 (+1.8) |
| GPT4.1 | 90.93 | 92.76 (+1.8) |
| GPT4.1nan | 83.95 | 83.48(-0.5) |
| Gem2.5Fl | 97.03 | 96.40(-0.6) |
| Gem2.5Pro | 98.12 | 98.28 (+0.2) |
| GROK 3 | 97.86 | 96.50(-1.4) |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| # Shots | Token Counts | Accuracy (%) |
|---|---|---|
| 1 | 183 | 73.38 |
| 2 | 377 | 74.44 |
| 5 | 857 | 75.65 |
| 10 | 1704 | 75.64 |
| 15 | 2571 | 75.29 |
| 20 | 3412 | 75.05 |
| Method | Full | Fewer-shot | ||
|---|---|---|---|---|
| Shots | Acc | Shots | Acc | |
| RL Pruner (100) | 32 | 74.42 | 10.3 | 75.32 |
| Rand Var- (100) | 32 | 74.42 | 10.3 | 75.33 |
| Rand Fix- (600) | 32 | 74.84 | 5 | 75.72 |
| Pruning Group | Improved | TA Traj | Total |
|---|---|---|---|
| RL Pruner | 55 | 26 | 81 |
| Rand Var- | 37 | 24 | 61 |
| Rand Fix- | 61 | - | 61 |
| Total | 142 | 61 | 203 |
| Pruning Group | Train | Validation | Test |
|---|---|---|---|
| Trained Pruner | 81 | – | 19 |
| Random Var- | 37 | 24 | – |
| Random Fix- | 50 | 11 | – |
| Total | 168 | 35 | 19 |
| Hyperparameter | Value |
|---|---|
| Batch size | 1 |
| Epochs | 20 |
| Learning rate | |
| Mask penalty coefficient | 2.0 |
| Balance ratio | 0.8 |
| Maximum sequence length | 4096 |
| Token Counts | Accuracy | |||||||
| Threshold | ||||||||
| Top-k | 0.0001 | 0.001 | 0.01 | 0.1 | 0.0001 | 0.001 | 0.01 | 0.1 |
| 2 | 150.4 | 1061.1 | 2950.9 | 4219.7 | 75.31 | 80.76 | 80.95 | 79.75 |
| 3 | 132.1 | 1023.2 | 2943.3 | 4208.3 | 75.35 | 80.73 | 80.63 | 80.11 |
| 4 | 130.8 | 978.5 | 2891.4 | 4205.0 | 73.37 | 80.93 | 80.91 | 80.22 |
| One-shot | Five-shot | |||
|---|---|---|---|---|
| Top- | Accuracy (%) | Tokens | Accuracy (%) | Tokens |
| topk10 | 56.88 | 591.0 | 62.78 | 1555.6 |
| topk20 | 62.78 | 476.8 | 62.44 | 453.2 |
| topk50 | 62.93 | 354.4 | 62.78 | 140.7 |
| topk100 | 63.04 | 265.6 | 63.10 | 130.2 |
| One-shot | Five-shot | |||
|---|---|---|---|---|
| Top- | Accuracy (%) | Tokens | Accuracy (%) | Tokens |
| topk10 | 59.26 | 353.4 | 63.94 | 1355.0 |
| topk20 | 63.29 | 298.9 | 63.91 | 1082.9 |
| topk50 | 63.53 | 206.0 | 64.09 | 666.4 |
| topk100 | 63.19 | 170.0 | 63.43 | 400.5 |
| topk200 | 62.77 | 127.3 | 62.50 | 178.1 |
| One-shot | Five-shot | Twenty-shot | ||||
|---|---|---|---|---|---|---|
| Top- | Accuracy (%) | Tokens | Accuracy (%) | Tokens | Accuracy (%) | Tokens |
| topk2 | 80.48 | 220.9 | 67.58 | 1078.3 | 62.83 | 4287.7 |
| topk5 | 80.64 | 219.2 | 73.93 | 991.8 | 79.40 | 3857.6 |
| topk10 | 79.78 | 214.1 | 65.45 | 970.0 | 78.43 | 3613.7 |
| topk20 | 71.22 | 203.3 | 76.58 | 897.2 | 76.38 | 3174.6 |
| topk50 | 76.37 | 187.7 | 79.64 | 715.6 | 84.75 | 2121.9 |
| ADJ: | adjective (e.g., big, old) |
| ADP: | adposition (e.g., in, to, during) |
| ADV: | adverb (e.g., very, tomorrow) |
| AUX: | auxiliary verb (e.g., is, has) |
| CCONJ: | coordinating conjunction (e.g., and, but) |
| DET: | determiner (e.g., the, a, some) |
| INTJ: | interjection (e.g., oh, wow) |
| Dataset | Primary Accuracy Measure | What the Accuracy is Checking |
|---|---|---|
| AGNews | Top-1 Accuracy | Whether the model correctly identified the single news topic (World, Sports, Business, or Sci/Tech). |
| Yelp5 | Star Rating Accuracy | Whether the model predicted the exact star rating (1, 2, 3, 4, or 5) assigned by the user in their review. |
| Yahoo | Topic Classification Accuracy | Whether the model correctly assigned the text to one of 10 main categories (e.g., Health, Sports, Politics). |
Prompt Compression
Prompt compression reduces the tokens sent to language models while trying to preserve the information needed for accurate, efficient responses.
See all 34 papers