xinfer-ai 0.13.5 → 0.13.7

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
@@ -23,9 +23,7 @@
23
23
 
24
24
  ## 📽️ Demo
25
25
 
26
- <p align="center">
27
- <video src="https://guoqingbao.github.io/xinfer/assets/demo.mp4" width="600" controls></video>
28
- </p>
26
+ <video src="pages/assets/demo.mp4" width="600" controls></video>
29
27
 
30
28
  ---
31
29
 
@@ -137,9 +135,10 @@ Add `--kvcache-dtype` to compress KV cache and extend context length:
137
135
  * ✅ Qwen3.5/3.6 Dense/MoE (27B, 35B, 122B, 397B, Multimodal model)
138
136
  * ✅ Mistral v1, v2
139
137
  * ✅ Mistral-3-VL Reasoning (3B, 8B, 14B, Multimodal model)
140
- * ✅ GLM4 (0414, **Not ChatGLM**)
138
+ * ✅ GLM4 (0414)
141
139
  * ✅ GLM4 MoE (4.6/4.7)
142
140
  * ✅ GLM4.7 Flash
141
+ * ✅ GLM 5.2 (DeepSeek V3.2 DSA architecture)
143
142
  * ✅ DeepSeek V3/R1/V3.2
144
143
  * ✅ Phi3 / Phi4 (Phi-3, Phi-4, Phi-4-mini, etc.)
