Unsloth Dynamic 2.0 achieves superior accuracy & outperforms other leading quants.
Granite-4.0-H-1B-Base
Model Summary:
Granite-4.0-H-1B-Base is a lightweight decoder-only language model designed for scenarios where efficiency and speed are critical. They can run on resource-constrained devices such as smartphones or IoT hardware, enabling offline and privacy-preserving applications. It also supports Fill-in-the-Middle (FIM) code completion through the use of specialized prefix and suffix tokens. The model is trained from scratch on approximately 15 trillion tokens following a four-stage training strategy: 10 trillion tokens in the first stage, 2 trillion in the second, another 2 trillion in the third, and 0.5 trillion in the final stage.
Supported Languages:
English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. Users may fine-tune Granite 4.0 Nano models to support languages beyond those included in this list.
Intended Use:
Prominent use cases of LLMs in text-to-text generation include summarization, text classification, extraction, question-answering and code-completion (including FIM) tasks. Moreover, these lightweight models can serve as baseline to create task-specific models for different applications.
Generation:
This is a simple example of how to use Granite-4.0-H-1B-Base model.
Then, copy the code snippet below to run the example.
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
2device ="cuda"34model_path ="ibm-granite/granite-4.0-h-1b-base"56tokenizer = AutoTokenizer.from_pretrained(model_path)7# drop device_map if running on CPU8model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)9model.eval()10# change input text as desired11input_text ="The capital of France is"12# tokenize the text13input_tokens = tokenizer(input_text, return_tensors="pt").to(device)14# generate output tokens15output = model.generate(**input_tokens, max_length=10)16# decode output tokens into text17output = tokenizer.batch_decode(output)18# print output19print(output[0])
Expected output:
The capital of France is Paris.
Evaluation Results:
Benchmarks
Metric
350M Dense
H 350M Dense
1B Dense
H 1B Dense
General Tasks
MMLU
5-shot
33.08
36.07
59.82
58.71
MMLU-Pro
5-shot,CoT
11.29
10.08
29.96
23.45
BBH
3-shot, CoT
32.19
29.96
57.73
48.45
AGI EVAL
3-shot
28.97
29.2
48.95
47.46
DROP
5-shot
29.77
28.56
58.18
57.18
Math Tasks
GSM8K
8-shot
24.11
24.41
62.4
57.39
Minerva Math
4-shot
9.96
11.5
30.3
21.3
Code Tasks
HumanEval
pass@1 [StarCoder Prompt]
34.6
35.61
68.08
68.26
HumanEval
pass@1
32
34
60
59
HumanEval+
pass@1
29
29
57
56
MBPP
pass@1
45
17
72
65
MBPP+
pass@1
38
16
60
54
Multilingual Tasks
MMMLU
5-shot
30.93
31.02
46.73
48.55
INCLUDE
5-shot
27.32
29.26
42.6
43.8
MGSM
8-shot
13.92
15.12
46.96
41.52
Multilingual Benchmarks and thr included languages:
Benchmarks
# Langs
Languages
MMMLU
11
ar, de, en, es, fr, ja, ko, pt, zh, bn, hi
INCLUDE
14
hi, bn, ta, te, ar, de, es, fr, it, ja, ko, nl, pt, zh
MGSM
5
en, es, fr, ja, zh
Model Architecture:
Granite-4.0-H-1B-Base is based on a decoder-only dense transformer architecture. Core components of this architecture are: GQA, Mamba2, MLP with SwiGLU, RMSNorm, and shared input/output embeddings.
Model
350M Dense
H 350M Dense
1B Dense
H 1B Dense
Embedding size
1024
768
2048
1536
Number of layers
28 attention
4 attention / 28 Mamba2
40 attention
4 attention / 36 Mamba2
Attention head size
64
64
128
128
Number of attention heads
16
12
16
12
Number of KV heads
4
4
4
4
Mamba2 state size
-
128
-
128
Number of Mamba2 heads
-
48
-
48
MLP / Shared expert hidden size
2048
2048
4096
4096
Num. Experts
-
-
-
-
Num. active Experts
-
-
-
-
Expert hidden size
-
-
-
-
MLP activation
SwiGLU
SwiGLU
SwiGLU
SwiGLU
Sequence length
32K
32K
128K
128K
Position embedding
RoPE
NoPE
RoPE
NoPE
# Parameters
350M
340M
1.6B
1.5B
# Active parameters
350M
340M
1.6B
1.5B
Training Data: This model is trained on a mix of open source and proprietary data following a four-stage training strategy.
Stage
Characteristics
350M Dense
H 350M Dense
1B Dense
H 1B Dense
I
General mixture of training data, warmup, and power scheduler for learning rate.
10
10
10
10
II
General mixture of training data with higher percentages of code and math with power scheduler for learning rate.
2
2
2
2
III
High quality training data, exponential decay of learning rate.
2
2
2
2
IV
High quality training data, linear decay to zero for learning rate.
0.5
0.5
0.5
0.5
Infrastructure:
We trained the Granite 4.0 Nano Language Models utilizing an NVIDIA GB200 NVL72 cluster hosted in CoreWeave. Intra-rack communication occurs via the 72-GPU NVLink domain, and a non-blocking, full Fat-Tree NDR 400 Gb/s InfiniBand network provides inter-rack communication. This cluster provides 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, including but not limited to: bias and fairness, misinformation, and autonomous decision-making. Granite-4.0-H-1B-Base model is not the exception in this regard. Even though this model is suited for multiple generative AI tasks, it has not undergone any safety alignment; therefore, it may produce problematic outputs. Additionally, it remains uncertain whether smaller models might exhibit increased susceptibility to hallucination in generation scenarios by copying text 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-4.0-H-1B-Base model with ethical intentions and in a responsible way.