xinfer-ai 0.13.3 → 0.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,13 +14,21 @@
14
14
  | **⚡** | Fast | Native Flash Attention, FlashInfer, CUDA Graphs, continuous batching, prefix caching, PD disaggregation. Up to **197 tok/s** decode for `30B+` models on consumer GPUs |
15
15
  | **ðŸŠķ** | Tiny footprint | Core scheduling + attention logic in **< 5 000 lines** of Rust |
16
16
  | **🌍** | Cross-platform | CUDA (Linux/Windows), Metal (macOS). Same binary, same API |
17
- | **🏭** | Production-ready | OpenAI/Anthropic-compatible APIs, built-in ChatGPT-style Web UI, MCP tool calling, structured outputs, embedding + tokenizer endpoints |
17
+ | **🏭** | Production-ready | OpenAI/Anthropic-compatible APIs, built-in ChatGPT-style Web UI, MCP tool calling, structured outputs, embedding + tokenizer endpoints, multi-token prediction (MTP) |
18
18
  | **🗜ïļ** | Aggressive KV compression | TurboQuant (`2–4 bit` KV cache) extends context up to **4.3×** with minimal quality loss. Run `30B+` MoE models with **millions of context** on single 24/32 GB GPUs |
19
19
  | **ðŸ”Ĩ** | V100 + NVFP4 | First-ever NVFP4 + low-bit KV cache on V100 — no hardware FP4 needed, coherent output on legacy GPUs |
20
20
  | **🐍** | Lightweight Python bindings | Optional PyO3 wheel when you need a Python entry point |
21
21
 
22
22
  ---
23
23
 
24
+ ## ðŸ“―ïļ Demo
25
+
26
+ <p align="center">
27
+ <video src="https://guoqingbao.github.io/xinfer/assets/demo.mp4" width="600" controls></video>
28
+ </p>
29
+
30
+ ---
31
+
24
32
  ## 🚀 Quick Start
25
33
 
26
34
  ### ðŸ“Ķ Install
@@ -55,6 +63,11 @@ xinfer --m /home/Qwen3.6-35B-A3B --d 0,1 --ui-server
55
63
  python3 -m xinfer.server --m Qwen/Qwen3.6-27B-FP8 --kvcache-dtype turbo4 --ui-server
56
64
  ```
57
65
 
66
+ **MTP**
67
+ ```bash
68
+ xinfer --w /home/Qwen3.6-35B-A3B --d 0,1 --ui-server --mtp 2
69
+ ```
70
+
58
71
  > **Tip:** Open `http://IP:8001` for the built-in chat UI, or use `http://IP:8000/v1/` as your API `Base URL`.
59
72
 
60
73
  ---
@@ -77,7 +90,7 @@ Add `--kvcache-dtype` to compress KV cache and extend context length:
77
90
 
78
91
  > Tested on **V100-32G**, **A100-40G**, **Hopper-80G** and **RTX 5090**
79
92
 
80
- | Model | Format | Size | Decoding Speed |
93
+ | Model | Format | Size | Decoding Speed (without MTP) |
81
94
  |---|---|---|---|
82
95
  | Ministral-3-3B (**Multimodal**) | ISQ (BF16→Q4K) | 3B | **193.67** tokens/s |
83
96
  | Qwen3-VL-8B-Instruct (**Multimodal**) | Q8_0 | 8B | **112.51** tokens/s |
@@ -164,6 +177,9 @@ xinfer --m Qwen/Qwen3.6-35B-A3B-FP8 --kvcache-dtype fp8
164
177
  # 27B Dense + turbo4
165
178
  xinfer --m Qwen/Qwen3.6-27B-FP8 --kvcache-dtype turbo4
166
179
 
180
+ # 26B Gemma4 (local model, occupy more kvcache with --kv-fraction)
181
+ xinfer --w /data/gemma-4-26B-A4B-it --ui-server --port 9000 --kv-fraction 0.8
182
+
167
183
  # 30B MoE GGUF + turbo4
168
184
  xinfer --m unsloth/Qwen3-30B-A3B-Instruct-2507-GGUF \
169
185
  --f Qwen3-30B-A3B-Instruct-2507-Q4_K_M.gguf --kvcache-dtype turbo4
@@ -235,11 +251,17 @@ xinfer --m /path/Qwen3-4B --isq q6k
235
251
  <summary><b>GGUF models</b></summary>
