mlx-bun 0.2.0 → 0.3.0

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.
Files changed (364) hide show
  1. package/README.md +71 -588
  2. package/docs/README.md +91 -0
  3. package/docs/{design → archive/investigations}/audio-input-plan.md +4 -4
  4. package/docs/{design → archive/investigations}/diffusion-gemma-port.md +3 -3
  5. package/docs/{design → archive/investigations}/faithful-l1-consolidation.md +4 -4
  6. package/docs/{design → archive/investigations}/minicpm5-decode-megakernel.md +11 -11
  7. package/docs/{design → archive/investigations}/optimization_plan.md +1 -1
  8. package/docs/{design → archive/investigations}/pre-colibri-stabilization.md +5 -5
  9. package/docs/{design → archive/investigations}/the-dreaming-handoff.md +2 -2
  10. package/docs/design/batching.md +569 -0
  11. package/docs/design/decode-speed-program.md +3178 -169
  12. package/docs/design/dreaming-nightly-pipeline.md +675 -282
  13. package/docs/design/generic-model-support.md +579 -334
  14. package/docs/design/kv-cache.md +680 -0
  15. package/docs/design/orpo-training.md +673 -1239
  16. package/docs/design/speculative-decoding.md +1627 -0
  17. package/docs/design/turboquant.md +2102 -0
  18. package/docs/design/unified-engine-frontier-plan.md +1831 -727
  19. package/docs/design/web-chat-redesign.md +666 -1083
  20. package/docs/planning/PRODUCT_ROADMAP.md +34 -1
  21. package/docs/planning/release-notes-v0.3.0.md +35 -0
  22. package/docs/planning/video-series.md +2 -2
  23. package/docs/reference/benchmarks.md +1162 -0
  24. package/docs/reference/cli.md +394 -159
  25. package/docs/reference/distribution.md +321 -182
  26. package/docs/reference/environment.md +348 -0
  27. package/docs/reference/glossary.md +39 -0
  28. package/docs/reference/library-api.md +566 -168
  29. package/docs/reference/memory.md +227 -64
  30. package/docs/reference/models.md +104 -6
  31. package/docs/reference/server-api.md +886 -425
  32. package/docs/reference/server-config.md +638 -330
  33. package/docs/reference/training.md +393 -254
  34. package/docs/reference/troubleshooting.md +166 -0
  35. package/package.json +9 -4
  36. package/src/audio/decode.ts +2 -2
  37. package/src/audio/features.ts +2 -2
  38. package/src/backends/mlx/autoregressive.ts +108 -0
  39. package/src/backends/mlx/batch-group.ts +1646 -0
  40. package/src/backends/mlx/diffusion.ts +39 -0
  41. package/src/backends/mlx/draft-target.ts +47 -0
  42. package/src/backends/mlx/evaluation.ts +105 -0
  43. package/src/backends/mlx/fill-append.ts +45 -0
  44. package/src/backends/mlx/gateway-binding.ts +71 -0
  45. package/src/backends/mlx/graph.ts +38 -0
  46. package/src/backends/mlx/memory-client.ts +189 -0
  47. package/src/backends/mlx/memory-guard.ts +40 -0
  48. package/src/backends/mlx/methods.ts +90 -0
  49. package/src/backends/mlx/model-prompt.ts +164 -0
  50. package/src/backends/mlx/model-serving.ts +79 -0
  51. package/src/backends/mlx/prefill.ts +33 -0
  52. package/src/backends/mlx/request-policy.ts +20 -0
  53. package/src/backends/mlx/rollback.ts +51 -0
  54. package/src/backends/mlx/serial-executor.ts +273 -0
  55. package/src/backends/mlx/speculative.ts +114 -0
  56. package/src/backends/mlx/state-views.ts +26 -0
  57. package/src/backends/mlx/text-engine.ts +73 -0
  58. package/src/cli.ts +58 -25
  59. package/src/client.ts +66 -0
  60. package/src/config.ts +21 -4
  61. package/src/contracts/completion.ts +16 -0
  62. package/src/contracts/execution.ts +49 -0
  63. package/src/contracts/generation.ts +103 -0
  64. package/src/contracts/host.ts +7 -0
  65. package/src/contracts/jobs.ts +66 -0
  66. package/src/contracts/pi-provider.ts +30 -0
  67. package/src/contracts/pi.ts +259 -0
  68. package/src/contracts/resources.ts +18 -0
  69. package/src/contracts/scheduling.ts +27 -0
  70. package/src/contracts/tsconfig.json +14 -0
  71. package/src/diffusion/diffusion-generate.ts +218 -153
  72. package/src/embed.ts +1 -1
  73. package/src/engine/admission.ts +59 -0
  74. package/src/engine/cancellation.ts +38 -0
  75. package/src/engine/engine.ts +56 -0
  76. package/src/engine/execution-coordinator.ts +70 -0
  77. package/src/engine/execution-plan.ts +51 -0
  78. package/src/engine/resources.ts +42 -0
  79. package/src/engine/scheduler.ts +67 -0
  80. package/src/engine/session.ts +247 -0
  81. package/src/eval/README.md +44 -1
  82. package/src/eval/kl.ts +236 -3
  83. package/src/eval/reference-logits.ts +207 -0
  84. package/src/eval/runner.ts +8 -96
  85. package/src/fill/echo-index.ts +188 -0
  86. package/src/fill/fill-session.ts +452 -0
  87. package/src/fill/proposal.ts +68 -0
  88. package/src/fill/schema-rows.ts +506 -0
  89. package/src/fill/tool-boundary.ts +103 -0
  90. package/src/fit.ts +1 -1
  91. package/src/generate.ts +656 -268
  92. package/src/grammar.ts +12 -7
  93. package/src/harness-pi.ts +14 -33
  94. package/src/hub-rest.ts +4 -4
  95. package/src/index.ts +7 -0
  96. package/src/inference/denoising.ts +17 -0
  97. package/src/inference/graph.ts +33 -0
  98. package/src/inference/prefill.ts +39 -0
  99. package/src/inference/rollback.ts +7 -0
  100. package/src/jobs/db.ts +4 -0
  101. package/src/jobs/index.ts +2 -0
  102. package/src/jobs/job-entry.ts +12 -12
  103. package/src/jobs/runner.ts +98 -13
  104. package/src/jobs/task-client.ts +19 -0
  105. package/src/jobs/types.ts +2 -58
  106. package/src/kv-store.ts +109 -49
  107. package/src/lab/README.md +18 -0
  108. package/src/{assets → lab/curve}/curve-designer.html +2 -2
  109. package/src/{curve-sampler.ts → lab/curve/curve-sampler.ts} +2 -2
  110. package/src/{expert-trace.ts → lab/expert-trace/expert-trace.ts} +5 -5
  111. package/src/{model → lab/paged-kv}/paged-kv.ts +9 -6
  112. package/src/library.ts +40 -0
  113. package/src/lora.ts +18 -0
  114. package/src/media-fetch.ts +1 -1
  115. package/src/memory/article.ts +1 -1
  116. package/src/memory/chunk.ts +1 -1
  117. package/src/memory/model.ts +30 -169
  118. package/src/memory/prompts.ts +1 -1
  119. package/src/memory/rest.ts +1 -1
  120. package/src/memory/schedule.ts +1 -1
  121. package/src/memory/stages.ts +4 -1
  122. package/src/memory/vault.ts +1 -3
  123. package/src/mlx/array.ts +9 -10
  124. package/src/mlx/compile.ts +12 -2
  125. package/src/mlx/ffi.ts +58 -11
  126. package/src/mlx/materialize.ts +23 -0
  127. package/src/mlx/metal-kernel.ts +10 -11
  128. package/src/mlx/ops.ts +33 -13
  129. package/src/mlx/quantized-rows.ts +36 -0
  130. package/src/mlx/token-bitmask.ts +52 -0
  131. package/src/mlx/turboquant-kv-decode.ts +82 -0
  132. package/src/mlx/turboquant-kv-inverse.ts +122 -0
  133. package/src/mlx/turboquant-ops.ts +33 -3
  134. package/src/mlx/turboquant-tables.ts +2 -2
  135. package/src/model/batched-mask.ts +8 -2
  136. package/src/model/batched-quant.ts +1 -1
  137. package/src/model/batched-rotating-quant.ts +2 -2
  138. package/src/model/batched-rotating.ts +1 -1
  139. package/src/model/compiled-decode.ts +1 -1
  140. package/src/model/diffusion-gemma.ts +8 -8
  141. package/src/model/factory.ts +76 -33
  142. package/src/model/fingerprint.ts +1 -1
  143. package/src/model/flash-attention.ts +3 -3
  144. package/src/model/gemma4-base.ts +26 -9
  145. package/src/model/gemma4.ts +6 -6
  146. package/src/model/generated/gemma4-12b.ts +2 -2
  147. package/src/model/generated/gemma4-26b.ts +2 -2
  148. package/src/model/generated/gemma4-e4b.ts +2 -2
  149. package/src/model/glm52-dsa.ts +13 -9
  150. package/src/model/glm52-memory.ts +1 -1
  151. package/src/model/implementation.ts +69 -0
  152. package/src/model/minicpm5.ts +6 -8
  153. package/src/model/profile.ts +12 -2
  154. package/src/model/qwen-append.ts +12 -0
  155. package/src/model/qwen-conv.ts +52 -0
  156. package/src/model/qwen3_5-checkpoint.ts +164 -0
  157. package/src/model/qwen3_5.ts +140 -56
  158. package/src/model/support.ts +1 -1
  159. package/src/model/trellis-balanced-scatter.ts +51 -0
  160. package/src/model/trellis-linear.ts +672 -0
  161. package/src/model/trellis-shared-m.ts +151 -0
  162. package/src/model/trellis-shared-scatter.ts +144 -0
  163. package/src/model/trellis-splitk-prefill.ts +158 -0
  164. package/src/model/trellis-tiled-prefill.ts +136 -0
  165. package/src/model/trellis-vector-expand.ts +62 -0
  166. package/src/model/trellis-wide-prefill.ts +94 -0
  167. package/src/model/universal/dense.ts +1 -1
  168. package/src/model/universal/modules.ts +8 -1
  169. package/src/native-pack.ts +6 -5
  170. package/src/pi-provider.ts +6 -64
  171. package/src/pi-web.ts +8 -315
  172. package/src/prompt-cache.ts +96 -53
  173. package/src/quantize/allocator.ts +1 -1
  174. package/src/quantize/config-writer.ts +10 -3
  175. package/src/quantize/rotate.ts +4 -4
  176. package/src/quantize/trellis.ts +586 -0
  177. package/src/responses.ts +28 -1
  178. package/src/runtime-config.ts +18 -4
  179. package/src/sampler.ts +4 -4
  180. package/src/serve/batch-scheduler.ts +8 -1671
  181. package/src/serve/chat-request.ts +391 -0
  182. package/src/serve/chat-stage.ts +195 -0
  183. package/src/serve/checkpoint-identity.ts +64 -0
  184. package/src/serve/completion-executor.ts +15 -7
  185. package/src/serve/discovery-routes.ts +12 -13
  186. package/src/serve/generation-gateway.ts +154 -193
  187. package/src/serve/http.ts +159 -0
  188. package/src/serve/inference-request.ts +79 -0
  189. package/src/serve/isolate.ts +297 -105
  190. package/src/serve/lab-routes.ts +3 -0
  191. package/src/serve/lane-registry.ts +2 -1
  192. package/src/serve/model-admin-routes.ts +7 -5
  193. package/src/serve/model-binding.ts +43 -0
  194. package/src/serve/model-host.ts +512 -0
  195. package/src/serve/openai-wire.ts +103 -0
  196. package/src/serve/parent-application.ts +56 -0
  197. package/src/serve/pipeline.ts +33 -0
  198. package/src/serve/preparation.ts +33 -0
  199. package/src/serve/request-plan.ts +19 -15
  200. package/src/serve/request-prep.ts +346 -0
  201. package/src/serve/response-lease.ts +24 -0
  202. package/src/serve/responses-client.ts +69 -0
  203. package/src/serve/session-completion-engine.ts +110 -0
  204. package/src/serve/session-search.ts +1 -1
  205. package/src/serve/static-routes.ts +5 -5
  206. package/src/serve/text-completion-stage.ts +104 -0
  207. package/src/serve/token-streams.ts +519 -0
  208. package/src/server.ts +317 -2649
  209. package/src/spec/assistant-source.ts +10 -44
  210. package/src/spec/deepspec-source.ts +6 -6
  211. package/src/spec/dflash-source.ts +8 -8
  212. package/src/spec/dspark/ab-stats.ts +3 -3
  213. package/src/spec/dspark/calibration.ts +2 -2
  214. package/src/spec/dspark/deepspec-module.ts +2 -2
  215. package/src/spec/dspark/generate-dflash.ts +2 -2
  216. package/src/spec/dspark/generate.ts +2 -2
  217. package/src/spec/dspark/loader.ts +1 -1
  218. package/src/spec/dspark/module-dflash.ts +4 -3
  219. package/src/spec/dspark/module.ts +3 -3
  220. package/src/spec/dspark/quantize-drafter.ts +1 -1
  221. package/src/spec/generate.ts +1 -1
  222. package/src/spec/glm52-mtp-source.ts +1 -1
  223. package/src/spec/ngram-source.ts +1 -1
  224. package/src/spec/prefix-state.ts +45 -0
  225. package/src/spec/qwen-mtp-source.ts +166 -69
  226. package/src/spec/serve-loop.ts +154 -156
  227. package/src/spec/source.ts +42 -10
  228. package/src/spec/two-model.ts +1 -1
  229. package/src/ssd-cache.ts +80 -12
  230. package/src/ssd-durability.ts +25 -13
  231. package/src/tool-call.ts +51 -14
  232. package/src/train/flash-cce.ts +2 -2
  233. package/src/train/forward.ts +6 -0
  234. package/src/train/loss.ts +1 -1
  235. package/src/train/prefix-shared.ts +5 -1
  236. package/src/train/segmented.ts +5 -3
  237. package/src/train/trainer.ts +6 -6
  238. package/src/vision/prompt.ts +1 -1
  239. package/src/vision/qwen3vl-tower.ts +52 -10
  240. package/src/web/app.html +1 -1
  241. package/src/web/app.js +5 -3
  242. package/src/web/src/adapters-panel.ts +3 -3
  243. package/src/web/src/assistant.ts +2 -36
  244. package/src/web/src/chat.ts +4 -4
  245. package/src/web/src/composer.ts +4 -4
  246. package/src/web/src/hub.ts +1 -1
  247. package/src/web/src/markdown.ts +0 -0
  248. package/src/web/src/memory-panel.ts +1 -1
  249. package/src/web/src/model-picker.ts +1 -1
  250. package/src/web/src/palette.ts +1 -1
  251. package/src/web/src/protocol.ts +3 -39
  252. package/src/web/src/sessions.ts +1 -1
  253. package/src/web/src/ui-catalog.ts +4 -18
  254. package/src/web-assets.ts +47 -0
  255. package/src/weights.ts +55 -9
  256. package/docs/archive/investigations/curve-runs/bisector-route.json +0 -98
  257. package/docs/archive/investigations/curve-runs/bisector-trace.json +0 -1393
  258. package/docs/archive/investigations/curve-runs/curve-terrain.json +0 -1179
  259. package/docs/archive/investigations/curve-runs/curve-terrain.svg +0 -42
  260. package/docs/archive/investigations/hlg-ab.html +0 -34
  261. package/docs/archive/investigations/hlg-explorer.html +0 -238
  262. package/docs/archive/investigations/hlg-figs/cliff.svg +0 -1
  263. package/docs/archive/investigations/hlg-figs/cross.svg +0 -1
  264. package/docs/archive/investigations/hlg-figs/edges.svg +0 -1
  265. package/docs/archive/investigations/hlg-figs/k20-grids.svg +0 -1
  266. package/docs/archive/investigations/hlg-figs/k20-peaks.svg +0 -1
  267. package/docs/archive/investigations/hlg-figs/lw-curve.svg +0 -1
  268. package/docs/archive/investigations/hlg-figs/terrain.svg +0 -1
  269. package/docs/archive/investigations/hlg-report.html +0 -262
  270. package/docs/archive/investigations/hlg-runs/hlg-ab.json +0 -149
  271. package/docs/archive/investigations/hlg-runs/hlg-blind-prompts.md +0 -87
  272. package/docs/archive/investigations/hlg-runs/hlg-blind.json +0 -107
  273. package/docs/archive/investigations/hlg-runs/hlg-cliff.json +0 -197
  274. package/docs/archive/investigations/hlg-runs/hlg-cross.json +0 -505
  275. package/docs/archive/investigations/hlg-runs/hlg-edge.json +0 -388
  276. package/docs/archive/investigations/hlg-runs/hlg-eval1.json +0 -25
  277. package/docs/archive/investigations/hlg-runs/hlg-frontier.json +0 -86
  278. package/docs/archive/investigations/hlg-runs/hlg-grid.json +0 -242
  279. package/docs/archive/investigations/hlg-runs/hlg-grid2.json +0 -343
  280. package/docs/archive/investigations/hlg-runs/hlg-lw-coarse.json +0 -110
  281. package/docs/archive/investigations/hlg-runs/hlg-map.json +0 -383
  282. package/docs/archive/investigations/hlg-runs/run0-original.log +0 -159
  283. package/docs/archive/investigations/hlg-runs/runA-recommended.log +0 -131
  284. package/docs/archive/investigations/hlg-runs/runAA-cliff-cpm5.log +0 -26
  285. package/docs/archive/investigations/hlg-runs/runAB-grid2-e4b.log +0 -18
  286. package/docs/archive/investigations/hlg-runs/runAC-peak-e4b-partial.log +0 -25
  287. package/docs/archive/investigations/hlg-runs/runAD-ab-samples.log +0 -8
  288. package/docs/archive/investigations/hlg-runs/runAE-edge-e4b.log +0 -51
  289. package/docs/archive/investigations/hlg-runs/runAF-logit-calibration.log +0 -10
  290. package/docs/archive/investigations/hlg-runs/runAG-eval-config2.log +0 -16
  291. package/docs/archive/investigations/hlg-runs/runB-gain-variants.log +0 -192
  292. package/docs/archive/investigations/hlg-runs/runC-pivots.log +0 -162
  293. package/docs/archive/investigations/hlg-runs/runD-oetf.log +0 -132
  294. package/docs/archive/investigations/hlg-runs/runE-eotf.log +0 -162
  295. package/docs/archive/investigations/hlg-runs/runF-shaper-working.log +0 -86
  296. package/docs/archive/investigations/hlg-runs/runG-shaper-sweep.log +0 -101
  297. package/docs/archive/investigations/hlg-runs/runH-wsweep.log +0 -176
  298. package/docs/archive/investigations/hlg-runs/runI-asweep.log +0 -176
  299. package/docs/archive/investigations/hlg-runs/runJ-knobmap.log +0 -49
  300. package/docs/archive/investigations/hlg-runs/runK-frontier.log +0 -19
  301. package/docs/archive/investigations/hlg-runs/runL-widemap.log +0 -65
  302. package/docs/archive/investigations/hlg-runs/runM-frontier-emb.log +0 -15
  303. package/docs/archive/investigations/hlg-runs/runN-verify.log +0 -116
  304. package/docs/archive/investigations/hlg-runs/runO-frontier-seed5000.log +0 -15
  305. package/docs/archive/investigations/hlg-runs/runP-grid-AxSm.log +0 -15
  306. package/docs/archive/investigations/hlg-runs/runQ-grid-tgW.log +0 -15
  307. package/docs/archive/investigations/hlg-runs/runR-blind-transcript.log +0 -79
  308. package/docs/archive/investigations/hlg-runs/runS-cross-coherence.log +0 -33
  309. package/docs/archive/investigations/hlg-runs/runT-cross-cpm5.log +0 -33
  310. package/docs/archive/investigations/hlg-runs/runU-cross-12b.log +0 -33
  311. package/docs/archive/investigations/hlg-runs/runV-lw-e4b.log +0 -22
  312. package/docs/archive/investigations/hlg-runs/runW-lw-12b.log +0 -22
  313. package/docs/archive/investigations/hlg-runs/runX-lw-cpm5.log +0 -22
  314. package/docs/archive/investigations/hlg-runs/runY-cliff-e4b.log +0 -26
  315. package/docs/archive/investigations/hlg-runs/runZ-cliff-12b.log +0 -26
  316. package/docs/archive/mlx-bun-lab-report.html +0 -275
  317. package/docs/archive/wwdc-mlx-bun.html +0 -848
  318. package/docs/design/adapters-end-to-end.md +0 -205
  319. package/docs/design/batching-perf-path.md +0 -255
  320. package/docs/design/batching-v2-plan.md +0 -529
  321. package/docs/design/bucketing-stage.md +0 -197
  322. package/docs/design/compat-cli-surface-design.md +0 -230
  323. package/docs/design/docs-reorg-plan.md +0 -165
  324. package/docs/design/dspark-serving-program.md +0 -371
  325. package/docs/design/dspark-speculative-decoding.md +0 -318
  326. package/docs/design/grammar-spec-batching-integration.md +0 -301
  327. package/docs/design/memory-inference-path.md +0 -422
  328. package/docs/design/memory-synthesis.md +0 -287
  329. package/docs/design/memory-system.md +0 -237
  330. package/docs/design/mlx-lm-serving-execution-seam.md +0 -81
  331. package/docs/design/mlx-lm-tool-parity-plan.md +0 -545
  332. package/docs/design/omlx-adoption-map.md +0 -98
  333. package/docs/design/orpo-dynamic-lambda.md +0 -220
  334. package/docs/design/orpo-future-enhancements.md +0 -340
  335. package/docs/design/paged-kv-cache.md +0 -214
  336. package/docs/design/parallel-slots.md +0 -567
  337. package/docs/design/parity-tier-dag.md +0 -161
  338. package/docs/design/repo-cleanup-plan.md +0 -231
  339. package/docs/design/runtime-isolation.md +0 -263
  340. package/docs/design/segmented-backward-training.md +0 -543
  341. package/docs/design/spec-decode-larger-targets.md +0 -229
  342. package/docs/design/ssd-kv-cold-tier.md +0 -415
  343. package/docs/design/structured-output.md +0 -484
  344. package/docs/design/tauri-desktop-app.md +0 -127
  345. package/docs/design/the-dreaming-master-plan.md +0 -445
  346. package/docs/design/turboquant-kv.md +0 -235
  347. package/docs/design/turboquant-weights.md +0 -467
  348. package/docs/design/w4a16-compute-precision-spike.md +0 -232
  349. package/docs/design/web-chat-beat-matrix.md +0 -315
  350. package/docs/design/write-pipeline-entity.md +0 -468
  351. package/docs/planning/IDEAS.md +0 -69
  352. package/docs/reference/embedding.md +0 -197
  353. package/docs/reference/features-matrix.md +0 -101
  354. package/docs/reference/orpo-quickstart.md +0 -135
  355. package/src/flags.ts +0 -11
  356. /package/docs/{design → archive/investigations}/colibri-glm52-port.md +0 -0
  357. /package/docs/{planning → archive/planning}/chunk-task-roadmap.md +0 -0
  358. /package/docs/{planning → archive/planning}/curve-sampler-research-plan.md +0 -0
  359. /package/docs/{planning → archive/planning}/memory-docs-and-dag-plan.md +0 -0
  360. /package/docs/{planning → archive/planning}/pi-integration-review.md +0 -0
  361. /package/docs/{planning → archive/planning}/release-notes-v0.2.0.md +0 -0
  362. /package/src/{memory-plan.ts → admission-plan.ts} +0 -0
  363. /package/{docs/archive/investigations → src/serve/assets}/curve-terrain.html +0 -0
  364. /package/{docs/dag → src/serve/assets}/training-inference-map.html +0 -0
