xinfer-ai 0.12.8 → 0.12.9

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
@@ -167,6 +167,9 @@ xinfer --m Qwen/Qwen3.6-27B-FP8 --kvcache-dtype turbo4
167
167
  # 30B MoE GGUF + turbo4
168
168
  xinfer --m unsloth/Qwen3-30B-A3B-Instruct-2507-GGUF \
169
169
  --f Qwen3-30B-A3B-Instruct-2507-Q4_K_M.gguf --kvcache-dtype turbo4
170
+
171
+ # Metal/MacOS
172
+ xinfer --m unsloth/Qwen3.5-4B-GGUF --f Qwen3.5-4B-Q4_K_M.gguf
170
173
  ```
171
174
 
172
175
  ---
package/docs/add_model.md CHANGED
@@ -20,7 +20,8 @@ The skill lives at `.cursor/skills/add-model/SKILL.md` and is **automatically ac
20
20
  | **3 — Implement** | Creates the model file (`src/models/<arch>.rs`), handles HF and GGUF weight paths, MoE construction, packed expert layouts. |
21
21
  | **4 — Register** | Wires the model into `mod.rs`, `config.rs`, `utils/mod.rs`, `runner.rs`, and `parser.rs`. |
22
22
  | **5 — Build** | Compiles with the correct platform features and fixes all errors/warnings. |
23
- | **6 — Test** | Starts the server, sends OpenAI-compatible requests, debugs common issues (NaN, crashes, wrong output). |
23
+ | **6 — Check** | Invokes the [check-model skill](check_model.md) to validate tensor format, quantization consistency, and multi-GPU TP divisibility before testing. |
24
+ | **7 — Test** | Starts the server, sends OpenAI-compatible requests, debugs common issues (NaN, crashes, wrong output). |
24
25
 
25
26
  ## Quick Start
26
27
 
@@ -0,0 +1,133 @@
1
+ # Model Compatibility Checking (AI-Assisted)
2
+
3
+ xInfer ships with a **Cursor Agent Skill** that validates model compatibility before loading. It checks config correctness, weight tensor format, quantization consistency, and multi-GPU (tensor-parallel) divisibility — catching issues that would otherwise cause runtime panics or silent precision bugs.
4
+
5
+ ## Prerequisites
6
+
7
+ - [Cursor IDE](https://cursor.sh/) with Agent mode enabled (for other Agents, mention the skill file manually)
8
+ - The xInfer repository cloned locally
9
+ - A model to check: HuggingFace URL/ID, local path, or pasted config + tensor info
10
+
11
+ ## How It Works
12
+
13
+ The skill lives at `.cursor/skills/check-model/SKILL.md` and is **automatically activated** when you ask the agent to check, validate, audit, or verify a model. It walks the agent through five phases:
14
+
15
+ | Phase | What happens |
16
+ |-------|-------------|
17
+ | **0 — Gather info** | Collects model config and tensor info from HuggingFace URL, local path, or user-provided data. |
18
+ | **1 — Parse config** | Identifies architecture, extracts attention/MoE/hybrid parameters, normalizes quantization config. |
19
+ | **2 — Validate tensors** | Checks that tensor names, shapes, and dtypes match the expected format for the detected quantization. |
20
+ | **3 — Multi-rank analysis** | Tests TP divisibility for world_size 1, 2, 4, and 8 across all sharded components. |
21
+ | **4 — Report** | Produces a structured summary with OK/WARN/ERROR flags for each check. |
22
+
23
+ ## Quick Start
24
+
25
+ Open the project in Cursor and ask the agent:
26
+
27
+ ```
28
+ Check this model: https://huggingface.co/AxionML/Qwen3.5-27B-NVFP4/blob/main/config.json
29
+ ```
30
+
31
+ You can also provide tensor info by clicking a `.safetensors` file in the HuggingFace model page and copying the tensor tree:
32
+
33
+ ```
34
+ Check this model for multi-GPU compatibility:
35
+ <paste config.json URL>
36
+ <paste tensor info>
37
+ ```
38
+
39
+ Or check a local model:
40
+
41
+ ```
42
+ Check the model at /data/Qwen3.5-122B-A10B-NVFP4/ for 4-GPU loading
43
+ ```
44
+
45
+ ## What Gets Checked
46
+
47
+ ### Tensor Format Validation
48
+
49
+ For each quantization format, the skill verifies tensor naming and shapes:
50
+
51
+ | Format | Expected tensors per linear layer |
52
+ |--------|----------------------------------|
53
+ | **BF16/FP16** | `weight` only |
54
+ | **FP8** | `weight` (U8) + `weight_scale` or `weight_scale_inv` (F32) |
55
+ | **NVFP4 (ModelOpt)** | `weight` (U8) + `weight_scale` (F8_E4M3) + `weight_scale_2` (F32) + `input_scale` (F32) |
56
+ | **NVFP4 (compressed-tensors)** | `weight_packed` (U8) + `weight_scale` (F8_E4M3) + `weight_global_scale` (F32) + `input_global_scale` (F32) |
57
+ | **MXFP4** | `weight_packed` or `blocks` (U8) + `weight_scale` or `scales` (U8) |
58
+
59
+ ### Quantization Ignore List
60
+
61
+ For models with mixed precision (e.g., NVFP4 MoE with BF16 attention), the skill parses the `ignore` list from `quantization_config` and verifies that:
62
+ - Ignored layers have BF16/FP16 weights only (no quantized tensors)
63
+ - Non-ignored layers have the expected quantized tensor structure
64
+ - The `ignore` list supports literal paths, regex patterns (`re:...`), and glob wildcards
65
+
66
+ ### Multi-Rank Divisibility
67
+
68
+ For each candidate GPU count (1, 2, 4, 8), the skill checks:
69
+
70
+ | Component | What must divide evenly |
71
+ |-----------|------------------------|
72
+ | Full attention Q heads | `num_attention_heads % world_size` |
73
+ | Full attention KV heads | `num_kv_heads % world_size` (or `world_size % num_kv_heads` for replicated mode) |
74
+ | GDN K/V heads | `linear_num_key_heads % world_size` and `linear_num_value_heads % world_size` |
75
+ | GDN projections | All projection output dims by `world_size` |
76
+ | MoE intermediate | `moe_intermediate_size % world_size` |
77
+ | Shared expert | `shared_expert_intermediate_size % world_size` |
78
+ | FP8 block alignment | Per-rank boundaries aligned to `weight_block_size` |
79
+ | FP4 scale alignment | Per-rank inner dims are multiples of group_size (16 for NVFP4, 32 for MXFP4) |
80
+
81
+ ### Loader Path Compatibility
82
+
83
+ The skill checks tensor naming against xinfer's loader priority order:
84
+
85
+ | Component | Tensor name priority (first match wins) |
86
+ |-----------|---------------------------------------|
87
+ | FP4 packed weights | `weight_packed` > `weight` > `blocks` |
88
+ | FP4 scales | `weight_scale` > `scales` |
89
+ | FP4 global scale | `weight_global_scale` (inverted) > `weight_scale_2` (direct) |
90
+ | FP4 input scale | `input_scale` (direct) > `input_global_scale` (inverted) |
91
+ | FP8 scale | `weight_scale` > `weight_scale_inv` |
92
+
93
+ ## Example Output
94
+
95
+ ```
96
+ ## Model Summary
97
+ Architecture: Qwen3_5MoeForConditionalGeneration
98
+ Quantization: nvfp4 (compressed-tensors)
99
+ Layers: 48 (36 linear_attention + 12 full_attention)
100
+ Hidden: 3072, Q heads: 32, KV heads: 2, GDN K: 16, V: 64
101
+
102
+ ## Tensor Format
103
+ [OK] Linear attention: BF16 (in ignore list)
104
+ [OK] Full attention: NVFP4 (weight_packed + weight_scale + weight_global_scale)
105
+ [OK] MoE experts: NVFP4 per-expert (weight_packed)
106
+ [OK] Shared expert: NVFP4 (weight_packed)
107
+
108
+ ## Multi-Rank Compatibility
109
+ | Component | 1 GPU | 2 GPUs | 4 GPUs | 8 GPUs |
110
+ |---------------------|-------|--------|--------|--------|
111
+ | Q heads (32) | OK | 16 | 8 | 4 |
112
+ | KV heads (2) | OK | 1 | repl(2)| repl(4)|
113
+ | GDN K heads (16) | OK | 8 | 4 | 2 |
114
+ | GDN V heads (64) | OK | 32 | 16 | 8 |
115
+ | MoE inter (1024) | OK | 512 | 256 | 128 |
116
+ | Overall | OK | OK | OK | OK |
117
+ ```
118
+
119
+ ## Integration with Add Model
120
+
121
+ The [add-model skill](add_model.md) automatically invokes the check-model skill after implementing a new architecture, ensuring the model loads correctly on single and multi-GPU configurations before testing.
122
+
123
+ ## File Reference
124
+
125
+ | File | Role |
126
+ |------|------|
127
+ | `.cursor/skills/check-model/SKILL.md` | The skill definition (read by the AI agent) |
128
+ | `src/models/layers/distributed.rs` | TP column/row linear, merged chunk loading, KV head sharding |
129
+ | `src/models/layers/linear.rs` | FP8/NVFP4/MXFP4 linear layer loaders |
130
+ | `src/models/layers/deltanet.rs` | GatedDeltaNet loading, per-weight quantization detection |
131
+ | `src/models/layers/attention.rs` | Full attention QKV loading and packed QKV for FP8 |
132
+ | `src/models/layers/moe.rs` | MoE expert loading for all quantization formats |
133
+ | `src/utils/config.rs` | QuantConfig normalization, ignore list parsing |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xinfer-ai",
3
- "version": "0.12.8",
4
- "assetVersion": "0.12.8",
3
+ "version": "0.12.9",
4
+ "assetVersion": "0.12.9",
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",