Downloads · 30 days
46
0% of all-time downloads
2imi9/gpt-oss-20B-NVFP4A16-BF16
gpt-oss-20B-NVFP4A16-BF16 is a text generation model from 2imi9. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
- Model Architecture: openai/gpt-oss-20b (Mixture of Experts, 128K context) - Parameters: 20 billion (quantized from original MXFP4 to NVFP4) - Input: Text - Output: Text - Model Optimizations: - Weight quantization:…
Downloads · 30 days
46
0% of all-time downloads
All-time downloads
15.7K
Public
Parameters
20.9B
41.9 GB on disk
Likes
5
Public
Click a slice to open those files.
.safetensors41.8 GB · 100%
From the Hugging Face model README
This model is a quantized version of OpenAI's GPT-OSS-20B using NVIDIA's advanced NVFP4 format. It follows the official NVIDIA TensorRT Model Optimizer methodology, providing superior accuracy retention compared to MXFP4 quantization while maintaining significant memory efficiency gains.
vLLM v0.13.0+ now includes native NVFP4 support via the EPLB (Expert-Parallel Load Balancing) system.
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
model_id = "2imi9/gpt-oss-20b-NVFP4"
# Initialize model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
llm = LLM(
model=model_id,
tensor_parallel_size=1,
trust_remote_code=True,
quantization="nvfp4" # Enable NVFP4 quantization
)
# Configure sampling
sampling_params = SamplingParams(
temperature=0.7,
top_p=0.9,
max_tokens=512
)
# Chat template example
messages = [
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = llm.generate([prompt], sampling_params)
print(outputs[0].outputs[0].text)
from vllm import LLM, SamplingParams
model_id = "2imi9/gpt-oss-20b-NVFP4"
# Multi-GPU with tensor parallelism
llm = LLM(
model=model_id,
tensor_parallel_size=2, # Use 2 GPUs
trust_remote_code=True,
quantization="nvfp4",
max_model_len=32768 # Adjust based on available VRAM
)
sampling_params = SamplingParams(
temperature=0.7,
top_p=0.9,
max_tokens=1024
)
outputs = llm.generate(["Your prompt here"], sampling_params)
# Start vLLM server with NVFP4 model
python -m vllm.entrypoints.openai.api_server \
--model 2imi9/gpt-oss-20b-NVFP4 \
--quantization nvfp4 \
--tensor-parallel-size 1 \
--max-model-len 32768 \
--trust-remote-code \
--host 0.0.0.0 \
--port 8000
# Client usage
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
response = client.chat.completions.create(
model="2imi9/gpt-oss-20b-NVFP4",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
],
temperature=0.7,
max_tokens=512
)
print(response.choices[0].message.content)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "2imi9/gpt-oss-20b-NVFP4"
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
# Generate text
prompt = "The future of artificial intelligence will"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This model was created using the official NVIDIA methodology with TensorRT Model Optimizer:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
import modelopt.torch.quantization as mtq
# Load base model (upcast from original MXFP4 to BF16)
MODEL_ID = "openai/gpt-oss-20b"
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
# Configure NVFP4 quantization
config = mtq.NVFP4_DEFAULT_CFG
# Calibration for optimal quantization
def forward_loop(model):
calibration_prompts = [
"The future of artificial intelligence is",
"Machine learning has transformed",
"Deep learning models are capable of"
]
model.eval()
with torch.no_grad():
for prompt in calibration_prompts:
inputs = tokenizer(
prompt,
return_tensors="pt",
max_length=512,
truncation=True
).to(model.device)
model(**inputs)
# Apply quantization
model = mtq.quantize(model, config, forward_loop)
# Save quantized model
model.save_pretrained("/path/to/output", safe_serialization=True)
tokenizer.save_pretrained("/path/to/output")
| Metric | Value |
|---|---|
| Method | Post-Training Quantization (PTQ) with NVFP4 |
| Accuracy Retention | Superior to MXFP4 with 2-3% better validation loss |
| Memory Efficiency | ~75% reduction from original model size |
| Precision | W4A16 (4-bit weights, 16-bit activations) |
The latest vLLM release includes comprehensive NVFP4 support:
Based on NVIDIA research findings:
For production use requiring maximum accuracy, NVIDIA recommends:
This approach can achieve up to 98% task-specific performance recovery.
| Hardware | Details |
|---|---|
| GPU | NVIDIA Blackwell architecture |
| Consumer | RTX 5000 series |
| Data Center | H200, B200, GB200, GB300 |
| Compute | Up to 15 PFLOPs of FP4 compute (Blackwell Ultra) |
| Memory | 24GB+ VRAM recommended |
| CUDA | 12.0+ (CUDA 13 for GB300) |
| Hardware | Notes |
|---|---|
| RTX 4090 | Ada Lovelace (software emulation) |
| RTX 4080/4070 | Compatible via software emulation |
| H100, A100 | Data center (software emulation) |
| Memory | 20GB+ VRAM for model loading |
| Framework | Status |
|---|---|
| vLLM | ✅ Full NVFP4 support (v0.13.0+) |
| TensorRT-LLM | ✅ Native NVFP4 support |
| SGLang | 🔄 NVFP4 support on roadmap |
| Transformers | ✅ BF16 fallback compatible |
| Property | Value |
|---|---|
| Storage Format | BF16 with NVFP4 quantization metadata |
| File Size | ~39GB (BF16 precision with quantization instructions) |
| Deployment Format | Runtime conversion to NVFP4 by vLLM/TensorRT-LLM |
| Deployed Size | ~10GB when converted to 4-bit NVFP4 format |
| File Format | SafeTensors with embedded quantization configuration |
This model contains the full BF16 weights along with quantization parameters that enable inference engines like vLLM and TensorRT-LLM to convert weights to true 4-bit NVFP4 format during model loading. The memory savings and performance benefits are realized at inference time, not during storage.
| Aspect | Expectation |
|---|---|
| Accuracy | Minimal degradation from original model |
| Speed | Significant acceleration on Blackwell GPUs |
| Memory | ~75% reduction in deployment memory requirements |
| Compatibility | Full vLLM support, optimized for NVIDIA frameworks |
This model maintains the capabilities of the original GPT-OSS-20B while providing memory efficiency benefits. For comprehensive evaluation, test against:
This model inherits the Apache 2.0 license from the base openai/gpt-oss-20b model. Commercial use is permitted under the same terms.
@misc{gpt-oss-20b-nvfp4-2025,
title={GPT-OSS-20B-NVFP4: NVIDIA NVFP4 Quantized Large Language Model},
author={2imi9},
year={2025},
url={https://huggingface.co/2imi9/gpt-oss-20b-NVFP4}
}