236
252
 
237
253
  ```bash
238
- # Single GPU — GGUF
254
+ # Multi-GPU GGUF (model ID + subfolder)
255
+ xinfer --d 0,1,2,3 --m unsloth/Qwen3.5-122B-A10B-GGUF --f Q3_K_M
256
+
257
+ # Remote GGUF — single-file model
239
258
  xinfer --m unsloth/Qwen3.5-27B-GGUF --f Qwen3.5-27B-Q4_K_M.gguf
240
259
 
241
- # Multi-GPU — GGUF
260
+ # Local GGUF file (direct path)
242
261
  xinfer --d 0,1 --m /path/Qwen3-30B-A3B-Instruct-2507-Q4_K_M.gguf
262
+
263
+ # Local GGUF folder
264
+ xinfer --d 0,1,2,3 --m /path/to/model-GGUF/
243
265
  ```
244
266
 
245
267
  </details>
@@ -338,6 +360,24 @@ See [more Python examples →](python/ReadMe.md)
338
360
 
339
361
  ---
340
362
 
363
+ ## 🌐 Multi-Node Tensor Parallelism
364
+
365
+ Distribute inference across multiple machines using TCP-based NCCL bootstrap. No MPI required.
366
+
367
+ ```bash
368
+ # Node 0 (master, 192.168.1.100): scheduler + API
369
+ xinfer --d 0,1,2,3 --m /data/DeepSeek-R1/ \
370
+ --num-nodes 2 --node-rank 0 --master-addr 192.168.1.100 --ui-server
371
+
372
+ # Node 1 (worker, 192.168.1.101): forward-only daemon
373
+ xinfer --d 0,1,2,3 --m /data/DeepSeek-R1/ \
374
+ --num-nodes 2 --node-rank 1 --master-addr 192.168.1.100
375
+ ```
376
+
377
+ All nodes must have model weights locally and be TCP-reachable on `--master-port` (default 29500). See [Get Started](docs/get_started.md) for details.
378
+
379
+ ---
380
+
341
381
  ## 🔀 Prefill-Decode Disaggregation
342
382
 
343
383
  Split prefill (prompt processing) and decode (token generation) across GPUs or machines. Eliminates decode stalls during long-context prefilling. PD Server and PD Client must use **same** KvCache type (`--kvcache-dtype`). API request(s) must send to PD Client and the PD Server only process internal prefill requests sent from PD Client.
@@ -432,12 +472,12 @@ Constraint-based generation via llguidance — Lark grammars, regex, JSON Schema
432
472
 
433
473
  | Flag | Description |
434
474
  |---|---|
435
- | `--m` | Model source: HuggingFace model ID, local Safetensors directory, or local GGUF file |
475
+ | `--m` | Model source: HuggingFace model ID, local Safetensors directory, local GGUF file, or local folder containing GGUF files |
436
476
  | `--w` | Legacy alias for local Safetensors directory; prefer `--m <local_dir>` |
437
477
  | `--f` | Local GGUF file when used alone; remote GGUF filename when paired with `--m <model_id>` |
438
478
  | `--d` | Device IDs (e.g. `--d 0,1`) |
439
479
  | `--ui-server` | API server + built-in ChatGPT-style web UI |
440
- | `--server` | API server only (no web UI) |
480
+ | `--server` | API server. Bare: `0.0.0.0:8000`; or `host[:port]`, `file:///path`, `socket:///path`, `unix:///path` |
441
481
  | `--i` | Interactive CLI chat |
442
482
  | `--isq` | On-the-fly quantization: `q2k`, `q3k`, `q4k`, `q5k`, `q6k`, `q8_0` |
443
483
  | `--kvcache-dtype` | KV cache quantization: `fp8`, `turbo8`, `turbo4`, `turbo3` |
@@ -459,6 +499,7 @@ Constraint-based generation via llguidance — Lark grammars, regex, JSON Schema
459
499
  | `--frequency-penalty` | Penalize frequent tokens (−2 to 2) |
460
500
  | `--mcp-config` | MCP servers JSON config |
461
501
  | `--mcp-command` / `--mcp-args` | Single MCP server command + args |
502
+ | `--mtp`| Multi-token prediction, usage `--mtp 2` for two-token prediction per forward pass |
462
503
 
463
504
  ### Environment Variables
464
505
 
