Model reference · open weights
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.
About
⚠️ 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
| Maker | ibm-granite |
|---|---|
| Type | Language models |
| Parameters (lead) | 3.5B |
| Context | 2k tokens |
| Variants | 1 |
| Runs with | transformers |
| Released | 2024-04-23 |
| Popularity | 40k downloads / month |
| Likes | 40 |
| Licence | Open weights |
How it works
Variants
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.
| Variant | Params | Precision | VRAM | Fits 16 GB | Weights |
|---|---|---|---|---|---|
| granite-3b-code-base-2k | 3.5B | BF16 | ~8 GB | ✓ | Weights ↗ |
Benchmarks
As published on the model card — the maker's own numbers, not measured by AxForge.
| Task | Dataset | Metric | Score |
|---|---|---|---|
| text-generation | MBPP | pass@1 | 36 |
| text-generation | MBPP+ | pass@1 | 45.1 |
| text-generation | HumanEvalSynthesis(Python) | pass@1 | 36.6 |
| text-generation | HumanEvalSynthesis(JavaScript) | pass@1 | 37.2 |
| text-generation | HumanEvalSynthesis(Java) | pass@1 | 40.9 |
| text-generation | HumanEvalSynthesis(Go) | pass@1 | 26.2 |
| text-generation | HumanEvalSynthesis(C++) | pass@1 | 35.4 |
| text-generation | HumanEvalSynthesis(Rust) | pass@1 | 22 |
| text-generation | HumanEvalExplain(Python) | pass@1 | 25 |
| text-generation | HumanEvalExplain(JavaScript) | pass@1 | 18.9 |
| text-generation | HumanEvalExplain(Java) | pass@1 | 29.9 |
| text-generation | HumanEvalExplain(Go) | pass@1 | 17.1 |
| text-generation | HumanEvalExplain(C++) | pass@1 | 26.8 |
| text-generation | HumanEvalExplain(Rust) | pass@1 | 14 |
| text-generation | HumanEvalFix(Python) | pass@1 | 18.3 |
| text-generation | HumanEvalFix(JavaScript) | pass@1 | 23.2 |
| text-generation | HumanEvalFix(Java) | pass@1 | 29.9 |
| text-generation | HumanEvalFix(Go) | pass@1 | 24.4 |
| text-generation | HumanEvalFix(C++) | pass@1 | 16.5 |
| text-generation | HumanEvalFix(Rust) | pass@1 | 3.7 |
Using it via the API
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"}]}'
Licence
Open weights under apache-2.0 — commercial use is permitted. Deploy it on AxForge EU hardware on request. Read the licence ↗