MPT-30B-Chat W4A16-GPTQ Quantized
This is a 4-bit weight, 16-bit activation (W4A16) GPTQ-quantized version of the original MPT-30B-Chat model from MosaicML. The model has been quantized using GPTQModel to significantly reduce memory requirements while maintaining high performance.
MPT-30B-Chat is a chatbot-like model for dialogue generation. It was built by finetuning MPT-30B on the ShareGPT-Vicuna, Camel-AI, GPTeacher, Guanaco, Baize and some generated datasets.
- License: CC-By-NC-SA-4.0 (non-commercial use only)
This model was trained by MosaicML and quantized by adamrb using GPTQModel.
Quantization Benefits
- 73% Size Reduction: From ~58GB to ~15GB
- 4x Memory Efficiency: Significantly reduced VRAM requirements
- Maintained Quality: Minimal quality loss compared to the original model
- Fast Inference: Optimized for efficient inference with various backends
Quantization Details
- Method: GPTQ (4-bit weights, 16-bit activations)
- Group Size: 128
- Calibration Dataset: HuggingFaceH4/ultrachat_200k (20 samples)
- Quantization Library: GPTQModel v2.2.0+
- Supported Kernels: MarlinQuantLinear, TritonV2QuantLinear, TorchQuantLinear
Model Date
June 22, 2023 (Original), Quantized: July 2025
Model License
CC-By-NC-SA-4.0 (non-commercial use only)
Documentation
- Blog post: Raising the bar for open-source foundation models
- Codebase (mosaicml/llm-foundry repo)
- GPTQModel Documentation
- Questions: Feel free to contact us via the MosaicML Community Slack!
How to Use
With GPTQModel (Recommended)
from gptqmodel import GPTQModel
# Load the quantized model
model = GPTQModel.load(
"adamrb/mpt-30b-chat-w4a16-gptq",
device="cuda:0",
trust_remote_code=True
)
# Generate text
result = model.generate("Hello, my name is")[0]
print(model.tokenizer.decode(result))
With Transformers + AutoGPTQ
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GPTQConfig
# Configure GPTQ
gptq_config = GPTQConfig(
bits=4,
group_size=128,
desc_act=False
)
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"adamrb/mpt-30b-chat-w4a16-gptq",
device_map="auto",
torch_dtype=torch.float16,
quantization_config=gptq_config,
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"adamrb/mpt-30b-chat-w4a16-gptq",
trust_remote_code=True
)
# Generate text
inputs = tokenizer("Hello, how can I help you today?", return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.7,
pad_token_id=tokenizer.eos_token_id
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
With vLLM (High Performance Inference)
from vllm import LLM, SamplingParams
# Initialize vLLM with GPTQ quantization
llm = LLM(
model="adamrb/mpt-30b-chat-w4a16-gptq",
quantization="gptq",
dtype="float16",
trust_remote_code=True,
max_model_len=4096
)
# Set up sampling parameters
sampling_params = SamplingParams(
temperature=0.7,
top_p=0.9,
max_tokens=100
)
# Generate text
prompts = ["Hello, my name is", "The future of AI is"]
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
print(f"Generated text: {output.outputs[0].text}")
Note: This model requires that trust_remote_code=True
be passed to the loading methods. This is because we use a custom MPT
model architecture.
Chat Template
This model uses a specific chat template. Here's how to format conversations:
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("adamrb/mpt-30b-chat-w4a16-gptq")
messages = [
{"role": "user", "content": "What is the capital of France?"},
{"role": "assistant", "content": "The capital of France is Paris."},
{"role": "user", "content": "What is its population?"}
]
formatted_chat = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print(formatted_chat)
Model Performance
Memory Usage Comparison
Model Version | Size | VRAM Usage (FP16) | VRAM Usage (BF16) |
---|---|---|---|
Original FP16 | ~58GB | ~60GB | ~58GB |
W4A16 GPTQ | ~15GB | ~16GB | ~15GB |
Hardware Requirements
- Minimum VRAM: 16GB (for basic inference)
- Recommended VRAM: 24GB+ (for optimal performance)
- Supported GPUs: RTX 3090, RTX 4090, A100, H100, etc.
Model Description
The architecture is a modification of a standard decoder-only transformer, now optimized with 4-bit quantization.
The model has been modified from a standard transformer in the following ways:
- It uses FlashAttention
- It uses ALiBi (Attention with Linear Biases) and does not use positional embeddings
- It does not use biases
- Quantized with GPTQ for 4-bit weights
Hyperparameter | Value |
---|---|
n_parameters | 29.95B |
n_layers | 48 |
n_heads | 64 |
d_model | 7168 |
vocab size | 50432 |
sequence length | 8192 |
quantization | 4-bit weights, 16-bit activations |
group size | 128 |
Quantization Configuration
{
"bits": 4,
"group_size": 128,
"damp_percent": 0.1,
"desc_act": false,
"static_groups": false,
"sym": true,
"true_sequential": true,
"model_name_or_path": null,
"model_file_base_name": "model"
}
Training Data Mix
The original model was trained on the following data mix:
Data Source | Number of Tokens in Source | Proportion |
---|---|---|
Airoboros/GPT4-1.2 | 26.4M | 1.71% |
Baize | 55.0M | 3.57% |
Camel | 301M | 19.54% |
GPTeacher | 7.56M | 0.49% |
Guanaco | 15.6M | 1.02% |
LongCoversations | 18.4M | 1.19% |
ShareGPT | 821M | 53.24% |
WizardLM | 297M | 19.23% |
Limitations and Biases
The following language is modified from EleutherAI's GPT-NeoX-20B
MPT-30B-Chat can produce factually incorrect output, and should not be relied on to produce factually accurate information. MPT-30B-Chat was trained on various public datasets. While great efforts have been taken to clean the pretraining data, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
Additional Quantization Considerations:
- Quantization may introduce minor numerical differences in outputs
- Performance may vary across different hardware configurations
- Some edge cases might show slightly different behavior compared to the full-precision model
Troubleshooting
Common Issues
- CUDA Out of Memory: Reduce batch size or use gradient checkpointing
- Slow Inference: Ensure you're using the appropriate quantization backend for your hardware
- Quality Issues: Try different sampling parameters (temperature, top_p, top_k)
Backend Selection
GPTQModel automatically selects the best backend for your hardware:
- MarlinQuantLinear: Best for A100/H100 GPUs
- TritonV2QuantLinear: Good for modern GPUs with Triton support
- TorchQuantLinear: Universal fallback, works on all GPUs
Acknowledgements
This model was finetuned by Sam Havens and the MosaicML NLP team. GPTQ quantization by adamrb using GPTQModel.
Disclaimer
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
Citation
Please cite this model using the following format:
@online{MosaicML2023Introducing,
author = {MosaicML NLP Team},
title = {Introducing MPT-30B: Raising the bar for open-source foundation models},
year = {2023},
url = {www.mosaicml.com/blog/mpt-30b},
note = {Accessed: 2023-06-22},
urldate = {2023-06-22}
}
For the quantization method, please also cite:
@article{frantar-gptq,
title={{GPTQ}: Accurate Post-training Compression for Generative Pretrained Transformers},
author={Elias Frantar and Saleh Ashkboos and Torsten Hoefler and Dan Alistarh},
journal={arXiv preprint arXiv:2210.17323},
year={2022}
}
- Downloads last month
- -
Model tree for adamrb/mpt-30b-chat-w4a16-gptq
Base model
mosaicml/mpt-30b-chat