tgetsov commited on
Commit
5f02adc
·
verified ·
1 Parent(s): 16b77dd

Document fused MLX and GGUF distributions

Browse files
Files changed (1) hide show
  1. README.md +113 -10
README.md CHANGED
@@ -5,6 +5,8 @@ pipeline_tag: text-generation
5
  license: apache-2.0
6
  tags:
7
  - mlx
 
 
8
  - lora
9
  - qwen3-next
10
  - orchestrator
@@ -13,12 +15,14 @@ tags:
13
 
14
  # bankai-v1
15
 
16
- `bankai-v1` is an MLX LoRA adapter for
17
  [`Qwen/Qwen3-Coder-Next`](https://huggingface.co/Qwen/Qwen3-Coder-Next), trained
18
  to perform one-step agent orchestration. Given a task, it selects one specialist
19
  worker and emits a complete delegated instruction as strict JSON.
20
 
21
- The adapter was trained against
 
 
22
  [`mlx-community/Qwen3-Coder-Next-4bit`](https://huggingface.co/mlx-community/Qwen3-Coder-Next-4bit).
23
  The upstream model is an 80B MoE with approximately 3B active parameters.
24
 
@@ -26,7 +30,7 @@ The upstream model is an 80B MoE with approximately 3B active parameters.
26
 
27
  | Property | Value |
28
  |---|---|
29
- | Model type | One-step agent orchestration adapter |
30
  | Upstream architecture | Qwen3-Next hybrid Gated DeltaNet / attention MoE |
31
  | Total base parameters | 79,674,391,296 (79.674B) |
32
  | Active parameters per token | Approximately 3B |
@@ -45,6 +49,19 @@ experts per token, and one shared expert. `bankai-v1` adapts only attention and
45
  gated-delta projections in the final 16 layers; it does not add LoRA matrices
46
  to the routed experts.
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  ## Output Contract
49
 
50
  ```json
@@ -74,6 +91,31 @@ Supported worker labels:
74
 
75
  ## Usage
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  Install MLX LM on Apple Silicon:
78
 
79
  ```bash
@@ -89,14 +131,66 @@ Generate with the adapter:
89
  mlx_lm.generate \
90
  --model mlx-community/Qwen3-Coder-Next-4bit \
91
  --adapter-path bankai-v1-adapter \
92
- --system-prompt "You are BankAI, a concise orchestration model. Select exactly one specialist worker for the user's task and return only the call_agent JSON contract." \
93
  --prompt "Design and test a GDPR-compliant CRM integration for a real-estate business." \
94
  --max-tokens 1024 \
95
  --temp 0
96
  ```
97
 
98
- For best consistency, use the complete system prompt from `training_config.yaml`
99
- or the source repository.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
  ## Training
102
 
@@ -140,6 +234,12 @@ Only assistant tokens contributed to the loss.
140
  The behavioral sample is small and measures formatting and category routing,
141
  not end-to-end quality of worker execution.
142
 
 
 
 
 
 
 
143
  ## Limitations
144
 
145
  This first version learns only single-step worker selection and prompt
@@ -179,8 +279,11 @@ used the checksummed final `training_set.jsonl` artifact.
179
 
180
  ## Integrity
181
 
182
- SHA-256 of `adapters.safetensors`:
 
 
 
 
183
 
184
- ```text
185
- 66df3ea1d9a9f0b1c3e07b1620a33dfb0b3bf36b6ea4b1e52fe2fc1bd8da67d9
186
- ```
 
5
  license: apache-2.0
6
  tags:
7
  - mlx
8
+ - gguf
9
+ - quantized
10
  - lora
11
  - qwen3-next
12
  - orchestrator
 
15
 
16
  # bankai-v1
17
 
18
+ `bankai-v1` is a one-step agent orchestration model based on
19
  [`Qwen/Qwen3-Coder-Next`](https://huggingface.co/Qwen/Qwen3-Coder-Next), trained
20
  to perform one-step agent orchestration. Given a task, it selects one specialist
21
  worker and emits a complete delegated instruction as strict JSON.
22
 
23
+ This repository includes the original MLX LoRA, a llama.cpp GGUF LoRA, a fully
24
+ fused 4-bit MLX model, and a fully fused Q4_K_M GGUF model. The adapter was
25
+ trained against
26
  [`mlx-community/Qwen3-Coder-Next-4bit`](https://huggingface.co/mlx-community/Qwen3-Coder-Next-4bit).
27
  The upstream model is an 80B MoE with approximately 3B active parameters.
28
 
 
30
 
31
  | Property | Value |
32
  |---|---|
33
+ | Model type | One-step agent orchestration model and adapters |
34
  | Upstream architecture | Qwen3-Next hybrid Gated DeltaNet / attention MoE |
35
  | Total base parameters | 79,674,391,296 (79.674B) |
36
  | Active parameters per token | Approximately 3B |
 
49
  gated-delta projections in the final 16 layers; it does not add LoRA matrices
50
  to the routed experts.
51
 
52
+ ## Repository Contents
53
+
54
+ | Path | Type | Size | Standalone |
55
+ |---|---|---:|---|
56
+ | `adapters.safetensors` | Original MLX LoRA | 11,439,496 bytes | No |
57
+ | `adapter_config.json` | MLX LoRA configuration | 1.3 KB | No |
58
+ | `gguf/bankai-v1-f16.gguf` | llama.cpp F16 LoRA | 6,116,192 bytes | No |
59
+ | `gguf/bankai-v1-Q4_K_M.gguf` | Fused Q4_K_M GGUF | 48,528,320,544 bytes | Yes |
60
+ | `mlx/` | Fused 4-bit MLX model, nine shards | Approximately 44.9 GB | Yes |
61
+ | `bankai-system.txt` | Exact training-time system prompt | 1 KB | N/A |
62
+ | `training_config.yaml` | Reproducible training configuration | 746 bytes | N/A |
63
+ | `evaluation.json` | Per-example behavioral evaluation | 30 KB | N/A |
64
+
65
  ## Output Contract
66
 
67
  ```json
 
91
 
92
  ## Usage
93
 
94
+ Download the exact system prompt:
95
+
96
+ ```bash
97
+ hf download ApplauseLab/bankai-v1 bankai-system.txt --local-dir bankai-v1
98
+ ```
99
+
100
+ ### Fused MLX Model
101
+
102
+ The fused MLX model does not require an adapter:
103
+
104
+ ```bash
105
+ hf download ApplauseLab/bankai-v1 \
106
+ --include "mlx/*" \
107
+ --local-dir bankai-v1
108
+
109
+ mlx_lm.generate \
110
+ --model bankai-v1/mlx \
111
+ --system-prompt "$(cat bankai-v1/bankai-system.txt)" \
112
+ --prompt "Design a GDPR-compliant CRM integration for a real-estate business." \
113
+ --max-tokens 1024 \
114
+ --temp 0
115
+ ```
116
+
117
+ ### MLX Adapter
118
+
119
  Install MLX LM on Apple Silicon:
120
 
121
  ```bash
 
131
  mlx_lm.generate \
132
  --model mlx-community/Qwen3-Coder-Next-4bit \
133
  --adapter-path bankai-v1-adapter \
134
+ --system-prompt "$(cat bankai-system.txt)" \
135
  --prompt "Design and test a GDPR-compliant CRM integration for a real-estate business." \
136
  --max-tokens 1024 \
137
  --temp 0
138
  ```
139
 
140
+ For best consistency, use the included `bankai-system.txt`.
141
+
142
+ ### Fused GGUF / llama.cpp
143
+
144
+ The fused GGUF is standalone and does not require `--lora`:
145
+
146
+ ```bash
147
+ hf download ApplauseLab/bankai-v1 \
148
+ gguf/bankai-v1-Q4_K_M.gguf \
149
+ --local-dir bankai-v1
150
+
151
+ llama-cli \
152
+ --model bankai-v1/gguf/bankai-v1-Q4_K_M.gguf \
153
+ --system-prompt-file bankai-v1/bankai-system.txt \
154
+ --prompt "Design a GDPR-compliant CRM integration for a real-estate business." \
155
+ --temp 0 \
156
+ --n-predict 1024 \
157
+ --single-turn
158
+ ```
159
+
160
+ ### GGUF Adapter
161
+
162
+ `bankai-v1-f16.gguf` is the same LoRA adapter converted for llama.cpp. It is
163
+ not a standalone 80B model; load it alongside a compatible
164
+ Qwen3-Coder-Next GGUF base:
165
+
166
+ ```bash
167
+ llama-cli \
168
+ --model Qwen3-Coder-Next-Q4_K_M.gguf \
169
+ --lora bankai-v1/gguf/bankai-v1-f16.gguf \
170
+ --system-prompt-file bankai-v1/bankai-system.txt \
171
+ --prompt "Design a GDPR-compliant CRM integration for a real-estate business." \
172
+ --temp 0 \
173
+ --n-predict 1024
174
+ ```
175
+
176
+ The GGUF adapter was converted through PEFT tensor orientation with
177
+ `lora_alpha=128`, preserving the MLX effective scale of 16 at rank 8.
178
+
179
+ Use the included `bankai-system.txt` for the exact worker vocabulary and JSON
180
+ contract seen during fine-tuning. Shorter prompts may produce valid routing in
181
+ a different schema.
182
+
183
+ ## Fusion Details
184
+
185
+ The fused MLX model was produced by merging the LoRA into
186
+ `mlx-community/Qwen3-Coder-Next-4bit` and saving the resulting quantized MLX
187
+ weights.
188
+
189
+ The standalone GGUF starts from the single-file Unsloth Q4_K_M conversion of
190
+ Qwen3-Coder-Next. Untouched tensors are copied bit-for-bit. The 64 targeted
191
+ attention and gated-delta matrices in layers 32-47 are dequantized to F32, the
192
+ LoRA delta is applied at effective scale 16, and each matrix is requantized to
193
+ its original Q4_K_M mixture type. The resulting GGUF contains 843 tensors.
194
 
195
  ## Training
196
 
 
234
  The behavioral sample is small and measures formatting and category routing,
235
  not end-to-end quality of worker execution.
236
 
237
+ Both fused formats received inference smoke tests with the full system prompt.
238
+ The fused MLX output matched the JSON contract. The fused GGUF output also
239
+ matched the contract, selected `compliance_specialist` for a held-out
240
+ real-estate GDPR/CRM/accounting request, and generated at approximately 64
241
+ tokens/second on an Apple M4 Max using Metal offload.
242
+
243
  ## Limitations
244
 
245
  This first version learns only single-step worker selection and prompt
 
279
 
280
  ## Integrity
281
 
282
+ | File | SHA-256 |
283
+ |---|---|
284
+ | `adapters.safetensors` | `66df3ea1d9a9f0b1c3e07b1620a33dfb0b3bf36b6ea4b1e52fe2fc1bd8da67d9` |
285
+ | `gguf/bankai-v1-f16.gguf` | `184b7855166c6c97fe366b4412de51cf98474dfc5df7caa95bda09f83c80e84d` |
286
+ | `gguf/bankai-v1-Q4_K_M.gguf` | `75f8200b83756e6f32565b4579c9bb07aa6aa591fca380bc3f85af1138102296` |
287
 
288
+ The fused GGUF also passed llama.cpp per-tensor hashing with whole-file XXH64
289
+ `c64819733a364e4d`.