@@ -1,119 +1,200 @@
1
1
  # CLI reference
2
2
 
3
- Every mlx-bun verb. Commands are shown as `mlx-bun <verb>`; from a clone the
4
- identical command is `bun src/cli.ts <verb>`. `mlx-bun help <verb>` (or
5
- `mlx-bun <verb> --help`) prints the full flag list for any command.
6
-
7
- Model arguments are **substring queries** against the registry (`e4b`, `26B`,
8
- `12B-it`); a query matching more than one model errors out and lists the
9
- candidates — just make it more specific.
10
-
11
- Bare `mlx-bun` with no verb runs `serve` — the appliance path: first run
12
- downloads a starter model, serves it, and opens the chat UI.
13
-
14
- > All verbs below ship in current releases; the release notes in
15
- > `docs/planning/` record when each verb first appeared.
16
-
17
- ## Serving & chat
3
+ Every mlx-bun verb, from `src/cli.ts`. Commands are shown as
4
+ `mlx-bun <verb>`; from a clone the identical command is
5
+ `bun src/cli.ts <verb>`. `mlx-bun help <verb>` (or `mlx-bun <verb> --help`)
6
+ prints the full flag list for any command; `mlx-bun --version` (also `-v` or
7
+ `mlx-bun version`) prints the version.
8
+
9
+ **Model arguments are substring queries** against the registry (`e4b`,
10
+ `12B`, `qwen`, a repo substring); a query that matches more than one model
11
+ errors and lists the candidates. A directory containing `config.json` is
12
+ loaded directly wherever a model is accepted (`serve`, `pi`, `benchmark`,
13
+ `embed`, `fuse`, `convert`, `perplexity`).
14
+
15
+ **Bare `mlx-bun`** (no verb, or only options such as `mlx-bun --port 9000`)
16
+ runs `serve`. Explicit verbs and `--help`/`--version` still win.
17
+
18
+ **Unknown flags are ignored**, not rejected — `mlx-bun serve --kv-bits 4`
19
+ starts a server as if the flag were absent. The exceptions are `fuse` and
20
+ `convert`, which refuse the mlx-lm flags they don't implement (listed under
21
+ each verb).
22
+
23
+ ## Verb index
24
+
25
+ | Verb | Does | mlx-lm counterpart |
26
+ |---|---|---|
27
+ | `serve` | OpenAI/Anthropic-compatible server + web app | `mlx_lm.server` |
28
+ | `pi` | built-in coding agent on a local model | — (`mlx_lm.chat` is the nearest) |
29
+ | `harness pi` | connect your own pi install to the local server | — |
30
+ | `generate` (`gen`) | one-shot generation, no server | `mlx_lm.generate` |
31
+ | `embed` | text embeddings, no server | — |
32
+ | `get` | download a model (resumable, verified) | `mlx_lm.manage` (partial) |
33
+ | `scan` | re-index the Hugging Face cache | `mlx_lm.manage --scan` |
34
+ | `ls` | list downloaded models | `mlx_lm.manage --scan` |
35
+ | `gc` | reclaim superseded snapshots + dead blobs | `mlx_lm.manage --delete` (different unit) |
36
+ | `fit` | will it fit? memory + speed assessment | — (`optiq latency`) |
37
+ | `train` | LoRA fine-tune (SFT / DPO / ORPO) | `mlx_lm.lora --train` |
38
+ | `train-watch` | live dashboard for a training run | — |
39
+ | `fuse` | merge an adapter into the base weights | `mlx_lm.fuse` |
40
+ | `convert` | quantize an HF model into a local MLX snapshot | `mlx_lm.convert` (+ `mlx_lm.dynamic_quant`, `optiq convert`) |
41
+ | `upload` | push a model directory to the Hub | `mlx_lm.upload` |
42
+ | `perplexity` | perplexity over a local dataset | `mlx_lm.perplexity` |
43
+ | `memory` (`setup`) | the assistant's personal wiki | — |
44
+ | `benchmark` (`bench`) | decode/prefill speed of our stack | `mlx_lm.benchmark` |
45
+ | `evals` | recorded benchmark runs | — |
46
+ | `help` | overview or per-verb help | — |
47
+
48
+ ## Serving & agents
18
49
 
