model card draft for base models 3.1
Browse files
README.md
CHANGED
@@ -1,3 +1,92 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
library_name: transformers
|
4 |
+
tags:
|
5 |
+
- language
|
6 |
+
- granite-3.1
|
7 |
+
---
|
8 |
+
|
9 |
+
# Granite-3.1-8B-Base
|
10 |
+
|
11 |
+
**Model Summary:**
|
12 |
+
Granite-3.1-8B-Base is a decoder-only language model to support a variety of text-to-text generation tasks. It is trained from scratch following a two-stage training strategy. In the first stage, it is trained on 10 trillion tokens sourced from diverse domains. During the second stage, it is further trained on 2 trillion tokens using a carefully curated mix of high-quality data, aiming to enhance its performance on specific tasks.
|
13 |
+
|
14 |
+
- **Developers:** Granite Team, IBM
|
15 |
+
- **GitHub Repository:** [ibm-granite/granite-3.1-language-models]()
|
16 |
+
- **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
|
17 |
+
- **Paper:** [Granite 3.1 Language Models]()
|
18 |
+
- **Release Date**: December 18th, 2024
|
19 |
+
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
20 |
+
|
21 |
+
**Supported Languages:**
|
22 |
+
English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. Users may finetune Granite 3.1 models for languages beyond these 12 languages.
|
23 |
+
|
24 |
+
**Intended use:**
|
25 |
+
Prominent use cases of LLMs in text-to-text generation include summarization, text classification, extraction, question-answering, and more. All Granite Base models are able to handle these tasks as they were trained on a large amount of data from various domains. Moreover, they can serve as baseline to create specialized models for specific application scenarios.
|
26 |
+
|
27 |
+
**Generation:**
|
28 |
+
This is a simple example of how to use Granite-3.1-8B-Base model.
|
29 |
+
|
30 |
+
Install the following libraries:
|
31 |
+
|
32 |
+
```shell
|
33 |
+
pip install torch torchvision torchaudio
|
34 |
+
pip install accelerate
|
35 |
+
pip install transformers
|
36 |
+
```
|
37 |
+
Then, copy the code snippet below to run the example.
|
38 |
+
|
39 |
+
```python
|
40 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
41 |
+
device = "auto"
|
42 |
+
model_path = "ibm-granite/granite-3.1-8B-base"
|
43 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
44 |
+
# drop device_map if running on CPU
|
45 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
|
46 |
+
model.eval()
|
47 |
+
# change input text as desired
|
48 |
+
input_text = "Where is the Thomas J. Watson Research Center located?"
|
49 |
+
# tokenize the text
|
50 |
+
input_tokens = tokenizer(input_text, return_tensors="pt").to(device)
|
51 |
+
# generate output tokens
|
52 |
+
output = model.generate(**input_tokens,
|
53 |
+
max_length=4000)
|
54 |
+
# decode output tokens into text
|
55 |
+
output = tokenizer.batch_decode(output)
|
56 |
+
# print output
|
57 |
+
print(output)
|
58 |
+
```
|
59 |
+
|
60 |
+
**Model Architecture:**
|
61 |
+
Granite-3.1-8B-Base is based on a decoder-only dense transformer architecture. Core components of this architecture are: GQA and RoPE, MLP with SwiGLU, RMSNorm, and shared input/output embeddings.
|
62 |
+
|
63 |
+
| Model | 2B Dense | 8B Dense | 1B MoE | 3B MoE |
|
64 |
+
| :-------- | :--------| :-------- | :------| :------|
|
65 |
+
| Embedding size | 2048 | **4096** | 1024 | 1536 |
|
66 |
+
| Number of layers | 40 | **40** | 24 | 32 |
|
67 |
+
| Attention head size | 64 | **128** | 64 | 64 |
|
68 |
+
| Number of attention heads | 32 | **32** | 16 | 24 |
|
69 |
+
| Number of KV heads | 8 | **8** | 8 | 8 |
|
70 |
+
| MLP hidden size | 8192 | **12800** | 512 | 512 |
|
71 |
+
| MLP activation | SwiGLU | **SwiGLU** | SwiGLU | SwiGLU |
|
72 |
+
| Number of Experts | — | **—** | 32 | 40 |
|
73 |
+
| MoE TopK | — | **—** | 8 | 8 |
|
74 |
+
| Initialization std | 0.1 | **0.1** | 0.1 | 0.1 |
|
75 |
+
| Sequence Length | 4096 | **4096** | 4096 | 4096 |
|
76 |
+
| Position Embedding | RoPE | **RoPE** | RoPE | RoPE |
|
77 |
+
| # Parameters | 2.5B | **8.1B** | 1.3B | 3.3B |
|
78 |
+
| # Active Parameters | 2.5B | **8.1B** | 400M | 800M |
|
79 |
+
| # Training tokens | 12T | **12T** | 10T | 10T |
|
80 |
+
|
81 |
+
**Training Data:**
|
82 |
+
This model is trained on a mix of open source and proprietary data following a two-stage training strategy.
|
83 |
+
* Stage 1 data: The data for stage 1 is sourced from diverse domains, such as: web, code, academic sources, books, and math data.
|
84 |
+
* Stage 2 data: The data for stage 2 comprises a curated mix of high-quality data from the same domains, plus multilingual and instruction data. The goal of this second training phase is to enhance the model’s performance on specific tasks.
|
85 |
+
|
86 |
+
A detailed attribution of datasets can be found in the [Granite Technical Report]() and [Accompanying Author List]().
|
87 |
+
|
88 |
+
**Infrastructure:**
|
89 |
+
We train Granite 3.1 Language Models using IBM's super computing cluster, Blue Vela, which is outfitted with NVIDIA H100 GPUs. This cluster provides a scalable and efficient infrastructure for training our models over thousands of GPUs while minimizing environmental impact by utilizing 100% renewable energy sources.
|
90 |
+
|
91 |
+
**Ethical Considerations and Limitations:**
|
92 |
+
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-3.1-8B-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, there 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-3.1-8B-Base model with ethical intentions and in a responsible way.
|