Model reference · open weights

granite-code-2k

granite-code-2k is an open-weight language model from ibm-granite, 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 ibm-granite 1 variants 40k downloads/mo
Request this model on EU hardware All served models Not on the shared API today — deployed on request.

About

What granite-code-2k is

⚠️ DEPRECATION WARNING ⚠️ ⚠️ NOT RECOMMENDED FOR USE IN NEW PROJECTS ⚠️ New applications/projects should use the latest mainline Granite language model family, whose code capabilities supercede this model. This model is being made available strictly for historical/scientific purposes. Please see our Granite Collections for the latest Granite releases. Granite-3B-Code-Base-2K Model Summary Granite-3B-Code-Base-2K is a decoder-only code model designed for code generative tasks (e.g., code generation, code explanation, code fixing, etc.). It is trained from scratch with a two-phase training strategy. In phase 1, our model is trained on 4 trillion tokens sourced from 116 programming languages, ensuring a comprehensive understanding of programming languages and syntax. In phase 2, our model is trained on 500 billion tokens with a carefully designed mixture of high-quality data from code and natural language domains to improve the models’ ability to reason and follow instructions. - Developers: IBM Research - GitHub Repository: ibm-granite/granite-code-models - Paper: Granite Code Models: A Family of Open Foundation Models for Code Intelligence - Release Date: May 6th, 2024 - License: Apache 2.0. Usage Intended use Prominent enterprise use cases of LLMs in software engineering productivity include code generation, code explanation, code fixing, generating unit tests, generating documentation, addressing technical debt issues, vulnerability detection, code translation, and more. All Granite Code Base models, including the 3B parameter model, are able to handle these tasks as they were trained on a large amount of code data from 116 programming languages. Generation This is a simple example of how to use Granite-3B-Code-Base-2K model. Training Data - Data Collection and Filtering: Pretraining code data is sourced from a combination of publicly available datasets (e.g., GitHub Code Clean, Starcoder data), and additional public code repositories and issues from GitHub. We filter raw data to retain a list of 116 programming languages. After language filtering, we also filter out low-quality code. - Exact and Fuzzy Deduplication: We adopt an aggressive deduplication strateg

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

Specifications

What it is

Makeribm-granite
TypeLanguage models
Parameters (lead)3.5B
Context2k tokens
Variants1
Runs withtransformers
Released2024-04-23
Popularity40k downloads / month
Likes40
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
granite-3b-code-base-2k3.5BBF16~8 GBWeights ↗

Benchmarks

Reported results

As published on the model card — the maker's own numbers, not measured by AxForge.

TaskDatasetMetricScore
text-generationMBPPpass@136
text-generationMBPP+pass@145.1
text-generationHumanEvalSynthesis(Python)pass@136.6
text-generationHumanEvalSynthesis(JavaScript)pass@137.2
text-generationHumanEvalSynthesis(Java)pass@140.9
text-generationHumanEvalSynthesis(Go)pass@126.2
text-generationHumanEvalSynthesis(C++)pass@135.4
text-generationHumanEvalSynthesis(Rust)pass@122
text-generationHumanEvalExplain(Python)pass@125
text-generationHumanEvalExplain(JavaScript)pass@118.9
text-generationHumanEvalExplain(Java)pass@129.9
text-generationHumanEvalExplain(Go)pass@117.1
text-generationHumanEvalExplain(C++)pass@126.8
text-generationHumanEvalExplain(Rust)pass@114
text-generationHumanEvalFix(Python)pass@118.3
text-generationHumanEvalFix(JavaScript)pass@123.2
text-generationHumanEvalFix(Java)pass@129.9
text-generationHumanEvalFix(Go)pass@124.4
text-generationHumanEvalFix(C++)pass@116.5
text-generationHumanEvalFix(Rust)pass@13.7

Using it via the API

Call it like any OpenAI endpoint

Once AxForge deploys granite-code-2k for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (granite-code-2k 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":"granite-code-2k","messages":[{"role":"user","content":"Hello"}]}'

Details

Languages, data & research

Trained / evaluated on

codeparrot/github-code-clean bigcode/starcoderdata open-web-math/open-web-math math-ai/StackMathQA bigcode/commitpackft TIGER-Lab/MathInstruct meta-math/MetaMathQA glaiveai/glaive-code-assistant-v3 glaive-function-calling-v2 bugdaryan/sql-create-context-instruction garage-bAInd/Open-Platypus nvidia/HelpSteer

Tags

transformers safetensors llama text-generation code granite dataset:codeparrot/github-code-clean dataset:bigcode/starcoderdata dataset:open-web-math/open-web-math dataset:math-ai/StackMathQA model-index text-generation-inference deploy:azure conversational

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 granite-code-2k 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