alt.freeweights.granite / granite-3b-code-base-128k
From: ibm-granite <huggingface.co/ibm-granite>Newsgroups: alt.freeweights.graniteSubject:

granite-3b-code-base-128k

Date: 2026-11-15Commit: ab7f9ccSigned: 2DC28CC7B26A283B ✓

Text generation model with 3.5B parameters. Safetensors weights, 6.97 GB in all. Published by ibm-granite under Apache-2.0.

3.5B params6.97GBgranite-3b-code-base-128ksafetensorspermissive
FactsParams3.5BSize6.97 GBFormatssafetensorsTasktext generationLicenseApache-2.0From sourcepermissive
$ fw get ibm-granite/granite-3b-code-base-128k
# manifest sha256 05f34a7bdb58… · 6.97 GB · 10 files
$ fw verify ./granite-3b-code-base-128k ibm-granite/granite-3b-code-base-128k
From sourceHosted (signed)ibm-granite/granite-3b-code-base-128kLast check: 2026-11-15 03:48 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Overview

Size
6.97 GB
Weights
6.97 GB (safetensors)
Parameters
3.5B
Formats
safetensors
Task
text generation
License
Apache-2.0 (permissive)
Files
10, each with a sha256
Publisher
ibm-granite
Added
2026-11-15
Section
alt.freeweights.granite
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 03:48 UTCpassed

Model card

From the publisher at commit ab7f9cc. Shown as plain text with links; images open at the publisher.

⚠️ DEPRECATION WARNING ⚠️#

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.


Image: image/png

Granite-3B-Code-Base-128K#

Model Summary#

Granite-3B-Code-Base-128K extends the context length of Granite-3B-Code-Base from 2K to 128K with continual pretraining using the original training data but with repository-level file packing and per-language length upsampling, that we found to be critical for long-context pretraining. We adopt an progressive training strategy where we doubled the context window until it reached the desired length of 128K by appropriately adjusting RoPE theta. We trained on 4B tokens total for all stages, which is only 0.1% of Granite-3B-Code-Base's original pre-training data.

Usage#

Intended use#

Prominent enterprise use cases of LLMs in software engineering productivity with 128K context length support that includes 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-128K model.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # or "cpu"
model_path = "ibm-granite/granite-3b-code-base-128k"
tokenizer = AutoTokenizer.from_pretrained(model_path)
# drop device_map if running on CPU
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
model.eval()
# change input text as desired
input_text = "def generate():"
# tokenize the text
input_tokens = tokenizer(input_text, return_tensors="pt")
# transfer tokenized inputs to the device
for i in input_tokens:
    input_tokens[i] = input_tokens[i].to(device)
# generate output tokens
output = model.generate(**input_tokens)
# decode output tokens into text
output = tokenizer.batch_decode(output)
# loop over the batch to print, in this example the batch size is 1
for i in output:
    print(i)

Training Data#

Starting from the base Granite model, this model was further pretrained on repository-level code data with per-language context-length oversampling, allowing it to effectively utilize up to 128K tokens of context. This continued training stage focused on a curated selection of programming languages, such as Python, C, C++, Go, Java, JavaScript, and TypeScript.

Infrastructure#

We train the Granite Code models using two of IBM's super computing clusters, namely Vela and Blue Vela, both outfitted with NVIDIA A100 and H100 GPUs respectively. These clusters provide a scalable and efficient infrastructure for training our models over thousands of GPUs.

Ethical Considerations and Limitations#

The use of Large Language Models involves risks and ethical considerations people must be aware of. Regarding code generation, caution is urged against complete reliance on specific code models for crucial decisions or impactful information as the generated code is not guaranteed to work as intended. Granite-3B-Code-Base-128K model is not the exception in this regard. Even though this model is suited for multiple code-related tasks, it has not undergone any safety alignment, there it may produce problematic outputs. Additionally, it remains uncertain whether smaller models might exhibit increased susceptibility to hallucination in generation scenarios by copying source code verbatim from the training dataset due to their reduced sizes and memorization capacities. This aspect is currently an active area of research, and we anticipate more rigorous exploration, comprehension, and mitigations in this domain. Regarding ethics, a latent risk associated with all Large Language Models is their malicious utilization. We urge the community to use Granite-3B-Code-Base-128K model with ethical intentions and in a responsible way. 

