DiffuMask: Diffusion Language Model for Token-level Prompt Pruning

Caleb Zheng, Jyotika Singh, Fang Tu, Weiyi Sun, Sujeeth Bharadwaj, Yassine Benajiba, Sujith Ravi, Eli Shlizerman, Dan RotharXiv 2026

TL;DR

Prompt compression for Large Language Models (LLMs) is vital for reducing inference costs, but traditional token-pruning methods are bottlenecked by slow, sequential token removal. DiffuMask solves this by framing prompt pruning as a parallel, diffusion-based denoising process, slashing prompt lengths by up to 80% in under a minute while maintaining or even boosting model accuracy.

What Problem Does This Paper Address?

Techniques like In-Context Learning (ICL) and Chain-of-Thought (CoT) prompting are essential for eliciting complex reasoning from LLMs. However, they come with a major downside: massive, redundant prompts that inflate inference latency, consume excessive memory, and drive up API costs. Worse yet, irrelevant details or overly verbose exemplars can actually confuse the model—a phenomenon often referred to as getting "lost in the middle."

To mitigate this, researchers use prompt compression. "Hard" compression methods prune discrete tokens to keep prompts readable and interpretable. Unfortunately, existing pruning algorithms rely on sequential token removal or reinforcement learning loops. Processing a single prompt can take anywhere from 10 hours to two days on an A100 GPU, making real-time or large-scale prompt optimization completely impractical.

Methods

The authors introduce DiffuMask, a framework that turns prompt pruning into an efficient, parallelized task using a finetuned Diffusion Language Model (DLM).

1. Dataset Construction (The Teacher Pipeline)

To train DiffuMask, the authors first built a high-quality dataset of full-to-pruned prompt pairs using a hierarchical pipeline:

  • Shot-level pruning: Reducing the number of multi-shot exemplars (e.g., dropping from 32 shots down to ~5–10 shots).
  • Token-level pruning: Using a threshold-accepting algorithm (TA-Pruning) to iteratively delete individual tokens within those remaining exemplars without degrading accuracy.
  • Filtering: Only prompts that actually maintained or improved accuracy compared to their uncompressed counterparts were kept for training.
Figure 1: Data generation pipeline for DIFFUMASK. The method applies hierarchical shot-level and token-level pruning to generate pruned prompt candidates, which are evaluated and filtered into training and validation sets. GSM8K is shown as a representative example; the pipeline is applicable to any dataset with long prompts.

2. The DiffuMask Architecture

Unlike standard masked DLMs that learn to predict missing text tokens, DiffuMask is trained to predict a binary token retention mask ($1$ for keep, $0$ for remove).

During the forward pass, the model takes a clean, pruned prompt and stochastically adds "noise" by re-introducing redundant tokens back into the text. During training, DiffuMask learns the reverse denoising trajectory: given a partially revealed, noisy prompt, it predicts which tokens should be retained.

To prevent the model from collapsing into a trivial strategy (like deleting everything), the authors implemented a combined loss function featuring an anti-mask penalty that heavily penalizes false token removals.

Figure 2: Overview of the proposed DiffuMask framework compared with a Masked DLM baseline.

3. Tunable Inference

At inference time, DiffuMask uses 64 parallel diffusion steps. Users can control pruning intensity using two hyperparameters: a top-k ranking strategy and a confidence threshold ($\tau$). This allows engineers to dynamically trade off compression strength against reasoning fidelity.

Datasets

  • In-Domain: GSM8K (Grade School Math benchmark), used for dataset generation, training, and primary evaluation.
  • Out-of-Domain (OOD): To test generalization, the model was evaluated on text classification datasets: Yelp5 (sentiment analysis), Yahoo Answers (topic classification), and AG’s News (news classification).

Key Insights and Ideas

  • Inverting the Diffusion Objective: Instead of generating text, diffusion can be effectively repurposed to predict structural metadata (masks) across an entire sequence simultaneously.
  • Simplicity Wins in Shot Selection: While complex reinforcement learning (RL) can be used to select which exemplars to keep, the authors found that a simple, random fixed-$k$ selection strategy performed on par with the RL pruner, significantly streamlining data preparation.
  • Trimming Fat, Not Grammar: Part-of-Speech (POS) analysis revealed that DiffuMask doesn't just naively strip out stop words or conjunctions. The linguistic distribution of the pruned tokens closely matches the original text, meaning it removes semantic redundancy rather than specific grammatical categories.
  • Handling Distribution Shift: When applied to out-of-domain datasets, the model's mask probability distributions become "softer" and less decisive. To counteract this calibration drift, users simply need to expand the top-k search parameter to restore stable pruning coverage.

Key Results

Speedup

While the sequential teacher method (TA-Pruning) took up to 48 hours to compress a single prompt, DiffuMask completes the task in under 1 minute on an A100 GPU—an orders-of-magnitude acceleration.

In-Domain Performance (GSM8K)

DiffuMask achieved an 80% reduction in prompt length while slightly improving Exact Match (EM) accuracy to 77.07% (up from the uncompressed baseline of 76.49%). It also soundly beat popular off-the-shelf compressors like LLMLingua.

In-domain evaluation table

Out-of-Domain Generalization

Despite being trained exclusively on mathematical reasoning data (GSM8K), DiffuMask generalized remarkably well to classification tasks. For instance, on 20-shot AG's News prompts, it slashed token counts by over 53% while skyrocketing accuracy from 25.37% to 84.40% by removing confusing contextual clutter.

Out-of-domain evaluation table

Cross-Model Transferability

Prompts compressed by DiffuMask (using a Llama-3.1 teacher) transferred seamlessly to 8 other major LLMs—including GPT-4o, Gemini 2.5 Pro, and Grok 3—without any model-specific retraining.

Cross-model evaluation table

Limitations and Future Work

  • Expensive Training Data: Generating the initial training pairs via sequential pruning remains a massive computational bottleneck (10–48 hours per sample). Future work will explore self-supervised data generation.
  • Not Quite Real-Time: Running 64 iterative diffusion steps is vastly faster than sequential methods, but it still introduces too much latency for instantaneous, real-time applications.
  • Domain Scope: The current evaluation focuses heavily on reasoning and classification tasks. The authors note that extending DiffuMask to dialogue, summarization, and multimodal contexts remains an open area for exploration.

Summary updated

BibTeX
@misc{zheng2026diffumask,
  author = {Caleb Zheng and Jyotika Singh and Fang Tu and Weiyi Sun and Sujeeth Bharadwaj and Yassine Benajiba and Sujith Ravi and Eli Shlizerman and Dan Roth},
  title = {{DiffuMask: Diffusion Language Model for Token-level Prompt Pruning}},
  year = {2026},
  eprint = {2604.06627},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.06627},
}
Figure