@@ -473,12 +514,6 @@ XINFER_NVFP4_FORCE_LUT=1 xinfer --m nvidia/Qwen3-30B-A3B-FP4 --ui-server
473
514
 
474
515
  ---
475
516
 
476
- ## ðŸ“―ïļ Demo
477
-
478
- <video src="https://github.com/user-attachments/assets/7fc6aa0b-78ac-4323-923f-d761dd12857f" width="1000px"></video>
479
-
480
- ---
481
-
482
517
  ## 🛠ïļ Roadmap
483
518
 
484
519
  * [x] Batched inference (Metal)
@@ -488,6 +523,7 @@ XINFER_NVFP4_FORCE_LUT=1 xinfer --m nvidia/Qwen3-30B-A3B-FP4 --ui-server
488
523
  * [x] OpenAI-compatible API (streaming support)
489
524
  * [x] Continuous batching
490
525
  * [x] Multi-gpu inference (Safetensors, GPTQ, AWQ, GGUF)
526
+ * [x] Multi-node tensor parallelism (TCP-based NCCL bootstrap, no MPI required)
491
527
  * [x] Speedup prompt processing on Metal/macOS
492
528
  * [x] Chunked Prefill
493
529
  * [x] Prefix cache (available on `CUDA` when `prefix-cache` enabled)
@@ -515,6 +551,7 @@ XINFER_NVFP4_FORCE_LUT=1 xinfer --m nvidia/Qwen3-30B-A3B-FP4 --ui-server
515
551
  * [x] **MXFP4/NVFP4 Model Support**
516
552
  * [x] **Support Turboquant (4-bit, 3-bit) KvCache**
517
553
  * [ ] TentorRT-LLM
554
+ * [x] **Multi-token Prediciton (MTP)**
518
555
 
519
556
  ---
520
557
 
@@ -22,8 +22,13 @@ cargo build --release --features metal
22
22
  ## Model formats
23
23
  - **Safetensors (HF layout)**: `--m <hf_id>` for cached download, or `--m <local_dir>` for offline weights + configs. `--w <local_dir>` still works as a legacy alias.
24
24
  - **Safetensors (HF layout) + ISQ**: in-situ quantize into GGUF with args `--isq <q4k|q2k|q6k|...>`.
25
- - **GGUF**: `--m <local.gguf>` or `--f <local.gguf>` for a local file. Use `--m <hf_id> --f <remote_file.gguf>` for a GGUF file hosted in a Hugging Face repo.
26
- - **Vision-Language** (Qwen3-VL, Gemma3, Mistral3-VL): require image tokens; use `--ui-server` for uploads or send image_url/base64 in the request.
25
+ - **GGUF**: multiple loading modes:
26
+ - `--m <local.gguf>` — load a single local GGUF file.
27
+ - `--m <local_dir>` — auto-detect the main GGUF file in a directory (picks the largest non-mmproj `.gguf`). Multi-shard files (`*-00001-of-00007.gguf`) and auxiliary files (`mmproj-*.gguf` for vision towers) are auto-discovered.
28
+ - `--f <local.gguf>` — load a single local GGUF file (alternative syntax).
29
+ - `--m <hf_id> --f <remote_file.gguf>` — download a GGUF file from a Hugging Face repo.
30
+ - `--m <hf_id> --f <subfolder>` — auto-detect all GGUF files in a HuggingFace repo subfolder (e.g. `--m unsloth/GLM-5.2-GGUF --f UD-Q2_K_XL`).
31
+ - **Vision-Language** (Qwen3-VL, Qwen3.5-VL, Gemma3, Gemma4, Mistral3-VL): require image tokens; use `--ui-server` for uploads or send image_url/base64 in the request. For GGUF multimodal models, place the `mmproj-*.gguf` vision tower file in the same directory as the main model file — it will be auto-detected.
27
32
 
28
33
 
29
34
  ## 3) Run patterns (single host)
@@ -36,11 +41,19 @@ cargo build --release --features metal
36
41
  ```bash
37
42
  target/release/xinfer --m meta-llama/Llama-3-8b --max-model-len 32768 --ui-server
38
43
  ```
39
- - **GGUF quantized**
44
+ - **GGUF quantized (single file)**
40
45
  ```bash
41
46
  target/release/xinfer --m /path/model-Q4_K_M.gguf --max-model-len 65536
42
47
  ```