Files

10 files · 6.97 GBWeights 6.97 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 10 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
README.md9.05 KBc17c86de52c1571e499d4a0a404e78f14edd72d95c99de14fdf790943cef833f
config.json680 Bd9df9a96ff24088014a5e35e56a8a1795d4d7c4390252ddcc1a9e92d27b26bb3
generation_config.json132 Bfd95e163cd4c3cf343d2385d3f1bd384d485a761fd8adc131a1466789052bc39
model-00001-of-00002.safetensors4.97 GBf99013285c93a09a4df3ce66416ea8841b549de6a399df28e24c70ab8476a437
model-00002-of-00002.safetensors1.99 GB1e53c7d441c654a41e67cda22b6e83eae73ba82d6d3e6f6a9d1c6c8da9df2e58
model.safetensors.index.json41.6 KBbcd1ac27ce8c784f682a702e0499bc9e4e73c2200bd34d2ced2fe2ce17a1132b
special_tokens_map.json1.02 KB2f2bba45146f073a7b8a097cb6133a6b4b66d5751e73f2a2aca81083288813e9
tokenizer.json2.06 MB9af07a3123a1f4d75dcb85fbdc4c62f9b7873d23fa39c449d2240c3e33eb3ab5
tokenizer_config.json4.13 KB0764d3ae3830187f63cfe568c754d99900fed85fc9d071e6cfe2add9f555b6bb
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
ab7f9cc61d pinned now2026-11-15 03:48 UTC10 files · 6.97 GB

Use it

$ fw get ibm-granite/granite-3b-code-base-128k
# manifest sha256 05f34a7bdb58… · 6.97 GB · 10 files
$ fw verify ./granite-3b-code-base-128k ibm-granite/granite-3b-code-base-128k
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/ibm-granite/granite-3b-code-base-128k.json --dir ./granite-3b-code-base-128k $ python3 fw.py verify ./granite-3b-code-base-128k ./ibm-granite__granite-3b-code-base-128k.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ibm-granite/granite-3b-code-base-128k --revision ab7f9cc61d94a9e87528b47d2c60888cb801f2ad --local-dir ./granite-3b-code-base-128k
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("ibm-granite/granite-3b-code-base-128k", revision="ab7f9cc61d94a9e87528b47d2c60888cb801f2ad") model = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-3b-code-base-128k", revision="ab7f9cc61d94a9e87528b47d2c60888cb801f2ad", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve ibm-granite/granite-3b-code-base-128k --revision ab7f9cc61d94a9e87528b47d2c60888cb801f2ad

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
c17c86de52c1571e499d4a0a404e78f14edd72d95c99de14fdf790943cef833f
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: ibm-granite <huggingface.co/ibm-granite>Newsgroups: alt.freeweights.graniteSubject: granite-3b-code-base-128kDate: 2026-11-15Commit: ab7f9ccSigned: 2DC28CC7B26A283B ✓
Upstream
ibm-granite/granite-3b-code-base-128k
Pinned commit
ab7f9cc61d94a9e87528b47d2c60888cb801f2ad
Manifest
granite-3b-code-base-128k.json · .minisig
Manifest sha256
05f34a7bdb58da1c24db181d9edf00a6375054079d8e92636696a0cb291fe57a
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 03:48 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-3b-code-base-128k.json $ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-3b-code-base-128k.json.minisig $ minisign -Vm granite-3b-code-base-128k.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

No related models in this catalog.Nothing here lists this model as its parent, and it names no parent.
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ibm-granite/granite-3b-code-base-128k
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. granite-3b-code-base-128k.json. Provenance. Takedown history: none.
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed1
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed2
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed3
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed1
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed2
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed3