AnCoder: Anchored Code Generation via Discrete Diffusion Models

Anton Xue, Litu Rout, Constantine Caramanis, Sanjay Shakkottai
2/5/2026
cs.LGcs.PL
diffusion-flow

No confident code implementation found for this paper.

Abstract

Diffusion language models offer a compelling alternative to autoregressive code generation, enabling global planning and iterative refinement of complex program logic. However, existing approaches fail to respect the rigid structure of programming languages and, as a result, often produce broken programs that fail to execute.

Show full abstract

To address this, we introduce AnchorTree, a framework that explicitly anchors the diffusion process using structured, hierarchical priors native to code. Specifically, AnchorTree uses the abstract syntax tree to prioritize resolving syntactically and semantically salient tokens, such as keywords (e.g., if, while) and identifiers (e.g., variable names), thereby establishing a structural scaffold that guides the remaining generation. We validate this framework via AnCoder, a family of models showing that structurally anchored diffusion offers a parameter-efficient path to high-quality code generation.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{xue2026ancoder,
  title  = {AnCoder: Anchored Code Generation via Discrete Diffusion Models},
  author = {Anton Xue and Litu Rout and Constantine Caramanis and Sanjay Shakkottai},
  year   = {2026},
  eprint = {2602.17688},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.17688v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2602.17688.svg)](https://codeofpaper.com/paper/2602.17688)

Discussion