acceptodds
Under review as a conference paper at ICLR 2027

LEARNING DECODING ORDER IN DIFFUSION FOR SECURE CODE GENERATION

Abstract

Generating secure code requires making decisions with the right context. A locally plausible implementation can be unsafe when the surrounding program is still unresolved. Diffusion language models provide a natural way to address this problem because they can generate a program in flexible order, committing some decisions while leaving others open for revision. Yet existing decoders typically choose this order using token confidence, which says little about what context a decision requires. We introduce Paco, a framework that learns the order in which code should be constructed. Our key idea is to establish program structure first and defer context-dependent decisions until the information they rely on is available. We learn this ordering from automatically computed program properties and use it to guide diffusion decoding. On CWEval, Paco improves security success by 50% and approximately doubles functional-and-secure generation over language-model-only fine-tuning. The learned ordering transfers to unseen JavaScript and Java, and at 128 decoding steps improves functional-security success by 62% over cached autoregressive decoding while running faster.

Primary area:
other topics in machine learning (i.e., none of the above)
Keywords:
Secure code generation, Multi-task learning, Diffusion language model

Reviews

Among:
Shape:
1234this paper, Top 49%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.33 over 3 reviews, above 51% of the others.
Reviewer_iYfhOpenReview ↗
Rating
3(+1)
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes PACO, a property-aware diffusion decoding framework for secure code generation. The key idea is to learn the order in which code tokens should be committed during diffusion decoding, prioritizing high-level program structures while delaying security-sensitive decisions until richer contextual information becomes available. The authors introduce two property-guided strategies based on AST syntactic depth and Bandit security-risk signals. These properties are learned through multitask training and subsequently used to adjust token commitment priorities during inference. Experiments on CWEval, SALLM, and QuixBugs demonstrate improvements in functional correctness, security, and inference efficiency. The results also suggest that the proposed approach can generalize across programming languages.

Critical strengths
  • The paper addresses an important research problem with significant practical implications.
  • The proposed approach demonstrates good novelty.
  • The paper provides interesting analyses and encouraging experimental results.
Critical weaknesses
  • It remains unclear whether the reported security improvements primarily come from multitask training or the proposed property-guided decoding strategy. PACO introduces two mechanisms simultaneously: (1) multitask training with additional program-property supervision and (2) property-guided token commitment ordering during inference. However, the current experimental results suggest that a substantial portion of the improvement may come from the additional supervision rather than the proposed decoding strategy. Specifically, Table 4 shows that Sec@5 improves from 33.33% (Finetuned) to 50.00% (PACO with the AST head disabled). However, enabling the AST head does not further improve Sec@5, which remains at 50.00%. Similarly, Func-Sec@5 improves from 16.67% to 29.17% with the head disabled, and further to 33.33% when the head is enabled. These results suggest that multitask training contributes substantially to the overall improvement.

  • I recommend adding several controlled experiments to better isolate and validate the effectiveness of the proposed decoding strategy.

  • Random commitment ordering: Randomly determine the token commitment order to examine whether the improvements arise from property-aware scheduling rather than changes to the decoding order in general.

  • Reversed AST ordering: Prioritize deeper AST tokens instead of shallower ones to evaluate whether the proposed structure-first principle is essential.

  • Random risk-token delay: Delay randomly selected tokens rather than predicted security-sensitive tokens to verify the effectiveness of the learned security-risk signal.

Questions for authors

See "Critical Weaknesses"

Reviewer_peztOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper introduces PACO, a property-aware decoding framework for diffusion language models aimed at improving secure code generation. The central motivation is that security-sensitive code decisions may require surrounding program context and therefore should not necessarily be committed early, even when the model assigns them high confidence.

PACO learns token-level property predictors using supervision from external program analysis tools. The authors investigate two property signals: syntactic depth derived from abstract syntax trees (ASTs), which encourages early commitment of high-level program structure, and vulnerability risk obtained from Bandit, which delays potentially unsafe code decisions. These predictions are used to reweight token confidence during masked diffusion decoding. The framework also jointly trains the language-model backbone and property prediction heads through a multitask objective.

The authors evaluate PACO on secure code generation benchmarks including CWEval and SALLM, as well as program repair tasks on QuixBugs. Experiments using Dream and LLaDA backbones demonstrate improvements in functionality, security, and their joint success rate compared with language-model-only fine-tuning and external-tool-guided decoding. The paper further reports cross-language transfer to JavaScript and Java, robustness to code perturbations, and improved inference efficiency relative to external analyzer guidance and an autoregressive baseline.

Critical strengths

S1. An interesting formulation of secure code generation through property-aware decoding order.

The paper introduces an interesting perspective on secure code generation by treating the order of token commitment as an optimization dimension. Unlike autoregressive models, masked diffusion models can leave uncertain or context-dependent positions unresolved while constructing other parts of a program. PACO exploits this flexibility by using program-property predictions to adjust commitment priorities.

