Qwen3-32B model quantized with torchao float8 dynamic activation and float8 weight quantization (per row granularity), by PyTorch team. Use it directly, or serve using vLLM with 47% VRAM reduction (34.54 GB needed), around 1.7x speedup and little to no accuracy impact on H100.
Inference with vLLM
Shell
1# Server
2VLLM_DISABLE_COMPILE_CACHE=1 vllm serve pytorch/Qwen3-32B-FP8 --tokenizer Qwen/Qwen3-32B -O3
Shell
1# Client
2curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
3 "model": "pytorch/Qwen3-32B-FP8",
4 "messages": [
5 {"role": "user", "content": "Give me a short introduction to large language models."}
6 ],
7 "temperature": 0.6,
8 "top_p": 0.95,
9 "top_k": 20,
10 "max_tokens": 32768
11}'
Inference with transformers
Py
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
34model_name = "pytorch/Qwen3-32B-FP8"
56# load the tokenizer and the model
7tokenizer = AutoTokenizer.from_pretrained(model_name)
8model = AutoModelForCausalLM.from_pretrained(
9 model_name,
10 torch_dtype="auto",
11 device_map="auto"
12)
1314# prepare the model input
15prompt = "Give me a short introduction to large language model."
16messages = [
17 {"role": "user", "content": prompt}
18]
19text = tokenizer.apply_chat_template(
20 messages,
21 tokenize=False,
22 add_generation_prompt=True,
23 enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
24)
25model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
2627# conduct text completion
28generated_ids = model.generate(
29 **model_inputs,
30 max_new_tokens=32768
31)
32output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
3334# parsing thinking content
35try:
36 # rindex finding 151668 (</think>)
37 index = len(output_ids) - output_ids[::-1].index(151668)
38except ValueError:
39 index = 0
4041thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
42content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
4344print("thinking content:", thinking_content)
45print("content:", content)
Abstract: We present TorchAO, a PyTorch-native model optimization framework leveraging quantization and sparsity to provide an end-to-end, training-to-serving workflow for AI models. TorchAO supports a variety of popular model optimization techniques, including FP8 quantized training, quantization-aware training (QAT), post-training quantization (PTQ), and 2:4 sparsity, and leverages a novel tensor subclass abstraction to represent a variety of widely-used, backend agnostic low precision data types, including INT4, INT8, FP8, MXFP4, MXFP6, and MXFP8. TorchAO integrates closely with the broader ecosystem at each step of the model optimization pipeline, from pre-training (TorchTitan) to fine-tuning (TorchTune, Axolotl) to serving (HuggingFace, vLLM, SGLang, ExecuTorch), connecting an otherwise fragmented space in a single, unified workflow. TorchAO has enabled recent launches of the quantized Llama 3.2 1B/3B and LlamaGuard3-8B models and is open-source at this https URL .
PyTorch has not performed safety evaluations or red teamed the quantized models. Performance characteristics, outputs, and behaviors may differ from the original models. Users are solely responsible for selecting appropriate use cases, evaluating and mitigating for accuracy, safety, and fairness, ensuring security, and complying with all applicable laws and regulations.
Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the licenses the models are released under, including any limitations of liability or disclaimers of warranties provided therein.