Salesforce CodeGen: A Multi-Turn Code Model Family with a Confusing Release History
CodeGen is a family of open-source model for program synthesis. Trained on TPU-v4. Competitive with OpenAI Codex.
At a glance
- What is it?
- CodeGen is a family of open-source program synthesis models from Salesforce, spanning three generations with sizes from 350M to 16B parameters. The repository offers pretrained weights and usage examples, but the training code lives elsewhere and the release notes are sparse.
- Who is it for?
- Adopt CodeGen if you need a research-grade, open-source code generation model with permissive Apache-2.0 licensing and you are comfortable pulling weights from Hugging Face Hub. Do not adopt it if you expect a maintained, single-package tool with active support or if you need the latest state-of-the-art performance, since the last push was June 2026 but no releases are listed and the training code is in a separate repository.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 105 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What CodeGen Solves and Who It Targets
CodeGen addresses program synthesis, the task of generating source code from a natural language description or a partial code context. The target audience is researchers and engineers working on code generation models, not end users seeking a turnkey coding assistant. The repository provides three generations of model weights: CodeGen1 from March 2022, CodeGen2 from May 2023, and CodeGen2.5 from July 2023. Each generation is available in sizes 350M, 1B, 3B, 7B, and 16B, though the README notes that CodeGen2.5 only released a 7B variant that it claims outperforms 16B models. The models are designed for multi-turn program synthesis, a focus that distinguishes them from single-shot code completion tools.
The Architecture and Training Approach
The repository does not contain model architecture code; it is a release point for weights and usage examples. The underlying training details are described in two ICLR 2023 papers linked in the README, and the training implementation lives in a separate repository called Jaxformer. According to the README, Jaxformer handles data pre-processing, training, and fine-tuning. The models were trained on TPU-v4 hardware, as stated in the repository description. The README's news entries give a rough timeline: CodeGen1 matched OpenAI Codex at the time of its release, CodeGen2 introduced infill sampling, and CodeGen2.5 improved on larger models. The user is expected to load the pretrained weights through the Hugging Face transformers library, not to retrain from scratch.
Getting Started with Pretrained Weights
The README provides concrete Python snippets for each generation. For CodeGen1, you load AutoTokenizer and AutoModelForCausalLM from the 'Salesforce/codegen-2B-mono' checkpoint. The example tokenizes the comment '# this function prints hello world' and generates 128 tokens, then decodes with a truncation pattern that stops at blank lines or triple quotes. CodeGen2 requires trust_remote_code=True and a revision parameter set to 'main' when loading 'Salesforce/codegen2-7B'. CodeGen2.5 also uses trust_remote_code=True for the tokenizer but not for the model. The decode step for CodeGen2.5 omits the truncate_before_pattern argument, suggesting that the tokenizer handles stopping differently. No installation steps are given beyond importing torch and transformers, which implies a standard Python environment with those packages installed.
The Split Between Weights and Training Code
A significant structural choice is that this repository contains no training code, only model cards and usage examples. The README points to the Jaxformer repository for any actual training or fine-tuning work. That separation means a user who wants to reproduce the training pipeline must navigate two repositories with different codebases. The Jaxformer library is not described in any detail in the README, so its dependencies, data formats, and TPU-specific requirements are unknown from this material. For an engineer evaluating adoption, this is a real friction point: you can run inference with a few lines of transformers code, but any modification or fine-tuning requires jumping to a separate project with its own learning curve.
Limitations and Mismatches with the Wrong Tool
The README carries an explicit ethics disclaimer stating the release is for research purposes only and that the models are not designed or evaluated for all downstream uses. That limits production deployment without additional safety work. The example generation is extremely short, only 128 tokens, which suits a comment-to-function task but not a full-file generation scenario. The truncate_before_pattern in the decoding examples is a heuristic that may cut output mid-expression, and the README does not explain how to adjust it for different languages or tasks. The models are likely wrong tool if you need a maintained API, a model that supports a specific language beyond the 'mono' variants, or a solution with clear documentation on bias and failure modes. The repository's last push is June 2026, but with no releases listed, the maintenance cadence is unclear.
Alternatives and How They Differ
The README itself names OpenAI Codex as a comparison point for CodeGen1, stating it was 'on par' at the time. Codex is a closed, API-based model, so the difference is fundamental: CodeGen offers open weights under Apache-2.0, while Codex is proprietary and accessed through a paid API. For an open-source alternative, the Hugging Face Hub hosts numerous code models, but the README does not name any specific one. The practical difference is that CodeGen requires you to manage your own inference infrastructure, while Codex handles that for you. CodeGen also has a multi-turn focus, which may not be present in all code completion models. The choice between CodeGen and any other open model depends on your need for the specific training data and the Jaxformer pipeline, which are not easily replicated elsewhere.
Maintenance, Licensing, and Upgrade Path
The repository is licensed under Apache-2.0, which permits commercial use, modification, and distribution with attribution, but the README includes an acceptable use policy that restricts certain applications. No release notes or changelog are present in the material, so tracking upgrades requires watching the Hugging Face Hub for new checkpoints. The three generations show a clear upgrade path: each new release adds capabilities or improves performance, but the user must manually migrate code to new model names and tokenizer settings. The CodeGen2.5 example uses a different decode pattern than the earlier versions, indicating that the tokenizer or generation logic changed. There is no automated migration tool or compatibility guarantee between generations, so upgrading means updating your inference code and re-testing output quality.
Editorial conclusion
Adopt CodeGen if you need a research-grade, open-source code generation model with permissive Apache-2.0 licensing and you are comfortable pulling weights from Hugging Face Hub. Do not adopt it if you expect a maintained, single-package tool with active support or if you need the latest state-of-the-art performance, since the last push was June 2026 but no releases are listed and the training code is in a separate repository. Before using any variant, verify which generation (1.0, 2.0, or 2.5) matches your task, check the specific model card on Hugging Face for infill support and tokenizer requirements, and review the Salesforce acceptable use policy if you plan any deployment beyond research.
Community notes