arXiv:2610.37642cs.CLOct 2026

Manuscript Offprint

arXiv:2610.37642

Metacognitive Decoding: Efficient Inference for Diffusion Language Agents

Mingyu Zhao, Shuhang Lin, Ligong Han, Xiaojing Yu, Zhenting Wang, Yifei Pang, Yang Zhou, Dimitris N. Metaxas

Abstract

Diffusion language models offer a promising path to efficient agents through parallel token generation. However, efficient interaction requires adapting both where computation is spent and how much text is generated. We introduce a metacognitive controller that guides diffusion generation according to the needs of the current response and the agent's interaction with the environment. It learns when to finalize tokens and how far generation should extend, reducing overall computation within responses. Our controller, a lightweight plug-in for the diffusion backbone, is trained on agent trajectories to balance correctness and generation cost. This approach connects the agent's generation process to the interaction the agent serves. Experiments across five benchmarks demonstrate that our approach reduces inference FLOPs by 20.6% on average compared with the most efficient baseline, while maintaining competitive task accuracy. Ablation studies further validate the effectiveness of our approach.

1 Introduction

Diffusion language models offer a promising foundation for efficient language agents. Their ability to generate multiple tokens in parallel creates opportunities to accelerate generation (Nie et al., 2025; Wu et al., 2026). In an agent, however, each response is part of an ongoing interaction: the model reasons about a task, calls a tool, observes the result, and continues. What the agent needs to generate changes throughout this process. Making effective use of diffusion therefore introduces a new challenge: adapting diffusion generation to the dynamic needs of agentic reasoning and interaction.

The primary bottleneck lies in the mismatch between conventional rigid decoding mechanisms and the highly structured nature of agent trajectories, which leads to severe computational redundancy. This inefficiency manifests in two main ways. First, agent outputs contain a mix of highly predictable formatting (e.g., API templates) and complex reasoning. Conventional decoding treats all tokens uniformly; it either wastes compute by over-processing easy tokens or introduces errors by finalizing complex tokens too early. Second, agent interactions have strict execution boundaries. Once a tool call is generated, the agent must pause for environment feedback. However, because diffusion models process tokens in fixed-size blocks, they often wastefully compute trailing tokens beyond this boundary that are ultimately discarded. Therefore, to achieve high efficiency, a diffusion agent must dynamically adjust its decoding strategy based on both prediction confidence and interaction states.

To address these inefficiencies, we introduce a metacognitive controller that enables environment-aware generation (Figure 1). 1^{1} Instead of generating tokens blindly, the controller monitors the agent's interaction states and the model's prediction confidence to dynamically coordinate two decisions: which tokens to finalize and how many positions to compute. At each step, after the diffusion backbone predicts tokens, the controller applies a cascaded policy to optimize decoding: First, flux decoding optimizes the active computation range. It dynamically shrinks the generation window to exclude unnecessary downstream positions from computation, expanding it back only when the current response actually requires more space to complete. Second, confidence alignment decoding manages token acceptance. It identifies highly predictable structures (e.g., standard tool-call formats) and finalizes them simultaneously, while adaptively adjusting the acceptance thresholds for individual tokens. Together, these mechanisms ensure that computation is spent only where needed, allowing generation to halt efficiently the moment a tool call is triggered.

∗^{*}These authors contributed equally to this work.

1^{1}We release our implementation on GitHub.

Figure

Figure 1: Metacognitive control of environment-aware diffusion decoding. Left: fixed-range decoding computes positions beyond the response consumed by the environment. Right: our controller guides content commitment and adjusts the active computation range during interaction. Orange denotes controller-guided revelation, gray denotes computed tail positions, and dashed cells lie outside the active range.

Our contributions are threefold:

• We identify a diffusion agent efficiency bottleneck: diffusion agents can have low token efficiency with common patterns.

• We propose a metacognitive controller for efficient agent generation. Our controller monitors both model prediction signals and agent interactions. It controls agent decoding with a cascaded decoding policy: confidence alignment decoding controls structural segments and token acceptance, while flux decoding adjusts the computation range through recoverable empty tokens.

• Across five benchmarks, our approach outperforms existing baselines by reducing inference FLOPs while maintaining competitive task accuracy. Ablation studies further demonstrate the effectiveness of our metacognitive controller.