Paper deep dive
Predict, Don't Iterate: Efficient Adaptive-Length Infilling for Diffusion Language Models
Haobo Xu, Sirui Chen, Yuanchen Bei, Lingjie Chen, Yuchen Yan, Dongqi Fu, Jingrui He, Hanghang Tong
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 93%
Last extracted: 9/3/2026, 3:50:36 AM
Summary
The paper introduces PILL (Probing-based InfiLling with preset-Length-free decoding), a method for Diffusion Language Models (DLMs) to perform adaptive-length infilling efficiently. PILL predicts the target length using a lightweight probe on bidirectional hidden states, decodes multiple length candidates in parallel using slot-wise attention, and selects the best span via a post-hoc coherence score. It outperforms baselines in quality and speed on code and text benchmarks.
Entities (7)
Relation Signals (6)
Diffusion Language Models → supports → Bidirectional Attention
confidence 95% · DLMs employ bidirectional attention and generate in any order, allowing them to condition on both the left and right context simultaneously
PILL → uses → Length Probing
confidence 95% · Stage I predicts a target length L^ directly from hidden states of mask token through a single forward pass with a lightweight MLP probe
PILL → uses → Multi-slot Parallel Decoding
confidence 95% · Stage II generates all candidate lengths in parallel at nearly the cost of decoding one, where each candidate length occupies a separate decoding slot
PILL → uses → Post-hoc Selection
confidence 95% · Stage III selects the final span from candidates via a post-hoc score that jointly measures each candidate’s internal coherence and how naturally the suffix continues from it
PILL → improvesover → CAL
confidence 90% · PILL improves over the strongest baseline by +4.8 average pass rate on code... while running 1.82x faster than that baseline.
CAL → suffersfrom → Sensitivity to initial length
confidence 90% · CAL (Liu et al., 2026) searches for suitable lengths using early-step denoising confidence, but incurs extra forward passes and is highly sensitive to the initial length.
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Diffusion language models (DLMs) have emerged as a promising alternative to the auto-regressive paradigm. With bidirectional attention and any-order generation, DLMs naturally fit infilling tasks, which require generating a middle span conditioned on both the prefix and the suffix. However, infilling is sensitive to the length of the span, while DLMs require the length to be fixed before generation. Although prior studies extend DLMs to dynamic lengths, they still suffer from two limitations. (i) Sensitivity to initial length. These methods require a preset length to initialize the search and are highly sensitive to this initial length, often yielding suboptimal results. (ii) Inference inefficiency. They either insert length-changing operations during generation or repeatedly search for an appropriate length using multi-step denoising confidence, both of which introduce substantial extra forward passes and computational cost. Therefore, we propose PILL (Probing-based InfiLling with preset-Length-free decoding), an efficient infilling method for DLMs that requires no preset initial length and adds far fewer extra forward passes than baselines, substantially reducing inference time. Experiments show that, across five DLMs spanning different families, architectures, and training recipes on eight infilling benchmarks, PILL improves over the strongest baseline by +4.8 average pass rate on code and +6.0 BLEU-2 on text, while running 1.82x faster than that baseline. The code is available at this https URL.
Tags
Links
- Source: https://arxiv.org/abs/2609.02108v1
- Canonical: https://arxiv.org/abs/2609.02108v1
Trouble viewing inline? Open PDF directly →
Full Text
87,168 characters extracted from source content.
Expand or collapse full text
Predict, Don’t Iterate: Efficient Adaptive-Length Infilling for Diffusion Language Models Haobo Xu Email: haoboxu@illinois.edu Sirui Chen Yuanchen Bei Lingjie Chen Yuchen Yan Dongqi Fu, Jingrui He, Hanghang Tong Affiliation: University of Illinois at Urbana-Champaign Meta Abstract Diffusion language models (DLMs) have emerged as a promising alternative to the auto-regressive paradigm. With bidirectional attention and any-order generation, DLMs naturally fit infilling tasks, which require generating a middle span conditioned on both the prefix and the suffix. However, infilling is sensitive to the length of the span, while DLMs require the length to be fixed before generation. Although prior studies extend DLMs to dynamic lengths, they still suffer from two limitations. (i) Sensitivity to initial length. These methods require a preset length to initialize the search and are highly sensitive to this initial length, often yielding suboptimal results. (i) Inference inefficiency. They either insert length-changing operations during generation or repeatedly search for an appropriate length using multi-step denoising confidence, both of which introduce substantial extra forward passes and computational cost. Therefore, we propose Pill (Probing-based InfiLling with preset-Length-free decoding), an efficient infilling method for DLMs that requires no preset initial length and adds far fewer extra forward passes than baselines, substantially reducing inference time. Experiments show that, across five DLMs spanning different families, architectures, and training recipes on eight infilling benchmarks, Pill improves over the strongest baseline by +4.8+4.8 average pass rate on code and +6.0+6.0 BLEU-2 on text, while running 1.82×1.82× faster than that baseline. The code is available at https://github.com/Hsu1023/PILL. 1 Introduction Recently, diffusion language models (DLMs) have emerged as a promising alternative to auto-regressive (AR) paradigm, showing great potential across various tasks (Nie et al., 2026b; Zhu et al., 2025b; Zhu et al., 2025a; Ye et al., 2025). Unlike AR models that rely on causal attention and decode strictly left to right, DLMs employ bidirectional attention and generate in any order, allowing them to condition on both the left and right context simultaneously (Hoogeboom et al., 2021). This property makes DLMs particularly well suited to infilling, generating a middle span that is coherent with both a given prefix and a given suffix, a setting that AR models are hard to handle (Bavarian et al., 2022). However, DLMs require the number of masked positions to be fixed before decoding, whereas the correct infilling length is unknown in advance and varies from case to case (Bie et al., 2025). Crucially, infilling quality is highly sensitive to the chosen length: as shown in Figure 1(a), the code-infilling example is solved correctly only when the mask span is given exactly the right number of tokens, while slightly shorter or longer spans produce incorrect completions. The model must therefore determine a length before it knows what to generate, even though the appropriate length depends on the content itself. Recent studies tackle this through adaptive-length decoding (Li et al., 2025a; Wu et al., 2026; Kim et al., 2025; Liu et al., 2026), but they still suffer from two limitations. Figure 1: Motivation and Performance of Pill. (a) For DLM infilling tasks, correctness is sensitive to the span lengths. (b) Baselines must preset an initial length L and their final length stays tied to it, whereas Pill requires no preset length. (c) Pill attains the best performance with minimal overhead compared to fixed-length generation with backbones. Baselines are reported at initial length L=4,8,16,32L=\4,8,16,32\. First, existing methods are sensitive to the initial length. They require a preset length to start the search for a better infilling length. For example, CAL (Liu et al., 2026) will be trapped into local minima near the initial length, yielding varying performances, as shown in Fig. 1(b). Second, they incur substantial inference overhead. Methods either inject explicit one token length-changing operations (Wu et al., 2026; Li et al., 2025a), or repeatedly probe denoising confidence over many decoding steps to estimate a length (Liu et al., 2026), introducing many extra forward passes and cost. To this end, we propose Pill, a framework that enables fixed-length DLMs to perform variable-length infilling with only two extra forward passes. Pill consists of three stages. (1) Instead of searching for a length, we directly predict it from the bidirectional hidden state of a single mask token inserted between the prefix and suffix. (2) Since generation is sensitive to length, we expand this estimate into a small set of candidate lengths and decode them in parallel at a cost close to decoding one. (3) Since DLMs cannot score a generated sequence by next-token likelihood, we select the final span with a post-hoc score that favors candidates coherent both internally and with the suffix, using one additional forward pass. In summary, it is more efficient than baselines: it replaces their iterative length search, which spends a forward pass per step, with just two extra passes, while the multi-slot decoding generates all candidates in parallel at almost no extra cost. As shown in Figure 1(c), it achieves the highest quality while adding <10%<10\% wall-clock time over vanilla fixed-length decoding, whereas baselines pay far more for a smaller gain. Our contributions are three-fold: • A preset-free infilling framework. We propose Pill, a backbone-frozen framework that enables DLMs to perform adaptive-length infilling beyond the fixed lengths with only two extra forward passes, centered on a length probe that predicts target lengths directly from a mask token’s bidirectional hidden state. • Parallel decoding and selection. We decode a set of length candidates in parallel at near single-candidate cost via a slot-wise attention mask, and select the final span with a post-hoc coherence score in one pass. • Extensive validation. Across five DLMs and eight code and text benchmarks, Pill surpasses the strongest baselines by +4.8+4.8 pass rate on code and +6.0+6.0 BLEU-2 on text while running 1.82×1.82× faster. 2 Related Work Diffusion Language Models. DLMs generate text by iteratively denoising masked or corrupted sequences. The idea originates from early works such as D3PM (Austin et al., 2021a) and Diffusion-LM (Li et al., 2022a), and is further developed by Masked Diffusion Language Models (MDLMs), which improve the modeling objective, sampling, and scalability (Shi et al., 2024; Sahoo et al., 2024). Recent models scale DLMs to larger parameters, including research previews such as Gemini-Diffusion and Seed Diffusion (Song et al., 2025) and open-sourced models such as LLaDA (Nie et al., 2026b) and Dream (Ye et al., 2025), reaching competitive performance across tasks including code generation, instruction following, and reasoning (Xie et al., 2025; Bie et al., 2025). Owing to their bidirectional attention, DLMs can condition on both left and right context, which makes them naturally suited to infilling (Li et al., 2025b). Infilling and Adaptive-Length Decoding. Infilling has been extensively studied in the AR paradigm, including FIM-style training (Bavarian et al., 2022) and code-specialized models (Fried et al., 2022; Li et al., 2023; Roziere et al., 2023), all of which decode the missing span left-to-right via causal attention. While effective, AR models can only access the suffix indirectly through prompt conditioning, motivating bidirectional alternatives such as DLMs that natively condition on both prefix and suffix (Ye et al., 2025). However, DLMs typically require the number of masked positions to be specified before decoding, restricting them to fixed-length generation (Lin et al., 2026a). Recent studies address this by adaptive length decoding. DAEDAL (Li et al., 2025a) dynamically expands the generation canvas during inference, but only focuses on appending at the end of sequences. DreamOn (Wu et al., 2026) introduces explicit length-changing operations into the diffusion process, but requires fine-tuning the DLM, and potentially compromises general-purpose capabilities. FlexMDM (Kim et al., 2025) and DDOT (Zhang et al., 2025a) also introduces additional fine-tuning cost. CAL (Liu et al., 2026) searches for suitable lengths using early-step denoising confidence, but incurs extra forward passes and is highly sensitive to the initial length. In contrast, our approach uses a lightweight probe to directly predict the target length, and a multi-slot decoding scheme that generates and selects among multiple length candidates in parallel. This yields adaptive-length infilling with minimal additional cost and no reliance on a preset initial length. 3 Preliminaries Diffusion Language Models. Let x=(x1,…CLOSE,x=(x_1,…, OPENxM)x_M) be a token sequence over vocabulary V, augmented with a mask token [] [M]. DLMs define a forward process that independently replaces each xix_i with [] [M] with probability t∈[0,1]t∈[0,1], yielding a corrupted sequence x(t)x^(t). A network pθ(x(0)∣x(t))p_θ(x^(0) x^(t)) is trained to reconstruct the original tokens at masked positions (Sahoo et al., 2024; Shi et al., 2024). Unlike auto-regressive models, DLMs use bidirectional attention, so every prediction conditions on all other positions on both sides. At inference, given a prefix P and a target length L, decoding starts from x(K)=P⊕[]Lx^(K)=P [M]^L, where ⊕ denotes concatenation, and proceeds for K steps. At each step k=K,…,1k=K,…,1, the model produces a distribution over V at every masked position; a subset of positions with the highest confidence are unmasked, while the rest remain masked for step k−1k-1. The final x(0)x^(0) contains no masks. A central limitation is that L must be specified before decoding and remains fixed throughout. Infilling Tasks for DLMs. The inference setting above fills a masked region given only a prefix P. Infilling extends this setting by additionally fixing a suffix S as a right-side condition, which DLMs can exploit directly thanks to their bidirectional attention and any-order generation. Given a prefix P and a suffix S, the infilling task asks for a middle span M=(w1,…,wL∗)M=(w_1,…,w_L^*) with wi∈w_i , such that the concatenation P⊕M⊕SP M S maximizes a task-specific quality metric Q (e.g., pass rate for code, BLEU-2 for text). The gold length L∗L^* is unknown at inference time, and Q is inaccessible during decoding. DLMs instantiate the masked region as P⊕[]L0⊕SP [M]^L_0 S at a preset length L0L_0 and run iterative masked decoding to fill it. 4 Method Figure 2: Pipeline of the proposed method. (a) Stage I probes the hidden state of a mask token to predict the target length L L; (b) Stage I decodes the candidate lengths L^−r,…,L^+r\ L-r,…, L+r\ in parallel with a slot-wise attention mask; (c) Stage I selects the final span with post-hoc score in one forward pass via a well-designed attention mask. 4.1 Overview We cast the infilling task as two coupled subproblems: (1) determining the length of the mask span and (2) generating content coherent with both the prefix and the suffix. The two subproblems are entangled, since the appropriate length depends on what to generate, yet DLMs can only generate with fixed lengths. Pill decouples them through a three-stage design shown in Fig. 2. (1) Stage I predicts a target length L L directly from hidden states of mask token through a single forward pass with a lightweight MLP probe, avoiding iterative length search. Since the generation is sensitive to lengths, we expand L L into a small candidate set L^−r,⋯,L^+r\ L-r,·s, L+r\ to enhance predictive reliability. (2) Stage I generates all candidate lengths in parallel at nearly the cost of decoding one, where each candidate length occupies a separate decoding region (a slot) and a slot-wise attention mask isolates the slots so they share prefix/suffix context but do not leak into one another, accelerating generation. (3) Stage I selects the final span from candidates via a post-hoc score that jointly measures each candidate’s internal coherence and how naturally the suffix continues from it in a single additional forward pass, equipped with a well-designed attention mask mechanism. Throughout the pipeline, we only introduce two passes, the probing pass and the scoring pass. Also, by predicting the length directly rather than searching from a preset value, Pill requires no initial lengths, yielding consistent performance across datasets. 4.2 Length Probing The first stage estimates the length of the missing span directly from hidden states, as shown in Fig. 2(a). Given a prefix P and suffix S, we construct a probing sequence by inserting a single mask token between them, denoted as xprobe=P⊕[M]⊕Sx_probe=P [M] S, and run a single forward pass of the frozen DLM backbone. We read the hidden state h[]∈ℝdh_ [M] ^d of the mask position at a certain layer. Because the backbone uses bidirectional attention, h[]h_ [M] aggregates information from both prefix and suffix, making it a natural summary of how much content the missing span is expected to hold. Rather than using only the mask hidden state, we form the probe representation by concatenating the mean-pooled hidden states of the last four prefix tokens, the mask hidden state, and the mean-pooled hidden states of the first four suffix tokens h=[MeanPool(hp−4:p−1);h[M];MeanPool(hs:s+3)]∈ℝ3dh=[MeanPool(h_p-4:p-1);h_ [M];MeanPool(h_s:s+3)] ^3d. This provides a richer representation than the single confidence scores used by DAEDAL (Li et al., 2025a) and CAL (Liu et al., 2026). Then, a lightweight 3-layer MLP probe fϕ(⋅)f_φ(·) maps h to a scalar length estimate L^=⌊exp(fϕ(h))⌉, L= (f_φ(h) ) , (1) where ⌊⋅⌉ · rounds to the nearest positive integer. We predict logL L rather than L directly, which guarantees a positive estimate and reduces the influence of long-tailed length distribution. More information about the probe can be found in Appendix A.1. The lightweight probe does not touch the backbone, preserving the DLM ability without finetuning the backbone. Also, we only introduce one single forward pass in this stage to avoid presetting an initial length, with minimal overhead. We also validate the probing by comparing predicted lengths against the oracle, indicating that our probe predicts lengths more accurately than the baseline while requiring no preset initial length (Sec. 5.5). 4.3 Multi-slot Parallel Decoding Since the DLM generation is highly sensitive to the length of the mask slot, we expand the length L L obtained by the probe within a local radius r into L^−r,⋯,L^+r\ L-r,·s, L+r\ to better reduce prediction errors, yielding N=2r+1N=2r+1 candidates, and assign the j-th candidate length ℓj _j to a separate decoding slot, which is a contiguous block of mask tokens that is decoded independently. But it yields much more decoding cost, therefore we propose a multi-slot parallel decoding strategy at a cost close to decoding one slot alone (Fig. 2(b)). Sequence Layout. Since all the candidates share the prefix and suffix, we pack the candidate slots together with a shared context region, P⊕[]L^⊕S⊕[S1]⋯[SN]P [M] L S [S_1]·s[S_N], where each slot SjS_j is initialized with ℓj _j mask tokens. The prefix, middle mask slot and suffix form a shared context, and they attend to each other and are attended by every slot SjS_j. In addition, to avoid interference between mask slots SjS_j, we isolate the slots through a slot-wise attention mask. Each slot SjS_j attends only to its own tokens and the shared context P,[]L^,S\P, [M] L,S\, but not to any other mask slot Sj′(j′≠j)S_j (j ≠ j). Because each slot sees nearly the same context as in single-slot generation, its denoising behavior, and thus its output, closely matches that of decoding the slot alone. This holds only when each slot is given appropriate position ids, which we address below. Position IDs. A subtlety is how to assign position ids to slots of different lengths. The key principle is that a DLM places each predicted token at the position dictated by its position id. If the mask span is given more position ids than the content needs, the model treats the extra positions as space still to be filled and under-generates. We illustrate this with a concrete example, in which [TODO] denotes the span to be filled. I (1) have 13 books, and you have 23 books. We have (17) [TODO] books. The numbers below the text are the position ids assigned by LLaDA. The intended answer is "36" (two tokens). When the gap is given exactly two position ids, the model correctly produces "36". But when we keep a single mask token yet leave a one-position gap between it and one side of the context, the model fills only half the answer: leaving the gap on the suffix side makes the mask take position id "(18)" while the suffix resumes at "(20)", and the model outputs only "3" (the first token of "36"); leaving the gap on the prefix side instead yields "6" (the second token). In each case the model anchors its output to the position ids and leaves the gap unfilled, i.e., it under-generates. It motivates a no-gap mask positional id design. The mask slot should start at the position id immediately after the prefix and end immediately before the suffix, leaving no gaps from them. We therefore fix the suffix anchor and interpolate each slot’s position ids over a shared gap interval, so that all slots present an identical layout to the suffix regardless of their length. Let the last prefix token have position id pPp_P. We fix the suffix to start at pS=pP+L^+1p_S=p_P+ L+1, leaving a gap interval [pP+1,pS−1][\,p_P+1,\ p_S-1\,] of width L L. For a slot SjS_j of length ℓj _j, its k-th token (k=1,…,ℓjk=1,…, _j) is assigned pos(Sj,k)=(pP+1)+(k−1)⋅L^−1ℓj−1, -5.0ptpos(S_j,k)=(p_P+1)+(k-1)· L-1 _j-1, (2) linearly interpolating the ℓj _j tokens between pP+1p_P+1 and pS−1p_S-1. Every slot thus spans the same interval and the suffix is anchored at pSp_S for all candidates, eliminating the length-dependent misalignment above. This design is critical: padding-based alternatives that left- or right-align the slot leave a position-id gap between the candidate and one side of the context, which leads to under-generation by the mechanism above. In contrast, interpolation removes this gap and substantially outperforms both padding variants (Sec 5.5). Parallel Decoding. Within each slot, we run the original denoising/unmasking process. Since the mask slots do not interfere with each other and can be denoised in parallel, we obtain N infill candidates C1,⋯,CN\C_1,·s,C_N\ in almost the same time as decoding a single slot. This also saves KV-cache computation, since the shared context P,[]L^,S\P, [M] L,S\ remains unchanged throughout decoding. The middle []L [M] L produces no output, and it merely anchors the shared position-id interval, and its KV is identical across all slots and steps. This motivates placing the shared context first in the sequence layout (P⊕[]L^⊕S⊕[S1]⋯[SN]P [M] L S [S_1]·s[S_N]), so that its KV can be cached and reused across decoding steps. Please see Fig. 2(c) for an illustration. 4.4 Post-hoc Selection Stage I returns N infill candidates C1,…,CN\C_1,…,C_N\ of different lengths, and we must commit to one. AR models can score a sequence by its left-to-right next-token likelihood. In contrast, DLMs are trained to predict the token at a masked position rather than the next token, so the distribution at an already-committed token is not a predictive distribution and cannot serve as a score (Fig. 3). Figure 3: Forward-pass targets in ARMs and DLMs. Our goal is to select the candidate that makes the completed sequence P⊕Cj⊕SP C_j S most coherent as a whole, rather than one that looks good in isolation. A natural score is the pseudo-log-likelihood, which masks each token in turn and reads its log-likelihood from the rest; however, this requires one forward pass per token and is prohibitively expensive. Instead, we fix the prefix as a shared condition across all candidates and score the inner part for internal coherence and the suffix for how naturally it continues from the candidate, all in a single forward pass. Masked Scoring Probes. For candidate CjC_j we lay out a visible block =Cj⊕S~=(v1,…,vℓj+m) v=C_j S=(v_1,…,v_ _j+m), the ℓj _j committed candidate tokens followed by the m selected suffix tokens S~ S-a small, representative subset of the suffix used to judge how well it continues from the candidate (introduced later)- and a block of scoring probes, =(μ1,…,μℓj+m) μ=( _1,…, _ _j+m), where each μk _k is a mask token and shares the position id of vkv_k. We then carefully design an attention mask (Fig. 2(c)), enforcing a strictly causal read. The prefix P is visible to the entire block. (1) Each visible token vkv_k attends to P and to v≤kv_≤ k (inclusive), so the visible block stays internally causal and no visible representation contains information of a later token. (2) Each probe μk _k attends to P and to v<kv_<k only (strict), never to vkv_k itself, to any later position, or to another probe, to prevent it from accessing v≥kv_≥ k. Consequently the output at μk _k is pθ(⋅∣P,v<k)p_θ(· P,v_<k), and reading it at the observed token gives logpθ(vk∣P,v<k) p_θ(v_k P,v_<k) with no label leakage; the first probe conditions on P alone. The inclusive-causal visible block is essential: were it bidirectional, v<kv_<k would already encode vkv_k and leak the token the probe is meant to predict. Since the suffix tokens follow the full candidate in v, their probes automatically condition on all of CjC_j, exactly the quantity needed to judge continuation. Selection Score. Let ckc_k and s~k s_k be the k-th token in CjC_j and S~j S_j. Partitioning the per-position log-probs of v into its candidate and suffix segments gives an inner score and a suffix score, sjin=1ℓj∑k=1ℓjlogpθ(ck∣P,c<k), s^in_j= 1 _j _k=1 _j p_θ\! (c_k P,c_<k ), sjsuf=1m∑t=1mlogpθ(s~t∣P,Cj,s<t), s^suf_j= 1m _t=1^m p_θ\! ( s_t P,C_j,s_<t ), and we select the candidate maximizing their convex combination, j⋆=argmaxjαsjin+(1−α)sjsuf.j = _j\;α\,s^in_j+(1-α)\,s^suf_j. (3) The inner score favors spans the model finds internally coherent, while the suffix score favors spans after which the observed suffix becomes likely, penalizing over- and under-generated spans that read fluently on their own but break the transition into S. The weight α balances local fluency against suffix alignment. We choose α=0.5α=0.5 in practice. Sparse Suffix Selection. Scoring the entire suffix is unnecessary, as the continuation signal concentrates in a few tokens. We build S~ S from (i) suffix head: the first few suffix tokens, which carry the immediate transition, and (i) important tokens: the suffix tokens that received the highest attention from the infilling region in Stage I, which capture longer-range dependence (e.g., some variables appear later in the code). These two groups need not be contiguous: the intervening suffix tokens are not scored, but are kept as visible context so that each scored token still conditions on the full true suffix preceding it, logpθ(s~t∣P,Cj,s<t) p_θ( s_t P,C_j,s_<t), with an attention mask. We cap the considered suffix length at 3232 and use m∈[4,8]m∈[4,8] (the two groups may overlap) scored tokens in practice. For clarity, Fig. 2(c) depicts only the suffix head; the salient tokens follow the same scoring structure and are omitted to save space. Single-pass Scoring. Finally, the N candidate blocks are packed into one sequence and isolated by a block-wise attention mask (Fig. 2(c), Global Attention Mask): the visible tokens and probes of candidate j attend only to the shared prefix and to CjC_j’s own block, never across candidates, so the blocks cannot interfere with each other. All candidates are therefore scored together in a single additional forward pass. 5 Experiments Datasets Python Other Language Text Human-S Human-M MBPP-S MBPP-M Java C/C++ Wiki Arxiv LLaDA-8B-Base Backbone 44.68 15.92 37.45 20.45 34.09 34.84 19.90 / 34.48 13.23 / 30.30 DAEDAL 44.99 16.76 38.86 22.48 35.34 36.03 10.82 / 20.78 6.65 / 16.61 CAL 64.74 24.61 54.49 32.21 50.31 49.22 23.00 / 37.25 15.69 / 32.69 Pill 71.35 28.20 57.49 38.19 57.10 54.57 29.29 / 44.96 20.28 / 39.82 Pill (Oracle) 81.90 38.54 71.56 50.92 60.98 60.08 41.51 / 56.76 29.35 / 50.43 LLaDA-8B-Instruct Backbone 49.73 17.62 37.47 21.15 32.42 33.40 18.07 / 32.77 12.57 / 29.44 DAEDAL 50.20 18.68 39.17 23.02 34.31 34.81 10.37 / 19.98 6.56 / 16.64 CAL 69.77 26.93 48.64 25.31 49.20 48.66 20.52 / 34.93 14.77 / 31.33 Pill 67.86 27.38 52.27 36.86 52.66 52.35 25.58 / 41.91 18.94 / 38.13 Pill (Oracle) 78.99 41.03 72.38 56.67 61.53 56.95 38.07 / 54.54 28.46 / 49.60 LLaDA-MoE-Base Backbone 45.84 16.43 40.42 22.56 34.53 34.92 17.23 / 31.51 13.04 / 29.69 DAEDAL 46.17 17.56 41.50 24.77 37.25 37.14 8.90 / 18.48 6.06 / 15.70 CAL 67.79 25.96 58.32 34.45 53.06 50.41 19.39 / 33.75 14.78 / 31.25 Pill 71.44 31.92 58.52 43.12 55.76 55.23 25.76 / 41.84 19.13 / 38.30 Pill (Oracle) 81.80 41.34 67.56 54.62 58.98 58.77 37.51 / 53.41 28.03 / 49.12 Dream-7B-Base Backbone 42.79 16.13 40.12 22.15 33.90 34.30 19.12 / 33.75 13.56 / 30.97 DAEDAL 42.62 17.60 41.22 25.11 38.20 37.88 9.68 / 19.33 6.72 / 17.22 CAL 64.48 26.38 56.00 33.60 47.92 48.00 21.68 / 36.68 15.98 / 33.52 Pill 68.34 28.55 57.97 37.72 58.98 56.30 32.36 / 48.13 22.89 / 42.79 Pill (Oracle) 79.77 39.19 70.91 52.11 63.64 62.63 44.66 / 59.98 33.64 / 54.49 Dream-Coder-7B-Base Backbone 49.64 19.00 43.94 25.62 36.89 37.66 - - DAEDAL 50.85 21.14 47.79 30.80 40.96 40.72 - - CAL 68.56 28.24 61.35 38.91 51.14 49.28 - - Pill 71.35 32.14 62.59 47.28 59.87 59.01 - - Pill (Oracle) 82.38 44.01 73.59 63.41 62.20 62.88 - - Table 1: Performance Comparison. We compare Pill with baselines on eight benchmarks across five models. 5.1 Experimental Setup Models. We apply Pill to five diffusion large language models (DLMs): LLaDA-8B-Base/Instruct (Nie et al., 2026b), LLaDA-MoE-Base (Zhu et al., 2025b), Dream-7B-Base (Ye et al., 2025), and Dream-Coder-7B-Base (Xie et al., 2025). These models cover both general-purpose and code-oriented DLMs, spanning different model families (LLaDA/Dream), architectures (dense/MoE), and training recipes (base/instruction-tuned). Datasets. We evaluate on code and natural-language infilling benchmarks, all disjoint from probe training set. For code, we use HumanEval-Infilling (Bavarian et al., 2022) with single-line (-S) and multi-line (-M) tasks, construct MBPP-S/-M from MBPP (Austin et al., 2021b) by a similar protocol, and build single-line Java and C/C++ tasks from MultiPL-E (Cassano et al., 2022). For text, we construct random contiguous word-span tasks from WikiText (Merity et al., 2016) and arXiv abstracts. We report pass rate for code and BLEU-2/ROUGE-L for text. See Appendix A.13 for details. Baselines. We compare Pill with the backbone models (fixed-length decoding) and two dynamic decoding methods, DAEDAL (Li et al., 2025a) and CAL (Liu et al., 2026). Since all baselines require an initial generation length, we follow (Wu et al., 2026; Liu et al., 2026) and report the average performance over L∈4,8,16,32L∈\4,8,16,32\. This provides a prior-free evaluation protocol, and per-length results are provided in Appendix. CAL is evaluated using its official implementation and hyperparameters. We adapt DAEDAL following the implementation in (Liu et al., 2026) to fit the infilling setting. We also report comparison with DreamOn (Wu et al., 2026) on text tasks. We also report results on Pill (Oracle), which uses the same generated candidate set as Pill but replaces the Stage I selector with the ground-truth task evaluator, providing a upper bound on candidate selection. All experiments run on a single NVIDIA A40 GPU. 5.2 Main Results Table 1 reports infilling quality across five DLMs and eight code and natural-language benchmarks. Pill delivers the strongest results on nearly every model-dataset combination, improving the most competitive baseline CAL by +4.8+4.8 pass rate on average across the code benchmarks and by +6.0+6.0 BLEU-2 points on text. These gains hold across model families (LLaDA/Dream), architectures (dense/MoE), training recipes (base/instruction-tuned), and both code and text, indicating that Pill fits different models and tasks. Figure 4: Ablation studies on four design choices of Pill. The baselines further illustrate why adaptive-length infilling is needed. DAEDAL, which only appends at the end of the canvas, cannot respect the suffix constraint and degrades even below the fixed-length backbone on text. CAL is the strongest baseline but still trails Pill while incurring repeated confidence-search passes and remaining sensitive to the preset initial length (Fig. 1(b)), whereas Pill needs no preset length at all. Finally, the oracle upper bound Pill (Oracle) shows that the candidate set almost always contains a strong completion, confirming that the multi-slot stage adequately covers the correct length. The remaining gap to the oracle indicates that the principal headroom lies in post-hoc selection rather than generation. 5.3 Efficiency Analysis Beyond the WikiText results in Fig. 1(c), Table 2 compares quality and cost on HumanEval-S with LLaDA-8B-Base. Pill attains the highest Pass@1 while adding only 7% wall-clock time over the fixed-length backbone, in contrast to CAL (+94%+94\%) and DAEDAL (+117%+117\%). Equivalently, Pill is 1.82×1.82× faster than the strongest baseline CAL yet 6.66.6 points more accurate. One of the reasons for this efficiency is that Pill introduces only two extra forward passes, the probing pass and the scoring pass, whereas the iterative length search in CAL and DAEDAL requires much more. Method Pass@1 Extra Fwd. Passes Time Cost Backbone 44.67 - 1.10 s (+0%+0\%) DAEDAL 44.80 11.98 2.29 s (+117% [rgb]1,0.3,0.3+117\%) CAL 64.74 13.79 2.13 s (+94% [rgb]1,0.3,0.3+94\%) Pill 71.35 2.00 1.18 s (+7% [rgb]1,0.3,0.3+7\%) Table 2: Efficiency of LLaDA-8B-Base on Human-S. 5.4 Sensitivity to Design Choices Length probing and candidate set. Fig. 4(b) varies the layer from which the probe reads the mask hidden state: Pass@1 increases monotonically with depth, consistent with deeper states aggregating richer bidirectional context from both prefix and suffix. We therefore read h from the last layer for convenience. Fig. 4(a) varies the candidate radius r. The oracle upper bound keeps rising with r, confirming that a larger candidate set is more likely to contain the correct length. Pill, however, saturates beyond r=2r=2, since candidate set is larger and the ratio of correct ones decreases. Also, we validate the effectiveness of length probing, as shown in Sec. 5.5. Post-hoc selection. Fig. 4(c) varies the number of scored suffix tokens m. Pass@1 peaks at m=4m=4 and declines thereafter, supporting our suffix selection: the continuation signal concentrates in a few tokens near the transition, and scoring more of them only injects noise. Fig. 4(d) varies the weight α between the inner and suffix scores. Performance peaks around α=0.5α=0.5 and drops at both extremes, showing that internal coherence and suffix continuation are complementary and neither alone suffices. 5.5 Validation of Stages Length Probing Effectiveness (Stage I). We directly evaluate predicted lengths against the gold length L∗L^* on Human-S with LLaDA-8B-Base, using MAE and Acc@k, the fraction of predictions within k tokens of L∗L^*. For CAL, we sweep the preset initial length l∈4,8,16,32l∈\4,8,16,32\, while Pill requires no initial length. As shown in Table 3, CAL is highly sensitive to its initialization: its MAE increases from 3.56 (l=4l=4) to 24.13 (l=32l=32), while Acc@1 drops from 0.58 to 0.02. In contrast, Pill achieves the lowest MAE (2.50) without tuning. Although CAL (l=4l=4) has higher Acc@1, Pill achieves substantially higher Acc@3 and Acc@5, which better reflects our setting since Pill expands L L into nearby candidate lengths and selects among them. In particular, Acc@5 reaches 86.4%, showing that the target length is covered by the local candidate window in most cases. Method MAE Acc@1 Acc@3 Acc@5 CAL (l=4l=4) 3.5644 0.5808 0.7086 0.7909 CAL (l=8l=8) 3.7106 0.5595 0.6912 0.7773 CAL (l=16l=16) 9.0600 0.2023 0.2730 0.3611 CAL (l=32l=32) 24.1336 0.0165 0.0203 0.0329 Pill 2.4974 0.4472 0.7822 0.8635 Table 3: Length prediction performance (l: initial length). Effect of Slot Position-ID Design (Stage I). We compare interpolation with left- and right-padding, which leave a position-ID gap on one side of the context. Since DLMs commonly use RoPE (Su et al., 2024), interpolation at non-integer positions requires no additional tuning (Chen et al., 2023; Zhang et al., 2025a). For ℓj=1 _j=1, we set the position ID to pP+1p_P+1. As shown in Table 4, interpolation substantially improves both Avg Pass@1 (51.6 vs. 28.2/31.6) and Oracle Pass@1 (81.9 vs. 73.2/74.2) over left/right padding. The gap persists under oracle selection, indicating that padding causes structural generation errors rather than merely poorer candidate selection. We further compare against independent single-slot decoding. Given the same candidate lengths L^−r,…,L^+r\ L-r,…, L+r\ produced by PILL, we decode each candidate separately in its own sequence, and oracle-select the best resulting candidate. Interpolation nearly matches this upper bound (81.9/51.6 vs. 83.6/52.9), showing that the shared multi-slot layout introduces little quality loss. Position-ID Design Oracle Pass@1 Avg Pass@1 Left-padding 73.2 28.2 Right-padding 74.2 31.6 Interpolation (ours) 81.9 51.6 Independent single-slot 83.6 52.9 Table 4: Effect of slot position-id design (LLaDA-8B-Base, Human-S, r=2r=2). Ablation of Post-hoc Selection Score (Stage I). We ablate the post-hoc selection score in Table 5. Random uniformly selects a decoded candidate, while predicted-length only uses the center candidate at L L without post-hoc selection. Inner-only and suffix-only correspond to α=1α=1 and α=0α=0 in Eq. (3), respectively, and our default combines both signals with α=0.5α=0.5. Random selection performs poorly despite the presence of strong candidates, showing that effective post-hoc selection is necessary. Using the predicted length alone is substantially stronger, while combining the inner and suffix scores achieves the best performance, confirming that the two signals are complementary. Selection Strategy Pass@1 Random candidate 51.62 Predicted length only 66.02 Inner-only (α=1α=1) 69.02 Suffix-only (α=0α=0) 63.99 Inner + Suffix (α=0.5α=0.5) 71.35 Table 5: Ablation of the post-hoc selection score on LLaDA-8B-Base and HumanEval-S. 6 Conclusion We presented Pill, a backbone-frozen framework that turns fixed-length DLMs into adaptive-length infillers through three lightweight stages: probing the mask hidden state to predict the target length, decoding multiple length candidates in parallel via slot-wise attention, and selecting among them with a post-hoc coherence score. Adding only two forward passes and requiring no preset length, Pill outperforms prior adaptive-length baselines across five DLMs on both code and text infilling, running substantially faster than them. Limitations While Pill is effective and efficient across a range of DLMs and infilling benchmarks, many practical scenarios involve complex editing settings, such as nested spans and repository-level code patches, remain interesting directions for future work. In addition, our experiments are conducted on DLMs up to roughly 7B/8B parameters on a single GPU. Whether the behavior of the length probe and the post-hoc selection scales to substantially larger diffusion backbones remains to be verified. Acknowledgement This work is supported by NSF (2324770). The content of the information in this document does not necessarily reflect the position or the policy of the Government, and no official endorsement should be inferred. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation here on. References Austin et al. (2021a) J. Austin, D. D. Johnson, J. Ho, D. Tarlow, and R. Van Den Berg Structured denoising diffusion models in discrete state-spaces. Advances in neural information processing systems 34, p. 17981–17993. Cited by: §2. Austin et al. (2021b) J. Austin, A. Odena, M. Nye, M. Bosma, H. Michalewski, D. Dohan, E. Jiang, C. Cai, M. Terry, Q. Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732. Cited by: §A.13, §5.1. Ban et al. (2021) Y. Ban, Y. Yan, A. Banerjee, and J. He Ee-net: exploitation-exploration neural networks in contextual bandits. arXiv preprint arXiv:2110.03177. Cited by: §A.12. Ban et al. (2023) Y. Ban, Y. Yan, A. Banerjee, and J. He Neural exploitation and exploration of contextual bandits. arXiv preprint arXiv:2305.03784. Cited by: §A.12. Bavarian et al. (2022) M. Bavarian, H. Jun, N. Tezak, J. Schulman, C. McLeavey, J. Tworek, and M. Chen Efficient training of language models to fill in the middle. arXiv preprint arXiv:2207.14255. Cited by: §A.13, §1, §2, §5.1. Bei et al. (2026) Y. Bei, T. Wei, X. Ning, Y. Zhao, Z. Liu, X. Lin, Y. Zhu, H. Hamann, J. He, and H. Tong Mem-gallery: benchmarking multimodal long-term conversational memory for mllm agents. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), p. 40750–40784. Cited by: §A.12. Bie et al. (2025) T. Bie, M. Cao, K. Chen, L. Du, M. Gong, Z. Gong, Y. Gu, J. Hu, Z. Huang, Z. Lan, et al. Llada2. 0: scaling up diffusion language models to 100b. arXiv preprint arXiv:2512.15745. Cited by: §1, §2. Cassano et al. (2022) F. Cassano, J. Gouwar, D. Nguyen, S. Nguyen, L. Phipps-Costin, D. Pinckney, M. Yee, Y. Zi, C. J. Anderson, M. Q. Feldman, et al. Multipl-e: a scalable and extensible approach to benchmarking neural code generation. arXiv preprint arXiv:2208.08227. Cited by: §A.13, §5.1. Chen et al. (2026) J. Chen, Y. Liang, and Z. Liu Dflash: block diffusion for flash speculative decoding. arXiv preprint arXiv:2602.06036. Cited by: §A.12. Chen et al. (2023) S. Chen, S. Wong, L. Chen, and Y. Tian Extending context window of large language models via positional interpolation. arXiv preprint arXiv:2306.15595. Cited by: §5.5. Cheng et al. (2026) X. Cheng, X. Yu, C. Shao, J. Li, Y. Xiong, Y. Qian, J. Zhu, S. Ma, X. Zhang, J. Ye, et al. DSpark: confidence-scheduled speculative decoding with semi-autoregressive generation. arXiv preprint arXiv:2607.05147. Cited by: §A.12. Du et al. (2021) B. Du, S. Zhang, Y. Yan, and H. Tong New frontiers of multi-network mining: recent developments and future trend. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, p. 4038–4039. Cited by: §A.12. Fried et al. (2022) D. Fried, A. Aghajanyan, J. Lin, S. Wang, E. Wallace, F. Shi, R. Zhong, W. Yih, L. Zettlemoyer, and M. Lewis Incoder: a generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999. Cited by: §2. Hoogeboom et al. (2021) E. Hoogeboom, D. Nielsen, P. Jaini, P. Forré, and M. Welling Argmax flows and multinomial diffusion: learning categorical distributions. Advances in neural information processing systems 34, p. 12454–12465. Cited by: §1. Huang et al. (2025) F. Huang, Y. Bei, Z. Yang, J. Jiang, H. Chen, Q. Shen, S. Wang, F. Karray, and P. S. Yu Large language model simulator for cold-start recommendation. In Proceedings of the eighteenth ACM international conference on web search and data mining, p. 261–270. Cited by: §A.12. Jing et al. (2024) B. Jing, Y. Yan, K. Ding, C. Park, Y. Zhu, H. Liu, and H. Tong Sterling: synergistic representation learning on bipartite graphs. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 38, p. 12976–12984. Cited by: §A.12. Kim et al. (2025) J. Kim, L. Cheuk-Kit, C. Domingo-Enrich, Y. Du, S. Kakade, T. Ngotiaoco, S. Chen, and M. Albergo Any-order flexible length masked diffusion. arXiv preprint arXiv:2509.01025. Cited by: §1, §2. Lai et al. (2026) X. Lai, W. Xu, Y. Yang, Q. Chen, Y. Xu, L. Zeng, X. Li, H. Sun, H. Zhu, V. Zhang, et al. Minimax sparse attention. arXiv preprint arXiv:2606.13392. Cited by: §A.12. Li et al. (2024) J. Li, R. Han, C. Sun, D. Sun, R. Wang, J. Zeng, Y. Yan, H. Tong, and T. Abdelzaher Large language model-guided disentangled belief representation learning on polarized social graphs. In 2024 33rd International Conference on Computer Communications and Networks (ICCCN), p. 1–9. Cited by: §A.12. Li et al. (2025a) J. Li, X. Dong, Y. Zang, Y. Cao, J. Wang, and D. Lin Beyond fixed: training-free variable-length denoising for diffusion large language models. arXiv preprint arXiv:2508.00819. Cited by: §A.13, §1, §1, §2, §4.2, §5.1. Li et al. (2023) R. Li, L. B. Allal, Y. Zi, N. Muennighoff, D. Kocetkov, C. Mou, M. Marone, C. Akiki, J. Li, J. Chim, et al. Starcoder: may the source be with you!. arXiv preprint arXiv:2305.06161. Cited by: §2. Li et al. (2025b) T. Li, M. Chen, B. Guo, and Z. Shen A survey on diffusion language models. arXiv preprint arXiv:2508.10875. Cited by: §2. Li et al. (2022a) X. Li, J. Thickstun, I. Gulrajani, P. S. Liang, and T. B. Hashimoto Diffusion-lm improves controllable text generation. Advances in neural information processing systems 35, p. 4328–4343. Cited by: §2. Li et al. (2026a) Y. Li, F. Wei, C. Zhang, and H. Zhang Eagle-3: scaling up inference acceleration of large language models via training-time test. Advances in Neural Information Processing Systems 38, p. 136737–136756. Cited by: §A.12. Li et al. (2022b) Y. Li, D. Choi, J. Chung, N. Kushman, J. Schrittwieser, R. Leblond, T. Eccles, J. Keeling, F. Gimeno, A. Dal Lago, et al. Competition-level code generation with alphacode. Science 378 (6624), p. 1092–1097. Cited by: §A.1, §A.13. Li et al. (2026b) Z. Li, H. Lin, Y. Xiao, Z. Li, X. Song, Z. Zheng, Y. He, H. Yao, K. Ding, C. Yu, et al. IV-cot: implicit visual chain-of-thought for structure-aware text-to-image generation. arXiv preprint arXiv:2606.24849. Cited by: §A.12. Lin et al. (2026a) H. Lin, X. Jia, S. Liu, S. Xia, W. Huang, H. Xu, J. Li, Y. Xiao, X. Xing, Z. Guo, et al. Efficient diffusion language models: a comprehensive survey. Cited by: §A.12, §2. Lin et al. (2026b) H. Lin, X. Jia, H. Xu, B. Yao, X. Guo, Y. Wu, Z. Lu, Y. Wei, Q. Zhang, and Z. Sun DuQuant++: fine-grained rotation enhances microscaling fp4 quantization. arXiv preprint arXiv:2604.17789. Cited by: §A.12. Lin et al. (2025a) H. Lin, T. Wang, Y. Ge, Y. Ge, Z. Lu, Y. Wei, Q. Zhang, Z. Sun, and Y. Shan Toklip: marry visual tokens to clip for multimodal comprehension and generation. arXiv preprint arXiv:2505.05422. Cited by: §A.12. Lin et al. (2024a) H. Lin, H. Xu, Y. Wu, J. Cui, Y. Zhang, L. Mou, L. Song, Z. Sun, and Y. Wei Duquant: distributing outliers via dual transformation makes stronger quantized llms. Advances in Neural Information Processing Systems 37, p. 87766–87800. Cited by: §A.12. Lin et al. (2025b) H. Lin, H. Xu, Y. Wu, Z. Guo, R. Zhang, Z. Lu, Y. Wei, Q. Zhang, and Z. Sun Quantization meets dllms: a systematic study of post-training quantization for diffusion llms. arXiv preprint arXiv:2508.14896. Cited by: §A.12. Lin et al. (2026c) H. Lin, K. Zhu, H. Xu, Y. Wu, Z. Lu, Q. Zhang, and Z. Sun Benchmarking trustworthiness of slms: pre-trained vs. compressed. arXiv preprint arXiv:2608.11981. Cited by: §A.12. Lin et al. (2024b) X. Lin, J. Kang, W. Cong, and H. Tong Bemap: balanced message passing for fair graph neural network. In Learning on Graphs Conference, p. 37–1. Cited by: §A.12. Lin et al. (2025c) X. Lin, Z. Liu, Z. Yang, G. Li, R. Qiu, S. Wang, H. Liu, H. Li, S. Keswani, V. Pardeshi, et al. Moralise: a structured benchmark for moral alignment in visual language models. arXiv preprint arXiv:2505.14728. Cited by: §A.12. Lin et al. (2026d) X. Lin, Z. Tang, W. Cong, M. Hang, K. Wang, Y. Wang, Z. Zeng, T. Li, H. Yoo, Z. Liu, et al. Mixture of sequence: theme-aware mixture-of-experts for long-sequence recommendation. In Proceedings of the ACM Web Conference 2026, p. 6469–6480. Cited by: §A.12. Liu et al. (2026) H. Liu, Z. Yang, and B. Su Diffusion lms can approximate optimal infilling lengths implicitly. arXiv preprint arXiv:2602.00476. Cited by: §A.13, §1, §1, §2, §4.2, §5.1. Liu et al. (2025) L. Liu, Z. Wang, D. Zhou, R. Wang, Y. Yan, B. Xiong, S. He, and H. Tong Few-shot knowledge graph completion via transfer knowledge from similar tasks. In Proceedings of the 34th ACM International Conference on Information and Knowledge Management, p. 4960–4965. Cited by: §A.12. Liu et al. (2024a) R. Liu, H. Bai, H. Lin, Y. Li, H. Gao, Z. Xu, L. Hou, J. Yao, and C. Yuan Intactkv: improving large language model quantization by keeping pivot tokens intact. arXiv preprint arXiv:2403.01241. Cited by: §A.12. Liu et al. (2024b) Z. Liu, J. Yuan, H. Jin, S. Zhong, Z. Xu, V. Braverman, B. Chen, and X. Hu Kivi: a tuning-free asymmetric 2bit quantization for kv cache. arXiv preprint arXiv:2402.02750. Cited by: §A.12. Manvi et al. (2026) R. Manvi, J. Hong, T. Seyde, M. Labonne, M. Lechner, and S. Levine Zero-overhead introspection for adaptive test-time compute. In International Conference on Learning Representations, Vol. 2026, p. 109705–109723. Cited by: §A.12. Merity et al. (2016) S. Merity, C. Xiong, J. Bradbury, and R. Socher Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843. Cited by: §A.13, §5.1. Nie et al. (2026a) S. Nie, Q. Min, S. Xu, Z. Huang, Y. Song, Y. Shan, Y. Lin, W. X. Zhao, C. Li, and J. Wen Improved large language diffusion models. arXiv preprint arXiv:2606.25331. Cited by: §A.4. Nie et al. (2026b) S. Nie, F. Zhu, Z. You, X. Zhang, J. Ou, J. Hu, J. Zhou, Y. Lin, J. Wen, and C. Li Large language diffusion models. Advances in Neural Information Processing Systems 38, p. 50608–50646. Cited by: §1, §2, §5.1. Raffel et al. (2020) C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of machine learning research 21 (140), p. 1–67. Cited by: §A.1, §A.13. Raychev et al. (2016) V. Raychev, P. Bielik, and M. Vechev Probabilistic model for code with decision trees. ACM SIGPLAN Notices 51 (10), p. 731–747. Cited by: §A.1, §A.13. Roach et al. (2020) S. Roach, C. Ni, A. Kopylov, T. Lu, J. Xu, S. Zhang, B. Du, D. Zhou, J. Wu, L. Liu, et al. Canon: complex analytics of network of networks for modeling adversarial activities. In 2020 IEEE International Conference on Big Data (Big Data), p. 1634–1643. Cited by: §A.12. Roziere et al. (2023) B. Roziere, J. Gehring, F. Gloeckle, S. Sootla, I. Gat, X. E. Tan, Y. Adi, J. Liu, R. Sauvestre, T. Remez, et al. Code llama: open foundation models for code. arXiv preprint arXiv:2308.12950. Cited by: §2. Sahoo et al. (2024) S. S. Sahoo, M. Arriola, Y. Schiff, A. Gokaslan, E. Marroquin, J. T. Chiu, A. Rush, and V. Kuleshov Simple and effective masked diffusion language models. Advances in Neural Information Processing Systems 37, p. 130136–130184. Cited by: §2, §3. Shi et al. (2024) J. Shi, K. Han, Z. Wang, A. Doucet, and M. Titsias Simplified and generalized masked diffusion for discrete data. Advances in neural information processing systems 37, p. 103131–103167. Cited by: §2, §3. Song et al. (2025) Y. Song, Z. Zhang, C. Luo, P. Gao, F. Xia, H. Luo, Z. Li, Y. Yang, H. Yu, X. Qu, et al. Seed diffusion: a large-scale diffusion language model with high-speed inference. arXiv preprint arXiv:2508.02193. Cited by: §2. Su et al. (2024) J. Su, M. Ahmed, Y. Lu, S. Pan, W. Bo, and Y. Liu Roformer: enhanced transformer with rotary position embedding. Neurocomputing 568, p. 127063. Cited by: §5.5. Wang et al. (2023) D. Wang, Y. Yan, R. Qiu, Y. Zhu, K. Guan, A. Margenot, and H. Tong Networked time series imputation via position-aware graph enhanced variational autoencoders. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, p. 2256–2268. Cited by: §A.12. Wang et al. (2018) R. Wang, Y. Yan, J. Wang, Y. Jia, Y. Zhang, W. Zhang, and X. Wang Acekg: a large-scale knowledge graph for academic data mining. In Proceedings of the 27th ACM international conference on information and knowledge management, p. 1487–1490. Cited by: §A.12. Wu et al. (2026) Z. Wu, L. Zheng, Z. Xie, J. Ye, J. Gao, S. Gong, Y. Feng, Z. Li, W. Bi, G. Zhou, et al. DreamOn: diffusion language models for code infilling beyond fixed-size canvas. arXiv preprint arXiv:2602.01326. Cited by: §A.10, §A.13, §1, §1, §2, §5.1. Xia et al. (2025) S. Xia, H. Lin, Y. Wu, Y. Zhou, Z. Li, Z. Wan, X. Xing, Y. Zheng, X. Li, C. Shan, et al. Medrek: retrieval-based editing for medical llms with key-aware prompts. arXiv preprint arXiv:2510.13500. Cited by: §A.12. Xiao et al. (2024) G. Xiao, Y. Tian, B. Chen, S. Han, and M. Lewis Efficient streaming language models with attention sinks. In International Conference on Learning Representations, Vol. 2024, p. 21875–21895. Cited by: §A.12. Xie et al. (2025) Z. Xie, J. Ye, L. Zheng, J. Gao, J. Dong, Z. Wu, X. Zhao, S. Gong, X. Jiang, Z. Li, et al. Dream-coder 7b: an open diffusion language model for code. arXiv preprint arXiv:2509.01142. Cited by: §2, §5.1. Xing et al. (2026) X. Xing, Z. Liu, S. Xiao, B. Gao, Y. Liang, H. Lin, X. Zeng, G. Li, and J. Zhang EfficientLLM: unified pruning-aware pretraining for auto-designed compact language models. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), p. 7813–7830. Cited by: §A.12. Xu et al. (2026) H. Xu, S. Chen, R. Qiu, Y. Yan, C. Luo, M. X. Cheng, J. He, and H. Tong Prune as you generate: online rollout pruning for faster and better rlvr. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), p. 13876–13893. Cited by: §A.12. Xu et al. (2024) H. Xu, Y. Yan, D. Wang, Z. Xu, Z. Zeng, T. F. Abdelzaher, J. Han, and H. Tong Slog: an inductive spectral graph neural network beyond polynomial filter. In Forty-first International Conference on Machine Learning, Cited by: §A.12. Yan et al. (2024a) Y. Yan, Y. Chen, H. Chen, X. Li, Z. Xu, Z. Zeng, L. Liu, Z. Liu, and H. Tong Thegcn: temporal heterophilic graph convolutional network. arXiv preprint arXiv:2412.16435. Cited by: §A.12. Yan et al. (2023a) Y. Yan, Y. Chen, H. Chen, M. Xu, M. Das, H. Yang, and H. Tong From trainable negative depth to edge heterophily in graphs. Advances in Neural Information Processing Systems 36, p. 70162–70178. Cited by: §A.12. Yan et al. (2024b) Y. Yan, Y. Hu, Q. Zhou, L. Liu, Z. Zeng, Y. Chen, M. Pan, H. Chen, M. Das, and H. Tong Pacer: network embedding from positional to structural. In Proceedings of the ACM Web Conference 2024, p. 2485–2496. Cited by: §A.12. Yan et al. (2024c) Y. Yan, Y. Hu, Q. Zhou, S. Wu, D. Wang, and H. Tong Topological anonymous walk embedding: a new structural node embedding approach. In Proceedings of the 33rd ACM International Conference on Information and Knowledge Management, p. 2796–2806. Cited by: §A.12. Yan et al. (2023b) Y. Yan, B. Jing, L. Liu, R. Wang, J. Li, T. Abdelzaher, and H. Tong Reconciling competing sampling strategies of network embedding. Advances in Neural Information Processing Systems 36, p. 6844–6861. Cited by: §A.12. Yan et al. (2025) Y. Yan, A. Kolekar, S. Genc, W. Xu, E. W. Huang, A. Srinivasan, M. Jain, Q. He, and H. Tong To answer or not to answer (taona): a robust textual graph understanding and question answering approach. In Findings of the Association for Computational Linguistics: EMNLP 2025, p. 6360–6376. Cited by: §A.12. Yan et al. (2021a) Y. Yan, L. Liu, Y. Ban, B. Jing, and H. Tong Dynamic knowledge graph alignment. In Proceedings of the AAAI conference on artificial intelligence, Vol. 35, p. 4564–4572. Cited by: §A.12. Yan et al. (2021b) Y. Yan, S. Zhang, and H. Tong Bright: a bridging algorithm for network alignment. In Proceedings of the web conference 2021, p. 3907–3917. Cited by: §A.12. Yan et al. (2022) Y. Yan, Q. Zhou, J. Li, T. Abdelzaher, and H. Tong Dissecting cross-layer dependency inference on multi-layered inter-dependent networks. In Proceedings of the 31st ACM International Conference on Information & Knowledge Management, p. 2341–2351. Cited by: §A.12. Yang et al. (2026a) L. Yang, H. Lin, Y. Wu, C. Shan, Z. Sun, and Q. Gu Reshape and rotate: adaptive weight reshaping and fine-grained rotation for ultra-low-bit diffusion transformers quantization. Neurocomputing, p. 133830. Cited by: §A.12. Yang et al. (2026b) L. Yang, H. Lin, Y. Wu, Z. Sun, and Q. Gu DapQ-dit: distribution-aware post-training quantization for efficient generative tasks in diffusion transformers. In Proceedings of the 2026 International Conference on Multimedia Retrieval, p. 2371–2380. Cited by: §A.12. Yang et al. (2024) X. Yang, H. Chen, Y. Yan, Y. Tang, Y. Zhao, E. Xu, Y. Cai, and H. Tong SimCE: simplifying cross-entropy loss for collaborative filtering. arXiv preprint arXiv:2406.16170. Cited by: §A.12. Ye et al. (2025) J. Ye, Z. Xie, L. Zheng, J. Gao, Z. Wu, X. Jiang, Z. Li, and L. Kong Dream 7b: diffusion large language models. arXiv preprint arXiv:2508.15487. Cited by: §1, §2, §2, §5.1. Yu et al. (2026) Q. Yu, Z. Zeng, Y. Yan, Z. Liu, B. Jing, R. Qiu, A. Azad, and H. Tong Planetalign: a comprehensive python library for benchmarking network alignment. In International Conference on Learning Representations, Vol. 2026, p. 66087–66115. Cited by: §A.12. Yu et al. (2025) Q. Yu, Z. Zeng, Y. Yan, L. Ying, R. Srikant, and H. Tong Joint optimal transport and embedding for network alignment. In Proceedings of the ACM on Web Conference 2025, p. 2064–2075. Cited by: §A.12. Zeng et al. (2026a) Z. Zeng, W. Bao, X. Lin, R. Qiu, T. Wei, X. Ning, Y. Yan, C. Luo, M. X. Cheng, J. He, et al. Subspace alignment for vision-language model test-time adaptation. arXiv preprint arXiv:2601.08139. Cited by: §A.12. Zeng et al. (2024) Z. Zeng, B. Du, S. Zhang, Y. Xia, Z. Liu, and H. Tong Hierarchical multi-marginal optimal transport for network alignment. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 38, p. 16660–16668. Cited by: §A.12. Zeng et al. (2025a) Z. Zeng, M. Hang, X. Liu, X. Liu, X. Lin, R. Qiu, T. Wei, Z. Liu, S. Yuan, C. Yang, et al. Hierarchical lora moe for efficient ctr model scaling. arXiv preprint arXiv:2510.10432. Cited by: §A.12. Zeng et al. (2025b) Z. Zeng, X. Liu, M. Hang, X. Liu, Q. Zhou, C. Yang, Y. Liu, Y. Ruan, L. Chen, Y. Chen, et al. Interformer: effective heterogeneous interaction learning for click-through rate prediction. In Proceedings of the 34th ACM International Conference on Information and Knowledge Management, p. 6225–6233. Cited by: §A.12. Zeng et al. (2025c) Z. Zeng, R. Qiu, W. Bao, T. Wei, X. Lin, Y. Yan, T. F. Abdelzaher, J. Han, and H. Tong Pave your own path: graph gradual domain adaptation on fused gromov-wasserstein geodesics. arXiv preprint arXiv:2505.12709. Cited by: §A.12. Zeng et al. (2026b) Z. Zeng, Q. Yu, X. Lin, R. Qiu, X. Ning, T. Wei, Y. Yan, J. He, and H. Tong Harnessing consistency for robust test-time llm ensemble. In Findings of the Association for Computational Linguistics: EACL 2026, p. 3528–3545. Cited by: §A.12. Zeng et al. (2023a) Z. Zeng, S. Zhang, Y. Xia, and H. Tong Parrot: position-aware regularized optimal transport for network alignment. In Proceedings of the ACM web conference 2023, p. 372–382. Cited by: §A.12. Zeng et al. (2023b) Z. Zeng, R. Zhu, Y. Xia, H. Zeng, and H. Tong Generative graph dictionary learning. In International Conference on Machine Learning, p. 40749–40769. Cited by: §A.12. Zhang et al. (2025a) A. Zhang, A. Sivakumar, C. Tang, and C. Thomas Flexible-length text infilling for discrete diffusion models. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, p. 31332–31347. Cited by: §2, §5.5. Zhang et al. (2026) J. Zhang, Y. Hsieh, Z. Wan, H. Lin, X. Wang, Z. Wang, Y. Lei, and M. Zhang Quantvla: scale-calibrated post-training quantization for vision-language-action models. arXiv preprint arXiv:2602.20309. Cited by: §A.12. Zhang et al. (2023) Z. Zhang, Y. Sheng, T. Zhou, T. Chen, L. Zheng, R. Cai, Z. Song, Y. Tian, C. Ré, C. Barrett, et al. H2o: heavy-hitter oracle for efficient generative inference of large language models. Advances in neural information processing systems 36, p. 34661–34710. Cited by: §A.12. Zhang et al. (2025b) Z. Zhang, H. Xu, Z. Yang, C. Yue, Z. Lin, H. Gao, Z. Wang, and H. Zhao Ta-vla: elucidating the design space of torque-aware vision-language-action models. arXiv preprint arXiv:2509.07962. Cited by: §A.12. Zhang et al. (2025c) Z. Zhang, C. Yue, H. Xu, M. Liao, X. Qi, H. Gao, Z. Wang, and H. Zhao Robochemist: long-horizon and safety-compliant robotic chemical experimentation. arXiv preprint arXiv:2509.08820. Cited by: §A.12. Zhu et al. (2025a) F. Zhu, R. Wang, S. Nie, X. Zhang, C. Wu, J. Hu, J. Zhou, J. Chen, Y. Lin, J. Wen, et al. Llada 1.5: variance-reduced preference optimization for large language diffusion models. arXiv preprint arXiv:2505.19223. Cited by: §1. Zhu et al. (2025b) F. Zhu, Z. You, Y. Xing, Z. Huang, L. Liu, Y. Zhuang, G. Lu, K. Wang, X. Wang, L. Wei, et al. Llada-moe: a sparse moe diffusion language model. arXiv preprint arXiv:2509.24389. Cited by: §1, §5.1. Zhu et al. (2025c) R. Zhu, Z. Wang, K. Hua, T. Zhang, Z. Li, H. Que, B. Wei, Z. Wen, F. Yin, H. Xing, et al. Scaling latent reasoning via looped language models. arXiv preprint arXiv:2510.25741. Cited by: §A.12. Appendix A Appendix A.1 Details of the Length Probe Architecture. The probe is implemented as a 3-layer MLP with hidden dimensions of 512 and 128. We use GeLU as the activation function. Training Datasets. For each model, we train a probe. We collect 196k training samples for each probe, from two sources: (1) a code corpus, including Py150 (Raychev et al., 2016), LeetCode, and CodeContests (Li et al., 2022b); and (2) a text corpus from C4 (Raffel et al., 2020). For each sample, we randomly mask a contiguous span from the original code or text sequence, using the remaining left and right contexts as the prefix and suffix, respectively. The length of the masked span is used as the target length. All training datasets are distinct from the evaluation datasets and are strictly non-overlapping. More details are provided in Sec. A.13. Data Construction. The probe is trained on auxiliary self-supervised infilling examples and does not use any evaluation instances or test cases from evaluation datasets. Each example consists of a prefix, an original masked span, and a suffix, with the token length of the masked span used as supervision. For code, we construct examples from the public training splits of Py150, LeetCode, and CodeContests. We retain contexts of at most 2,048 tokens under the LLaDA tokenizer, mask non-comment code lines, and require non-empty prefix and suffix contexts. For multilingual code, the target span is required to contain at least four tokenizer tokens. We restrict Py150 examples to top-level Python functions, extract LeetCode examples from its Python solution field, and use only accepted submissions from CodeContests. No executable tests from these auxiliary datasets are used. For text, we sample examples from the English training split of C4. We normalize each document, retain documents containing 80-400 words with sufficient alphabetic content, exclude URL-heavy pages, and mask a random contiguous span of 2-8 words while requiring at least 32 characters of both prefix and suffix context. We apply no additional target-length filtering. Since hidden representations differ across backbone models, we train a separate probe for each backbone using the same data-construction pipeline. Training Recipe. For the length probe, we train a lightweight MLP regressor with a regression objective. Unless otherwise specified, the probe is optimized with AdamW using a learning rate of 1×10−31× 10^-3, weight decay of 1×10−41× 10^-4 , batch size of 16, and dropout rate of 0.10.1. The model is trained for up to 5050 epochs with mean squared error (MSE) loss. Discussion. All adaptive-length methods incur some preparation cost; the key difference lies in its form and when it is paid. The PILL probe is trained only once per backbone (about 100 minutes on a single NVIDIA A40 GPU) and is thereafter reused across all tasks and inputs with no further training, adding merely two forward passes at inference time. In contrast, CAL is not cost-free either: it re-initializes its confidence parameters for each setting (about 20 minutes, 2k samples), and this cost recurs online, since its iterative confidence search introduces many extra forward passes at inference (Table 2). DAEDAL likewise relies on fitted/tuned components rather than operating fully out of the box. PILL’s cost is therefore a one-time, amortized expense, whereas the baselines pay repeatedly at inference. Moreover, the probe’s training cost does not stem from overfitting to the evaluation distribution. As shown in our comparison with DreamOn (Section A.10, Table 17), the text infilling tasks are out-of-distribution for our probe, which is fitted only on code; PILL nonetheless outperforms DreamOn across all of its length configurations on both datasets. This indicates that the length prediction generalizes beyond its training domain, so the gains arise from the method design rather than from in-distribution length statistics. A.2 Per-Stage Overhead at a Fixed Length To attribute cost to each stage, we decompose Pill’s runtime on LLaDA-8B-Base (Human-S) against a controlled baseline: a single fixed-length decoding at the same predicted length L L (denoted Basic Dec.). This isolates the cost added by each stage from any effect of the decoding length itself, and therefore differs from the end-to-end comparison in Table 2, where the backbone is averaged over preset lengths L∈4,8,16,32L∈\4,8,16,32\ and thus decodes at different lengths. As shown in Table 6, relative to this matched-length decoding, the probe, multi-slot decoding, and selection add 8.9%8.9\%, 3.4%3.4\%, and 9.4%9.4\% respectively. Notably, the multi-slot stage adds almost nothing despite generating all 2r+12r+1 candidates, confirming that the slot-wise parallel design decodes the full candidate set at a cost close to a single slot; the two lightweight probes account for the remainder. Breakdown Basic Dec. Probe Multi-slot Selection Total Time Cost 0.967s 0.086s 0.033s 0.091s 1.177s Overhead - 8.9% 3.4% 9.4% 21.7% Table 6: Per-stage overhead at a fixed length. A.3 Full Results across Initial Lengths Table 7 reports the per-length results that are averaged into Table 1 of the main paper, on three categories of tasks: Python (Human-S), other language (Java), and text (Wikitext). Two patterns stand out. First, baseline quality is highly sensitive to the preset length and varies non-monotonically with it: the backbone peaks at L=16L=16 on Human-S (56.24) but at L=8L=8 on Wikitext (19.04), and even the strongest baseline CAL drops from 70.86 at L=4L=4 to 50.82 at L=32L=32 on Human-S, and from 22.69 to 5.35 over the same range on Wikitext. Crucially, the best-performing length differs across datasets, so no single preset length transfers, which is precisely the difficulty an adaptive method must resolve. Second, larger lengths inflate the time cost monotonically while quality does not follow, so the longer configurations pay more for worse results. In contrast, Pill uses no preset length and a single run already surpasses the best length-specific result of every baseline, at a time cost close to the cheapest backbone configuration. (a) Results on Human-S dataset Init Length 4 8 16 32 Avg Pass@1 Time Pass@1 Time Pass@1 Time Pass@1 Time Pass@1 Time Backbone 22.36 0.279 51.21 0.567 56.24 1.155 48.89 2.411 44.68 1.103 DAEDAL 29.72 0.519 53.34 1.123 53.63 3.095 43.27 4.417 44.99 2.288 CAL 70.86 1.143 73.48 1.465 63.79 2.275 50.82 3.604 64.74 2.122 Pill - - - - - - - - 71.35 1.176 (b) Results on Java dataset Init Length 4 8 16 32 Avg Pass@1 Time Pass@1 Time Pass@1 Time Pass@1 Time Pass@1 Time Backbone 11.20 0.576 38.36 1.163 43.90 2.365 42.90 4.831 34.09 2.234 DAEDAL 14.75 0.828 41.24 1.520 44.79 4.265 40.58 5.800 35.34 3.103 CAL 49.78 2.379 54.99 3.039 50.89 4.432 45.57 7.038 50.31 4.222 Pill - - - - - - - - 57.10 2.555 (c) Results on Wikitext dataset Init Length 4 8 16 32 Avg BLEU-2 Time BLEU-2 Time BLEU-2 Time BLEU-2 Time BLEU-2 Time Backbone 17.44 0.213 19.04 0.434 10.88 0.894 5.57 1.887 13.23 0.857 DAEDAL 13.73 2.494 6.39 5.681 3.62 6.794 2.87 7.040 6.65 5.502 CAL 19.27 0.553 22.69 0.883 15.44 1.513 5.35 2.387 15.69 1.334 Pill - - - - - - - - 29.29 0.928 Table 7: Baseline results under different initial lengths. A.4 More Results on Recent DLMs To further evaluate the generalizability of Pill to stronger DLM backbones, we apply it to iLLaDA-8B-Base (Nie et al., 2026a), a recently proposed model that improves upon LLaDA through scaled pre-training and enhanced fine-tuning. We use the same Pill pipeline and evaluation protocol without modifying the backbone. Table 8 reports the results on Java and C/C++. Dataset Backbone DAEDAL CAL Pill Java 35.95 38.75 52.99 57.43 C/C++ 37.90 40.39 52.94 55.88 Table 8: Infilling performance on iLLaDA-8B-Base. Backbone DAEDAL CAL Pill Time / sample 1.06s 2.17s 2.01s 1.11s Table 9: Inference efficiency on iLLaDA-8B-Base under the same evaluation protocol as Sec. 5.3. Pill consistently outperforms all baselines on both datasets while requiring 1.11s per sample, compared with 1.06s for fixed-length backbone decoding and 2.01s for CAL. Thus, Pill adds only about 5% wall-clock overhead over the backbone while retaining its efficiency advantage over iterative adaptive-length decoding. A.5 Extension to Multi-span Infilling To evaluate Pill beyond single-span infilling, we construct a multi-span infilling setting based on MBPP, where each instance contains multiple disjoint missing spans. Pill handles all gaps jointly within a single sequence: a single probing pass predicts the lengths of all missing spans, multi-slot decoding generates their candidate spans in parallel, and the resulting candidates are scored jointly. Method Backbone CAL Pill Pass Rate 33.80 40.73 45.59 Time / sample 6.60s 17.40s 6.70s Table 10: Performance and efficiency on multi-span infilling constructed from MBPP. As shown in Table 10, Pill improves the pass rate by 11.79 points over fixed-length decoding and by 4.86 points over CAL. Meanwhile, it incurs only about 1.5% wall-clock overhead over the backbone (6.70s vs. 6.60s) and is approximately 2.6× faster than CAL. These results suggest that the probing and parallel-decoding design extends naturally to multiple disjoint gaps without incurring iterative search for each span. A.6 Robustness of Length Probing Robustness to structural complexity. We first examine whether length probing remains reliable when the dependency between the prefix and suffix becomes structurally more complex. To control for span length, we restrict the analysis to Java and C/C++ examples with the same gold infill length of 10 tokens. We parse each complete gold program and measure structural complexity using (1) the maximum AST nesting depth within the missing span and (2) the number of cross-boundary identifier reuses, i.e., identifiers shared between the missing span and its prefix or suffix. Examples are divided into low- and high-complexity groups at the median. Dataset Complexity MAE Exact Within 1 Within 2 Java Low 1.14 23.8 71.4 92.9 High 1.47 25.6 58.1 81.4 C/C++ Low 1.59 21.7 58.7 78.3 High 1.91 21.3 46.8 70.2 Table 11: Length-probing performance (%) under different levels of structural complexity. MAE is measured in tokens; the remaining columns report the percentage of predictions that exactly match or fall within 1/2 tokens of the gold length. As shown in Table 11, greater structural complexity moderately increases MAE and reduces near-exact prediction accuracy. Nevertheless, 81.4% and 70.2% of high-complexity Java and C/C++ examples, respectively, remain within two tokens of the gold length, matching the default candidate radius r=2r=2. This suggests that the probe remains effective even in structurally complex, nested, and dependency-heavy contexts. Robustness to training data size. We further study the sensitivity of the length probe to the amount of auxiliary training data. We train probes with different numbers of samples and evaluate the resulting Pill models on Human-S with LLaDA-8B-Base. # of Samples 1k 5k 10k 20k 50k 100k CAL Pass@1 59.24 66.21 67.96 69.31 70.86 71.35 64.74 Table 12: Effect of the amount of auxiliary probe-training data on Human-S with LLaDA-8B-Base. As shown in Table 12, performance improves steadily with more probe-training data but already surpasses CAL with 10k examples (67.96 vs. 64.74). The improvement becomes modest beyond 50k samples, suggesting that the probe does not critically depend on the full 100k training set. A.7 Scaling of Multi-slot Parallel Decoding We study how the computational cost of multi-slot decoding scales with the number of candidate lengths. We vary the candidate radius from r=0r=0 to r=4r=4, corresponding to 1–9 candidates, and profile wall-clock time and peak GPU memory on Human-S with LLaDA-8B-Base using a single NVIDIA A40 GPU. Radius r 0 1 2 3 4 Adaptive # Candidates 1 3 5 7 9 3/5/7 Time (s) 0.82 0.95 1.10 1.27 1.44 1.13 GPU Memory (GB) 21.3 23.8 25.1 29.1 33.7 24.5 Pass@1 66.0 71.5 71.4 70.2 70.1 71.4 Oracle Pass@1 66.0 78.3 81.9 83.2 84.0 81.8 Table 13: Scaling of multi-slot decoding with the number of candidate lengths on Human-S using LLaDA-8B-Base. The adaptive setting uses 3/5/7 candidates according to prediction uncertainty. As shown in Table 13, both runtime and memory increase approximately with the number of candidates, since the shared prefix/suffix context is reused while only slot-specific tokens grow with the candidate set. From one to nine candidates, runtime increases from 0.82s to 1.44s (1.76×) and memory from 21.3GB to 33.7GB (1.58×). Meanwhile, Pass@1 saturates around r=2r=2 even though the oracle upper bound continues to increase, indicating that adding more candidate lengths primarily improves coverage rather than final selected performance. This motivates our default choice of r=2r=2. A.8 Failure Modes We analyze where the remaining errors of Pill arise by separating them into probe coverage, candidate generation, and post-hoc selection failures. Table 14 summarizes the breakdown. Failure Type Ratio Probe coverage failure 24.3% of which other candidates still pass 10.2% Candidate generation failure 3.6% Selection failure 11.4% Table 14: Failure mode analysis of Pill on Human-S. Probe coverage is the largest source of error. Interestingly, in 10.2% of cases associated with coverage failure, a nearby-length candidate still produces a correct solution. Candidate generation failures are relatively rare (3.6%), while selection failures account for 11.4%, consistent with the remaining gap between Pill and Pill (Oracle). A.9 Potential of Uncertainty-aware Candidate Expansion Our default Pill uses a fixed candidate radius r=2r=2 for all examples. However, length predictions may have different levels of uncertainty, suggesting that a fixed candidate set may not be optimal for every input. We therefore first examine whether prediction uncertainty provides a useful signal for dynamically adjusting the candidate radius. Prediction uncertainty. We train five bootstrap length probes and use the standard deviation of their predictions as an uncertainty estimate. Table 15 reports the mean uncertainty grouped by gold span length. Gold Length 1-8 9-16 17-32 >>32 Mean Uncertainty 0.106 0.123 0.161 0.185 Table 15: Prediction uncertainty across different gold span lengths. Prediction uncertainty increases consistently with span length and has a Pearson correlation of 0.320.32 with the gold length. This suggests that longer or more difficult spans tend to require a wider search neighborhood, while a smaller candidate set may suffice for confident predictions. Dynamic candidate radius. Motivated by this observation, we explore an uncertainty-aware candidate expansion strategy. We divide examples into low-, medium-, and high-uncertainty groups according to uncertainty terciles and assign 3, 5, and 7 candidate lengths, respectively. Compared with the default fixed radius r=2r=2 (five candidates), the adaptive strategy improves Pass@1 from 71.35 to 71.44. Although the improvement is modest on the current benchmark, this result shows that prediction uncertainty can be used to dynamically allocate the candidate budget without degrading performance. We view uncertainty-aware candidate expansion as a promising direction for settings with more diverse or longer span-length distributions. A.10 Additional Comparison Results Comparison with Oracle Best-Initialized CAL. Our main evaluation follows a prior-free protocol that averages CAL over initial lengths L∈4,8,16,32L∈\4,8,16,32\, since the optimal initialization is unknown at deployment time and varies across datasets. To further examine whether our results are driven by this averaging protocol, we compare Pill against an oracle version of CAL that retrospectively selects its best initial length on each test set. Dataset CAL (Best Init.) Pill Human-S 73.48 (L=8L=8) 71.35 Human-M 31.61 (L=32L=32) 28.20 MBPP-S 56.93 (L=8L=8) 57.49 MBPP-M 37.79 (L=16L=16) 38.19 Java 55.10 (L=8L=8) 57.10 C/C++ 54.32 (L=8L=8) 54.57 Table 16: Comparison with CAL using its best test-set initialization among L∈4,8,16,32L∈\4,8,16,32\. This oracle initialization is selected retrospectively and is not available in practical deployment. As shown in Table 16, Pill outperforms oracle best-initialized CAL on four of the six benchmarks, despite requiring no preset initial length. Moreover, CAL’s optimal initialization varies across datasets, ranging from L=8L=8 to L=32L=32, illustrating the difficulty of choosing a single transferable prior. On Human-S and Human-M, oracle CAL performs better, but this comparison assumes access to test-set performance when choosing the initialization. Thus, the results support our main prior-free evaluation while providing a stronger upper-bound comparison for CAL. Comparison with DreamOn. DreamOn (Wu et al., 2026) attains variable-length infilling by fine-tuning the DLM with explicit length-changing operations, whereas Pill requires no backbone-finetuning and leaves the backbone untouched. We compare on the text infilling tasks, which are out-of-distribution for both methods (Table 17): DreamOn is trained on code, and for this comparison, our probe is also fitted only on code (with a separately trained code-only probe). The result is presented in Table 17. In this out-of-domain setting, Pill outperforms DreamOn across all of its length configurations (initial length l∈1,4,8l∈\1,4,8\) on both datasets, showing that Pill transfers effectively across domains without backbone fine-tuning. DreamOn’s performance also varies noticeably with the initial length, whereas Pill requires no preset length. We emphasize that DreamOn operates under a different adaptation regime with task-specific backbone fine-tuning, so this comparison is not intended to establish superiority over its specialized fine-tuned system. Dataset Wiki Arxiv BLEU-2 ROUGE-L BLEU-2 ROUGE-L DreamOn (l=1) 18.72 33.43 13.76 30.25 DreamOn (l=4) 21.33 36.09 15.62 33.17 DreamOn (l=8) 17.39 31.34 14.50 31.57 Pill 23.67 38.89 16.11 34.43 Table 17: Comparison with DreamOn (l: initial length). A.11 Quality-Efficiency Trade-off Figure 5 visualizes the quality–time trade-off on Wikitext, with each baseline shown at all four preset lengths L∈4,8,16,32L∈\4,8,16,32\ and Pill shown as a single length-free point. Pill lies at the upper-left frontier, attaining the highest BLEU-2 at a time cost lower than nearly all baseline configurations; every baseline point is strictly dominated. Sweeping a baseline along L traces a curve that moves rightward (more time) without consistently moving upward (better quality), illustrating that tuning the preset length cannot recover the operating point Pill reaches without any tuning. Figure 5: Quality-efficiency trade-off on Wikitext (BLEU-2 vs. wall-clock time, log-scaled x-axis). Each baseline is annotated with its preset length L∈4,8,16,32L∈\4,8,16,32\; Pill requires no preset length. Pill sits at the upper-left frontier and dominates all baseline configurations. A.12 Additional Related Work Efficient Large Language Models. With the rapid development of machine learning (Xia et al., 2025; Ban et al., 2023; Roach et al., 2020; Yu et al., 2025; Zeng et al., 2025c) and foundation models (Lin et al., 2025a; Li et al., 2026b), recent studies have explored a wide range of applications, including recommendation (Zeng et al., 2025a; Zeng et al., 2025b; Yan et al., 2022; Yan et al., 2024a; Yang et al., 2024; Li et al., 2024; Jing et al., 2024; Liu et al., 2025; Lin et al., 2026d), graph learning (Wang et al., 2018; Wang et al., 2023; Du et al., 2021; Xu et al., 2024; Yu et al., 2026; Yan et al., 2021a; Yan et al., 2021b; Lin et al., 2024b), reasoning (Zeng et al., 2026b; Zeng et al., 2026a; Yan et al., 2023a; Yan et al., 2023b), and multi-modality tasks (Zhang et al., 2025c; Zhang et al., 2025b; Bei et al., 2026; Lin et al., 2025c). Meanwhile, as foundation models continue to scale, their increasing computational and memory costs have motivated extensive research on efficient large language models. Existing studies improve efficiency from different perspectives, including small language model learning (Xing et al., 2026; Lin et al., 2026c; Yan et al., 2025), model compression and quantization (Lin et al., 2024a; Lin et al., 2026b; Lin et al., 2025b; Yang et al., 2026b; Yang et al., 2026a; Zhang et al., 2026), efficient attention and long-context modeling (Xiao et al., 2024; Zhang et al., 2023), KV-cache optimization (Liu et al., 2024b; Liu et al., 2024a), and efficient model architectures (Lai et al., 2026; Zhu et al., 2025c). These approaches aim to reduce the computational and memory overhead of large language models while preserving their modeling capabilities. One can refer to (Lin et al., 2026a). Efficient Decoding and Inference. Recent advances in artificial intelligence (Zeng et al., 2023b; Zeng et al., 2024; Yan et al., 2024b; Yan et al., 2024c; Zeng et al., 2023a; Ban et al., 2021) have led to increasingly capable but computationally intensive generative models Huang et al. (2025), making efficient inference an important research problem. Existing studies have explored accelerated decoding (Xu et al., 2026), parallel decoding (Cheng et al., 2026), speculative decoding (Chen et al., 2026; Li et al., 2026a), and adaptive inference strategies (Manvi et al., 2026) to reduce sequential computation and redundant model evaluations. Such efficiency is particularly important for diffusion language models, which generate sequences through iterative denoising and may require repeated forward passes during inference. In adaptive-length infilling, existing approaches further introduce additional computation to determine or adjust the generation length. In contrast, PILL directly predicts the target length, decodes multiple nearby length candidates in parallel, and selects the final candidate with a single additional scoring pass, enabling adaptive-length infilling with minimal inference overhead. A.13 Details of Datasets All datasets and models used in this work are publicly available under licenses permitting research use, and we use them accordingly. Also, all evaluation results for test dataset are from a single run with deterministic decoding. Following all prior adaptive-length infilling methods we compare against (Li et al., 2025a; Liu et al., 2026; Wu et al., 2026), we report results from a single run with deterministic decoding, which keeps the comparison protocol identical across methods. Our use is consistent with these resources’ intended research use, and the infilling benchmarks we derive from them are likewise intended for research only. HumanEval. HumanEval-Infilling (Bavarian et al., 2022) is an infilling benchmark derived from the original HumanEval code generation benchmark. It evaluates whether a model can complete missing code spans given both the left and right contexts. Following prior work, the benchmark contains several infilling settings, including single-line, multi-line, random-span, and random-span-light, which cover different granularities and locations of missing code. MBPP. Mostly Basic Python Problems (MBPP) (Austin et al., 2021b) is a Python program synthesis benchmark consisting of 974 crowd-sourced programming problems. Each example contains a natural language task description, a reference Python solution, and test cases for functional correctness. The problems are designed to be solvable by entry-level programmers and mainly cover basic programming concepts, standard library usage, and simple algorithmic reasoning. Py150. Py150 (Raychev et al., 2016) is a large-scale Python corpus collected from GitHub repositories. The dataset contains 150k Python files, split into 100k training files and 50k evaluation files. The original release provides parsed Python ASTs as well as source files, and applies filtering steps such as removing duplicate files, excluding repository forks, keeping files that can be parsed, and focusing on permissive licenses. We use Py150 as a source of natural Python code for constructing length-probe training samples. LeetCode. The LeetCode dataset11 1 https://huggingface.co/datasets/greengerong/leetcode. contains algorithmic programming problems from LeetCode, including problem titles, difficulty levels, descriptions, and reference solutions in multiple programming languages such as Python, Java, C++, and JavaScript. Compared with MBPP, these examples are generally more algorithmic and closer to interview-style coding tasks. CodeContests. CodeContests (Li et al., 2022b) is a competitive programming dataset released by DeepMind and used in the development of AlphaCode. It contains programming problems collected from multiple online judge platforms, such as Aizu, AtCoder, CodeChef, Codeforces, and HackerEarth. Each problem includes natural language statements, input-output test cases, and both correct and incorrect human submissions in multiple programming languages. We use it as a source of challenging algorithmic code. MultiPL-E. MultiPL-E (Cassano et al., 2022) is a multilingual code generation benchmark that translates unit-test-driven Python benchmarks, including HumanEval and MBPP, into 18 additional programming languages. It is designed to evaluate whether code generation models generalize beyond Python and across diverse programming languages. In our setting, MultiPL-E provides multilingual code examples and evaluation-style prompts for constructing infilling instances. WikiText. WikiText (Merity et al., 2016) is a language modeling dataset extracted from verified Good and Featured articles on Wikipedia. Compared with heavily preprocessed corpora such as Penn Treebank, WikiText preserves original casing, punctuation, numbers, and long-form article structure, making it suitable for evaluating long-range dependencies in natural language modeling. We use WikiText as a source of high-quality natural text for non-code infilling samples. C4. The Colossal Clean Crawled Corpus (C4) (Raffel et al., 2020) is a large-scale cleaned web corpus derived from Common Crawl and introduced with the T5 framework. It contains diverse English web text after a series of filtering and cleaning steps. We use C4 as a broad-domain natural language corpus to improve the coverage of text-side length-probe training examples. arXiv. The arXiv dataset22 2 https://huggingface.co/datasets/UniverseTBD/arxiv-abstracts-large. provides metadata and abstracts for scholarly articles across domains such as physics, computer science, statistics, electrical engineering, quantitative biology, and economics. We use arXiv abstracts as scientific-domain natural text, which complements the general-domain text from C4 and WikiText. A.14 Potential Risks Pill is a backbone-frozen method for diffusion language models: it does not modify the underlying backbone, and its lightweight probe is trained only on public corpora. We do not expect any personally identifying information in these resources. As our method builds on pretrained DLMs, it may inherit biases or factual errors present in these backbones, and the infilled spans it produces should be reviewed before use in sensitive applications. All datasets used in our experiments are commonly used, publicly available research datasets. We rely on their released and curated versions rather than collecting data directly from individuals, and we do not use or intentionally retain personally identifying information. We additionally inspected the data-construction pipeline and did not identify fields intended to contain personal identifiers or offensive content. A.15 Declaration of AI Assistance We used AI tools for language polishing and part of the experimental implementation. These tools did not contribute to the idea, analysis, results, or scientific claims.