Granite 3.1 8B
Model Card
View on HuggingFaceGranite-3.1-8B-Instruct
Model Summary: Granite-3.1-8B-Instruct is a 8B parameter long-context instruct model finetuned from Granite-3.1-8B-Base using a combination of open source instruction datasets with permissive license and internally collected synthetic datasets tailored for solving long context problems. This model is developed using a diverse set of techniques with a structured chat format, including supervised finetuning, model alignment using reinforcement learning, and model merging.
- Developers: Granite Team, IBM
- GitHub Repository: ibm-granite/granite-3.1-language-models
- Website: Granite Docs
- Paper: Granite 3.1 Language Models (coming soon)
- Release Date: December 18th, 2024
- License: Apache 2.0
Supported Languages: 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.
Intended Use: The model is designed to respond to general instructions and can be used to build AI assistants for multiple domains, including business applications.
Capabilities
- Summarization
- Text classification
- Text extraction
- Question-answering
- Retrieval Augmented Generation (RAG)
- Code related tasks
- Function-calling tasks
- Multilingual dialog use cases
- Long-context tasks including long document/meeting summarization, long document QA, etc.
Generation: This is a simple example of how to use Granite-3.1-8B-Instruct model.
Install the following libraries:
pip install torch torchvision torchaudio
pip install accelerate
pip install transformers
Then, copy the snippet from the section that is relevant for your use case.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "auto"
model_path = "ibm-granite/granite-3.1-8b-instruct"
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
chat = [
{ "role": "user", "content": "Please list one IBM Research laboratory located in the United States. You should only output its name and location." },
]
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
# tokenize the text
input_tokens = tokenizer(chat, return_tensors="pt").to(device)
# generate output tokens
output = model.generate(**input_tokens,
max_new_tokens=100)
# decode output tokens into text
output = tokenizer.batch_decode(output)
# print output
print(output)
Evaluation Results:
<table> <caption><b>HuggingFace Open LLM Leaderboard V1</b></caption> <thead> <tr> <th style="text-align:left; background-color: #001d6c; color: white;">Models</th> <th style="text-align:center; background-color: #001d6c; color: white;">ARC-Challenge</th> <th style="text-align:center; background-color: #001d6c; color: white;">Hellaswag</th> <th style="text-align:center; background-color: #001d6c; color: white;">MMLU</th> <th style="text-align:center; background-color: #001d6c; color: white;">TruthfulQA</th> <th style="text-align:center; background-color: #001d6c; color: white;">Winogrande</th> <th style="text-align:center; background-color: #001d6c; color: white;">GSM8K</th> <th style="text-align:center; background-color: #001d6c; color: white;">Avg</th> </tr></thead> <tbody> <tr> <td style="text-align:left; background-color: #DAE8FF; color: black;">Granite-3.1-8B-Instruct</td> <td style="text-align:center; background-color: #DAE8FF; color: black;">62.62</td> <td style="text-align:center; background-color: #DAE8FF; color: black;">84.48</td> <td style="text-align:center; background-color: #DAE8FF; color: black;">65.34</td> <td style="text-align:center; background-color: #DAE8FF; color: black;">66.23</td> <td style="text-align:center; background-color: #DAE8FF; color: black;">75.37</td> <td style="text-align:center; background-color: #DAE8FF; color: black;">73.84</td> <td style="text-align:center; background-color: #DAE8FF; color: black;">71.31</td> </tr> <tr> <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">Granite-3.1-2B-Instruct</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">54.61</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">75.14</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">55.31</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">59.42</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">67.48</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">52.76</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">60.79</td> </tr> <tr> <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">Granite-3.1-3B-A800M-Instruct</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">50.42</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">73.01</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">52.19</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">49.71</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">64.87</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">48.97</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">56.53</td> </tr> <tr> <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">Granite-3.1-1B-A400M-Instruct</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">42.66</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">65.97</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">26.13</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">46.77</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">62.35</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">33.88</td> <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">46.29</td> </tr> </tbody></table>...
Quantizations & VRAM
Benchmarks (8)
GPUs that can run this model
At Q4_K_M quantization. Sorted by minimum VRAM.
Find the best GPU for Granite 3.1 8B
Build Hardware for Granite 3.1 8B