Welcome to CoDA, Salesforce AI Research's diffusion-based language model designed for powerful code generation and bidirectional context understanding.
We're releasing CoDA as a lightweight yet capable model:
CoDA-1.7B-Base
— diffusion foundation model with bidirectional diffusion architecture, ideal for further fine-tuning and RL training
CoDA-1.7B-Instruct
— optimized for code generation tasks with bidirectional diffusion modeling (1.7B parameters)
CoDA leverages discrete diffusion processes to enable understanding of both past and future tokens, making it uniquely suited for code completion and generation tasks where context flows in both directions.
This model card is dedicated to the
CoDA-1.7B-Base
model. Check out our
model collection
for other variants.
⭐️ Highlights
Bidirectional Context Understanding:
Leverage discrete diffusion processes to understand both past and future tokens, enabling superior code completion.
Confidence-Guided Sampling:
Maintain competitive inference latency through intelligent sampling strategies that balance quality and speed.
Lightweight Architecture:
Achieve strong performance with only 1.7B parameters, making it accessible for researchers with limited computational resources.
Full Training Pipeline:
Complete reproducible training pipeline from pre-training to fine-tuning, enabling customization for specific domains.
Optimized for Code:
Specifically designed and trained for code generation tasks, with strong performance on HumanEval, MBPP, and other coding benchmarks.
📊 Model Details
Model Size
: 1.7B parameters
Architecture
: Diffusion-based language model
Training
: TPU-based pre-training with GPU fine-tuning
Primary Use
: Code generation and completion tasks
✨ Key Features
Bidirectional Context
: Diffusion modeling enables understanding of both past and future tokens
Confidence-Guided Sampling
: Maintains competitive inference latency through intelligent sampling
Lightweight Design
: Achieves strong performance with fewer parameters than comparable models
Open Training Pipeline
: Fully reproducible training from pre-training to fine-tuning
📈 Performance
CoDA-1.7B-Instruct demonstrates competitive performance on standard code generation benchmarks:
Model
HumanEval
HumanEval+
MBPP
MBPP+
EvalPlus
CoDA-Base
29.3
23.8
35.2
46.0
34.9
CoDA-Instruct
54.3
47.6
47.2
63.2
55.4
Dream-Base
56.7
50.0
68.7
57.4
53.7
Dream-7B-Instruct
57.9
53.7
68.3
56.1
54.9
LLaDA-8B-Instruct
35.4
31.7
31.5
28.6
30.2
🎯 Key Finding
: CoDA-1.7B-Instruct matches or surpasses diffusion models up to 7B parameters while maintaining significantly lower computational requirements. CoDA offers an advantageous balance between inference speed and accuracy compared to larger diffusion models.
🎓 Training Methodology
CoDA employs a three-stage training process:
Three-stage training: (1) Pre-training with bidirectional masking, (2) Post-training with instruction format, (3) Inference with progressive denoising.
🛠️ Usage
🚀 Quick Start
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "Salesforce/CoDA-v0-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Generate code
prompt = "Write a Python function to calculate fibonacci numbers"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_tokens=256,
diffusion_steps=128,
temperature=0.0
)
print(tokenizer.decode(outputs[0]))
🚀 Deployment
For production deployment, we provide serving with OpenAI-compatible APIs:
# Clone the repository
git clone https://github.com/SalesforceAIResearch/CoDA
cd CoDA
# Set up environment
python3 -m venv .venv
source .venv/bin/activate
pip install -r serving/requirements.txt
# Export your Hugging Face tokenexport HF_TOKEN="hf_..."# Start the server
bash serving/fast-api/start_server.sh
# Set up fine-tuning environmentcd post-train/LLaMA-Factory
pip install -r requirements.txt
# Configure dataset and run fine-tuning
bash ../../run_sft.sh
📊 Evaluation
cd evaluation/lm_eval
bash eval_mbpp_humaneval.sh
📚 Citation
Technical report coming soon. For now, please cite:
@misc{coda2025,
title={CoDA: Coding LM via Diffusion Adaptation},
author={Chen, Haolin and Wang, Shiyu and Qin, Can and Pang, Bo and Liu, Zuxin and Qiu, Jielin and Zhang, Jianguo and Zhou, Yingbo and Chen, Zeyuan and Xu, Ran and Heinecke, Shelby and Savarese, Silvio and Xiong, Caiming and Wang, Huan and Yao, Weiran},
year={2025},
publisher={Salesforce AI Research}
}
CoDA-v0-Base huggingface.co is an AI model on huggingface.co that provides CoDA-v0-Base's model effect (), which can be used instantly with this Salesforce CoDA-v0-Base model. huggingface.co supports a free trial of the CoDA-v0-Base model, and also provides paid use of the CoDA-v0-Base. Support call CoDA-v0-Base model through api, including Node.js, Python, http.
CoDA-v0-Base huggingface.co is an online trial and call api platform, which integrates CoDA-v0-Base's modeling effects, including api services, and provides a free online trial of CoDA-v0-Base, you can try CoDA-v0-Base online for free by clicking the link below.
Salesforce CoDA-v0-Base online free url in huggingface.co:
CoDA-v0-Base is an open source model from GitHub that offers a free installation service, and any user can find CoDA-v0-Base on GitHub to install. At the same time, huggingface.co provides the effect of CoDA-v0-Base install, users can directly use CoDA-v0-Base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.