Text Generation
Transformers
Safetensors
English
llama
nvfp4
compressed-tensors
modelopt
vllm
llama-3.3
deepseek
reasoning
distillation
dgx-spark
gb10
conversational
text-generation-inference
8-bit precision
Instructions to use Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4") model = AutoModelForCausalLM.from_pretrained("Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4
- SGLang
How to use Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4 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 "Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4" \ --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": "Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4", "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 "Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4" \ --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": "Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4 with Docker Model Runner:
docker model run hf.co/Kaleto/DeepSeek-R1-Distill-Llama-70B-NVFP4
Initial release: DeepSeek-R1-Distill-Llama-70B-NVFP4
Browse files
README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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| 7 |
+
library_name: transformers
|
| 8 |
+
tags:
|
| 9 |
+
- nvfp4
|
| 10 |
+
- compressed-tensors
|
| 11 |
+
- modelopt
|
| 12 |
+
- vllm
|
| 13 |
+
- llama
|
| 14 |
+
- llama-3.3
|
| 15 |
+
- deepseek
|
| 16 |
+
- reasoning
|
| 17 |
+
- distillation
|
| 18 |
+
- dgx-spark
|
| 19 |
+
- gb10
|
| 20 |
+
pipeline_tag: text-generation
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# DeepSeek-R1-Distill-Llama-70B — NVFP4 (compressed-tensors)
|
| 24 |
+
|
| 25 |
+
**Built with Llama.**
|
| 26 |
+
|
| 27 |
+
NVFP4 (4-bit floating-point, W4A4, group_size=16) quantization of [deepseek-ai/DeepSeek-R1-Distill-Llama-70B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B), produced via a distributed 2-node pipeline on **NVIDIA DGX Spark** (GB10) hardware.
|
| 28 |
+
|
| 29 |
+
To my knowledge this is the first publicly available NVFP4 of the DeepSeek-R1-Distill-Llama-70B base — the top non-RP reasoning model in the 70B class with ~4.5 M downloads on the original.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## Quick facts
|
| 34 |
+
|
| 35 |
+
| | |
|
| 36 |
+
|---|---|
|
| 37 |
+
| **Base model** | deepseek-ai/DeepSeek-R1-Distill-Llama-70B (Llama-3.3-70B distilled from R1) |
|
| 38 |
+
| **Architecture** | LlamaForCausalLM, 80 layers, hidden_size=8192, 64 attn heads, 8 KV heads, head_dim=128 |
|
| 39 |
+
| **Original size** | ~132 GB (BF16) |
|
| 40 |
+
| **Quantized size** | ~40 GB (see Files tab) |
|
| 41 |
+
| **Quant format** | NVFP4 via [nvidia-modelopt](https://github.com/NVIDIA/TensorRT-Model-Optimizer) 0.43.0 |
|
| 42 |
+
| **Storage layout** | compressed-tensors (vLLM-native) |
|
| 43 |
+
| **lm_head** | Kept BF16 (unquantized), in `quantization_config.ignore` |
|
| 44 |
+
| **KV cache** | Configurable at serve time (FP8 recommended) |
|
| 45 |
+
| **Calibration data** | 256 samples from `cnn_dailymail`, lengths 150–1200 tokens |
|
| 46 |
+
| **Conversion date** | 2026-05-15 |
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## Why this exists
|
| 51 |
+
|
| 52 |
+
DeepSeek-R1-Distill-Llama-70B is the most-downloaded non-RP reasoning model in the 70B-class (4.5 M downloads on the original), and until now had no public NVFP4 quantization despite being a perfect target — Llama-3.3 architecture, 70B fits cleanly on a single 128 GB UMA DGX Spark in NVFP4 with massive KV-cache headroom for long reasoning chains.
|
| 53 |
+
|
| 54 |
+
This release closes that gap with a production-quality 256-sample calibration run on a 2-Spark Ray cluster, using the same pipeline that produced [Anubis-Pro-105B-NVFP4](https://huggingface.co/Kaleto/Anubis-Pro-105B-NVFP4) and [Behemoth-X-123B-v2.2-NVFP4](https://huggingface.co/Kaleto/Behemoth-X-123B-v2.2-NVFP4) — open at **[github.com/KaletoAI/distrib-nvfp4](https://github.com/KaletoAI/distrib-nvfp4)** (Apache 2.0).
|
| 55 |
+
|
| 56 |
+
For 70B-class models the distributed pipeline is honestly overkill (the model fits on one Spark for quantization too), but it's the same toolchain so reusing it is free. The benefit: identical workflow, identical fix-list applied, identical reproducibility as the larger releases.
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## Quantization Pipeline (short version)
|
| 61 |
+
|
| 62 |
+
Two Ray actors own 40 layers each. modelopt's `mtq.quantize(wrapper, NVFP4_DEFAULT_CFG, forward_loop=None)` inserts the W4A4 quantizers in calibration mode without running its own forward; the driver routes hidden states between actors via Ray RPC for each of 256 calibration samples.
|
| 63 |
+
|
| 64 |
+
After finalize, per-actor disk-eviction (`cloudpickle` for modelopt's dynamic QuantLinear), then streaming per-layer NVFP4 export via `mte.export_hf_checkpoint` on a 1-layer template (with `use_cache=False`). Driver merges per-actor shards, renames layer indices on shard 1 with the +40 offset, copies tokenizer (DeepSeek uses tiktoken BPE — no `tokenizer.model` file), patches `config.json` to keep `lm_head` BF16, and injects `input_scale=1.0` for every weight quantizer (modelopt 0.43 omits these but vLLM's loader requires them).
|
| 65 |
+
|
| 66 |
+
Calibration health on the run that produced this artifact:
|
| 67 |
+
- shard0 (layers 0–39 + embed): **good=280, zero=0, nan=0**
|
| 68 |
+
- shard1 (layers 40–79 + norm + lm_head): **good=280, zero=0, nan=0**
|
| 69 |
+
|
| 70 |
+
(NVFP4_DEFAULT_CFG inserts 7 quantizers per layer for Llama arch.)
|
| 71 |
+
|
| 72 |
+
Total pipeline time: **25 min** on 2× DGX Spark (IB-connected at 10.20.0.x). Load 3 min, calibrate ~15 min, eviction 105 s, export 110 s, merge 25 s.
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## Performance
|
| 77 |
+
|
| 78 |
+
Stock-vLLM bench will follow as separate update; pattern is consistent with the related Anubis-Pro and Behemoth releases:
|
| 79 |
+
|
| 80 |
+
**Anubis-Pro-105B-NVFP4** (for reference):
|
| 81 |
+
- Stock vLLM: ~3.1 tok/s decode short context
|
| 82 |
+
- MARLIN+FlashInfer: **3.78 tok/s** (+22 %)
|
| 83 |
+
|
| 84 |
+
**DeepSeek-R1-Distill-Llama-70B-NVFP4** (this model):
|
| 85 |
+
- Expected to be **faster than both** Anubis (105B) and Behemoth (123B) due to smaller size
|
| 86 |
+
- Estimate ~4.5–5.5 tok/s decode on the MARLIN+FlashInfer stack
|
| 87 |
+
- Will measure and update once the model is benched on Spark
|
| 88 |
+
|
| 89 |
+
For reasoning workloads (long chain-of-thought outputs) on a single Spark, this model is the sweet spot — 70B class, fits with ample KV-cache pool, and the NVFP4 quality preservation at W4A4 retains the R1-distilled reasoning behaviour.
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## Usage
|
| 94 |
+
|
| 95 |
+
### vLLM (direct)
|
| 96 |
+
|
| 97 |
+
Recommended on GB10 — the tuned Spark stack with MARLIN GEMM + FlashInfer attention:
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
VLLM_NVFP4_GEMM_BACKEND=marlin \
|
| 101 |
+
VLLM_TEST_FORCE_FP8_MARLIN=1 \
|
| 102 |
+
VLLM_MARLIN_USE_ATOMIC_ADD=1 \
|
| 103 |
+
vllm serve /path/to/DeepSeek-R1-Distill-Llama-70B-NVFP4 \
|
| 104 |
+
--served-model-name DeepSeek-R1-Distill-Llama-70B-NVFP4 \
|
| 105 |
+
--attention-backend flashinfer \
|
| 106 |
+
--quantization compressed-tensors \
|
| 107 |
+
--dtype auto \
|
| 108 |
+
--kv-cache-dtype fp8 \
|
| 109 |
+
--max-model-len 32768 \
|
| 110 |
+
--max-num-seqs 4 \
|
| 111 |
+
--gpu-memory-utilization 0.80 \
|
| 112 |
+
--enable-chunked-prefill \
|
| 113 |
+
--enable-prefix-caching \
|
| 114 |
+
--port 9007
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
`--gpu-memory-utilization 0.80` for the 40 GB DeepSeek NVFP4 leaves ~62 GB of KV-cache pool on a 128 GB UMA Spark — long enough for 32 K context with `max-num-seqs 4` and a healthy chain-of-thought reasoning buffer. Bump to 0.85 if you want more concurrency.
|
| 118 |
+
|
| 119 |
+
### llama-swap entry
|
| 120 |
+
|
| 121 |
+
```yaml
|
| 122 |
+
"DeepSeek-R1-Distill-Llama-70B-NVFP4":
|
| 123 |
+
proxy: "http://127.0.0.1:9007"
|
| 124 |
+
ttl: 0
|
| 125 |
+
checkEndpoint: "/health"
|
| 126 |
+
env:
|
| 127 |
+
- "VLLM_NVFP4_GEMM_BACKEND=marlin"
|
| 128 |
+
- "VLLM_TEST_FORCE_FP8_MARLIN=1"
|
| 129 |
+
- "VLLM_MARLIN_USE_ATOMIC_ADD=1"
|
| 130 |
+
cmd: >-
|
| 131 |
+
/home/<user>/vllm-env/bin/python3 -m vllm.entrypoints.openai.api_server
|
| 132 |
+
--model /home/<user>/models/DeepSeek-R1-Distill-Llama-70B-NVFP4
|
| 133 |
+
--attention-backend flashinfer
|
| 134 |
+
--served-model-name DeepSeek-R1-Distill-Llama-70B-NVFP4
|
| 135 |
+
--quantization compressed-tensors
|
| 136 |
+
--dtype auto
|
| 137 |
+
--kv-cache-dtype fp8
|
| 138 |
+
--max-model-len 32768
|
| 139 |
+
--max-num-seqs 4
|
| 140 |
+
--gpu-memory-utilization 0.80
|
| 141 |
+
--trust-remote-code
|
| 142 |
+
--enable-chunked-prefill
|
| 143 |
+
--enable-prefix-caching
|
| 144 |
+
--port 9007
|
| 145 |
+
--host 127.0.0.1
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
### Recommended sampling (from DeepSeek's original card)
|
| 149 |
+
|
| 150 |
+
R1-distilled models perform best with:
|
| 151 |
+
- `temperature: 0.6`
|
| 152 |
+
- `top_p: 0.95`
|
| 153 |
+
- Avoid system prompts — DeepSeek-R1 family expects user-first conversation flow
|
| 154 |
+
- For reasoning tasks: let the `<think>...</think>` block grow uncapped; set `--max-tokens` high (4096+)
|
| 155 |
+
|
| 156 |
+
---
|
| 157 |
+
|
| 158 |
+
## Files in this repository
|
| 159 |
+
|
| 160 |
+
- `model-NNNNN-of-00008.safetensors` — 8 shards, NVFP4-packed weights + scales (~40 GB total)
|
| 161 |
+
- `model.safetensors.index.json` — weight map (~2 403 keys: 80 layers × 7 quant linears × 4 keys + norms + embed + lm_head + injected input_scale)
|
| 162 |
+
- `config.json` — Llama config with `quantization_config.ignore=["lm_head"]` and `input_activations.dynamic: true`
|
| 163 |
+
- `hf_quant_config.json`, `generation_config.json` — auxiliary configs
|
| 164 |
+
- `tokenizer.json`, `tokenizer_config.json` — DeepSeek tokenizer (tiktoken BPE; no `tokenizer.model` file)
|
| 165 |
+
|
| 166 |
+
---
|
| 167 |
+
|
| 168 |
+
## Recent fixes baked into the conversion
|
| 169 |
+
|
| 170 |
+
modelopt 0.43's NVFP4 export needs six gotchas worked around before vLLM will serve the output without producing garbage. All applied automatically by the pipeline:
|
| 171 |
+
|
| 172 |
+
1. Phase-6 1-layer template needs `vocab_size=2` (not 1) because modelopt's `llm_dummy_forward` feeds `torch.ones([1, 2])`.
|
| 173 |
+
2. Phase-6 template needs `pad_token_id=None`/`bos`/`eos=None` — pad-eos consistency assertion otherwise.
|
| 174 |
+
3. Phase-6 must NOT clear `_calibrator` on quantized modules.
|
| 175 |
+
4. Per-actor exports omit `input_scale` keys; vLLM produces garbage decoding unless `input_scale=1.0` is injected per `.weight_scale_2` key.
|
| 176 |
+
5. Merged `config.json` needs `input_activations.dynamic: true` (modelopt writes false but emits no static scale).
|
| 177 |
+
6. Merged config must restore `num_hidden_layers`, `vocab_size`, pad/bos/eos token IDs from source.
|
| 178 |
+
|
| 179 |
+
(Plus three N-shard-specific fixes for the 3-shard Behemoth release — not exercised here since DeepSeek is 2-shard.)
|
| 180 |
+
|
| 181 |
+
---
|
| 182 |
+
|
| 183 |
+
## Acknowledgments
|
| 184 |
+
|
| 185 |
+
- **[DeepSeek-AI](https://huggingface.co/deepseek-ai)** for the original R1-Distill-Llama-70B
|
| 186 |
+
- **[Avarok-Cybersecurity](https://github.com/Avarok-Cybersecurity/dgx-vllm)** (`tbraun96`) for the MARLIN-backend NVFP4 GEMM port — drives the ~+22 % decode speedup on Spark
|
| 187 |
+
- **[entrpi / antirez](https://forums.developer.nvidia.com/t/deepseekv4-flash-hybrid-quant-1x-dgx-spark-antirezs-optimized-128-gb-mlx-recipe-ported-to-vllm-for-gb10/369584)** for the parallel hybrid-quant work on the MoE side of the Spark ecosystem (DeepSeek-V4-Flash) — different recipe, same Spark constraints
|
| 188 |
+
- **[saricles](https://huggingface.co/saricles)** for setting the bar on GB10-tuned NVFP4 calibration recipes
|
| 189 |
+
- **NVIDIA** for the DGX Spark / GB10 platform, the NVFP4 format, and [modelopt](https://github.com/NVIDIA/TensorRT-Model-Optimizer)
|
| 190 |
+
- **vLLM project** for compressed-tensors NVFP4 inference support
|
| 191 |
+
|
| 192 |
+
---
|
| 193 |
+
|
| 194 |
+
## License
|
| 195 |
+
|
| 196 |
+
MIT, inherited from `deepseek-ai/DeepSeek-R1-Distill-Llama-70B`. Pipeline code under Apache 2.0 at [github.com/KaletoAI/distrib-nvfp4](https://github.com/KaletoAI/distrib-nvfp4).
|
| 197 |
+
|
| 198 |
+
---
|
| 199 |
+
|
| 200 |
+
## Status
|
| 201 |
+
|
| 202 |
+
Single-author release. Issues + feedback welcome — both on the model artifact and on the pipeline that built it.
|