The proposed framework is conceptually appealing because it incorporates structured program information into the generation process rather than relying exclusively on post-generation security analysis. The two investigated properties, syntactic depth and vulnerability risk, provide intuitive signals for controlling the generation process.

S2. Extensive empirical evaluation across functionality, security, and inference efficiency.

The paper evaluates PACO on multiple benchmarks, including CWEval, SALLM, and QuixBugs, and considers both Dream and LLaDA backbones. The results show substantial improvements in joint functional-security success over language-model-only fine-tuning.

I particularly appreciate the evaluation of both functionality and security rather than security alone, as well as the comparison between learned property guidance and external program-analysis tools. The cross-language experiments and inference-latency measurements further strengthen the empirical evaluation. The reported efficiency gains over external analyzer guidance are practically relevant, especially given the high cost of repeatedly invoking program-analysis tools during diffusion decoding.

Critical weaknesses

W1. The main security improvements appear to come primarily from multitask training rather than the proposed decoding-order optimization.

The central contribution of PACO is presented as learning a property-aware token commitment order to improve secure code generation. However, the ablation results in Table 4 suggest that most of the observed security improvements can be attributed to the additional property-supervised training objective rather than the learned decoding policy itself.

On CWEval with the Dream backbone, language-model-only fine-tuning achieves 16.67% Func-Sec@5 and 33.33% Sec@5. The PACO (AST) checkpoint with its property head disabled already achieves 29.17% Func-Sec@5 and 50.00% Sec@5 using standard confidence-based diffusion decoding. Enabling the AST-guided commitment order further improves Func-Sec@5 to 33.33%, but Sec@5 remains unchanged at 50.00%.

Therefore, enabling the learned decoding order produces a relatively modest improvement in joint success and no improvement in security success on this comparison. This raises an important concern about whether the paper's primary contribution is really learning an effective decoding order, or whether its improvements largely result from incorporating additional program-property supervision during training.

Although the authors acknowledge this distinction, the paper's motivation and conclusions emphasize decoding-order learning. Stronger evidence isolating the causal contribution of the proposed scheduling mechanism would be necessary to fully support this claim.

W2. The effectiveness of the proposed scheduling mechanism is insufficiently isolated from alternative decoding schedules and the quality of the learned property representations.

The paper motivates PACO through the hypothesis that establishing program structure early and deferring security-sensitive decisions allows the model to make safer choices with richer context. However, the current experiments do not conclusively demonstrate that the proposed property-aware ordering is better than alternative commitment strategies.

For example, the AST-guided decoder prioritizes syntactically shallow positions, but it is unclear whether this specific structural ordering is necessary or whether comparable benefits could be achieved through simpler heuristics, random or reversed scheduling, or other confidence modifications with similar changes to commitment frequency.

Similarly, the Bandit-guided decoder delays potentially risky tokens, but the paper provides limited systematic evidence that these delayed decisions subsequently become safer because additional context has been established. The qualitative examples are illustrative, yet they do not demonstrate that the proposed mechanism consistently operates as hypothesized across vulnerabilities.

Without stronger schedule-controlled ablations and quantitative analysis of commitment trajectories, it remains difficult to distinguish the benefits of the proposed program-aware ordering from generic changes to the diffusion decoding dynamics.

Questions for authors

Q1. Can the authors further isolate the contribution of learned decoding order from multitask property supervision?

Table 4 shows that PACO (AST) with the head disabled already provides most of the improvement over language-model-only fine-tuning. In particular, enabling AST guidance increases Func-Sec@5 from 29.17% to 33.33%, while Sec@5 remains unchanged at 50.00%.

Could the authors explain why this result supports the claim that decoding-order optimization is the primary mechanism driving security improvements? Additional experiments using the same trained backbone with different commitment strategies would help clarify the contribution of the learned scheduling policy.

Q2. How does PACO compare against alternative commitment schedules under the same training checkpoint?

Could the authors evaluate random, reversed-property, fixed shallow-to-deep, and other heuristic schedules using the same PACO-trained backbone? These comparisons would help establish whether the learned property-guided ordering captures meaningful program dependencies rather than simply changing token commitment priorities.

Q3. Does delaying security-sensitive tokens actually improve the security of their eventual predictions?

The paper argues that postponing security-sensitive decisions allows them to be resolved with richer surrounding context. Could the authors quantify this mechanism by measuring the correctness or security of predictions at risky positions as a function of their commitment time?

For example, it would be informative to compare risky tokens committed early versus late, or to measure how frequently initially unsafe candidates become safe before commitment. Such analysis would provide stronger evidence for the proposed causal explanation.

Q4. How robust are the security improvements across different vulnerability categories?

The AST-based approach improves security despite not explicitly modeling vulnerability risk, while the Bandit-based approach is designed to identify security-sensitive regions. Could the authors provide a CWE-level breakdown of the improvements, particularly for vulnerability categories that require long-range data-flow reasoning or semantic program understanding?

This would help determine whether the method primarily improves general code quality or addresses security-specific weaknesses. It would also clarify when AST guidance and Bandit guidance provide complementary benefits.

