Granite-3.1-2B-Reasoning-4bit (Quantized for Efficiency)
Model Overview
This is a 4-bit quantized version of ruslanmv/granite-3.1-2b-Reasoning, which is fine-tuned from ibm-granite/granite-3.1-2b-instruct. The quantization allows for significantly reduced memory usage while maintaining strong reasoning capabilities.
This 4-bit quantized model is ideal for users who require fast inference speeds and reduced memory usage while still benefiting from Granite's advanced reasoning capabilities.
✅ 2x Faster Training compared to standard methods
✅ Lower VRAM usage, ideal for consumer GPUs
✅ Optimized for inference, making it more efficient for deployment
Installation & Usage
To run the quantized model, install the required dependencies:
Use the following Python snippet to load and generate text with the 4-bit quantized model:
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3import bitsandbytes as bnb
45device ="cuda"if torch.cuda.is_available()else"cpu"6model_path ="ruslanmv/granite-3.1-2b-Reasoning-4bit"78tokenizer = AutoTokenizer.from_pretrained(model_path)9model = AutoModelForCausalLM.from_pretrained(10 model_path,11 device_map="auto",12 load_in_4bit=True,# Load model in 4-bit precision13 quantization_config=bnb.QuantizationConfig(llm_int8_threshold=6.0)14)15model.eval()1617input_text ="Can you explain the difference between inductive and deductive reasoning?"18input_tokens = tokenizer(input_text, return_tensors="pt").to(device)1920output = model.generate(**input_tokens, max_length=4000)21output_text = tokenizer.batch_decode(output)2223print(output_text)
Intended Use
Granite-3.1-2B-Reasoning-4bit is designed for tasks requiring structured reasoning, including:
Logical and analytical problem-solving
Text-based reasoning tasks
Mathematical and symbolic reasoning
Advanced instruction-following
This model is particularly useful for users needing a lightweight, high-performance version of Granite-3.1-2B-Reasoning without sacrificing too much accuracy.
License & Acknowledgments
This model is released under the Apache 2.0 license. It is fine-tuned from IBM’s Granite 3.1-2B-Instruct model and quantized using bitsandbytes for optimal efficiency. Special thanks to the IBM Granite Team for developing the base model.