43
- - **Remote GGUF quantized**
48
+ - **GGUF quantized (folder with auto-detection)**
49
+ ```bash
50
+ target/release/xinfer --m /path/model-GGUF/ --ui-server
51
+ ```
52
+ - **Remote GGUF quantized (multi-shard subfolder)**
53
+ ```bash
54
+ target/release/xinfer --d 0,1,2,3 --m unsloth/GLM-5.2-GGUF --f UD-Q2_K_XL --ui-server
55
+ ```
56
+ - **Remote GGUF quantized (single file)**
44
57
  ```bash
45
58
  target/release/xinfer --m unsloth/Qwen3-0.6B-GGUF --f Qwen3-0.6B-Q4_K_M.gguf --ui-server
46
59
  ```
@@ -65,6 +78,52 @@ Reasoning defaults to enabled when a request omits `thinking` / `enable_thinking
65
78
  ```
66
79
  - **Graph capture**: CUDA graph is auto-enabled with `cuda` feature. Use `--disable-cuda-graph` at runtime to skip graph capture.
67
80
 
81
+ ## 4.1) Multi-node tensor parallelism
82
+
83
+ Distribute tensor-parallel inference across multiple machines via TCP-based NCCL bootstrap. Node 0 is the coordinator (runs scheduler + API); worker nodes run forward-only daemon loops.
84
+
85
+ **Requirements:**
86
+ - All nodes must have the same model weights available locally (same path or HuggingFace cache).
87
+ - All nodes must be reachable via TCP on the `--master-port` (default 29500) and `--master-port + 1` (forward coordination).
88
+ - Build with `--features cuda,nccl,flashinfer,cutlass` on all nodes.
89
+
90
+ **Example: 2 nodes × 4 GPUs = 8-way tensor parallelism**
91
+
92
+ ```bash
93
+ # Node 0 (master, at 192.168.1.100): runs scheduler + API server
94
+ xinfer --m /data/DeepSeek-R1/ --d 0,1,2,3 \
95
+ --num-nodes 2 --node-rank 0 \
96
+ --master-addr 192.168.1.100 --master-port 29500 \
97
+ --ui-server
98
+
99
+ # Node 1 (worker, at 192.168.1.101): runs forward-only daemon
100
+ xinfer --m /data/DeepSeek-R1/ --d 0,1,2,3 \
101
+ --num-nodes 2 --node-rank 1 \
102
+ --master-addr 192.168.1.100 --master-port 29500
103
+ ```
104
+
105
+ **How it works:**
106
+ 1. Node 0 generates a NCCL unique ID and distributes it to worker nodes via TCP.
107
+ 2. Each node spawns local runner subprocesses with global NCCL ranks (`node_rank × local_gpus + local_rank`).
108
+ 3. All ranks join a single global NCCL communicator for all-reduce / all-gather operations.
109
+ 4. Node 0 broadcasts forward-pass commands to worker nodes via TCP; NCCL synchronizes the actual tensor computations.
110
+ 5. Only node 0 runs the scheduler and API server; worker nodes are stateless forward engines.
111
+
112
+ **CLI flags:**
113
+ | Flag | Default | Description |
114
+ |------|---------|-------------|
115
+ | `--num-nodes` | 1 | Total number of nodes |
116
+ | `--node-rank` | 0 | This node's rank (0 = master) |
117
+ | `--master-addr` | _(required)_ | Master node's IP address |
118
+ | `--master-port` | 29500 | TCP port for NCCL bootstrap |
119
+
120
+ **NCCL environment variables** (optional tuning):
121
+ ```bash
122
+ export NCCL_IB_DISABLE=1 # Disable InfiniBand if unavailable
123
+ export NCCL_SOCKET_IFNAME=eth0 # Specify network interface
124
+ export NCCL_DEBUG=INFO # Enable NCCL debug logging
125
+ ```
126
+
68
127
  ## 5) PD Disaggregation (prefill/decoding split)
69
128
  - **PD server (prefill host, usually memory-rich)**
70
129
  ```bash
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xinfer-ai",
3
- "version": "0.13.3",
4
- "assetVersion": "0.13.3",
3
+ "version": "0.13.5",
4
+ "assetVersion": "0.13.5",
5
5
  "description": "xInfer — a high-performance LLM inference engine in Rust with CUDA/Metal acceleration",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/guoqingbao/xinfer#readme",