Q5. How much of the reported cross-language improvement is attributable to the learned scheduling mechanism?

The paper reports promising transfer from Python to JavaScript and Java. However, the evaluation compares PACO against other model checkpoints rather than isolating the learned commit order on the same checkpoint in the target languages.

Could the authors provide a head-disabled comparison for these cross-language evaluations? This would help determine whether the learned scheduling policy itself transfers across languages or whether the gains primarily arise from the multitask-trained backbone.

Reviewer_tPkYOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes PACO, a framework that uses predicted program properties to guide token commitment in diffusion code generation. The authors jointly train a language model and lightweight heads to predict AST depth or security risk, then use these predictions to adjust the decoding order. Experiments on CWEval, SALLM, and QuixBugs compare learned guidance with ordinary decoding and external analyzers. The paper also studies cross-language transfer, inference latency, and individual decoding trajectories. The idea is interesting, but the evidence is stronger for multitask training than for the central claim about learning a better security-aware decoding order. Missing comparisons with security-trained autoregressive LLMs and limited evaluation on realistic development tasks leave PACO's practical advantage unclear.

Critical strengths
  • Interesting use of diffusion decoding: Using program structure and security risk to decide when tokens should become fixed is well motivated. The learned heads can also provide guidance when incomplete code cannot be reliably analyzed by an external tool.

  • Useful ablations: The paper compares tool-based and learned guidance, evaluates two backbones, and includes a head-disabled control. The latency study and successful and unsuccessful decoding examples help explain the method's benefits and limits.

Critical weaknesses
  • Most of the headline gain comes from training, rather than learned decoding order: In Table 4, Func-Sec@5 improves from 16.67 to 29.17 with multitask training and the head disabled. Enabling the head raises it to 33.33, while Sec@5 remains at 50.00. The paper acknowledges this, but the title and main framing still put decoding order at the center. so there is a discrepancy between novelty claimed and experiment evidence.

  • Missing security-trained LLM baselines: Table 8 includes ordinary autoregressive models such as CodeLlama and Qwen2.5-Coder, but no models trained with SafeCoder, ProSec or SecCoderX. A comparable autoregressive model fine-tuned on the same corpus is also missing. These comparisons, under comparable model sizes and compute budgets, are needed to establish PACO's advantage over existing secure-code generation approaches. Moreover, DreamCoder-Instruct already achieves higher Func-Sec@5 than PACO (AST) (37.50 vs. 33.33 on cweval, which pose questions to the effectiveness of the method.

  • The proposed mechanism is only partly validated: Table 2 measures how often the head changes the commit order, rather than whether its predicted depth or risk is correct. The case studies are useful, but do not establish that the proposed priorities are better than random or reversed priorities on the same checkpoint. Head accuracy across masking levels and a matched ordering control would make the explanation more convincing.

  • Training-data validation is incomplete: Appendix A.2 uses LLMs to generate and filter secure code, but does not identify those models or quantify the correctness of the retained examples.

  • Limited evaluation on agentic coding benchmarks: The quantitative results focus on CWEval, SALLM, and QuixBugs. Appendix C.3 reports only two MLflow path-traversal repair examples from A.S.E., with no aggregate benchmark results. The paper should provide systematic agentic evaluations on benchmarks such as BaxBench, SusVibes, or A.S.E., using a consistent agent framework and comparable inference budgets. Two successful function replacements do not establish effectiveness across repository-level development tasks.

Questions for authors

See Weaknesses.

Comments on the paper

1 comment

Dear Area Chair,

Thank you for your time and effort in overseeing our submission. As the discussion period concludes, we would like to briefly summarize our new experiments, manuscript revisions, and the current status of the discussion.

All three reviewers appreciated the motivation of using program properties to guide diffusion decoding for secure code generation, and raised a shared set of constructive questions. Below is a high-level summary of how we addressed them in our responses and the revised PDF:

  1. Clarifying claims and isolating the learned decoding order (All Reviewers): We revised the paper's framing to clearly distinguish the progressive roles of multitask property supervision and inference-time property-guided decoding. Holding the trained checkpoints fixed, we added controlled comparisons against confidence-only, random, and reversed-priority schedules, property-head accuracy across masking ratios, and cross-language head-disabled ablations. Across all settings, the learned priorities improve over confidence-only decoding while random and reversed schedules degrade performance.
  2. Matched SFT and security-trained baselines (Reviewer tPkY): We added comparisons against Qwen2.5-Coder-7B fine-tuned on the same training data and SafeCoder trained on the same diffusion backbone, clarified the effect of base-model initialization, and evaluated 7B models on BaxBench to examine current model-scale limits on full-application generation.
  3. Granular breakdowns, data validation, and scope clarity (Reviewers tPkY, pezt): We added a CWE category breakdown, documented the static-analysis and unit-test validation pipeline for synthetic training data, and clarified the single-function scope of our cross-file case studies.

Thank you again to you and the reviewers for the constructive feedback, which has helped us make the paper much stronger and clearer.

Best regards, The Authors

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.