Instructions to use PureTensorAI/Jais-3-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-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-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-3.7B-NVFP4A16", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PureTensorAI/Jais-3-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-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-3.7B-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PureTensorAI/Jais-3-3.7B-NVFP4A16
- SGLang
How to use PureTensorAI/Jais-3-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-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-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-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-3.7B-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PureTensorAI/Jais-3-3.7B-NVFP4A16 with Docker Model Runner:
docker model run hf.co/PureTensorAI/Jais-3-3.7B-NVFP4A16
Jais-3-3.7B NVFP4A16 (GPTQ, weights only, Arabic and English calibration)
NVFP4 quantization of inception42/Jais-3-3.7B, made by PureTensor from the official BF16 weights. Weights are 4-bit; activations stay 16-bit (W4A16). The file is 4.69 GB against 10.12 GB for BF16.
This is a test release. It is not affiliated with or endorsed by the model's authors.
Read this first: this checkpoint was calibrated on half Arabic, half English text. On ArabicMMLU and GSM8K it is statistically indistinguishable from BF16. On English MMLU it is 4.0 points lower. In our test it served about 1.8 times faster than BF16 on vLLM.
What was done
| Source | inception42/Jais-3-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 (about a quarter of the parameters, which is why the file is 2.2 times smaller, not 3.5), 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.
| BF16 | This checkpoint | Change | Paired test | |
|---|---|---|---|---|
| ArabicMMLU, accuracy (14,455 questions) | 61.56 | 61.81 | +0.25 | 675 lost, 712 gained, p = 0.33 |
| GSM8K, exact match (1,319 problems) | 79.45 | 79.23 | -0.22 | 79 lost, 76 gained, p = 0.87 |
| MMLU, accuracy (14,042 questions) | 68.28 | 64.28 | -4.00 | 1,024 lost, 462 gained, p = 4e-49 |
| WikiText-2 perplexity (131,072 tokens) | 11.67 | 12.21 | +0.54 |
| Text | Tokens | Mean KL divergence | 99th percentile KL | Same top token as BF16 |
|---|---|---|---|---|
| WikiText-2 test (English) | 131,072 | 0.047 | 0.37 | 88.9% |
Chat (HuggingFaceH4/ultrachat_200k, test_sft, 256 conversations, English) |
238,748 | 0.061 | 0.85 | 90.9% |
Arabic (arbml/CIDAR, 256 pairs from row 9,000 on) |
64,040 | 0.048 | 0.81 | 91.4% |
- 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 KL set comes from the same dataset as the Arabic calibration half (different rows), and the chat set from the same family as part of the English half, so those two rows are flattering. ArabicMMLU and WikiText are unrelated to the calibration data.
Calibration language
We built the same quant twice, changing only the calibration text.
| Calibration | MMLU (English) | ArabicMMLU | GSM8K | KL, English wiki | KL, Arabic |
|---|---|---|---|---|---|
| BF16 reference | 68.28 | 61.56 | 79.45 | 0 | 0 |
| Half Arabic, half English (this checkpoint) | 64.28 | 61.81 | 79.23 | 0.047 | 0.048 |
| English only (not published) | 66.16 | 59.32 | 78.92 | 0.046 | 0.059 |
Update after a repeat: we built the mixed recipe a second time with different calibration rows. That second build scored 66.44 on MMLU, 60.83 on ArabicMMLU and 78.24 on GSM8K, with KL of 0.046 on English wiki and 0.040 on Arabic. So the MMLU gap between the two rows above is within build-to-build noise and should not be read as a trade-off. What held in both mixed builds is the lower Arabic KL (0.040 and 0.048 against 0.059), at no cost in English KL. We publish a mixed build because Jais is an Arabic-first model.
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) | 79.38 | 78.77 |
| Throughput, single stream | 1.00x | 1.78x |
| Throughput, 8 concurrent | 1.00x | 1.75x |
| Throughput, 32 concurrent | 1.00x | 1.58x |
Throughput is fixed 256-token greedy generations and will differ on other hardware. A full 4-bit build (weights and activations) was also tested and is not published: it lost 6.3 points on MMLU, 4.7 on ArabicMMLU and 6.0 on served GSM8K, and was no faster than this one.
Usage
vLLM:
vllm serve PureTensorAI/Jais-3-3.7B-NVFP4A16 --trust-remote-code
Transformers (requires pip install compressed-tensors):
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "PureTensorAI/Jais-3-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
- English MMLU is 4 points below BF16 for this file. A second build of the same recipe was 1.8 points below, so part of that is build-to-build noise.
- 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.
- 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 per build, no repeated seeds. No safety, dialect, or long-context evaluation was run on the quantized model.
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
- 47
Model tree for PureTensorAI/Jais-3-3.7B-NVFP4A16
Base model
inception42/Jais-3-3.7B