19
50
  ### `serve` — run the server
20
51
 
21
- Start the OpenAI/Anthropic-compatible server plus the browser web app (chat,
22
- status, and model tools).
52
+ Start the OpenAI/Anthropic-compatible server plus the browser web app.
23
53
 
24
54
  ```sh
25
- mlx-bun serve # default model, http://localhost:8080
26
- mlx-bun serve e4b # pick a model by substring
27
- mlx-bun serve gemma --memory-budget 18 # ...with admission control (GB)
28
- mlx-bun serve e4b --no-open # don't open the browser chat UI
29
- mlx-bun serve GLM-5.2 --context-length 4096 # bounded Colibri runtime, native MTP
55
+ mlx-bun serve # default model
56
+ mlx-bun serve e4b # pick a model by substring
57
+ mlx-bun serve --model ./fused_model # explicit path (mlx_lm.server spelling)
58
+ mlx-bun serve e4b --no-open # don't open the chat UI
59
+ mlx-bun serve GLM-5.2 --context-length 4096
30
60
  ```
31
61
 
32
- Common flags (full list in [server-config.md](server-config.md)):
62
+ `serve` takes the model as a positional, `--query <q>`, or `--model <path|query>`
63
+ (`--model` wins). The flag set below is **shared with `mlx-bun pi`**. Defaults,
64
+ semantics, and which combinations compose live in
65
+ **[server-config.md](server-config.md)** — this page only names them.
33
66
 
