NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DIP: Dynamic In-Context Planner For Diffusion Language Models

Yang Li, Han Meng, Chenan Wang, Haipeng Chen · DOI

Abstract: Diffusion language models (DLMs) have shown strong potential for general natural language tasks with in-context examples. However, due to the bidirectional attention mechanism, DLMs incur substantial computational cost as context length increases. This work addresses this issue with a key discovery: unlike the sequential generation in autoregressive language models (ARLMs), the diffusion generation paradigm in DLMs allows efficient dynamic adjustment of the context during generation. Building on this insight, we propose Dynamic In-Context Planner (DIP), a context-optimization method that dynamically selects and inserts in-context examples during generation, rather than providing all examples in the prompt upfront. Results show DIP maintains generation quality while achieving up to 12.9× inference speedup over standard inference and 1.17× over KV cache-enhanced inference.

The Challenge of Context in DLMs

Diffusion Language Models (DLMs) are emerging as a powerful alternative to standard Autoregressive Language Models (ARLMs). Because they use bidirectional attention and iterative refinement, DLMs offer fine-grained control and global planning. However, this bidirectional attention scales poorly with context length. When using In-Context Learning (ICL)—where multiple examples are provided in the prompt—the computational cost skyrockets, resulting in slow inference. While techniques like KV caching help, they don't solve the fundamental inefficiency of computing full attention over a massive static prompt during the entire generation process.

Methodology: Dynamic In-Context Planner (DIP)

The core insight of this work is that the diffusion generation paradigm doesn't require a fixed context; it can be adjusted mid-generation. DIP is a plug-in context-optimization method with two main stages:

  1. Example Ranking: Before generation, DIP uses Maximal Marginal Relevance (MMR) to rank a pool of candidate in-context examples, ensuring relevance to the query while minimizing redundancy.
  2. Example Insertion Policy: Instead of inserting all examples at step zero, DIP decides when to insert them based on a Bernoulli distribution influenced by Generation Confidence (monitoring when the model "struggles") and Inference Efficiency (a time penalty that encourages later insertion to save compute).
The DIP architecture: Examples are ranked and then dynamically inserted based on model confidence and cost penalties during the block-wise decoding process.

DIP is built on top of Fast-dLLM, a framework that divides generation into discrete blocks and uses KV caching, allowing the prompt to be updated with minimal overhead between blocks.

Key Results and Performance

Evaluated on the GSM8k benchmark (5-shot setting), DIP demonstrated that context fluidity is a major advantage for DLMs. By delaying context insertion until necessary, the system significantly reduces the average context length processed during the iterative refinement steps.

As shown in the results table below, DIP achieved up to a 12.9× inference speedup (89.47 tokens/sec) compared to standard LLaDA decoding. Even when compared to the optimized Fast-dLLM baseline, DIP achieved a 1.17× speedup while maintaining on-par accuracy (77.8% vs 77.7%).

Performance comparison showing DIP achieving superior throughput while maintaining accuracy relative to standard and optimized baselines.

Conclusion and Future Work

DIP proves that DLMs can break the "fixed context" rule of autoregressive models. By treating context as a dynamic resource, DLMs can achieve high-speed inference without sacrificing the reasoning capabilities provided by in-context learning. Future research will explore DIP's performance across a wider variety of tasks and its compatibility with other emerging KV cache optimization methods.

Summary updated

BibTeX
@misc{li2026dip,
  author = {Yang Li and Han Meng and Chenan Wang and Haipeng Chen},
  title = {{DIP: Dynamic In-Context Planner For Diffusion Language Models}},
  year = {2026},
  eprint = {2601.03199},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.03199},
}
Figure