Instructions to use PureTensorAI/Jais-3-7B-NVFP4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PureTensorAI/Jais-3-7B-NVFP4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PureTensorAI/Jais-3-7B-NVFP4A16", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("PureTensorAI/Jais-3-7B-NVFP4A16", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PureTensorAI/Jais-3-7B-NVFP4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PureTensorAI/Jais-3-7B-NVFP4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PureTensorAI/Jais-3-7B-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PureTensorAI/Jais-3-7B-NVFP4A16
- SGLang
How to use PureTensorAI/Jais-3-7B-NVFP4A16 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "PureTensorAI/Jais-3-7B-NVFP4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PureTensorAI/Jais-3-7B-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "PureTensorAI/Jais-3-7B-NVFP4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PureTensorAI/Jais-3-7B-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PureTensorAI/Jais-3-7B-NVFP4A16 with Docker Model Runner:
docker model run hf.co/PureTensorAI/Jais-3-7B-NVFP4A16
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("PureTensorAI/Jais-3-7B-NVFP4A16", trust_remote_code=True, device_map="auto")Jais-3-7B NVFP4A16 (GPTQ, weights only, Arabic and English calibration)
NVFP4 quantization of inception42/Jais-3-7B, made by PureTensor from the official BF16 weights. Weights are 4-bit; activations stay 16-bit (W4A16). The file is 8.01 GB against 18.00 GB for BF16.
This is a test release. It is not affiliated with or endorsed by the model's authors.
Read this first: on ArabicMMLU and GSM8K this checkpoint is statistically indistinguishable from BF16. On English MMLU it is 0.8 points lower, a small but significant difference. In our test it served about twice as fast as BF16 on vLLM.
What was done
| Source | inception42/Jais-3-7B, BF16 |
| Format | compressed-tensors nvfp4-pack-quantized, scheme NVFP4A16: 4-bit E2M1 values, one FP8 E4M3 scale per group of 16, one FP32 scale per tensor |
| Quantized | the weights of every Linear layer in the 36 transformer blocks |
| Kept in BF16 | token embeddings and output head, all norms, all activations |
| Method | GPTQ (block_size 128, dampening_frac 0.01, actorder static) |
| Calibration | 2,048 chat-formatted samples, up to 2,048 tokens each: 1,024 Arabic instruction and answer pairs (the first rows of arbml/CIDAR) and 1,024 from mlabonne/open-perfectblend |
| Tools | llm-compressor 0.15.0, compressed-tensors 0.20.1, transformers 5.21.0, torch 2.14.1 |
The base model's chat template requires a thinking field on assistant turns. For calibration and evaluation text we passed an empty reasoning_content.
Measured quality
One harness, BF16 as reference. The saved checkpoint reloaded from disk to logits identical to the in-memory quantized model, and the benchmarks below were run on the reloaded file.
| BF16 | This checkpoint | Change | Paired test | |
|---|---|---|---|---|
| ArabicMMLU, accuracy (14,455 questions) | 68.51 | 68.38 | -0.13 | 565 lost, 546 gained, p = 0.59 |
| GSM8K, exact match (1,319 problems) | 85.60 | 84.08 | -1.52 | 70 lost, 50 gained, p = 0.08 |
| MMLU, accuracy (14,042 questions) | 73.54 | 72.75 | -0.79 | 465 lost, 353 gained, p = 1e-4 |
| WikiText-2 perplexity (131,072 tokens) | 10.13 | 10.42 | +0.29 |
| Text | Tokens | Mean KL divergence | 99th percentile KL | Same top token as BF16 |
|---|---|---|---|---|
| WikiText-2 test (English) | 131,072 | 0.038 | 0.33 | 90.4% |
Chat (HuggingFaceH4/ultrachat_200k, test_sft, 256 conversations, English) |
238,748 | 0.076 | 1.11 | 91.3% |
Arabic (arbml/CIDAR, 256 pairs from row 9,000 on) |
64,040 | 0.057 | 0.71 | 90.8% |
- Benchmarks: default
arabicmmlu,mmluandgsm8kconfigurations of lm-evaluation-harness 0.4.13, no chat template, GSM8K flexible-extract. The paired test is an exact McNemar test on per-question correctness. - KL divergence: full next-token distribution, teacher-forced, windows of 1,024 tokens. The Arabic and chat sets share a dataset family with the calibration data (different rows), so those two rows are flattering; ArabicMMLU, MMLU and WikiText are unrelated to it.
- A caution from our other experiments: benchmark scores move by a point or two between calibration draws of the same recipe. The MMLU difference here is real for this file but small enough that another draw could land on either side.
On a real serving engine
Served with vLLM 0.34.0 on one NVIDIA Blackwell workstation GPU (compute capability 12.0), using vLLM's weight-only FP4 kernel (MarlinNvFp4LinearKernel).
| BF16 | This checkpoint | |
|---|---|---|
| GSM8K through the completions API (flexible-extract) | 85.44 | 84.23 |
| Throughput, single stream | 1.00x | 2.08x |
| Throughput, 8 concurrent | 1.00x | 2.08x |
| Throughput, 32 concurrent | 1.00x | 1.86x |
Throughput is fixed 256-token greedy generations and will differ on other hardware.
Usage
vLLM:
vllm serve PureTensorAI/Jais-3-7B-NVFP4A16 --trust-remote-code
Transformers (requires pip install compressed-tensors):
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "PureTensorAI/Jais-3-7B-NVFP4A16"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.bfloat16).to("cuda")
msgs = [{"role": "user", "content": "لخّص دورة الماء في جملتين."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to("cuda")
out = model.generate(**ids, max_new_tokens=256)
print(tok.decode(out[0, ids["input_ids"].shape[1]:], skip_special_tokens=True))
Limitations
- In Transformers the weights are expanded back to 16-bit at load, so there the saving is disk and download size only. The speed gain needs an engine with an FP4 weight kernel, such as vLLM.
- One calibration draw, no repeated seeds. No safety, dialect, or long-context evaluation was run on the quantized model.
- Keep the tokenizer's default behaviour. All calibration text and all benchmarks here begin with the start-of-text token, which this model's tokenizer adds by default. The 0.9B model of this family, whose tokenizer does not add it, failed completely on prompts without that token when quantized the same way, while working normally with it. We have not tested this checkpoint without the start-of-text token.
License
Apache-2.0, as the base model. Changes from the base release: the Linear weights are quantized to NVFP4 and stored packed, and config.json gains a quantization_config block.
- Downloads last month
- 49
Model tree for PureTensorAI/Jais-3-7B-NVFP4A16
Base model
inception42/Jais-3-7B
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PureTensorAI/Jais-3-7B-NVFP4A16", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)