34
- | Flag | Effect |
67
+ | Group | Flags |
35
68
  |---|---|
36
- | `--host <addr>` | Interface to bind (default `127.0.0.1`, loopback only; `0.0.0.0` to expose) |
37
- | `--port <n>` | Listen port (default 8080) |
38
- | `--memory-budget <GB>` | Admission ceiling for requests (bills the active `--kv-quant` scheme; clamps `max_tokens`, 400s only prompts that leave no room — never refuses to start) |
39
- | `--kv-budget <GB>` | Aggregate KV budget across concurrent batch rows: over-budget joiners queue until rows finish; a request over the budget alone is rejected (off unless set) |
40
- | `--prompt-cache <GB>` | RAM prefix-KV cache, byte-capped LRU (default 8; `0` disables). Non-consuming prefix sharing: a hit clones instead of consuming the donor entry |
41
- | `--isolate` | Run the inference engine as a crash-isolated child process on a unix socket; this process becomes a pure reverse-proxy (instant under GPU load, auto-respawns on engine crash) — default off ([runtime-isolation.md](../design/runtime-isolation.md)) |
42
- | `--model-pool <n>` | With `--isolate`: cap on resident per-model engine children (default 1); over the cap the LRU engine drains its cache to the SSD tier and exits, respawning on demand |
43
- | `--ssd-cache <dir>` | SSD cold tier under the prompt cache: idle/evicted prefix-KV spills to disk and restores on reattach, surviving restarts (default off — [ssd-kv-cold-tier.md](../design/ssd-kv-cold-tier.md)) |
44
- | `--ssd-cache-max <GB>` | SSD tier byte cap, oldest-mtime evicted first (default 32; `--ssd-cache` only) |
45
- | `--ssd-cache-verify` | Verify every tensor hash on restore, not just the header (integrity paranoia; roughly doubles restore reads; `--ssd-cache` only) |
46
- | `--ssd-demote-idle <sec>` | Idle prompt-cache entries spill to the SSD tier and free GPU memory after this long (default 300 with `--ssd-cache`; `0` disables) |
47
- | `--kv-quant config\|off\|4\|8\|turbo[:k<bits>v<bits>]` | KV cache quantization: per-layer `kv_config.json`, bf16, uniform bits, or TurboQuant (rotation-based, default `k8v3` — [turboquant-kv.md](../design/turboquant-kv.md); full-attention layers only, solo-only/serial) (default `off` — quantized KV trades 5–20% decode speed for memory headroom, so it's opt-in) |
48
- | `--paged-kv` | OPTIONAL vLLM-style paged KV cache (block pool + gather before the stock SDPA; env `MLX_BUN_PAGED_KV=1`) — bit-exact with the plain path, default off. v1: serial only (pins `--batch 1` unless `--batch` is given; refuses `--batch N>1`, `--kv-quant`, `--draft-model`), Gemma4-family, bf16; bypasses the prompt cache and runs uncompiled decode. Expect a small decode cost at batch=1 — v1 ships the abstraction for batched/CoW follow-ups ([paged-kv-cache.md](../design/paged-kv-cache.md)) |
49
- | `--paged-kv-block-size <n>` | Tokens per KV block (default 256 = the plain cache's growth step; `--paged-kv` only) |
50
- | `--adapter <dir>` | Mount a LoRA adapter at startup (`--adapter-path` accepted as the mlx_lm.server alias) |
51
- | `--draft-model <path\|query>` | Speculative decoding: a drafter proposes, the main model verifies — exact results, faster decode when drafts land. The artifact's kind is auto-detected: a full same-tokenizer model (mlx_lm.server parity), a Gemma `-assistant` KV-borrowing drafter, a DSpark checkpoint trained here, or one of DeepSeek's released DSpark drafters (DeepSpec `Gemma4DSparkModel`, e.g. `dspark_gemma4_12b_block7`). Serial lane only: with `--batch N` a mounted draft routes every request serial |
52
- | `--draft-kind <kind>` | Override draft-artifact detection: `two-model` \| `assistant` \| `dspark` \| `deepspec` \| `mtp` \| `ngram` (default: auto). `mtp` is a NATIVE multi-token-prediction head split from the target's own release (e.g. `mlx-community/Qwen3.8-27B-MTP-bf16`; auto-detected from a `*_mtp` `model_type`) — it binds the target's embeddings/lm-head and taps its pre-final-norm hiddens, and the serve loop rolls the target's recurrent DeltaNet caches back across rejected drafts via bit-exact snapshot/replay. `--draft-kind mtp` WITHOUT `--draft-model` resolves the companion from the artifact's own `mtp/` subfolder (single-repo bundles, e.g. the TQ releases) and refuses with a clear error when the model bundles none. `ngram` is MODEL-FREE prompt lookup — no `--draft-model` (mounting one alongside it is refused): drafts are copied from the request's own prompt+generation whenever its trailing tokens have occurred earlier in that stream, verified by the target like any other draft, so results stay exact at any temperature. Zero weights, zero memory; best on agentic/RAG/code-edit traffic that re-emits spans already in context (prior art: prompt-lookup decoding / vLLM's `ngram` proposer) |
53
- | `--num-draft-tokens <n>` | Drafts per verify round (default 3; `ngram` defaults to 10 — drafting is free; a DSpark draft pins to its trained block width) |
54
- | `--ngram-max <k>` / `--ngram-min <k>` | Prompt-lookup match-window bounds, `--draft-kind ngram` only: the longest/shortest trailing k-gram searched (defaults 3 / 1, the reference values) |
55
- | `--mtp on\|off` | GLM-5.2 checkpoint-native MTP (default on). Native MTP uses the exact serial verify lane; `off` enables ordinary continuous batching (batched per-row MTP is post-release) |
56
- | `--context-length <n>` | GLM-5.2 context reserved by the header-only resource equation (default 4096) |
57
- | `--batch <n>` | Continuous-scheduler concurrency cap, mlx-lm parity at the same B (default 8; a lone admitted request uses the gated B=1 fast path, while `--batch 1` pins the preserved strict serial executor) |
58
- | `--temperature` / `--top-p` / `--top-k` / `--max-tokens` | Server-wide sampling defaults (per-request fields still win; GLM-5.2 defaults to the planned 128 generated tokens) |
59
- | `--l1` / `--l2` | Parity tier alias: bit-exact to mlx-lm / bit-exact to mlx-optiq. **No tier = `--l1`** (the default since 2026-07-05 — output-changing levers are opt-in until they beat the L1 baseline in a paired A/B). Each expands to per-fork flags (`--compiled-decode`, `--compiled-activations`, `--fused-sdpa`, `--kv-quant`); a fork flag overrides one. `--l3` was removed 2026-07-05 and now errors (the Lab replaces it — [unified-engine-frontier-plan.md](../design/unified-engine-frontier-plan.md)). See [server-config.md](server-config.md#fidelity-tiers-and-the-decode-route---l1----l2). |
60
- | `--allow-private-media` | Let `image_url`/`audio_url` parts fetch from private/loopback/link-local hosts (blocked by default — SSRF guard; the 10 s timeout and 64 MB cap on remote media apply either way) |
61
- | `--no-open` | Don't auto-open the chat UI |
69
+ | Network | `--host`, `--port`, `--no-open`, `--allow-private-media` |
70
+ | Memory & caches | `--memory-budget`, `--kv-budget`, `--prompt-cache`, `--ssd-cache`, `--ssd-cache-max`, `--ssd-cache-verify`, `--ssd-demote-idle`, `--generation-checkpoint` |
71
+ | Process model | `--isolate`, `--model-pool`, `--unix` (internal — the engine half of `--isolate`) |
72
+ | Scheduling | `--batch` (`--decode-concurrency` accepted as the mlx_lm.server alias) |
73
+ | KV cache | `--kv-quant`, `--paged-kv`, `--paged-kv-block-size` |
74
+ | Adapters | `--adapter` (`--adapter-path` alias) |
75
+ | Speculative decoding | `--draft-model`, `--draft-kind`, `--num-draft-tokens`, `--ngram-max`, `--ngram-min` |
76
+ | GLM-5.2 | `--mtp`, `--context-length` |
77
+ | Sampling defaults | `--temperature` (`--temp` alias), `--top-p`, `--top-k`, `--max-tokens`, `--thinking`, `--hlg-sampling`, `--hlg-width`, `--hlg-shoulder`, `--hlg-toe`, `--hlg-pivot-offset` |
78
+ | Parity tier | `--l1`, `--l2` (`--l3` errors — removed) |
79
+ | Kill switches | `--compiled-decode`, `--compiled-activations`, `--fused-sdpa`, `--force-wire`, `--expert-offload` |
62
80
 
63
81
  Endpoints: `/v1/chat/completions`, `/v1/completions`, `/v1/messages`,
64
- `/v1/responses`, `/v1/models`, `/v1/adapters`, `/health`, `/stats`, `/fit`,
65
- `/library`, `/downloads` — web app at `/` (lands on chat); `/chat`, `/status`,
66
- `/quantize`, `/finetune`, `/dataset` deep-link its views. Full
67
- schemas in [server-api.md](server-api.md).
82
+ `/v1/responses`, `/v1/embeddings`, `/v1/models`, `/v1/adapters`, `/health`,
83
+ `/stats`, `/fit`, `/library`, `/downloads`; the web app at `/` (`/chat`,
84
+ `/status`, `/quantize`, `/finetune`, `/dataset` deep-link its views). Schemas
85
+ in [server-api.md](server-api.md).
68
86
 
69
87
  ### `pi` — built-in coding agent
70
88
 
71
89
  Run the pi coding agent's terminal UI in-process against a local model —
72
- nothing to install. Reuses a healthy running server, otherwise starts one for
73
- the session.
90
+ pi is bundled, nothing to install. Reuses a healthy server on the chosen
91
+ port; otherwise starts one that lives exactly as long as the session.
74
92
 
75
93
  ```sh
76
- mlx-bun pi # interactive agent session
77
- mlx-bun pi -p "explain this repo" # one-shot: print the reply and exit
94
+ mlx-bun pi # interactive session
95
+ mlx-bun pi fix the failing test # pre-fill the first turn
96
+ mlx-bun pi -p "explain this repo" # one-shot: print the reply and exit
97
+ mlx-bun pi -p --json "summarize README" # one-shot with the full event stream
98
+ mlx-bun pi --mode rpc # JSONL RPC over stdio
99
+ mlx-bun pi -q qwen --port 8090 # model + server flags for the session server
100
+ git diff | mlx-bun pi -p "review this" # piped stdin makes it one-shot too
78
101
  ```
79
102
 
103
+ | Flag | Meaning |
104
+ |---|---|
105
+ | `-q`, `--query <q>` | model to serve when starting a session server |
106
+ | `-p`, `--print [msg]` | one-shot print mode (also reads piped stdin) |
107
+ | `--json` | with `-p`: emit the full event stream as JSON |
108
+ | `--mode json\|rpc\|text` | `json` = print + JSON, `rpc` = JSONL RPC over stdio, `text` = print |
109
+ | `--verbose` | verbose agent logging |
110
+ | every `serve` flag | applies to the session server; ignored (with a note) when reusing a running one |
111
+
112
+ Other pi flags are dropped with a note — the full pi surface (`--continue`,
113
+ `--resume`, extensions, themes) lives in your own pi via `harness pi`.
114
+ `mlx-bun help pi` is our help; `mlx-bun pi --help` prints it only when it is
115
+ the sole argument.
116
+
80
117
  ### `harness pi` — connect your own pi
81
118
 
82
- For people who already use
83
- [pi](https://www.npmjs.com/package/@earendil-works/pi-coding-agent): installs a small,
84
- reversible discovery extension that registers the local server as a pi
85
- provider.
119
+ For people who already run [pi](https://www.npmjs.com/package/@earendil-works/pi-coding-agent):
120
+ writes one reversible extension, `~/.pi/agent/extensions/mlx-bun-provider.ts`,
121
+ that registers `mlx-bun` as a pi provider. Models are discovered live from
122
+ `/v1/models` at pi startup (the list baked at install time is the fallback
123
+ when the server is down), exposed under the stable id `mlx-bun/local`. It
124
+ never touches your existing pi config.
125
+
126
+ ```sh
127
+ mlx-bun harness pi # install; requires pi on PATH
128
+ mlx-bun harness pi --base-url http://127.0.0.1:8090/v1
129
+ mlx-bun harness pi --remove # delete the extension
130
+ pi --provider mlx-bun # then run pi as usual
131
+ pi --models "mlx-bun/*" # or scope cycling
132
+ ```
133
+
134
+ #### LoRA adapters from pi: the adapter extension
135
+
136
+ `scripts/packaging/pi-extensions/mlx-bun-adapter.ts` ships with the repo and
137
+ adds an `/adapter` command to pi. Install by copying (or symlinking) it into
138
+ `~/.pi/agent/extensions/`, then `/reload` inside pi:
86
139
 
87
140
  ```sh
88
- mlx-bun harness pi # then: pi --provider mlx-bun
89
- mlx-bun harness pi --remove # disconnect
141
+ cp scripts/packaging/pi-extensions/mlx-bun-adapter.ts ~/.pi/agent/extensions/
142
+ MLX_BUN_URL=http://127.0.0.1:8080 pi --provider mlx-bun
90
143
  ```
91
144
 
145
+ | In pi | Effect |
146
+ |---|---|
147
+ | `/adapter` or `/adapter list` | list adapters on disk (`/v1/adapters/available`), which are loaded, and the active one |
148
+ | `/adapter <id>` | mount it if needed (`POST /v1/adapters`) and inject `adapter: <id>` into every request |
149
+ | `/adapter off` | back to the base model (no field sent) |
150
+
151
+ The extension reads the server URL from `MLX_BUN_URL` (its built-in fallback
152
+ is port 8090, so set it to match your server). Default is no adapter; the
153
+ mechanism is pi's `before_provider_request` hook, the same one the web chat's
154
+ adapter selector uses. Serving-side detail: [server-api.md](server-api.md#adapters-lora-hot-swap)
155
+ and [docs/design/web-chat-redesign.md](../design/web-chat-redesign.md).
156
+
92
157
  ### `generate` (alias `gen`) — one-shot generation
93
158
 
94
- Load the model, generate, print, exit — no server. Renders through the chat
95
- template by default; `--raw` feeds the prompt verbatim. Sampling and
96
- decode-path levers mirror `serve` (`--temperature`, `--seed`, `--l1/--l2`,
97
- `--kv-quant`, …).
159
+ Load the model, generate, print, exit. The prompt is rendered through the
160
+ chat template unless `--raw`.
98
161
 
99
162
  ```sh
100
- mlx-bun generate gemma "a haiku about metal shaders"
163
+ mlx-bun generate e4b "a haiku about metal shaders"
101
164
  mlx-bun gen e4b --prompt "…" --max-tokens 512 --seed 42
102
- mlx-bun generate GLM-5.2 --prompt "Explain DSA" --max-tokens 128
165
+ mlx-bun generate qwen --raw --prompt "def fib(n):" --temperature 0
103
166
  ```
104
167
 
168
+ | Flag | Meaning |
169
+ |---|---|
170
+ | `[query]` / `--query <q>` | model (auto-picks when omitted) |
171
+ | `--prompt "…"` | the prompt (or pass it as the positional after the model) |
172
+ | `--raw` | skip the chat template |
173
+ | `--max-tokens <n>` | completion cap |
174
+ | `--temperature <n>` (`--temp` alias), `--top-p`, `--top-k`, `--seed` | sampling |
175
+ | `--l1` / `--l2`, `--kv-quant`, `--fused-sdpa`, `--compiled-decode`, `--compiled-activations` | decode route, same meaning as for `serve` |
176
+
105
177
  ### `embed` — text embeddings
106
178
 
107
- One-shot embeddings from a local Qwen3-Embedding model (last-token pooled,
108
- L2-normalized — bit-exact vs mlx-lm). One JSON vector per input line.
179
+ Embeddings from a local Qwen3-Embedding model, no server. One JSON vector
180
+ per input line.
109
181
 
110
182
  ```sh
111
183
  mlx-bun embed --text "hello world"
112
- echo -e "line one\nline two" | mlx-bun embed --json
184
+ mlx-bun embed Qwen3-Embedding "hello world"
185
+ printf 'line one\nline two\n' | mlx-bun embed --json
186
+ mlx-bun embed --instruct "Retrieve passages that answer the question" --text "what is a KV cache?"
113
187
  ```
114
188
 
115
- For a server endpoint, `mlx-bun serve <embedding-model>` then
116
- `POST /v1/embeddings`.
189
+ | Flag | Meaning |
190
+ |---|---|
191
+ | `[query]` / `--query <q>` | embedding model; omitted = the first downloaded embedding model (errors with a `get` suggestion when none) |
192
+ | `--text "…"` | text to embed (omit to read one text per stdin line) |
193
+ | `--instruct "…"` | Qwen3-Embedding query instruction; omit for plain document embeddings |
194
+ | `--json` | one OpenAI-style `{object:"list",data:[…]}` object instead of bare arrays |
195
+
196
+ Server equivalent: `mlx-bun serve <embedding-model>` then
197
+ [`POST /v1/embeddings`](server-api.md#post-v1embeddings-openai-embeddings-api).
117
198
 
118
199
  ## Models & disk
119
200
 
@@ -121,26 +202,26 @@ Full guide: [models.md](models.md).
121
202
 
122
203
  ### `get` — download a model
123
204
 
124
- Resumable, checksum-verified download into the standard Hugging Face cache
125
- (plain HTTPS, no Xet — no 0% stalls). Before payload transfer, the downloader
126
- credits complete blobs and partial prefixes, then requires enough free space
127
- for the exact remainder plus a fixed 1 GiB reserve.
205
+ Resumable (Range requests against partial blobs), sha256-verified download
206
+ into the standard Hugging Face cache over plain HTTPS (no Xet). Complete
207
+ blobs and partial prefixes are credited before transfer, and the volume must
208
+ fit the remainder plus a 1 GiB reserve. Uses `HF_TOKEN` / `hf auth login`
209
+ credentials when present.
128
210
 
129
211
  ```sh
130
212
  mlx-bun get mlx-community/gemma-4-12B-it-OptiQ-4bit
131
- mlx-bun get 12B # no "/" = registry query; re-gets/refreshes the match
132
- mlx-bun get mateogrgic/GLM-5.2-colibri-int4-with-int8-mtp \
133
- --revision 3cc8db99b1b13fc79325d987ba3c1c430766b3b8
213
+ mlx-bun get 12B # no "/" = registry query; re-gets/refreshes the match
214
+ mlx-bun get mlx-community/MiniCPM5-1B-OptiQ-4bit --revision main
134
215
  ```
135
216
 
136
- The GLM artifact is roughly 357 GiB; select `HF_HUB_CACHE` on a sufficiently
137
- large fast volume before starting. Rerunning the same command resumes verified
138
- `.incomplete` prefixes. See the [32 GB GLM quickstart](models.md#glm-52-on-a-32-gb-mac).
217
+ `--revision <rev>` selects a git revision. When upstream has pushed a new
218
+ revision the previous snapshot stays on disk — `get` says so and `gc`
219
+ reclaims it. GLM-5.2 specifics: [models.md](models.md#glm-52-on-a-32-gb-mac).
139
220
 
140
221
  ### `scan` — index your cache
141
222
 
142
- Re-index the HF cache into the registry (config + safetensors headers only,
143
- never tensor bytes) so `ls`, `serve`, and `fit` can find models by substring.
223
+ Re-index the HF cache into the registry (config + safetensors headers, never
224
+ tensor bytes) so `ls`, `serve`, and `fit` resolve models by substring.
144
225
 
145
226
  ```sh
146
227
  mlx-bun scan
@@ -148,105 +229,139 @@ mlx-bun scan
148
229
 
149
230
  ### `ls` — list models
150
231
 
232
+ One row per repo (canonical revision, `refs/main`); superseded snapshots are
233
+ hidden.
234
+
151
235
  ```sh
152
- mlx-bun ls # size, params, quant, capabilities
153
- mlx-bun ls --vision --max-size 10GB # filter
154
- mlx-bun ls --all-revisions # one row per cached snapshot
236
+ mlx-bun ls # size, params, quant, license, capabilities
237
+ mlx-bun ls gemma # filter by substring
238
+ mlx-bun ls --vision --max-size 10GB # vision-capable, under 10 GB
239
+ mlx-bun ls --all-revisions # one row per cached snapshot (canonical marked *)
155
240
  ```
156
241
 
157
242
  ### `gc` — reclaim disk
158
243
 
159
- Delete superseded snapshots and the blobs only they reference. Prints the plan
160
- by default; `--yes` actually deletes. Same planner (`src/registry.ts`
161
- `planGc`/`executeGc`) also backs `GET /api/gc/plan` / `POST /api/gc/execute`
162
- on a running `serve` — see [server-api.md](server-api.md#get-apigcplan--post-apigcexecute).
244
+ Delete superseded snapshots and the blobs only they reference. Prints the
245
+ plan by default.
163
246
 
164
247
  ```sh
165
- mlx-bun gc # dry-run: what would be reclaimed
166
- mlx-bun gc --yes # delete
248
+ mlx-bun gc # dry run: what would be reclaimed
249
+ mlx-bun gc --yes # delete
250
+ mlx-bun gc --yes --force # also prune snapshots holding files the canonical revision lacks
167
251
  ```
168
252
 
253
+ `--dry-run` never deletes even with `--yes`. The same planner backs
254
+ [`GET /api/gc/plan` / `POST /api/gc/execute`](server-api.md#get-apigcplan--post-apigcexecute).
255
+
169
256
  ### `fit` — memory contract
170
257
 
171
- Deterministic memory assessment: does it fit, what's the max context, predicted
172
- tok/s. Weights bytes from safetensors headers, KV bytes/token from the config,
173
- calibrated prefill transient, wired-memory ceiling. `--kv-quant` mirrors serve's
174
- flag: it bills the quantized cache at its true bytes/element, so the reported
175
- window matches what serving with the same flag admits (a 4-bit cache holds
176
- ~3.5× the context of bf16 in the same budget).
258
+ Deterministic memory assessment: does it fit, max safe context, predicted
259
+ tok/s — from safetensors headers, the config's KV bytes/token, a calibrated
260
+ prefill transient, and the wired-memory ceiling.
177
261
 
178
262
  ```sh
179
- mlx-bun fit gemma --ctx 32768 # for this machine
263
+ mlx-bun fit gemma --ctx 32768 # this machine
180
264
  mlx-bun fit gemma --ctx 8192 --skus # across the Apple Silicon lineup
181
- mlx-bun fit qwen --kv-quant 4 # window with a 4-bit-quantized KV cache
265
+ mlx-bun fit qwen --kv-quant 4 # bill a 4-bit-quantized KV cache
266
+ mlx-bun fit GLM-5.2 # streamed-artifact plan (resident weights, expert slabs, KV, reserves)
182
267
  ```
183
268
 
184
- The direct Colibri GLM-5.2 artifact is handled by its streamed-runtime
185
- contract, not by the generic resident-weights estimator. `fit GLM-5.2`
186
- defaults to the supported 4,096-token / 128-generation-token plan and reports
187
- the artifact's disk footprint separately from resident weights, the main and
188
- MTP expert slabs, KV, reserves, and the 25 GiB process ceiling. Its throughput
189
- line is the measured warm quality-preserving result; the direct Colibri oracle
190
- and the 2 tok/s aspiration are labeled separately. `--skus` explains that the
191
- generic resident-model matrix does not apply to this streamed artifact.
192
-
193
- ```sh
194
- mlx-bun fit GLM-5.2
195
- mlx-bun fit GLM-5.2 --ctx 4096
196
- ```
269
+ | Flag | Meaning |
270
+ |---|---|
271
+ | `--ctx <tokens>` | context size to assess |
272
+ | `--kv-quant 4\|8\|config\|off` | bill the KV cache at the quantized bytes/element (`config` needs a model that ships `kv_config.json`; `turbo` is not accepted here) |
273
+ | `--skus` | also print the Apple silicon SKU matrix (not applicable to the streamed GLM-5.2 artifact) |
197
274
 
198
275
  ## Training & model creation
199
276
 
200
277
  Full reference: [training.md](training.md); guided walkthrough:
201
- [orpo-quickstart.md](orpo-quickstart.md).
278
+ [docs/reference/training.md](./training.md).
202
279
 
203
280
  ### `train` — LoRA fine-tune
204
281
 
205
- SFT / DPO / ORPO on your data, with the full memory stack (flash-CCE head,
206
- prefix-sharing, segmented backward) on by default. Saves a mountable adapter.
282
+ SFT / DPO / ORPO on `<dir>/train.jsonl` (+ optional `valid.jsonl`). Rows are
283
+ `{prompt, chosen, rejected}` for dpo/orpo or `{messages|text}` for sft. Runs
284
+ in the foreground and saves a mountable adapter.
207
285
 
208
286
  ```sh
209
- mlx-bun train e4b --data ./prefs # ORPO (default) on {prompt,chosen,rejected}
210
- mlx-bun train e4b --data ./prefs --method sft # SFT on {messages|text}
211
- mlx-bun train e4b --data ./prefs --dry-run # inspect the plan, don't train
287
+ mlx-bun train e4b --data ./prefs # ORPO (default)
288
+ mlx-bun train e4b --data ./prefs --method sft
289
+ mlx-bun train e4b --data ./prefs --dry-run # inspect data + resolved plan, don't train
290
+ mlx-bun train cpm5 --data ./prefs --iters 400 --save-every 50 --adapter ~/adapters/cpm5-orpo
291
+ nohup mlx-bun train e4b --data ./prefs & # long runs: detach from your shell
212
292
  ```
213
293
 
294
+ | Flag | Meaning |
295
+ |---|---|
296
+ | `<model>` / `--query <q>` | model to fine-tune (auto-picks when omitted) |
297
+ | `--data <dir>` | dataset dir (required) |
298
+ | `--method sft\|dpo\|orpo` | objective |
299
+ | `--adapter <dir>` | output adapter dir (default under `~/.cache/mlx-bun/mlx-bun-finetunes/`) |
300
+ | `--iters`, `--lr`, `--rank`, `--scale`, `--seq`, `--batch`, `--grad-accum`, `--grad-clip`, `--seed`, `--val-size` | loop hyperparameters (method-dependent defaults: `mlx-bun help train`) |
301
+ | `--lambda <f>`, `--sft-scope full\|response` | ORPO odds-ratio weight and chosen-NLL scope |
302
+ | `--seg <n>`, `--no-segment` | segmented backward (layers per segment / off) |
303
+ | `--no-flash`, `--no-prefix` | disable the flash-CCE head / prefix-sharing |
304
+ | `--save-every <n>`, `--resume <dir>` | checkpoint cadence / warm-start LoRA weights |
305
+ | `--dry-run` | print the plan, don't train |
306
+
214
307
  ### `train-watch` — live training dashboard
215
308
 
216
- Tails an adapter dir's `metrics.jsonl` and renders live loss / speed / memory.
309
+ Tails `<adapter-dir>/metrics.jsonl` (written by `train` and the web
310
+ fine-tune tile) and renders live loss / speed / memory.
217
311
 
218
312
  ```sh
219
313
  mlx-bun train-watch ~/.cache/mlx-bun/mlx-bun-finetunes/orpo-e4b
314
+ mlx-bun train-watch --adapter ~/adapters/cpm5-orpo
220
315
  ```
221
316
 
222
317
  ### `fuse` — merge an adapter into the base
223
318
 
224
- Folds LoRA deltas into the base weights and writes a standalone snapshot; a
225
- quantized base keeps its exact quantization layout. Flag names match
226
- `mlx_lm.fuse`.
319
+ Folds LoRA deltas into the base weights and writes a standalone snapshot
320
+ (weights + config + tokenizer); a quantized base keeps its per-module
321
+ quantization layout. Flag names follow `mlx_lm.fuse`.
227
322
 
228
323
  ```sh
229
324
  mlx-bun fuse e4b --adapter ./adapters --save-path ./fused_model
325
+ mlx-bun fuse --model ./base-snapshot --adapter-path ./adapters
230
326
  mlx-bun serve ./fused_model
231
327
  ```
232
328
 
329
+ | Flag | Meaning |
330
+ |---|---|
331
+ | `<model>` / `--model` | base model (query or snapshot path) |
332
+ | `--adapter <dir>` (`--adapter-path` alias) | adapter directory (`adapters.safetensors` + `adapter_config.json`); default `adapters` |
333
+ | `--save-path <dir>` | output directory; default `fused_model` |
334
+
335
+ Refused with an error (mlx_lm.fuse flags not implemented): `--de-quantize`,
336
+ `--dequantize`, `--export-gguf`, `--gguf-path`, `--upload-repo`.
337
+
233
338
  ### `convert` — quantize a model
234
339
 
235
- Quantize an HF model (local path, downloaded model, or repo id) into a local
236
- MLX snapshot — uniform 4/8-bit, or mixed-precision via `--target-bpw`
237
- (sensitivity sweep + per-layer bit knapsack). `--upload-repo` pushes the result.
340
+ Quantize an HF model (local path, downloaded model, or repo id — an
341
+ un-downloaded repo is fetched first) into a local MLX snapshot: uniform
342
+ affine 4/8-bit, or mixed precision via `--target-bpw` (sensitivity sweep +
343
+ per-layer bit knapsack). Same engine as the web `/api/quantize`.
238
344
 
239
345
  ```sh
240
- mlx-bun convert Qwen/Qwen3-4B -q # uniform 4-bit
241
- mlx-bun convert Qwen/Qwen3-4B --target-bpw 4.5 # mixed precision
242
- mlx-bun convert ./qwen3.5-bf16 -q --rotate-weights # fold then quantize
346
+ mlx-bun convert Qwen/Qwen3-4B -q # uniform 4-bit → ./mlx_model
347
+ mlx-bun convert --hf-path Qwen/Qwen3-4B -q --q-bits 8 --mlx-path ./qwen3-8bit
348
+ mlx-bun convert Qwen/Qwen3-4B --target-bpw 4.5 # mixed precision (implies -q)
349
+ mlx-bun convert ./qwen3.5-bf16 -q --rotate-weights # fold the TurboQuant rotation, then quantize
350
+ mlx-bun convert Qwen/Qwen3-4B -q --upload-repo you/qwen3-4b-4bit
243
351
  ```
244
352
 
245
- `--rotate-weights` makes the offline rotation part of the same conversion
246
- pipeline and records its recipe in `optiq_metadata.json`. The adapter is
247
- selected from the model/tensor schema (Llama, Qwen3.5 trunk, or Qwen MTP);
248
- `--rotation-seed` defaults to `42`. Folding requires full-precision source
249
- weights and an MTP companion must use the same seed as its trunk.
353
+ | Flag | Meaning |
354
+ |---|---|
355
+ | `--hf-path <src>` (`--model` or the bare positional) | source model |
356
+ | `--mlx-path <dir>` | output directory; must not already exist (mlx_lm.convert behavior) |
357
+ | `-q`, `--quantize`, `--q-bits 4\|8`, `--q-group-size 32\|64` | uniform affine quantization |
358
+ | `--target-bpw <f>`, `--candidate-bits <list>`, `--calibration-mix optiq\|<jsonl>`, `--n-calibration <n>` | mixed precision (writes per-module bits into `config.json`) |
359
+ | `--rotate-weights`, `--rotation-seed <n>` | fold the offline TurboQuant rotation first (auto-detects Llama / Qwen3.5 trunk / Qwen MTP; an MTP companion must use its trunk's seed); recipe recorded in `optiq_metadata.json` |
360
+ | `--upload-repo <id>` | push the result afterwards (token checked before any work starts) |
361
+
362
+ Refused with an error: `--dtype`, `-d`/`--dequantize`, `--quant-predicate`,
363
+ `--q-mode` other than `affine`, and plain non-quantizing conversion (pass `-q`
364
+ or `--target-bpw`).
250
365
 
251
366
  ### `upload` — push to the Hugging Face Hub
252
367
 
@@ -255,57 +370,177 @@ git-LFS batch protocol, commits. Flag names match `mlx_lm.upload`.
255
370
 
256
371
  ```sh
257
372
  mlx-bun upload --path ./fused_model --upload-repo you/my-model
373
+ mlx-bun upload --path ./mlx_model --upload-repo you/my-model --private
258
374
  ```
259
375
 
376
+ Needs a WRITE token from `~/.mlx-bun/hf.json` (web UI Settings), `$HF_TOKEN`,
377
+ or `~/.cache/huggingface/token` (`hf auth login`); errors before uploading
378
+ anything when none is found. `--private` is an mlx-bun extension.
379
+
260
380
  ### `perplexity` — evaluate on your data
261
381
 
262
- `mlx_lm.perplexity` methodology exactly, over a **local** `.jsonl`/`.txt` file.
382
+ `mlx_lm.perplexity` methodology exactly (seeded sample order, concatenate,
383
+ non-overlapping rows, f32 CE at every position, delta-method standard
384
+ error) over a **local** `.jsonl` (`{"text": …}` rows) or `.txt` file — never
385
+ an HF dataset download.
263
386
 
264
387
  ```sh
265
388
  mlx-bun perplexity e4b --data-path ./corpus.jsonl
389
+ mlx-bun perplexity ./fused_model --data-path ./corpus.txt --sequence-length 1024 --num-samples -1 --batch-size 4 --seed 7
266
390
  ```
267
391
 
392
+ Flags: `<model>` (`--model` / `--query` accepted), `--data-path <file>`
393
+ (required), `--sequence-length <n>`, `--num-samples <n>` (`-1` = all),
394
+ `--batch-size <n>`, `--seed <n>`.
395
+
268
396
  ## Memory
269
397
 
270
- ### `memory` — the personal wiki
398
+ ### `memory` (alias `setup`) — the personal wiki
271
399
 
272
- A local, durable memory for the assistant: a git-tracked Markdown wiki at
273
- `~/.mlx-bun/wiki` that loads into every `mlx-bun pi` / `mlx-bun serve` session.
274
- Full guide: [memory.md](memory.md).
400
+ A local, git-tracked Markdown wiki at `~/.mlx-bun/wiki` that loads into
401
+ every `mlx-bun pi` / `mlx-bun serve` session. Full guide:
402
+ [memory.md](memory.md). `mlx-bun memory` with no subcommand runs `status`.
275
403
 
276
404
  ```sh
277
- mlx-bun memory init # create the wiki (idempotent); import + schedule
278
- mlx-bun memory status # path, article count, git + schedule state
279
- mlx-bun memory open [article] # open in Obsidian (falls back to Finder)
280
- mlx-bun memory search <query> # search articles from the terminal
281
- mlx-bun memory synthesize # conversations → cross-linked articles, all local
282
- mlx-bun memory schedule --at 03:00
405
+ mlx-bun memory init # create the wiki (idempotent); offers import + nightly job
406
+ mlx-bun memory status # path, article count, git + schedule state
407
+ mlx-bun memory open # open the vault in Obsidian (falls back to Finder)
408
+ mlx-bun memory open Archie_Project # open one article
409
+ mlx-bun memory list # article titles + read-only Reference docs
410
+ mlx-bun memory search kv cache # search from the terminal
411
+ mlx-bun memory read Archie_Project # print an article (stem)
412
+ mlx-bun memory toc Archie_Project # headings + anchors
413
+ mlx-bun memory section Archie_Project decisions # one section by anchor
414
+ mlx-bun memory links Archie_Project # outbound + inbound wikilinks
415
+ mlx-bun memory synthesize # conversations → articles, the full local DAG
416
+ mlx-bun memory synthesize --dry-run # plan only, never writes the vault
417
+ mlx-bun memory segment --limit 20 # one stage worker (also: extract, route, synthesize-stage)
418
+ mlx-bun memory extract --convs a1b2,c3d4 # restrict a stage to specific conversations
419
+ mlx-bun memory link --limit 50 # deterministic cross-linking pass (no model)
420
+ mlx-bun memory schedule --at 03:00 # install the nightly launchd job
421
+ mlx-bun memory unschedule # remove it
283
422
  ```
284
423
 
285
- `setup` is an alias for `memory`.
424
+ | Subcommand | Aliases | Meaning |
425
+ |---|---|---|
426
+ | `init` | `setup` | create the wiki; offers to import an existing vault and install the nightly job (TTY prompts; non-interactive shells take the defaults) |
427
+ | `status` | | path, counts, git + schedule state |
428
+ | `open [article]` | `browse` | open the vault or one article |
429
+ | `list` | | article titles + `Reference/` docs |
430
+ | `search <query>` | | ranked article hits with sample lines |
431
+ | `read <article>` | | print an article |
432
+ | `toc <article>` | | headings + anchors |
433
+ | `section <article> <anchor>` | | print one section |
434
+ | `links <article>` | | resolved outbound + inbound wikilinks |
435
+ | `synthesize` | `pipeline`, `all` | run the full synthesis DAG; `--dry-run` plans without writing. `--since` and `--model` are parsed but the pipeline does not consume them yet (`src/memory/pipeline.ts` marks `model` reserved) |
436
+ | `segment` · `extract` · `route` · `synthesize-stage` | `stage-synthesize` | run one decomposed, resumable stage worker (`--limit <n>` except `route`; `--convs a,b`) |
437
+ | `link` | | inline-link first mentions + rebuild `## See also` (`--limit <n>`; no model) |
438
+ | `schedule` | | install the nightly launchd job (`--at HH:MM`) |
439
+ | `unschedule` | | remove it |
440
+
441
+ An unknown subcommand prints the help and exits non-zero, so launchd jobs
442
+ and scripts can detect typos.
286
443
 
287
444
  ## Measurement
288
445
 
289
446
  ### `benchmark` (alias `bench`) — measure our stack
290
447
 
291
- Runs mlx-bun by itself on this machine and records to the eval DB.
448
+ Runs mlx-bun by itself (greedy decode, in-process) and records the median
449
+ to the eval DB.
292
450
 
293
451
  ```sh
294
452
  mlx-bun bench e4b --tokens 256 --runs 3
453
+ mlx-bun bench --model ./fused_model --prompt-tokens 4096 --kv-quant turbo:k8v3
454
+ ```
455
+
456
+ | Flag | Meaning |
457
+ |---|---|
458
+ | `[query]` / `--query` / `--model <path\|query>` | model (auto-picks when omitted) |
459
+ | `--tokens <n>` | tokens decoded per run |
460
+ | `--runs <n>` | runs (median reported) |
461
+ | `--prompt-tokens <n>` | pad the prompt to about n tokens (long-context decode) |
462
+ | `--kv-quant config\|off\|4\|8\|turbo[:k<bits>v<bits>]` | KV scheme for the run |
463
+ | `--compiled-decode`, `--compiled-activations`, `--fused-sdpa` | kill switches; A/B by running twice |
464
+
465
+ For **quotable, cross-stack** numbers use the preflight-gated harness from
466
+ the repo — it spawns the real CLI at its real defaults next to the mlx-lm
467
+ and optiq reference servers and writes a dated report:
468
+
469
+ ```sh
470
+ bun scripts/bench-serve.ts all
471
+ bun scripts/bench-serve.ts all --models cpm5,e4b --arms mlx-bun,mlx-lm --out report.md
295
472
  ```
296
473
 
297
- For quotable **cross-stack** numbers use `./benchmark.sh` from the repo — it
298
- preflight-gates on an idle machine and runs the mlx-lm/optiq comparison legs,
299
- writing `benchmarks-h2h-<date>.md`.
474
+ Curated results: [benchmarks.md](benchmarks.md).
300
475
 
301
476
  ### `evals` — recorded runs
302
477
 
303
478
  ```sh
304
- mlx-bun evals # table: when, model, KV mode, tok/s, TTFT, peak, commit
479
+ mlx-bun evals # table: when, stack, model, bench, KV, prefill, decode, TTFT, peak, commit
480
+ mlx-bun evals --limit 50
305
481
  mlx-bun evals --raw # JSON lines for scripts/jq
482
+ mlx-bun evals --clear # archive the DB to a timestamped backup and start fresh
306
483
  ```
307
484
 
308
- ## Everything else
309
-
310
- - `help [verb]` — overview, or per-verb help (same as `<verb> --help`).
311
- - `--version` / `-v` — print the version.
485
+ ## mlx-lm compatibility
486
+
487
+ mlx-bun borrows mlx-lm's verb and flag vocabulary so scripts drop in with a
488
+ rename of the executable: `mlx_lm.<verb> …` becomes `mlx-bun <verb> …`.
489
+ There is no `mlx-bun.<verb>` dotted alias (the package installs one binary,
490
+ `mlx-bun`). Surface parity is not architecture parity: a verb run against an
491
+ unsupported architecture errors clearly rather than guessing.
492
+
493
+ ### What maps to what
494
+
495
+ | mlx-lm | mlx-bun | Accepted mlx-lm spellings | Not accepted |
496
+ |---|---|---|---|
497
+ | `mlx_lm.server` | `serve` | `--model`, `--host`, `--port`, `--adapter-path`, `--temp`, `--top-p`, `--top-k`, `--max-tokens`, `--draft-model`, `--num-draft-tokens`, `--decode-concurrency` (semantics differ — [server-config.md](server-config.md)) | `--prompt-cache-size`/`--prompt-cache-bytes` (use `--prompt-cache`), `--min-p`, `--chat-template`, `--chat-template-args`, `--use-default-chat-template`, `--trust-remote-code`, `--log-level`, `--allowed-origins`, `--pipeline`, `--prefill-step-size`, `--prompt-concurrency` — silently ignored |
498
+ | `mlx_lm.generate` | `generate` | `--prompt`, `--max-tokens`, `--temp`, `--top-p`, `--top-k`, `--seed` | `--kv-bits`/`--kv-group-size`/`--quantized-kv-start` (use `--kv-quant`), `--min-p`, `--xtc-*`, `--prompt-cache-file`, `--max-kv-size`, `--adapter-path`, `--draft-model`, `--system-prompt`, `--ignore-chat-template` (use `--raw`), `--verbose` — silently ignored |
499
+ | `mlx_lm.chat` | `pi` / the web chat | — | no terminal REPL verb; `pi` is the agent, `serve` opens the chat UI |
500
+ | `mlx_lm.convert` | `convert` | `--hf-path`, `--mlx-path`, `-q`/`--quantize`, `--q-bits`, `--q-group-size`, `--q-mode affine`, `--upload-repo` | `--dtype`, `-d`/`--dequantize`, `--quant-predicate`, non-affine `--q-mode`, plain non-quantizing conversion — **refused** |
501
+ | `mlx_lm.fuse` | `fuse` | `--model`, `--adapter-path`, `--save-path` | `--de-quantize`, `--export-gguf`, `--gguf-path`, `--upload-repo` — **refused** |
502
+ | `mlx_lm.lora --train` | `train` | `--data`, `--iters`, `--seed` (same names); otherwise own names (`--method`, `--adapter`, `--lr`, `--rank`, `--seq`, `--batch`, `--grad-accum`, `--save-every`, `--resume`) | `--train`/`--test`, `--config` (YAML), `--fine-tune-type`, `--adapter-path`, `--learning-rate`, `--max-seq-length`, `--batch-size`, `--num-layers`, `--mask-prompt`, `--optimizer` — silently ignored |
503
+ | `mlx_lm.upload` | `upload` | `--path`, `--upload-repo` (+ `--private`) | — |
504
+ | `mlx_lm.perplexity` | `perplexity` | `--model`, `--sequence-length`, `--num-samples`, `--batch-size`, `--seed`; `--data-path` is a local file | HF dataset ids |
505
+ | `mlx_lm.benchmark` | `benchmark` | `--model` | `-p`/`--prompt-tokens` short form, `-g`/`--generation-tokens`, `-b`/`--batch-size`, `-n`/`--num-trials` (ours: `--prompt-tokens`, `--tokens`, `--runs`; one stream) |
506
+ | `mlx_lm.manage` | `get` / `scan` / `ls` / `gc` | — | `--scan`/`--delete`/`--pattern` flag forms; `gc` deletes superseded snapshots, not whole repos |
507
+ | `mlx_lm.dynamic_quant` | `convert --target-bpw` | — | the `dynamic_quant` verb name |
508
+
509
+ mlx-optiq's CLI (`optiq convert` / `serve` / `lora` / `benchmark` / `eval` /
510
+ `latency` / `kv-cache` / `lab`) maps onto the same verbs where the concept
511
+ exists: `optiq convert` → `convert --target-bpw`; `optiq serve --kv-config`
512
+ → `serve --kv-quant config` (the `--l2` preset); `optiq latency` → `fit`;
513
+ `optiq lab` → the web app served by `serve`. `optiq eval` and `optiq
514
+ kv-cache` have no verb (below).
515
+
516
+ ### mlx-lm entry points: covered / not covered
517
+
518
+ Against the console scripts the pinned oracle ships
519
+ (`mlx_lm-*.dist-info/entry_points.txt` in the oracle venv). The scoping
520
+ behind each "not covered" row is in
521
+ [docs/reference/cli.md](./cli.md).
522
+
523
+ | Entry point | Status | Where |
524
+ |---|---|---|
525
+ | `mlx_lm.server` | covered | `serve` (incl. `--draft-model` speculative decoding) |
526
+ | `mlx_lm.generate` | covered | `generate` |
527
+ | `mlx_lm.chat` | covered differently | `pi` (agent TUI) + web chat; no plain REPL |
528
+ | `mlx_lm.convert` | covered | `convert` (quantizing paths only) |
529
+ | `mlx_lm.dynamic_quant` | covered | `convert --target-bpw` (sensitivity scan + per-layer bits) |
530
+ | `mlx_lm.lora` | covered (train) | `train`; the `--test` evaluation mode is not covered |
531
+ | `mlx_lm.fuse` | covered | `fuse` (no dequantize / GGUF / upload) |
532
+ | `mlx_lm.upload` | covered | `upload` |
533
+ | `mlx_lm.perplexity` | covered | `perplexity` (local files only) |
534
+ | `mlx_lm.benchmark` | covered | `benchmark` (own flag names; `evals` views the DB) |
535
+ | `mlx_lm.manage` | covered | `get` / `scan` / `ls` / `gc` |
536
+ | `mlx_lm.cache_prompt` | not covered | no on-disk prompt-cache files; the server's prompt cache (+ `--ssd-cache`) is the equivalent for served traffic |
537
+ | `mlx_lm.evaluate` | not covered | no lm-evaluation-harness backend; `benchmark`/`evals`/`perplexity` are the native measurement, and the `/v1` API accepts external harnesses |
538
+ | `mlx_lm.awq` | not covered | activation-aware weight quantization |
539
+ | `mlx_lm.dwq` | not covered | distilled weight quantization |
540
+ | `mlx_lm.gptq` | not covered | Hessian-conditioned rounding |
541
+ | `mlx_lm.share` | not covered | distributed cache share |
542
+ | `mlx_lm` (umbrella `mlx_lm <verb>`) | covered | `mlx-bun <verb>` is the same shape |
543
+
544
+ Native verbs with no mlx-lm counterpart — `pi`, `harness pi`, `embed`,
545
+ `fit`, `train-watch`, `memory`, `evals` — are the surface that makes mlx-bun
546
+ more than a drop-in.