145
144
  * ✅ Gemma3/**Gemma4** (Multimodal model)
@@ -218,6 +217,9 @@ xinfer --m olka-fi/Qwen3.5-4B-MXFP4
218
217
  # GGUF model (4-bit KvCache)
219
218
  xinfer --m unsloth/Qwen3.5-27B-GGUF --f Qwen3.5-27B-Q4_K_M.gguf --kvcache-dtype turbo4
220
219
 
220
+ # Multi-shard 5.2 GGUF (auto-detected from HF subfolder)
221
+ xinfer --d 0,1,2,3 --m unsloth/Qwen3.5-122B-A10B-GGUF --f Q3_K_M --kvcache-dtype fp8
222
+
221
223
  # FP8 on Metal
222
224
  xinfer --m Qwen/Qwen3.5-4B-FP8
223
225
 
@@ -229,6 +231,15 @@ xinfer --m GadflyII/GLM-4.7-Flash-NVFP4
229
231
 
230
232
  # Interactive CLI chat
231
233
  xinfer --i --m unsloth/Qwen3.5-27B-GGUF --f Qwen3.5-27B-Q4_K_M.gguf
234
+
235
+ # Faster GDN prefill on Hopper with slight precision loss
236
+ SM90_LOWER_PRECISION_GDN_PREFILL=1 xinfer --m Qwen/Qwen3.5-35B-A3B-FP8
237
+
238
+ # MultiNode: GLM 5.2 (DeepSeek V3.2 architecture, FP8)
239
+ # Master node
240
+ xinfer --d 0,1,2,3,4,5,6,7 --m zai-org/GLM-5.2-FP8 --num-nodes 2 --node-rank 0 --master-addr 192.168.xxx.xxx
241
+ # Other node(s)
242
+ xinfer --d 0,1,2,3,4,5,6,7 --m zai-org/GLM-5.2-FP8 --num-nodes 2 --node-rank 1 --master-addr 192.168.xxx.xxx
232
243
  ```
233
244
 
234
245
  <details>
@@ -261,7 +272,7 @@ xinfer --m unsloth/Qwen3.5-27B-GGUF --f Qwen3.5-27B-Q4_K_M.gguf
261
272
  xinfer --d 0,1 --m /path/Qwen3-30B-A3B-Instruct-2507-Q4_K_M.gguf
262
273
 
263
274
  # Local GGUF folder
264
- xinfer --d 0,1,2,3 --m /path/to/model-GGUF/
275
+ xinfer --d 0,1,2,3 --m /path/to/Qwen3.5-122B-A10B-GGUF/Q3_K_M
265
276
  ```
266
277
 
267
278
  </details>
@@ -438,9 +449,14 @@ xinfer --m unsloth/Qwen3-30B-A3B-Instruct-2507-GGUF \
438
449
 
439
450
  ---
440
451
 
441
- ## 🔌 Structured Outputs
452
+ ## 🔌 Structured Outputs & Guided Decoding
442
453
 
443
- Constraint-based generation via llguidance — Lark grammars, regex, JSON Schema.
454
+ Constraint-based generation via llguidance — JSON Schema, regex, Lark grammars, choice lists.
455
+
456
+ ```bash
457
+ # Enable structured outputs and tool grammar
458
+ xinfer --m Qwen/Qwen3.6-27B-FP8 --ui-server --enable-tool-grammar
459
+ ```
444
460
 
445
461
  [Structured outputs documentation →](docs/guided_decoding.md)
446
462
 
@@ -506,12 +522,19 @@ Constraint-based generation via llguidance — Lark grammars, regex, JSON Schema
506
522
  | Variable | Description |
507
523
  |---|---|
508
524
  | `XINFER_NVFP4_FORCE_LUT=1` | Force software NVFP4 decode to use the LUT-based dequantization path (higher precision) instead of hardware FP4 intrinsics on Blackwell (SM100+). Useful when decode precision matters more than peak throughput. |
525
+ | `XINFER_SSE_BUFFER_SIZE=256` | Size of the bounded SSE streaming buffer per client connection (default: 256). Increase for slow network proxies or high-throughput models. |
526
+ | `SM90_LOWER_PRECISION_GDN_PREFILL=1` | Enable the FlashInfer SM90 persistent kernel for GatedDeltaNet (GDN) prefill on Hopper GPUs (SM90). Delivers faster prefill speedup for Qwen3.5/3.6, with a slight precision trade-off. |
509
527
 
510
528
  **Example (Blackwell with high-precision NVFP4 decode):**
511
529
  ```bash
512
530
  XINFER_NVFP4_FORCE_LUT=1 xinfer --m nvidia/Qwen3-30B-A3B-FP4 --ui-server
513
531
  ```
514
532
 
533
+ **Example (Hopper with faster GDN prefill):**
534
+ ```bash
535
+ SM90_LOWER_PRECISION_GDN_PREFILL=1 xinfer --m Qwen/Qwen3.5-35B-A3B-FP8 --ui-server
536
+ ```
537
+
515
538
  ---
516
539
 
517
540
  ## 🛠️ Roadmap
@@ -535,7 +558,8 @@ XINFER_NVFP4_FORCE_LUT=1 xinfer --m nvidia/Qwen3-30B-A3B-FP4 --ui-server
535
558
  * [x] FP8 KV Cache (with FlashInfer, SM80+)
536
559
  * [x] TurboQuant KV Cache (2-4 bit compression with WHT rotation)
537
560
  * [x] FP8 Models (CUDA: MoE, Dense; Metal: Dense)
538
- * [ ] Additional model support (Kimi K2, GLM 5.1 etc.)
561
+ * [x] GLM 5.2 (DeepSeek V3.2 + DSA)
562
+ * [ ] Additional model support (Kimi K2, etc.)
539
563
  * [x] CPU KV Cache Offloading
540
564
  * [x] Prefill-decode Disaggregation (CUDA)
541
565
  * [x] Prefill-decode Disaggregation (Metal)
@@ -47,7 +47,7 @@ cargo build --release --features metal
47
47
  ```
48
48
  - **GGUF quantized (folder with auto-detection)**
49
49
  ```bash
50
- target/release/xinfer --m /path/model-GGUF/ --ui-server
50
+ target/release/xinfer --m /path/GLM-5.2-GGUF/ --ui-server
51
51
  ```
52
52
  - **Remote GGUF quantized (multi-shard subfolder)**
53
53
  ```bash
@@ -8,13 +8,23 @@ It focuses on:
8
8
  - how reasoning effort is applied
9
9
  - practical usage and validation commands
10
10
 
11
+ ## JSON Schema Reference
12
+
13
+ For detailed JSON Schema constraint documentation with curl examples, see [`llguidance-json-schema.md`](llguidance-json-schema.md).
14
+
15
+ This covers:
16
+ - Schema type definitions (string, integer, number, boolean, object, array)
17
+ - All supported API endpoints (OpenAI-compatible and Claude server)
18
+ - Complete curl examples for each permutation
19
+ - Schema sanitization behavior
20
+
11
21
  ## Current Model
12
22
 
13
23
  Guided decoding is request-scoped.
14
24
 
15
25
  The core engine does not invent grammars on its own. A request either:
16
26
  - supplies a constraint grammar
17
- - gets that constraint grammar composed with a reasoning prefix
27
+ - gets a composed grammar containing both
18
28
  - or runs unconstrained when neither exists
19
29
 
20
30
  The final grammar is stored in `SamplingParams.grammar` and consumed by the runner.
@@ -44,7 +54,7 @@ The server composes:
44
54
 
45
55
  The result is a single `TopLevelGrammar` assigned to `SamplingParams.grammar`.
46
56
 
47
- If no client-supplied constraint grammar exists, `params.grammar` stays `None`.
57
+ If no constraint grammar and no tool grammar exist, `params.grammar` stays `None`.
48
58
 
49
59
  ### 3. Sampling in runner
50
60
 
@@ -84,14 +94,17 @@ Legacy fields
84
94
  - `constraint`
85
95
  - `constraint_type = regex | lark | json_schema | json`
86
96
 
87
- If a request provides none of the above, guided decoding is not enabled.
97
+ If a request provides none of the above, guided decoding is not enabled unless tool grammar synthesis adds one.
98
+
99
+ The grammar composition logic is in `src/utils/guidance_grammar.rs`. The `GrammarRequestDispatcher` and `GrammarComposer` handle the composition of constraint grammars with reasoning grammars.
88
100
 
89
101
  ### Claude server
90
102
 
103
+ Claude reuses the same tool-grammar builder path.
104
+
91
105
  Current state:
92
106
  - Claude does not expose the same client-supplied grammar request surface as the OpenAI endpoint
93
107
  - Claude reasoning is still driven by explicit thinking behavior, not by `reasoning_effort` grammar composition
94
- - Claude requests therefore do not currently enable guided decoding
95
108
 
96
109
  ## Reasoning Effort
97
110
 
@@ -99,7 +112,7 @@ Reasoning effort is separate from ordinary structured outputs.
99
112
 
100
113
  ### Current state
101
114
 
102
- The OpenAI path maps `reasoning_effort` into grammar composition when a request constraint exists.
115
+ The OpenAI path maps `reasoning_effort` into grammar composition.
103
116
 
104
117
  Accepted values come from `ReasoningEffort::from_str`:
105
118
  - `none`
@@ -115,7 +128,7 @@ Non-Python builds also support:
115
128
  - `custom:<template>`
116
129
 
117
130
  Relevant code:
118
- - `src/utils/reasoning.rs`
131
+ - `src/utils/guidance_grammar.rs`
119
132
  - `src/server/server.rs`
120
133
  - `src/utils/guidance.rs`
121
134
 
@@ -124,7 +137,6 @@ Relevant code:
124
137
  Reasoning effort:
125
138
  - does not enable chat-template thinking by itself
126
139
  - only affects grammar composition
127
- - is ignored when no request constraint grammar is present
128
140
  - only works when reasoning start/end tokens are available
129
141
 
130
142
  If the tokenizer does not expose reasoning markers, the system logs a warning and falls back to the base grammar.
@@ -160,7 +172,7 @@ xinfer --m Qwen/Qwen3.5-35B-A3B-FP8/ --ui-server --d 0
160
172
  | Enforce text pattern | `structured_outputs` or `constraint` | `regex` |
161
173
  | Enforce full object schema | `structured_outputs` or `response_format` | `json` / `json_schema` |
162
174
  | Enforce custom grammar | `structured_outputs` or `constraint` | `grammar` / `lark` |
163
- | Constrain tagged structured output payload | `structured_outputs` | `structural_tag` |
175
+ | Constrain tool call payload | `structured_outputs` or automatic tool grammar | `structural_tag` / tool grammar |
164
176
  | Add a reasoning prefix | `reasoning_effort` | `low`, `medium`, `high`, etc. |
165
177
 
166
178
  ### 1. Constrain the answer to a fixed set
@@ -470,5 +482,5 @@ Check:
470
482
 
471
483
  - Guided decoding is only active when `SamplingParams.grammar` is present.
472
484
  - OpenAI currently has the richest client-facing grammar surface.
473
- - Claude does not currently expose request-level guided decoding.
485
+ - Claude currently reuses tool grammar, but not the same direct constraint request API.
474
486
  - No request-level grammar means no guided decoding.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xinfer-ai",
3
- "version": "0.13.5",
4
- "assetVersion": "0.13.5",
3
+ "version": "0.13.7",
4
+ "assetVersion": "0.13.7",
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",