MPT-30B-Chat W8A8-GPTQ Quantized
This is an 8-bit weight, 8-bit activation (W8A8) GPTQ-quantized version of the original MPT-30B-Chat model from MosaicML. The model has been quantized using GPTQModel to reduce memory requirements while maintaining excellent 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
- Balanced Performance: 8-bit quantization offers excellent quality with good memory savings
- Better Quality: Higher precision than 4-bit while still reducing memory usage significantly
- Stable Inference: More numerically stable than 4-bit quantization
- Wide Compatibility: Works well across different hardware configurations
Quantization Details
- Method: GPTQ (8-bit weights and 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-w8a8-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 for 8-bit
gptq_config = GPTQConfig(
bits=8,
group_size=128,
desc_act=False
)
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"adamrb/mpt-30b-chat-w8a8-gptq",
device_map="auto",
torch_dtype=torch.float16,
quantization_config=gptq_config,
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"adamrb/mpt-30b-chat-w8a8-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-w8a8-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-w8a8-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 |
W8A8 GPTQ | ~30GB | ~32GB | ~30GB |
W4A16 GPTQ | ~15GB | ~16GB | ~15GB |
Quality vs Efficiency Trade-off
- W8A8: Better quality retention, moderate memory savings
- W4A16: Maximum memory savings, slight quality trade-off
Hardware Requirements
- Minimum VRAM: 32GB (for basic inference)
- Recommended VRAM: 40GB+ (for optimal performance)
- Supported GPUs: A6000, RTX 6000 Ada, A100, H100, etc.
Model Description
The architecture is a modification of a standard decoder-only transformer, now optimized with 8-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 8-bit weights and activations
Hyperparameter | Value |
---|---|
n_parameters | 29.95B |
n_layers | 48 |
n_heads | 64 |
d_model | 7168 |
vocab size | 50432 |
sequence length | 8192 |
quantization | 8-bit weights and activations |
group size | 128 |
Quantization Configuration
{
"bits": 8,
"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% |
Use Cases
When to Choose W8A8 over W4A16:
- Quality Priority: When you need the best possible quality retention
- Moderate Memory Constraints: When you have sufficient VRAM but want some memory savings
- Stable Inference: When numerical stability is important for your application
- Production Deployment: When you need a balance of efficiency and reliability
When to Choose W4A16 instead:
- Extreme Memory Constraints: When VRAM is very limited
- Maximum Throughput: When you need to serve many concurrent requests
- Edge Deployment: When running on resource-constrained hardware
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:
- 8-bit quantization provides better numerical stability than 4-bit
- Quality retention is excellent compared to the original model
- Performance may vary across different hardware configurations
Troubleshooting
Common Issues
- CUDA Out of Memory: This model requires more VRAM than the 4-bit version
- Slow Inference: Ensure you're using the appropriate quantization backend for your hardware
- Quality Issues: Try different sampling parameters (temperature, top_p, top_k)
Performance Tips
- Use
torch.compile()
for faster inference on compatible PyTorch versions - Enable FlashAttention with
attn_impl='triton'
for better memory efficiency - Use mixed precision (fp16/bf16) for optimal performance
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-w8a8-gptq
Base model
mosaicml/mpt-30b-chat