Model reference · open weights

codegen2-16B_P

codegen2-16B_P is an open-weight language model from Salesforce, listed in the AxForge catalogue. AxForge can bring it up on EU-owned hardware for you on request — with the licence handled where one is required.

LLMs Salesforce 1 variants 22k downloads/mo
Request this model on EU hardware All served models Not on the shared API today — deployed on request.

About

What codegen2-16B_P is

CodeGen2 (CodeGen2-16B) Model description CodeGen2 is a family of autoregressive language models for program synthesis, introduced in the paper: CodeGen2: Lessons for Training LLMs on Programming and Natural Languages by Erik Nijkamp\, Hiroaki Hayashi\, Caiming Xiong, Silvio Savarese, Yingbo Zhou. Unlike the original CodeGen model family (i.e., CodeGen1), CodeGen2 is capable of infilling, and supports more programming languages. Four model sizes are released: 1B, 3.7B, 7B, 16B. How to use This model can be easily loaded using the AutoModelForCausalLM functionality. Causal sampling For regular causal sampling, simply generate completions given the context: Infill sampling For infill sampling, we introduce three new special token types: <maskN: N-th span to be masked. In practice, use <mask1 to where you want to sample infill. <sep: Separator token between the suffix and the infilled sample. See below. <eom: "End-Of-Mask" token that model will output at the end of infilling. You may use this token to truncate the output. For example, if we want to generate infill for the following cursor position of a function: we construct an input to the model by 1. Inserting <mask1 token in place of cursor position 2. Append <sep token to indicate the boundary 3. Insert another <mask1 to indicate which mask we want to infill. The final snippet looks as follows: You might want to truncate the model output with <eom. Training data This checkpoint is trained on the stricter permissive subset of the deduplicated version of the Stack dataset (v1.1). Supported languages (and frameworks) are as follows: c, c++, c-sharp, dart, go, java, javascript, kotlin, lua, php, python, ruby, rust, scala, shell, sql, swift, typescript, vue. Training procedure CodeGen2 was trained using cross-entropy loss to maximize the likelihood of sequential inputs. The input sequences are formatted in two ways: (1) causal language modeling and (2) file-level span corruption. Please refer to the paper for more details. Evaluation results We evaluate our models on HumanEval and HumanEval-Infill. Please refer to the paper for more details. Intended use and limitations As an autoregressive language model, CodeGen2

Summarised from the published model card. Read the full card on the HuggingFace links below.

Specifications

What it is

MakerSalesforce
TypeLanguage models
Context2k tokens
Variants1
Runs withtransformers
Released2023-04-26
Popularity22k downloads / month
Likes45
LicenceOpen weights

How it works

How language models work

Your prompttext / messagesTransformerattention over tokensNext-token loopgenerate + streamResponsetext · tool callsA language model reads your tokens and predicts the next one, again and again, streaming the reply back.

Variants

Sizes & precisions

Open weights ship in several sizes and precisions. One page, all the variants — pick the one that fits your GPU. VRAM figures are estimates from model size.

VariantParamsPrecisionVRAMFits 16 GBWeights
codegen2-16B_PBF16Weights ↗

Using it via the API

Call it like any OpenAI endpoint

Once AxForge deploys codegen2-16b-p for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (codegen2-16b-p below is illustrative; you get the exact model name on deployment.)

$ curl -sS https://api.axforge.ai/v1/chat/completions \
  -H "Authorization: Bearer $AXFORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"codegen2-16b-p","messages":[{"role":"user","content":"Hello"}]}'

Details

Languages, data & research

Tags

transformers pytorch codegen text-generation custom_code endpoints_compatible

Papers

Licence

Open weights

Open weights under apache-2.0 — commercial use is permitted. Deploy it on AxForge EU hardware on request. Read the licence ↗

Sources

Weights & code

Want codegen2-16B_P on EU-owned hardware?

Request this model on EU hardware See what’s served now

Explore

More language models

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms