Massive language fashions (LLMs) have turn into foundational to AI code understanding and era, powering a variety of enterprise AI workflows — from software program synthesis to automated reasoning over symbolic sequences. Regardless of this success, most code-focused LLMs at the moment are autoregressive (AR): they predict the subsequent token based mostly solely on earlier context. This sequential formulation has been the default alternative for language modeling, but it surely limits bidirectional reasoning, code infilling, and edit consistency — challenges that new approaches like diffusion language fashions are serving to to deal with in enterprise settings.
Diffusion language fashions (DLMs) present another era paradigm. As an alternative of manufacturing tokens one after the other, they generate sequences by a technique of iterative denoising — progressively reworking a masked or noisy sequence right into a coherent one. This iterative construction naturally helps parallel era, context-aware reasoning, and structured enhancing, making it particularly well-suited for modeling supply code, the place long-range dependencies and syntactic precision are important.
To discover this paradigm in a sensible and reproducible setting, we introduce CoDA (Coding by way of Diffusion Adaptation) — a diffusion language mannequin for code. CoDA demonstrates that diffusion-based era might be environment friendly, light-weight, and aggressive, even with out resorting to multi-billion–parameter fashions. It’s absolutely open-sourced with coaching recipes, analysis harnesses, and mannequin checkpoints to help additional analysis.
Overview of CoDA
CoDA is constructed by adapting a transformer-based autoregressive spine (Qwen3-1.7B) to a discrete diffusion goal. It’s educated end-to-end on TPU clusters utilizing an open PyTorch/XLA pipeline optimized for large-scale textual content diffusion. Key options embody:
- Multi-stage coaching design: pre-training, mid-training, and post-training levels that align noise distributions progressively.
- Progressive masking curriculum: structured masking methods to enhance infilling, truncation restoration, and variable-length conditioning.
- Reproducible infrastructure: end-to-end TPU pipeline and analysis harness launched publicly for transparency and benchmarking.
How CoDA Works
CoDA is educated in three main levels designed to progressively adapt the mannequin from normal textual content to high-quality code reasoning.
Pre-training (179B tokens): The pre-training part exposes the mannequin to various textual and code-based content material, forming the inspiration for syntactic understanding and reasoning. The corpus combines net textual content, coding and reasoning knowledge, equivalent to dclm-baseline-1.0 dataset, The Stack v2, RedPajama, and so on.
Mid-training (20B tokens): The second stage bridges pre-training and fine-tuning by introducing a progressive masking curriculum. Mid-training knowledge contains 20B tokens from curated sources equivalent to RedPajama Arxiv, Gutenberg, OpenCoder Annealing Corpus, and SmolLM-PythonEdu.
Put up-training (Instruction Tuning): Within the closing stage, CoDA is fine-tuned on instruction-following knowledge derived from OpenCoder (Stage 1 and Stage 2) to adapt the mannequin for prompt-conditioned code era and downside fixing. This stage additionally introduces conditioned-span annealing, the place the mannequin transitions from unconditional denoising to progressively conditioning on bigger parts of the consumer immediate. This mechanism ensures secure alignment between the immediate semantics and the denoising course of.
Progressive Masking
Determine 1: Three masking methods adopted to progressively navigate from pre-training to instruction fine-tuning.
Conventional fashions be taught by predicting the subsequent token. CoDA learns to fill within the blanks. We launched three complementary masking methods:
Unmaskable Prefix (S1): ensures constant conditioning on an preliminary immediate, stabilizing prefix-aligned era.
Truncated Suffix (S2): teaches the mannequin to deal with sequences of various size, enhancing robustness to partial contexts.
Block Masking (S3): masks contiguous spans, simulating life like infilling and code-repair eventualities.
Possibilities for every technique are step by step elevated over epochs, successfully transitioning the mannequin from random token masking to structured code infilling. This curriculum helps align the mannequin’s inside noise distribution with downstream inference conduct.
Outcomes: Compact But Highly effective
We consider CoDA on normal public benchmarks, together with HumanEval and MBPP, and their EvalPlus extensions. Efficiency is measured utilizing the move@1 metric, representing the likelihood of producing an accurate resolution on the primary try.
Desk 1: Comparability of code era efficiency on Humaneval and MBPP. Evalplus scores are calculated as a median of move@1 scores on plus-enhanced variants. Daring numbers point out metrics the place CoDA fashions obtain the strongest diffusion-model outcome. *represents self- reported scores.
CoDA achieves aggressive efficiency in comparison with a lot bigger diffusion fashions, closing many of the hole whereas remaining inside a considerably smaller parameter footprint. Instruction tuning yields a 25% enchancment on HumanEval, emphasizing the significance of post-training alignment for diffusion coders. Moreover, the mannequin achieves 39.6% decrease inference latency than the 7B-parameter mannequin, confirming the scalability benefits of smaller DLMs.
Totally Open Supply
To facilitate group analysis, Salesforce Analysis is releasing:
Mannequin weights: https://huggingface.co/Salesforce/CoDA-v0-Instruct
TPU coaching pipeline and recipes: https://github.com/SalesforceAIResearch/CoDA
Collectively, these sources allow anybody — from tutorial labs to open-source builders — to construct, prepare, and deploy their very own diffusion-based coding assistants.
Study Extra:
Paper: https://arxiv.org/abs/2510.03270v1
Mannequin: https://huggingface.co/Salesforce/CoDA-v0-Instruct
Code & Coaching Pipeline: https://github.com/SalesforceAIResearch/CoDA

