mlx-bun 0.4.0 → 1.0.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.
- package/README.md +1453 -88
- package/THIRD_PARTY_NOTICES.md +882 -0
- package/bin/mlx-bun.convert.mjs +4 -0
- package/bin/mlx-bun.fuse.mjs +4 -0
- package/bin/mlx-bun.generate.mjs +4 -0
- package/bin/mlx-bun.lora.mjs +4 -0
- package/bin/mlx-bun.mjs +13 -21
- package/bin/mlx-bun.server.mjs +4 -0
- package/bin/mlx-bun.upload.mjs +4 -0
- package/dist/web/app.js +9584 -0
- package/package.json +50 -53
- package/src/cli/ane-install.ts +76 -0
- package/src/cli/args.ts +179 -0
- package/src/cli/engine-entry.ts +68 -0
- package/src/cli/inference.ts +214 -0
- package/src/cli/job-entry.ts +97 -0
- package/src/cli/library-host.ts +117 -0
- package/src/cli/main.ts +57 -0
- package/src/cli/memory-engine.ts +163 -0
- package/src/cli/memory.ts +36 -0
- package/src/cli/mlx-lm-aliases.ts +309 -0
- package/src/cli/model-choice.ts +33 -0
- package/src/cli/model-selection.ts +84 -0
- package/src/cli/module-host.ts +11 -0
- package/src/cli/module-verbs.ts +50 -0
- package/src/cli/numerical-policy.ts +12 -0
- package/src/cli/perplexity.ts +89 -0
- package/src/cli/serve-host.ts +423 -0
- package/src/cli/serve-isolated.ts +217 -0
- package/src/cli/serve-options.ts +106 -0
- package/src/cli/serve-state.ts +205 -0
- package/src/cli/serve.ts +500 -0
- package/src/cli/served-model-host.ts +102 -0
- package/src/cli/server-entry.ts +148 -0
- package/src/cli/serving-unit.ts +177 -0
- package/src/{tui.ts → cli/terminal.ts} +13 -8
- package/src/cli/worker-adapters.ts +34 -0
- package/src/cli/worker-entry.ts +272 -0
- package/src/cli/worker-unit.ts +179 -0
- package/src/engine/adapter-operation.ts +26 -0
- package/src/engine/cache-services.ts +114 -0
- package/src/engine/completion.ts +39 -0
- package/src/engine/generation-gateway.ts +358 -0
- package/src/engine/index.ts +59 -0
- package/src/engine/kv-budget.ts +120 -0
- package/src/engine/media-preparation.ts +232 -0
- package/src/engine/model-binding.ts +24 -0
- package/src/engine/model-host.ts +513 -0
- package/src/engine/model-serving.ts +89 -0
- package/src/{serve → engine}/preparation.ts +10 -8
- package/src/{serve → engine}/session-completion-engine.ts +6 -6
- package/src/engine/telemetry.ts +109 -0
- package/src/hub/downloads.ts +116 -0
- package/src/jobs/db.ts +16 -7
- package/src/jobs/events.ts +29 -0
- package/src/jobs/executable.ts +5 -0
- package/src/jobs/host.ts +51 -0
- package/src/jobs/in-process.ts +55 -0
- package/src/{contracts/jobs.ts → jobs/protocol.ts} +7 -9
- package/src/jobs/runner.ts +150 -231
- package/src/jobs/service.ts +75 -0
- package/src/jobs/sse.ts +59 -23
- package/src/jobs/worker-memory.ts +46 -0
- package/src/jobs/worker-process.ts +163 -0
- package/src/jobs/worker-supervisor.ts +258 -0
- package/src/modules.ts +58 -0
- package/src/publishing/catalog-hub.ts +18 -0
- package/src/publishing/credentials.ts +31 -0
- package/src/publishing/upload.ts +37 -0
- package/src/residency/leased-adapters.ts +21 -0
- package/src/residency/local-records.ts +16 -0
- package/src/residency/model-residency.ts +405 -0
- package/src/residency/record-index.ts +28 -0
- package/src/residency/resident-estimate.ts +50 -0
- package/src/{anthropic.ts → server/anthropic.ts} +3 -81
- package/src/server/cache-routes.ts +36 -0
- package/src/{serve → server}/chat-request.ts +12 -10
- package/src/{serve → server}/chat-stage.ts +27 -22
- package/src/{client.ts → server/client.ts} +28 -2
- package/src/{serve → server}/completion-executor.ts +42 -42
- package/src/server/decision-body.ts +55 -0
- package/src/server/decision-routes.ts +134 -0
- package/src/server/decision-wire.ts +228 -0
- package/src/{serve → server}/discovery-routes.ts +42 -83
- package/src/server/generated-token-history.ts +57 -0
- package/src/{serve → server}/http.ts +25 -13
- package/src/{serve → server}/inference-request.ts +5 -5
- package/src/server/job-routes.ts +20 -0
- package/src/server/media-prompt.ts +63 -0
- package/src/server/memory-completion-client.ts +46 -0
- package/src/server/model-routes.ts +192 -0
- package/src/{serve → server}/openai-wire.ts +3 -2
- package/src/{serve → server}/pipeline.ts +1 -1
- package/src/server/prompt-builder.ts +13 -0
- package/src/server/prompt-contracts.ts +17 -0
- package/src/server/proxy-routes.ts +187 -0
- package/src/server/publishing-routes.ts +41 -0
- package/src/{serve → server}/request-plan.ts +8 -8
- package/src/{serve → server}/request-prep.ts +82 -68
- package/src/{serve → server}/responses-client.ts +30 -13
- package/src/{responses.ts → server/responses.ts} +12 -93
- package/src/server/routes.ts +205 -0
- package/src/server/start.ts +72 -0
- package/src/server/status-routes.ts +108 -0
- package/src/{serve → server}/text-completion-stage.ts +25 -4
- package/src/server/text-prompt.ts +12 -0
- package/src/{serve → server}/token-streams.ts +36 -38
- package/src/server/worker-routes.ts +311 -0
- package/src/storage/paths.ts +61 -0
- package/src/web/assets.ts +37 -0
- package/src/web/{src → browser}/api.ts +5 -23
- package/src/web/browser/chat-host.ts +17 -0
- package/src/web/browser/installed-panels.ts +6 -0
- package/src/web/browser/main.ts +55 -0
- package/src/web/browser/markdown.ts +279 -0
- package/src/web/browser/memory-panel.ts +9 -0
- package/src/web/browser/palette.ts +64 -0
- package/src/web/browser/protocol.ts +13 -0
- package/src/web/browser/shell.ts +467 -0
- package/src/web/{src → browser}/status.ts +32 -36
- package/src/web/build.ts +51 -0
- package/src/web/public/app.html +1054 -0
- package/src/web/{sw.js → public/sw.js} +4 -3
- package/src/web/{vendor → public/vendor}/hljs-theme.css +2 -2
- package/src/web/{vendor → public/vendor}/hljs.js +2 -2
- package/THIRD_PARTY_LICENSES.md +0 -51
- package/docs/README.md +0 -94
- package/docs/archive/hlg-sampling.md +0 -350
- package/docs/archive/investigations/audio-input-plan.md +0 -356
- package/docs/archive/investigations/chunk-finetune-experiment.md +0 -84
- package/docs/archive/investigations/colibri-glm52-port.md +0 -1486
- package/docs/archive/investigations/colibri-oracle-pin.md +0 -1284
- package/docs/archive/investigations/curve-bisector-routing.md +0 -123
- package/docs/archive/investigations/decode-roofline-lookagain.md +0 -348
- package/docs/archive/investigations/diffusion-gemma-port.md +0 -602
- package/docs/archive/investigations/dspark-handoff.md +0 -224
- package/docs/archive/investigations/expert-offload-single-user-moe.md +0 -292
- package/docs/archive/investigations/faithful-l1-consolidation.md +0 -310
- package/docs/archive/investigations/hlg-sampling-investigation.md +0 -970
- package/docs/archive/investigations/indexshare-performance-spike.md +0 -357
- package/docs/archive/investigations/kernel-perf-review-2026-07.md +0 -171
- package/docs/archive/investigations/lab-build-journal.md +0 -157
- package/docs/archive/investigations/minicpm5-decode-megakernel.md +0 -489
- package/docs/archive/investigations/openjarvis-fit.md +0 -198
- package/docs/archive/investigations/openwiki-evaluation.md +0 -249
- package/docs/archive/investigations/optimization_plan.md +0 -346
- package/docs/archive/investigations/orpo-base-uf-experiment-and-directions.md +0 -120
- package/docs/archive/investigations/orpo-flash-cce-pin-leak.md +0 -167
- package/docs/archive/investigations/orpo-uf-testing-handoff.md +0 -126
- package/docs/archive/investigations/pareto-specialized-runtime-findings.md +0 -92
- package/docs/archive/investigations/pi-builtin-investigation.md +0 -308
- package/docs/archive/investigations/pre-colibri-stabilization.md +0 -329
- package/docs/archive/investigations/qwen38-27b-campaign-log.md +0 -1092
- package/docs/archive/investigations/segmented-backward-handoff.md +0 -148
- package/docs/archive/investigations/starter-model-port-handoff.md +0 -342
- package/docs/archive/investigations/steel-flash-cce-handoff.md +0 -489
- package/docs/archive/investigations/the-dreaming-handoff.md +0 -141
- package/docs/archive/investigations/trainer-validation-experiment.md +0 -173
- package/docs/archive/planning/chat-ui-vision-memory-first.md +0 -199
- package/docs/archive/planning/chat-ui-vision.md +0 -50
- package/docs/archive/planning/chunk-task-roadmap.md +0 -77
- package/docs/archive/planning/curve-sampler-research-plan.md +0 -331
- package/docs/archive/planning/journal.md +0 -316
- package/docs/archive/planning/memory-docs-and-dag-plan.md +0 -194
- package/docs/archive/planning/pi-integration-review.md +0 -178
- package/docs/archive/planning/release-notes-v0.0.10.md +0 -57
- package/docs/archive/planning/release-notes-v0.0.11.md +0 -239
- package/docs/archive/planning/release-notes-v0.0.12.md +0 -80
- package/docs/archive/planning/release-notes-v0.0.13.md +0 -77
- package/docs/archive/planning/release-notes-v0.0.9.md +0 -122
- package/docs/archive/planning/release-notes-v0.2.0.md +0 -49
- package/docs/archive/planning/release-notes-v0.3.0.md +0 -35
- package/docs/archive/planning/web-ui-pass-plan.md +0 -213
- package/docs/archive/planning/website-readme-pass-plan.md +0 -224
- package/docs/design/batching.md +0 -1841
- package/docs/design/decode-speed-program.md +0 -2349
- package/docs/design/dreaming-nightly-pipeline.md +0 -684
- package/docs/design/generic-model-support.md +0 -705
- package/docs/design/kv-cache.md +0 -824
- package/docs/design/orpo-training.md +0 -680
- package/docs/design/speculative-decoding.md +0 -1990
- package/docs/design/turboquant.md +0 -2212
- package/docs/design/unified-engine-frontier-plan.md +0 -1880
- package/docs/design/web-chat-redesign.md +0 -695
- package/docs/planning/PRODUCT_ROADMAP.md +0 -594
- package/docs/planning/ResearchTopics.md +0 -119
- package/docs/planning/release-notes-v0.4.0.md +0 -45
- package/docs/planning/video-series.md +0 -421
- package/docs/reference/benchmarks.md +0 -3613
- package/docs/reference/cli.md +0 -585
- package/docs/reference/distribution.md +0 -355
- package/docs/reference/environment.md +0 -398
- package/docs/reference/glossary.md +0 -39
- package/docs/reference/library-api.md +0 -674
- package/docs/reference/memory.md +0 -260
- package/docs/reference/models.md +0 -334
- package/docs/reference/server-api.md +0 -1775
- package/docs/reference/server-config.md +0 -846
- package/docs/reference/training.md +0 -462
- package/docs/reference/troubleshooting.md +0 -158
- package/src/admission-plan.ts +0 -18
- package/src/audio/conformer.ts +0 -647
- package/src/audio/decode.ts +0 -133
- package/src/audio/features.ts +0 -202
- package/src/audio/transcode.ts +0 -67
- package/src/backends/mlx/assistant-target.ts +0 -46
- package/src/backends/mlx/autoregressive-draft-rows.ts +0 -120
- package/src/backends/mlx/autoregressive.ts +0 -108
- package/src/backends/mlx/batch-group.ts +0 -1790
- package/src/backends/mlx/cache-attachment.ts +0 -67
- package/src/backends/mlx/cache-layout.ts +0 -31
- package/src/backends/mlx/checkpoint-state.ts +0 -53
- package/src/backends/mlx/continuation-persistence.ts +0 -106
- package/src/backends/mlx/continuation-request.ts +0 -43
- package/src/backends/mlx/continuation.ts +0 -77
- package/src/backends/mlx/diffusion.ts +0 -39
- package/src/backends/mlx/draft-target.ts +0 -32
- package/src/backends/mlx/evaluation.ts +0 -105
- package/src/backends/mlx/fill-append.ts +0 -45
- package/src/backends/mlx/full-kv-row-append.ts +0 -32
- package/src/backends/mlx/full-kv-row-donor.ts +0 -54
- package/src/backends/mlx/full-transitioning-kv-rows.ts +0 -65
- package/src/backends/mlx/gateway-binding.ts +0 -130
- package/src/backends/mlx/graph.ts +0 -38
- package/src/backends/mlx/kv-codec.ts +0 -9
- package/src/backends/mlx/kv-maintenance.ts +0 -133
- package/src/backends/mlx/kv-tensor-rows.ts +0 -212
- package/src/backends/mlx/memory-client.ts +0 -189
- package/src/backends/mlx/methods.ts +0 -90
- package/src/backends/mlx/model-prompt.ts +0 -164
- package/src/backends/mlx/model-serving.ts +0 -79
- package/src/backends/mlx/prefill-cohort.ts +0 -89
- package/src/backends/mlx/prefill-rows.ts +0 -200
- package/src/backends/mlx/prefill.ts +0 -33
- package/src/backends/mlx/projected-context-rows.ts +0 -72
- package/src/backends/mlx/request-policy.ts +0 -20
- package/src/backends/mlx/request-state-policy.ts +0 -41
- package/src/backends/mlx/rollback.ts +0 -89
- package/src/backends/mlx/row-sampling.ts +0 -49
- package/src/backends/mlx/serial-executor.ts +0 -242
- package/src/backends/mlx/speculative-group.ts +0 -359
- package/src/backends/mlx/speculative-round.ts +0 -161
- package/src/backends/mlx/speculative.ts +0 -114
- package/src/backends/mlx/state-rows.ts +0 -104
- package/src/backends/mlx/state-views.ts +0 -46
- package/src/backends/mlx/target-layout-capability.ts +0 -35
- package/src/backends/mlx/text-engine.ts +0 -73
- package/src/backends/mlx/transitioning-kv-rows.ts +0 -165
- package/src/chat-template.ts +0 -382
- package/src/cli.ts +0 -3168
- package/src/config.ts +0 -399
- package/src/contracts/completion.ts +0 -16
- package/src/contracts/execution.ts +0 -60
- package/src/contracts/generation.ts +0 -103
- package/src/contracts/host.ts +0 -7
- package/src/contracts/pi-provider.ts +0 -30
- package/src/contracts/pi.ts +0 -259
- package/src/contracts/prefix-cache.ts +0 -23
- package/src/contracts/resources.ts +0 -25
- package/src/contracts/sampling.ts +0 -23
- package/src/contracts/scheduling.ts +0 -45
- package/src/contracts/tsconfig.json +0 -14
- package/src/dataset/generators.ts +0 -1087
- package/src/dataset/index.ts +0 -12
- package/src/dataset/job.ts +0 -81
- package/src/dataset/llm.ts +0 -71
- package/src/dataset/registry.ts +0 -528
- package/src/diffusion/diffusion-generate.ts +0 -507
- package/src/download.ts +0 -505
- package/src/embed.ts +0 -77
- package/src/engine/admission.ts +0 -59
- package/src/engine/cancellation.ts +0 -38
- package/src/engine/engine.ts +0 -56
- package/src/engine/execution-coordinator.ts +0 -70
- package/src/engine/execution-plan.ts +0 -53
- package/src/engine/resources.ts +0 -53
- package/src/engine/scheduler.ts +0 -72
- package/src/engine/session.ts +0 -247
- package/src/eval/README.md +0 -130
- package/src/eval/ifeval.ts +0 -81
- package/src/eval/kl-prompts.ts +0 -29
- package/src/eval/kl.ts +0 -590
- package/src/eval/perplexity.ts +0 -164
- package/src/eval/quality-db.ts +0 -92
- package/src/eval/reference-logits.ts +0 -207
- package/src/eval/runner.ts +0 -124
- package/src/eval/score.ts +0 -49
- package/src/eval/tasks/bfcl.ts +0 -535
- package/src/eval/tasks/gsm8k.ts +0 -98
- package/src/eval/tasks/hashhop.ts +0 -139
- package/src/eval/tasks/humaneval.ts +0 -275
- package/src/eval/tasks/ifeval.ts +0 -525
- package/src/eval/tasks/mmlu.ts +0 -157
- package/src/eval/ultrafeedback.ts +0 -60
- package/src/evaldb.ts +0 -199
- package/src/expert-io.ts +0 -393
- package/src/expert-offload-build.ts +0 -77
- package/src/expert-offload.ts +0 -76
- package/src/expert-residency.ts +0 -1134
- package/src/expert-usage.ts +0 -415
- package/src/fill/echo-index.ts +0 -188
- package/src/fill/fill-session.ts +0 -452
- package/src/fill/proposal.ts +0 -68
- package/src/fill/schema-rows.ts +0 -506
- package/src/fill/tool-boundary.ts +0 -103
- package/src/fit.ts +0 -249
- package/src/generate.ts +0 -1346
- package/src/grammar.ts +0 -591
- package/src/harness-pi.ts +0 -184
- package/src/hf-push.ts +0 -628
- package/src/hub-rest.ts +0 -242
- package/src/index.ts +0 -63
- package/src/inference/denoising.ts +0 -17
- package/src/inference/draft-acceptance.ts +0 -41
- package/src/inference/draft-output.ts +0 -49
- package/src/inference/graph.ts +0 -33
- package/src/inference/prefill.ts +0 -39
- package/src/inference/rollback.ts +0 -7
- package/src/jobs/index.ts +0 -31
- package/src/jobs/job-entry.ts +0 -107
- package/src/jobs/task-client.ts +0 -19
- package/src/jobs/types.ts +0 -2
- package/src/kv-scheme.ts +0 -257
- package/src/kv-store.ts +0 -1099
- package/src/lab/README.md +0 -18
- package/src/lab/curve/curve-designer.html +0 -303
- package/src/lab/curve/curve-sampler.ts +0 -122
- package/src/lab/expert-trace/expert-trace.ts +0 -69
- package/src/lab/paged-kv/paged-kv-rows.ts +0 -83
- package/src/lab/paged-kv/paged-kv.ts +0 -270
- package/src/library.ts +0 -40
- package/src/lora.ts +0 -408
- package/src/md-modules.d.ts +0 -49
- package/src/media-fetch.ts +0 -442
- package/src/memory/article.ts +0 -558
- package/src/memory/chunk-validation.ts +0 -150
- package/src/memory/chunk.ts +0 -318
- package/src/memory/cluster.ts +0 -351
- package/src/memory/coverage.ts +0 -134
- package/src/memory/crosslink.ts +0 -0
- package/src/memory/db.ts +0 -253
- package/src/memory/entity.ts +0 -203
- package/src/memory/gate.ts +0 -187
- package/src/memory/history.ts +0 -152
- package/src/memory/ingest.ts +0 -335
- package/src/memory/model.ts +0 -183
- package/src/memory/normalize.ts +0 -671
- package/src/memory/parse.ts +0 -22
- package/src/memory/pipeline.ts +0 -275
- package/src/memory/prompts.ts +0 -65
- package/src/memory/query.ts +0 -334
- package/src/memory/reconcile.ts +0 -734
- package/src/memory/redirect.ts +0 -108
- package/src/memory/reindex.ts +0 -325
- package/src/memory/resolve.ts +0 -307
- package/src/memory/rest.ts +0 -245
- package/src/memory/route.ts +0 -272
- package/src/memory/schedule.ts +0 -165
- package/src/memory/stages.ts +0 -777
- package/src/memory/synthesize.ts +0 -1638
- package/src/memory/tools.ts +0 -749
- package/src/memory/vault.ts +0 -1194
- package/src/memory/wikify.ts +0 -1064
- package/src/mlx/array.ts +0 -388
- package/src/mlx/autograd.ts +0 -304
- package/src/mlx/checkpoint.ts +0 -149
- package/src/mlx/compile.ts +0 -168
- package/src/mlx/custom-vjp.ts +0 -188
- package/src/mlx/ffi.ts +0 -512
- package/src/mlx/materialize.ts +0 -23
- package/src/mlx/metal-kernel.ts +0 -159
- package/src/mlx/ops.ts +0 -1021
- package/src/mlx/quantized-rows.ts +0 -36
- package/src/mlx/token-bitmask.ts +0 -52
- package/src/mlx/turboquant-kv-decode.ts +0 -82
- package/src/mlx/turboquant-kv-inverse.ts +0 -122
- package/src/mlx/turboquant-ops.ts +0 -861
- package/src/mlx/turboquant-tables.ts +0 -237
- package/src/mmap.ts +0 -90
- package/src/model/artifact-identity.ts +0 -73
- package/src/model/batched-kv.ts +0 -235
- package/src/model/batched-mask.ts +0 -279
- package/src/model/batched-quant.ts +0 -212
- package/src/model/batched-quantized-kv.ts +0 -144
- package/src/model/batched-rotating-quant.ts +0 -353
- package/src/model/batched-rotating-state.ts +0 -149
- package/src/model/batched-rotating.ts +0 -338
- package/src/model/batched-row-storage.ts +0 -179
- package/src/model/batched-ssm.ts +0 -52
- package/src/model/batched-turboquant-kv.ts +0 -93
- package/src/model/compiled-decode.ts +0 -712
- package/src/model/decoded-kv-donor.ts +0 -12
- package/src/model/delayed-quantized-kv.ts +0 -72
- package/src/model/delayed-rotating-quantized-kv.ts +0 -93
- package/src/model/delayed-turboquant-kv.ts +0 -55
- package/src/model/diffusion-gemma.ts +0 -1026
- package/src/model/factory.ts +0 -189
- package/src/model/fingerprint.ts +0 -33
- package/src/model/flash-attention.ts +0 -694
- package/src/model/full-prefill-padding.ts +0 -56
- package/src/model/full-prefill-row.ts +0 -105
- package/src/model/gemma4-base.ts +0 -2351
- package/src/model/gemma4.ts +0 -1315
- package/src/model/generated/gemma4-12b.ts +0 -429
- package/src/model/generated/gemma4-26b.ts +0 -448
- package/src/model/generated/gemma4-e4b.ts +0 -717
- package/src/model/generated/index.ts +0 -18
- package/src/model/glm52-atlas.ts +0 -511
- package/src/model/glm52-cache.ts +0 -792
- package/src/model/glm52-config.ts +0 -262
- package/src/model/glm52-container.ts +0 -305
- package/src/model/glm52-coupling.ts +0 -388
- package/src/model/glm52-dsa.ts +0 -606
- package/src/model/glm52-expert-layout.ts +0 -253
- package/src/model/glm52-layout.ts +0 -152
- package/src/model/glm52-memory.ts +0 -500
- package/src/model/glm52-mla.ts +0 -792
- package/src/model/glm52-moe.ts +0 -223
- package/src/model/glm52-pilot.ts +0 -537
- package/src/model/glm52-reference.ts +0 -445
- package/src/model/glm52-residency.ts +0 -557
- package/src/model/glm52-resident-weights.ts +0 -135
- package/src/model/glm52-streamed-experts.ts +0 -453
- package/src/model/glm52-streamed-metal.ts +0 -610
- package/src/model/glm52-weights.ts +0 -503
- package/src/model/glm52.ts +0 -1132
- package/src/model/implementation.ts +0 -69
- package/src/model/kv-attention-view.ts +0 -67
- package/src/model/minicpm5.ts +0 -376
- package/src/model/profile.ts +0 -443
- package/src/model/qwen-append.ts +0 -12
- package/src/model/qwen-conv.ts +0 -52
- package/src/model/qwen3-delta-state.ts +0 -74
- package/src/model/qwen3-delta.ts +0 -451
- package/src/model/qwen3-moe.ts +0 -404
- package/src/model/qwen3-mrope.ts +0 -252
- package/src/model/qwen3.ts +0 -277
- package/src/model/qwen3_5-checkpoint.ts +0 -164
- package/src/model/qwen3_5.ts +0 -819
- package/src/model/rotating-kv-donor.ts +0 -35
- package/src/model/rotating-kv-layout.ts +0 -262
- package/src/model/rotating-row-transaction.ts +0 -35
- package/src/model/speculative-rotating-kv.ts +0 -101
- package/src/model/ssm-prefill-padding.ts +0 -39
- package/src/model/support.ts +0 -102
- package/src/model/trellis-balanced-scatter.ts +0 -51
- package/src/model/trellis-linear.ts +0 -672
- package/src/model/trellis-shared-m.ts +0 -151
- package/src/model/trellis-shared-scatter.ts +0 -144
- package/src/model/trellis-splitk-prefill.ts +0 -158
- package/src/model/trellis-tiled-prefill.ts +0 -136
- package/src/model/trellis-vector-expand.ts +0 -62
- package/src/model/trellis-wide-prefill.ts +0 -94
- package/src/model/turboquant-codec.ts +0 -83
- package/src/model/universal/archs.ts +0 -332
- package/src/model/universal/dense.ts +0 -612
- package/src/model/universal/modules.ts +0 -170
- package/src/model/universal/rope.ts +0 -381
- package/src/native/expert_io.c +0 -523
- package/src/native/frame_extract.swift +0 -140
- package/src/native-pack.ts +0 -162
- package/src/pi-provider.ts +0 -53
- package/src/pi-session.ts +0 -81
- package/src/pi-terminal.ts +0 -274
- package/src/pi-web.ts +0 -1932
- package/src/preflight.ts +0 -158
- package/src/prompt-cache.ts +0 -460
- package/src/quantize/allocator.ts +0 -627
- package/src/quantize/atomic-output.ts +0 -38
- package/src/quantize/calibration.ts +0 -181
- package/src/quantize/config-writer.ts +0 -145
- package/src/quantize/index.ts +0 -84
- package/src/quantize/job.ts +0 -162
- package/src/quantize/quantizer.ts +0 -666
- package/src/quantize/rotate.ts +0 -603
- package/src/quantize/safetensors-writer.ts +0 -249
- package/src/quantize/sensitivity.ts +0 -216
- package/src/quantize/trellis.ts +0 -586
- package/src/quantize/weight-transform.ts +0 -292
- package/src/registry.ts +0 -602
- package/src/runtime-config.ts +0 -81
- package/src/safetensors.ts +0 -158
- package/src/sampler.ts +0 -1011
- package/src/serve/admin-routes.ts +0 -184
- package/src/serve/assets/curve-terrain.html +0 -105
- package/src/serve/assets/training-inference-map.html +0 -575
- package/src/serve/aux-routes.ts +0 -132
- package/src/serve/batch-scheduler.ts +0 -8
- package/src/serve/checkpoint-identity.ts +0 -64
- package/src/serve/generation-gateway.ts +0 -496
- package/src/serve/isolate.ts +0 -609
- package/src/serve/kv-budget.ts +0 -14
- package/src/serve/lab-routes.ts +0 -341
- package/src/serve/lane-registry.ts +0 -45
- package/src/serve/model-admin-routes.ts +0 -155
- package/src/serve/model-binding.ts +0 -43
- package/src/serve/model-host.ts +0 -511
- package/src/serve/parent-application.ts +0 -56
- package/src/serve/prompt-response-trace.ts +0 -147
- package/src/serve/response-lease.ts +0 -24
- package/src/serve/session-search.ts +0 -326
- package/src/serve/static-routes.ts +0 -101
- package/src/server.ts +0 -1314
- package/src/spec/assistant-rows.ts +0 -92
- package/src/spec/assistant-source.ts +0 -126
- package/src/spec/cache-identity.ts +0 -22
- package/src/spec/deepspec-rows.ts +0 -29
- package/src/spec/deepspec-source.ts +0 -145
- package/src/spec/dflash-source.ts +0 -149
- package/src/spec/drafter.ts +0 -304
- package/src/spec/dspark/ab-stats.ts +0 -136
- package/src/spec/dspark/calibration.ts +0 -112
- package/src/spec/dspark/data-dflash.ts +0 -156
- package/src/spec/dspark/data.ts +0 -201
- package/src/spec/dspark/deepspec-module.ts +0 -776
- package/src/spec/dspark/generate-dflash.ts +0 -245
- package/src/spec/dspark/generate.ts +0 -290
- package/src/spec/dspark/loader.ts +0 -23
- package/src/spec/dspark/loss.ts +0 -213
- package/src/spec/dspark/module-dflash.ts +0 -560
- package/src/spec/dspark/module.ts +0 -540
- package/src/spec/dspark/quantize-drafter.ts +0 -91
- package/src/spec/dspark/sample.ts +0 -112
- package/src/spec/generate.ts +0 -276
- package/src/spec/glm52-mtp-graph.ts +0 -29
- package/src/spec/glm52-mtp-rows.ts +0 -132
- package/src/spec/glm52-mtp-source.ts +0 -317
- package/src/spec/glm52-mtp-state.ts +0 -33
- package/src/spec/ngram-source.ts +0 -204
- package/src/spec/projected-draft-rows.ts +0 -73
- package/src/spec/qwen-mtp-module.ts +0 -171
- package/src/spec/qwen-mtp-rows.ts +0 -219
- package/src/spec/qwen-mtp-source.ts +0 -383
- package/src/spec/qwen-mtp-state.ts +0 -30
- package/src/spec/serve-loop.ts +0 -585
- package/src/spec/source.ts +0 -215
- package/src/spec/two-model-rows.ts +0 -61
- package/src/spec/two-model.ts +0 -113
- package/src/ssd-cache.ts +0 -372
- package/src/ssd-durability.ts +0 -211
- package/src/tokenizer.ts +0 -335
- package/src/tool-approvals.ts +0 -131
- package/src/tool-call.ts +0 -695
- package/src/train/dataset.ts +0 -484
- package/src/train/diffusion-lora.ts +0 -216
- package/src/train/export.ts +0 -32
- package/src/train/flash-cce.ts +0 -1234
- package/src/train/forward.ts +0 -266
- package/src/train/fuse.ts +0 -243
- package/src/train/index.ts +0 -46
- package/src/train/job.ts +0 -205
- package/src/train/lora-params.ts +0 -254
- package/src/train/loss.ts +0 -1591
- package/src/train/merge.ts +0 -195
- package/src/train/optimizer.ts +0 -183
- package/src/train/prefix-shared.ts +0 -490
- package/src/train/rank.ts +0 -137
- package/src/train/segmented.ts +0 -1828
- package/src/train/steel-qmm-header.ts +0 -1461
- package/src/train/trainer.ts +0 -1221
- package/src/train/watch.ts +0 -542
- package/src/vision/diffusion-vision.ts +0 -620
- package/src/vision/embedder.ts +0 -168
- package/src/vision/preprocess.ts +0 -247
- package/src/vision/prompt.ts +0 -373
- package/src/vision/qwen3vl-preprocess.ts +0 -409
- package/src/vision/qwen3vl-prompt.ts +0 -196
- package/src/vision/qwen3vl-tower.ts +0 -555
- package/src/vision/siglip.ts +0 -599
- package/src/vision/video-frames.ts +0 -148
- package/src/web/app.html +0 -2143
- package/src/web/app.js +0 -5703
- package/src/web/skills/memory/SKILL.md +0 -120
- package/src/web/skills/web-research/SKILL.md +0 -46
- package/src/web/skills.ts +0 -97
- package/src/web/src/adapters-panel.ts +0 -288
- package/src/web/src/assistant.ts +0 -451
- package/src/web/src/chat.ts +0 -1057
- package/src/web/src/composer.ts +0 -959
- package/src/web/src/dataset.ts +0 -132
- package/src/web/src/finetune.ts +0 -267
- package/src/web/src/hub.ts +0 -428
- package/src/web/src/main.ts +0 -98
- package/src/web/src/markdown.ts +0 -0
- package/src/web/src/memory-panel.ts +0 -572
- package/src/web/src/model-picker.ts +0 -159
- package/src/web/src/palette.ts +0 -346
- package/src/web/src/protocol.ts +0 -26
- package/src/web/src/quantize.ts +0 -167
- package/src/web/src/rag.ts +0 -274
- package/src/web/src/sessions.ts +0 -469
- package/src/web/src/shell.ts +0 -804
- package/src/web/src/ui-catalog.ts +0 -78
- package/src/web/vendor/README.md +0 -61
- package/src/web-assets.ts +0 -47
- package/src/web-tools.ts +0 -478
- package/src/weights.ts +0 -255
- /package/src/{serve → server}/completion-sink.ts +0 -0
- /package/src/web/{icon.svg → public/icon.svg} +0 -0
- /package/src/web/{manifest.webmanifest → public/manifest.webmanifest} +0 -0
- /package/src/web/{vendor → public/vendor}/hljs-LICENSE +0 -0
package/docs/reference/cli.md
DELETED
|
@@ -1,585 +0,0 @@
|
|
|
1
|
-
# CLI reference
|
|
2
|
-
|
|
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
|
|
49
|
-
|
|
50
|
-
### `serve` — run the server
|
|
51
|
-
|
|
52
|
-
Start the OpenAI/Anthropic-compatible server plus the browser web app.
|
|
53
|
-
|
|
54
|
-
```sh
|
|
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
|
|
60
|
-
```
|
|
61
|
-
|
|
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.
|
|
66
|
-
|
|
67
|
-
Library requests support delayed uniform or per-layer affine conversion with
|
|
68
|
-
qualified shared drafting providers, including rotating caches. CLI affine
|
|
69
|
-
quantization starts at zero.
|
|
70
|
-
|
|
71
|
-
The unreleased shared executor supports qualified Qwen MTP and start-zero
|
|
72
|
-
TurboQuant at one or several active rows; `--batch 1` still selects the
|
|
73
|
-
legacy serial control. No new CLI flag is required for the shared interfaces.
|
|
74
|
-
Full-attention and rotating targets, including Llama, MiniCPM and Gemma, use shared bf16, uniform KV4/KV8, per-layer affine KV or TurboQuant
|
|
75
|
-
prompt lookup and standalone drafting, including generated RAM/SSD state.
|
|
76
|
-
Gemma assistant drafting also shares these target layouts and caches its last true target
|
|
77
|
-
hidden alongside target KV through the same RAM/SSD interfaces.
|
|
78
|
-
DeepSpec and DSpark use the same executor and persist their projected context through those
|
|
79
|
-
interfaces. DeepSpec accepts bf16 or affine-quantized weights; DSpark retains
|
|
80
|
-
its Markov/RNN head and checkpoint confidence policy.
|
|
81
|
-
|
|
82
|
-
Shared Qwen MTP retains completed decode state through the existing
|
|
83
|
-
`--prompt-cache` and `--ssd-cache` settings.
|
|
84
|
-
|
|
85
|
-
| Group | Flags |
|
|
86
|
-
|---|---|
|
|
87
|
-
| Network | `--host`, `--port`, `--no-open`, `--allow-private-media` |
|
|
88
|
-
| Memory & caches | `--memory-budget`, `--kv-budget`, `--prompt-cache`, `--ssd-cache`, `--ssd-cache-max`, `--ssd-cache-verify`, `--ssd-demote-idle`, `--generation-checkpoint` |
|
|
89
|
-
| Process model | `--isolate`, `--model-pool`, `--unix` (internal — the engine half of `--isolate`) |
|
|
90
|
-
| Scheduling | `--batch` (`--decode-concurrency` accepted as the mlx_lm.server alias) |
|
|
91
|
-
| KV cache | `--kv-quant`, `--paged-kv`, `--paged-kv-block-size` |
|
|
92
|
-
| Adapters (compatible sets can batch) | `--adapter` (`--adapter-path` alias) |
|
|
93
|
-
| Speculative decoding (Qwen methods and full-attention/rotating lookup/standalone and Gemma assistant/DeepSpec/DSpark drafting share execution) | `--draft-model`, `--draft-kind`, `--num-draft-tokens`, `--ngram-max`, `--ngram-min` |
|
|
94
|
-
| GLM-5.2 | `--mtp`, `--context-length` |
|
|
95
|
-
| Sampling defaults | `--temperature` (`--temp` alias), `--top-p`, `--top-k`, `--max-tokens`, `--thinking`, `--hlg-sampling`, `--hlg-width`, `--hlg-shoulder`, `--hlg-toe`, `--hlg-pivot-offset` |
|
|
96
|
-
| Parity tier | `--l1`, `--l2` (`--l3` errors — removed) |
|
|
97
|
-
| Kill switches | `--compiled-decode`, `--compiled-activations`, `--fused-sdpa`, `--force-wire`, `--expert-offload` |
|
|
98
|
-
|
|
99
|
-
Serving treats memory estimates as advisory by default and attempts the request.
|
|
100
|
-
`--memory-budget` opts into estimated admission limits; `--kv-budget` opts
|
|
101
|
-
into aggregate KV limits. `--max-tokens` supplies an explicit output cap.
|
|
102
|
-
|
|
103
|
-
Endpoints: `/v1/chat/completions`, `/v1/completions`, `/v1/messages`,
|
|
104
|
-
`/v1/responses`, `/v1/embeddings`, `/v1/models`, `/v1/adapters`, `/health`,
|
|
105
|
-
`/stats`, `/fit`, `/library`, `/downloads`; the web app at `/` (`/chat`,
|
|
106
|
-
`/status`, `/quantize`, `/finetune`, `/dataset` deep-link its views). Schemas
|
|
107
|
-
in [server-api.md](server-api.md).
|
|
108
|
-
|
|
109
|
-
### `pi` — built-in coding agent
|
|
110
|
-
|
|
111
|
-
Run the pi coding agent's terminal UI in-process against a local model —
|
|
112
|
-
pi is bundled, nothing to install. Reuses a healthy server on the chosen
|
|
113
|
-
port; otherwise starts one that lives exactly as long as the session.
|
|
114
|
-
|
|
115
|
-
```sh
|
|
116
|
-
mlx-bun pi # interactive session
|
|
117
|
-
mlx-bun pi fix the failing test # pre-fill the first turn
|
|
118
|
-
mlx-bun pi -p "explain this repo" # one-shot: print the reply and exit
|
|
119
|
-
mlx-bun pi -p --json "summarize README" # one-shot with the full event stream
|
|
120
|
-
mlx-bun pi --mode rpc # JSONL RPC over stdio
|
|
121
|
-
mlx-bun pi -q qwen --port 8090 # model + server flags for the session server
|
|
122
|
-
git diff | mlx-bun pi -p "review this" # piped stdin makes it one-shot too
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
| Flag | Meaning |
|
|
126
|
-
|---|---|
|
|
127
|
-
| `-q`, `--query <q>` | model to serve when starting a session server |
|
|
128
|
-
| `-p`, `--print [msg]` | one-shot print mode (also reads piped stdin) |
|
|
129
|
-
| `--json` | with `-p`: emit the full event stream as JSON |
|
|
130
|
-
| `--mode json\|rpc\|text` | `json` = print + JSON, `rpc` = JSONL RPC over stdio, `text` = print |
|
|
131
|
-
| `--verbose` | verbose agent logging |
|
|
132
|
-
| every `serve` flag | applies to the session server; ignored (with a note) when reusing a running one |
|
|
133
|
-
|
|
134
|
-
Other pi flags are dropped with a note — the full pi surface (`--continue`,
|
|
135
|
-
`--resume`, extensions, themes) lives in your own pi via `harness pi`.
|
|
136
|
-
`mlx-bun help pi` is our help; `mlx-bun pi --help` prints it only when it is
|
|
137
|
-
the sole argument.
|
|
138
|
-
|
|
139
|
-
### `harness pi` — connect your own pi
|
|
140
|
-
|
|
141
|
-
For people who already run [pi](https://www.npmjs.com/package/@earendil-works/pi-coding-agent):
|
|
142
|
-
writes one reversible extension, `~/.pi/agent/extensions/mlx-bun-provider.ts`,
|
|
143
|
-
that registers `mlx-bun` as a pi provider. Models are discovered live from
|
|
144
|
-
`/v1/models` at pi startup (the list baked at install time is the fallback
|
|
145
|
-
when the server is down), exposed under the stable id `mlx-bun/local`. It
|
|
146
|
-
never touches your existing pi config.
|
|
147
|
-
|
|
148
|
-
```sh
|
|
149
|
-
mlx-bun harness pi # install; requires pi on PATH
|
|
150
|
-
mlx-bun harness pi --base-url http://127.0.0.1:8090/v1
|
|
151
|
-
mlx-bun harness pi --remove # delete the extension
|
|
152
|
-
pi --provider mlx-bun # then run pi as usual
|
|
153
|
-
pi --models "mlx-bun/*" # or scope cycling
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### LoRA adapters from pi: the adapter extension
|
|
157
|
-
|
|
158
|
-
`scripts/packaging/pi-extensions/mlx-bun-adapter.ts` ships with the repo and
|
|
159
|
-
adds an `/adapter` command to pi. Install by copying (or symlinking) it into
|
|
160
|
-
`~/.pi/agent/extensions/`, then `/reload` inside pi:
|
|
161
|
-
|
|
162
|
-
```sh
|
|
163
|
-
cp scripts/packaging/pi-extensions/mlx-bun-adapter.ts ~/.pi/agent/extensions/
|
|
164
|
-
MLX_BUN_URL=http://127.0.0.1:8080 pi --provider mlx-bun
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
| In pi | Effect |
|
|
168
|
-
|---|---|
|
|
169
|
-
| `/adapter` or `/adapter list` | list adapters on disk (`/v1/adapters/available`), which are loaded, and the active one |
|
|
170
|
-
| `/adapter <id>` | mount it if needed (`POST /v1/adapters`) and inject `adapter: <id>` into every request |
|
|
171
|
-
| `/adapter off` | back to the base model (no field sent) |
|
|
172
|
-
|
|
173
|
-
The extension reads the server URL from `MLX_BUN_URL` (its built-in fallback
|
|
174
|
-
is port 8090, so set it to match your server). Default is no adapter; the
|
|
175
|
-
mechanism is pi's `before_provider_request` hook, the same one the web chat's
|
|
176
|
-
adapter selector uses. Serving-side detail: [server-api.md](server-api.md#adapters-lora-hot-swap)
|
|
177
|
-
and [docs/design/web-chat-redesign.md](../design/web-chat-redesign.md).
|
|
178
|
-
|
|
179
|
-
### `generate` (alias `gen`) — one-shot generation
|
|
180
|
-
|
|
181
|
-
Load the model, generate, print, exit. The prompt is rendered through the
|
|
182
|
-
chat template unless `--raw`.
|
|
183
|
-
|
|
184
|
-
```sh
|
|
185
|
-
mlx-bun generate e4b "a haiku about metal shaders"
|
|
186
|
-
mlx-bun gen e4b --prompt "…" --max-tokens 512 --seed 42
|
|
187
|
-
mlx-bun generate qwen --raw --prompt "def fib(n):" --temperature 0
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
| Flag | Meaning |
|
|
191
|
-
|---|---|
|
|
192
|
-
| `[query]` / `--query <q>` | model (auto-picks when omitted) |
|
|
193
|
-
| `--prompt "…"` | the prompt (or pass it as the positional after the model) |
|
|
194
|
-
| `--raw` | skip the chat template |
|
|
195
|
-
| `--max-tokens <n>` | completion cap |
|
|
196
|
-
| `--temperature <n>` (`--temp` alias), `--top-p`, `--top-k`, `--seed` | sampling |
|
|
197
|
-
| `--l1` / `--l2`, `--kv-quant`, `--fused-sdpa`, `--compiled-decode`, `--compiled-activations` | decode route, same meaning as for `serve` |
|
|
198
|
-
|
|
199
|
-
### `embed` — text embeddings
|
|
200
|
-
|
|
201
|
-
Embeddings from a local Qwen3-Embedding model, no server. One JSON vector
|
|
202
|
-
per input line.
|
|
203
|
-
|
|
204
|
-
```sh
|
|
205
|
-
mlx-bun embed --text "hello world"
|
|
206
|
-
mlx-bun embed Qwen3-Embedding "hello world"
|
|
207
|
-
printf 'line one\nline two\n' | mlx-bun embed --json
|
|
208
|
-
mlx-bun embed --instruct "Retrieve passages that answer the question" --text "what is a KV cache?"
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
| Flag | Meaning |
|
|
212
|
-
|---|---|
|
|
213
|
-
| `[query]` / `--query <q>` | embedding model; omitted = the first downloaded embedding model (errors with a `get` suggestion when none) |
|
|
214
|
-
| `--text "…"` | text to embed (omit to read one text per stdin line) |
|
|
215
|
-
| `--instruct "…"` | Qwen3-Embedding query instruction; omit for plain document embeddings |
|
|
216
|
-
| `--json` | one OpenAI-style `{object:"list",data:[…]}` object instead of bare arrays |
|
|
217
|
-
|
|
218
|
-
Server equivalent: `mlx-bun serve <embedding-model>` then
|
|
219
|
-
[`POST /v1/embeddings`](server-api.md#post-v1embeddings-openai-embeddings-api).
|
|
220
|
-
|
|
221
|
-
## Models & disk
|
|
222
|
-
|
|
223
|
-
Full guide: [models.md](models.md).
|
|
224
|
-
|
|
225
|
-
### `get` — download a model
|
|
226
|
-
|
|
227
|
-
Resumable (Range requests against partial blobs), sha256-verified download
|
|
228
|
-
into the standard Hugging Face cache over plain HTTPS (no Xet). Complete
|
|
229
|
-
blobs and partial prefixes are credited before transfer, and the volume must
|
|
230
|
-
fit the remainder plus a 1 GiB reserve. Uses `HF_TOKEN` / `hf auth login`
|
|
231
|
-
credentials when present.
|
|
232
|
-
|
|
233
|
-
```sh
|
|
234
|
-
mlx-bun get mlx-community/gemma-4-12B-it-OptiQ-4bit
|
|
235
|
-
mlx-bun get 12B # no "/" = registry query; re-gets/refreshes the match
|
|
236
|
-
mlx-bun get mlx-community/MiniCPM5-1B-OptiQ-4bit --revision main
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
`--revision <rev>` selects a git revision. When upstream has pushed a new
|
|
240
|
-
revision the previous snapshot stays on disk — `get` says so and `gc`
|
|
241
|
-
reclaims it. GLM-5.2 specifics: [models.md](models.md#glm-52-on-a-32-gb-mac).
|
|
242
|
-
|
|
243
|
-
### `scan` — index your cache
|
|
244
|
-
|
|
245
|
-
Re-index the HF cache into the registry (config + safetensors headers, never
|
|
246
|
-
tensor bytes) so `ls`, `serve`, and `fit` resolve models by substring.
|
|
247
|
-
|
|
248
|
-
```sh
|
|
249
|
-
mlx-bun scan
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### `ls` — list models
|
|
253
|
-
|
|
254
|
-
One row per repo (canonical revision, `refs/main`); superseded snapshots are
|
|
255
|
-
hidden.
|
|
256
|
-
|
|
257
|
-
```sh
|
|
258
|
-
mlx-bun ls # size, params, quant, license, capabilities
|
|
259
|
-
mlx-bun ls gemma # filter by substring
|
|
260
|
-
mlx-bun ls --vision --max-size 10GB # vision-capable, under 10 GB
|
|
261
|
-
mlx-bun ls --all-revisions # one row per cached snapshot (canonical marked *)
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### `gc` — reclaim disk
|
|
265
|
-
|
|
266
|
-
Delete superseded snapshots and the blobs only they reference. Prints the
|
|
267
|
-
plan by default.
|
|
268
|
-
|
|
269
|
-
```sh
|
|
270
|
-
mlx-bun gc # dry run: what would be reclaimed
|
|
271
|
-
mlx-bun gc --yes # delete
|
|
272
|
-
mlx-bun gc --yes --force # also prune snapshots holding files the canonical revision lacks
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
`--dry-run` never deletes even with `--yes`. The same planner backs
|
|
276
|
-
[`GET /api/gc/plan` / `POST /api/gc/execute`](server-api.md#get-apigcplan--post-apigcexecute).
|
|
277
|
-
|
|
278
|
-
### `fit` — memory contract
|
|
279
|
-
|
|
280
|
-
Deterministic memory assessment: does it fit, max safe context, predicted
|
|
281
|
-
tok/s — from safetensors headers, the config's KV bytes/token, a calibrated
|
|
282
|
-
prefill transient, and the wired-memory ceiling.
|
|
283
|
-
|
|
284
|
-
```sh
|
|
285
|
-
mlx-bun fit gemma --ctx 32768 # this machine
|
|
286
|
-
mlx-bun fit gemma --ctx 8192 --skus # across the Apple Silicon lineup
|
|
287
|
-
mlx-bun fit qwen --kv-quant 4 # bill a 4-bit-quantized KV cache
|
|
288
|
-
mlx-bun fit GLM-5.2 # streamed-artifact plan (resident weights, expert slabs, KV, reserves)
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
| Flag | Meaning |
|
|
292
|
-
|---|---|
|
|
293
|
-
| `--ctx <tokens>` | context size to assess |
|
|
294
|
-
| `--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) |
|
|
295
|
-
| `--skus` | also print the Apple silicon SKU matrix (not applicable to the streamed GLM-5.2 artifact) |
|
|
296
|
-
|
|
297
|
-
## Training & model creation
|
|
298
|
-
|
|
299
|
-
Full reference: [training.md](training.md); guided walkthrough:
|
|
300
|
-
[docs/reference/training.md](./training.md).
|
|
301
|
-
|
|
302
|
-
### `train` — LoRA fine-tune
|
|
303
|
-
|
|
304
|
-
SFT / DPO / ORPO on `<dir>/train.jsonl` (+ optional `valid.jsonl`). Rows are
|
|
305
|
-
`{prompt, chosen, rejected}` for dpo/orpo or `{messages|text}` for sft. Runs
|
|
306
|
-
in the foreground and saves a mountable adapter.
|
|
307
|
-
|
|
308
|
-
```sh
|
|
309
|
-
mlx-bun train e4b --data ./prefs # ORPO (default)
|
|
310
|
-
mlx-bun train e4b --data ./prefs --method sft
|
|
311
|
-
mlx-bun train e4b --data ./prefs --dry-run # inspect data + resolved plan, don't train
|
|
312
|
-
mlx-bun train cpm5 --data ./prefs --iters 400 --save-every 50 --adapter ~/adapters/cpm5-orpo
|
|
313
|
-
nohup mlx-bun train e4b --data ./prefs & # long runs: detach from your shell
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
| Flag | Meaning |
|
|
317
|
-
|---|---|
|
|
318
|
-
| `<model>` / `--query <q>` | model to fine-tune (auto-picks when omitted) |
|
|
319
|
-
| `--data <dir>` | dataset dir (required) |
|
|
320
|
-
| `--method sft\|dpo\|orpo` | objective |
|
|
321
|
-
| `--adapter <dir>` | output adapter dir (default under `~/.cache/mlx-bun/mlx-bun-finetunes/`) |
|
|
322
|
-
| `--iters`, `--lr`, `--rank`, `--scale`, `--seq`, `--batch`, `--grad-accum`, `--grad-clip`, `--seed`, `--val-size` | loop hyperparameters (method-dependent defaults: `mlx-bun help train`) |
|
|
323
|
-
| `--lambda <f>`, `--sft-scope full\|response` | ORPO odds-ratio weight and chosen-NLL scope |
|
|
324
|
-
| `--seg <n>`, `--no-segment` | segmented backward (layers per segment / off) |
|
|
325
|
-
| `--no-flash`, `--no-prefix` | disable the flash-CCE head / prefix-sharing |
|
|
326
|
-
| `--save-every <n>`, `--resume <dir>` | checkpoint cadence / warm-start LoRA weights |
|
|
327
|
-
| `--dry-run` | print the plan, don't train |
|
|
328
|
-
|
|
329
|
-
### `train-watch` — live training dashboard
|
|
330
|
-
|
|
331
|
-
Tails `<adapter-dir>/metrics.jsonl` (written by `train` and the web
|
|
332
|
-
fine-tune tile) and renders live loss / speed / memory.
|
|
333
|
-
|
|
334
|
-
```sh
|
|
335
|
-
mlx-bun train-watch ~/.cache/mlx-bun/mlx-bun-finetunes/orpo-e4b
|
|
336
|
-
mlx-bun train-watch --adapter ~/adapters/cpm5-orpo
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### `fuse` — merge an adapter into the base
|
|
340
|
-
|
|
341
|
-
Folds LoRA deltas into the base weights and writes a standalone snapshot
|
|
342
|
-
(weights + config + tokenizer); a quantized base keeps its per-module
|
|
343
|
-
quantization layout. Flag names follow `mlx_lm.fuse`.
|
|
344
|
-
|
|
345
|
-
```sh
|
|
346
|
-
mlx-bun fuse e4b --adapter ./adapters --save-path ./fused_model
|
|
347
|
-
mlx-bun fuse --model ./base-snapshot --adapter-path ./adapters
|
|
348
|
-
mlx-bun serve ./fused_model
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
| Flag | Meaning |
|
|
352
|
-
|---|---|
|
|
353
|
-
| `<model>` / `--model` | base model (query or snapshot path) |
|
|
354
|
-
| `--adapter <dir>` (`--adapter-path` alias) | adapter directory (`adapters.safetensors` + `adapter_config.json`); default `adapters` |
|
|
355
|
-
| `--save-path <dir>` | output directory; default `fused_model` |
|
|
356
|
-
|
|
357
|
-
Refused with an error (mlx_lm.fuse flags not implemented): `--de-quantize`,
|
|
358
|
-
`--dequantize`, `--export-gguf`, `--gguf-path`, `--upload-repo`.
|
|
359
|
-
|
|
360
|
-
### `convert` — quantize a model
|
|
361
|
-
|
|
362
|
-
Quantize an HF model (local path, downloaded model, or repo id — an
|
|
363
|
-
un-downloaded repo is fetched first) into a local MLX snapshot: uniform
|
|
364
|
-
affine 4/8-bit, or mixed precision via `--target-bpw` (sensitivity sweep +
|
|
365
|
-
per-layer bit knapsack). Same engine as the web `/api/quantize`.
|
|
366
|
-
|
|
367
|
-
```sh
|
|
368
|
-
mlx-bun convert Qwen/Qwen3-4B -q # uniform 4-bit → ./mlx_model
|
|
369
|
-
mlx-bun convert --hf-path Qwen/Qwen3-4B -q --q-bits 8 --mlx-path ./qwen3-8bit
|
|
370
|
-
mlx-bun convert Qwen/Qwen3-4B --target-bpw 4.5 # mixed precision (implies -q)
|
|
371
|
-
mlx-bun convert ./qwen3.5-bf16 -q --rotate-weights # fold the TurboQuant rotation, then quantize
|
|
372
|
-
mlx-bun convert Qwen/Qwen3-4B -q --upload-repo you/qwen3-4b-4bit
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
| Flag | Meaning |
|
|
376
|
-
|---|---|
|
|
377
|
-
| `--hf-path <src>` (`--model` or the bare positional) | source model |
|
|
378
|
-
| `--mlx-path <dir>` | output directory; must not already exist (mlx_lm.convert behavior) |
|
|
379
|
-
| `-q`, `--quantize`, `--q-bits 4\|8`, `--q-group-size 32\|64` | uniform affine quantization |
|
|
380
|
-
| `--target-bpw <f>`, `--candidate-bits <list>`, `--calibration-mix optiq\|<jsonl>`, `--n-calibration <n>` | mixed precision (writes per-module bits into `config.json`) |
|
|
381
|
-
| `--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` |
|
|
382
|
-
| `--upload-repo <id>` | push the result afterwards (token checked before any work starts) |
|
|
383
|
-
|
|
384
|
-
Refused with an error: `--dtype`, `-d`/`--dequantize`, `--quant-predicate`,
|
|
385
|
-
`--q-mode` other than `affine`, and plain non-quantizing conversion (pass `-q`
|
|
386
|
-
or `--target-bpw`).
|
|
387
|
-
|
|
388
|
-
### `upload` — push to the Hugging Face Hub
|
|
389
|
-
|
|
390
|
-
Native push-to-hub, no Python: creates the repo if needed, uploads via the
|
|
391
|
-
git-LFS batch protocol, commits. Flag names match `mlx_lm.upload`.
|
|
392
|
-
|
|
393
|
-
```sh
|
|
394
|
-
mlx-bun upload --path ./fused_model --upload-repo you/my-model
|
|
395
|
-
mlx-bun upload --path ./mlx_model --upload-repo you/my-model --private
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
Needs a WRITE token from `~/.mlx-bun/hf.json` (web UI Settings), `$HF_TOKEN`,
|
|
399
|
-
or `~/.cache/huggingface/token` (`hf auth login`); errors before uploading
|
|
400
|
-
anything when none is found. `--private` is an mlx-bun extension.
|
|
401
|
-
|
|
402
|
-
### `perplexity` — evaluate on your data
|
|
403
|
-
|
|
404
|
-
`mlx_lm.perplexity` methodology exactly (seeded sample order, concatenate,
|
|
405
|
-
non-overlapping rows, f32 CE at every position, delta-method standard
|
|
406
|
-
error) over a **local** `.jsonl` (`{"text": …}` rows) or `.txt` file — never
|
|
407
|
-
an HF dataset download.
|
|
408
|
-
|
|
409
|
-
```sh
|
|
410
|
-
mlx-bun perplexity e4b --data-path ./corpus.jsonl
|
|
411
|
-
mlx-bun perplexity ./fused_model --data-path ./corpus.txt --sequence-length 1024 --num-samples -1 --batch-size 4 --seed 7
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
Flags: `<model>` (`--model` / `--query` accepted), `--data-path <file>`
|
|
415
|
-
(required), `--sequence-length <n>`, `--num-samples <n>` (`-1` = all),
|
|
416
|
-
`--batch-size <n>`, `--seed <n>`.
|
|
417
|
-
|
|
418
|
-
## Memory
|
|
419
|
-
|
|
420
|
-
### `memory` (alias `setup`) — the personal wiki
|
|
421
|
-
|
|
422
|
-
A local, git-tracked Markdown wiki at `~/.mlx-bun/wiki` that loads into
|
|
423
|
-
every `mlx-bun pi` / `mlx-bun serve` session. Full guide:
|
|
424
|
-
[memory.md](memory.md). `mlx-bun memory` with no subcommand runs `status`.
|
|
425
|
-
|
|
426
|
-
```sh
|
|
427
|
-
mlx-bun memory init # create the wiki (idempotent); offers import + nightly job
|
|
428
|
-
mlx-bun memory status # path, article count, git + schedule state
|
|
429
|
-
mlx-bun memory open # open the vault in Obsidian (falls back to Finder)
|
|
430
|
-
mlx-bun memory open Archie_Project # open one article
|
|
431
|
-
mlx-bun memory list # article titles + read-only Reference docs
|
|
432
|
-
mlx-bun memory search kv cache # search from the terminal
|
|
433
|
-
mlx-bun memory read Archie_Project # print an article (stem)
|
|
434
|
-
mlx-bun memory toc Archie_Project # headings + anchors
|
|
435
|
-
mlx-bun memory section Archie_Project decisions # one section by anchor
|
|
436
|
-
mlx-bun memory links Archie_Project # outbound + inbound wikilinks
|
|
437
|
-
mlx-bun memory synthesize # conversations → articles, the full local DAG
|
|
438
|
-
mlx-bun memory synthesize --dry-run # plan only, never writes the vault
|
|
439
|
-
mlx-bun memory segment --limit 20 # one stage worker (also: extract, route, synthesize-stage)
|
|
440
|
-
mlx-bun memory extract --convs a1b2,c3d4 # restrict a stage to specific conversations
|
|
441
|
-
mlx-bun memory link --limit 50 # deterministic cross-linking pass (no model)
|
|
442
|
-
mlx-bun memory schedule --at 03:00 # install the nightly launchd job
|
|
443
|
-
mlx-bun memory unschedule # remove it
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
| Subcommand | Aliases | Meaning |
|
|
447
|
-
|---|---|---|
|
|
448
|
-
| `init` | `setup` | create the wiki; offers to import an existing vault and install the nightly job (TTY prompts; non-interactive shells take the defaults) |
|
|
449
|
-
| `status` | | path, counts, git + schedule state |
|
|
450
|
-
| `open [article]` | `browse` | open the vault or one article |
|
|
451
|
-
| `list` | | article titles + `Reference/` docs |
|
|
452
|
-
| `search <query>` | | ranked article hits with sample lines |
|
|
453
|
-
| `read <article>` | | print an article |
|
|
454
|
-
| `toc <article>` | | headings + anchors |
|
|
455
|
-
| `section <article> <anchor>` | | print one section |
|
|
456
|
-
| `links <article>` | | resolved outbound + inbound wikilinks |
|
|
457
|
-
| `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) |
|
|
458
|
-
| `segment` · `extract` · `route` · `synthesize-stage` | `stage-synthesize` | run one decomposed, resumable stage worker (`--limit <n>` except `route`; `--convs a,b`) |
|
|
459
|
-
| `link` | | inline-link first mentions + rebuild `## See also` (`--limit <n>`; no model) |
|
|
460
|
-
| `schedule` | | install the nightly launchd job (`--at HH:MM`) |
|
|
461
|
-
| `unschedule` | | remove it |
|
|
462
|
-
|
|
463
|
-
An unknown subcommand prints the help and exits non-zero, so launchd jobs
|
|
464
|
-
and scripts can detect typos.
|
|
465
|
-
|
|
466
|
-
## Measurement
|
|
467
|
-
|
|
468
|
-
### `benchmark` (alias `bench`) — measure our stack
|
|
469
|
-
|
|
470
|
-
Runs mlx-bun by itself (greedy decode, in-process) and records the median
|
|
471
|
-
to the eval DB.
|
|
472
|
-
|
|
473
|
-
```sh
|
|
474
|
-
mlx-bun bench e4b --tokens 256 --runs 3
|
|
475
|
-
mlx-bun bench --model ./fused_model --prompt-tokens 4096 --kv-quant turbo:k8v3
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
| Flag | Meaning |
|
|
479
|
-
|---|---|
|
|
480
|
-
| `[query]` / `--query` / `--model <path\|query>` | model (auto-picks when omitted) |
|
|
481
|
-
| `--tokens <n>` | tokens decoded per run |
|
|
482
|
-
| `--runs <n>` | runs (median reported) |
|
|
483
|
-
| `--prompt-tokens <n>` | pad the prompt to about n tokens (long-context decode) |
|
|
484
|
-
| `--kv-quant config\|off\|4\|8\|turbo[:k<bits>v<bits>]` | KV scheme for the run |
|
|
485
|
-
| `--compiled-decode`, `--compiled-activations`, `--fused-sdpa` | kill switches; A/B by running twice |
|
|
486
|
-
|
|
487
|
-
For **quotable, cross-stack** numbers use the preflight-gated harness from
|
|
488
|
-
the repo — it spawns the real CLI at its real defaults next to the mlx-lm
|
|
489
|
-
and optiq reference servers and writes a dated report:
|
|
490
|
-
|
|
491
|
-
```sh
|
|
492
|
-
bun scripts/bench-serve.ts all
|
|
493
|
-
bun scripts/bench-serve.ts all --models cpm5,e4b --arms mlx-bun,mlx-lm --out report.md
|
|
494
|
-
bun scripts/bench-serve.ts all --models qwen27b --arms mlx-bun-serial,mlx-bun --logprobs --top-logprobs 3
|
|
495
|
-
# Same KV settings on both executors
|
|
496
|
-
bun scripts/bench-serve.ts all --models qwen27b --arms mlx-bun-serial,mlx-bun --kv-quant 4
|
|
497
|
-
# Same adapter settings on both execution arms:
|
|
498
|
-
bun scripts/bench-serve.ts all --models e4b --arms mlx-bun-serial,mlx-bun --adapter fixtures/adapters/upper
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
Curated results: [benchmarks.md](benchmarks.md).
|
|
502
|
-
|
|
503
|
-
### `evals` — recorded runs
|
|
504
|
-
|
|
505
|
-
```sh
|
|
506
|
-
mlx-bun evals # table: when, stack, model, bench, KV, prefill, decode, TTFT, peak, commit
|
|
507
|
-
mlx-bun evals --limit 50
|
|
508
|
-
mlx-bun evals --raw # JSON lines for scripts/jq
|
|
509
|
-
mlx-bun evals --clear # archive the DB to a timestamped backup and start fresh
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
## mlx-lm compatibility
|
|
513
|
-
|
|
514
|
-
mlx-bun borrows mlx-lm's verb and flag vocabulary so scripts drop in with a
|
|
515
|
-
rename of the executable: `mlx_lm.<verb> …` becomes `mlx-bun <verb> …`.
|
|
516
|
-
There is no `mlx-bun.<verb>` dotted alias (the package installs one binary,
|
|
517
|
-
`mlx-bun`). Surface parity is not architecture parity: a verb run against an
|
|
518
|
-
unsupported architecture errors clearly rather than guessing.
|
|
519
|
-
|
|
520
|
-
### What maps to what
|
|
521
|
-
|
|
522
|
-
| mlx-lm | mlx-bun | Accepted mlx-lm spellings | Not accepted |
|
|
523
|
-
|---|---|---|---|
|
|
524
|
-
| `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 |
|
|
525
|
-
| `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 |
|
|
526
|
-
| `mlx_lm.chat` | `pi` / the web chat | — | no terminal REPL verb; `pi` is the agent, `serve` opens the chat UI |
|
|
527
|
-
| `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** |
|
|
528
|
-
| `mlx_lm.fuse` | `fuse` | `--model`, `--adapter-path`, `--save-path` | `--de-quantize`, `--export-gguf`, `--gguf-path`, `--upload-repo` — **refused** |
|
|
529
|
-
| `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 |
|
|
530
|
-
| `mlx_lm.upload` | `upload` | `--path`, `--upload-repo` (+ `--private`) | — |
|
|
531
|
-
| `mlx_lm.perplexity` | `perplexity` | `--model`, `--sequence-length`, `--num-samples`, `--batch-size`, `--seed`; `--data-path` is a local file | HF dataset ids |
|
|
532
|
-
| `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) |
|
|
533
|
-
| `mlx_lm.manage` | `get` / `scan` / `ls` / `gc` | — | `--scan`/`--delete`/`--pattern` flag forms; `gc` deletes superseded snapshots, not whole repos |
|
|
534
|
-
| `mlx_lm.dynamic_quant` | `convert --target-bpw` | — | the `dynamic_quant` verb name |
|
|
535
|
-
|
|
536
|
-
mlx-optiq's CLI (`optiq convert` / `serve` / `lora` / `benchmark` / `eval` /
|
|
537
|
-
`latency` / `kv-cache` / `lab`) maps onto the same verbs where the concept
|
|
538
|
-
exists: `optiq convert` → `convert --target-bpw`; `optiq serve --kv-config`
|
|
539
|
-
→ `serve --kv-quant config` (the `--l2` preset); `optiq latency` → `fit`;
|
|
540
|
-
`optiq lab` → the web app served by `serve`. `optiq eval` and `optiq
|
|
541
|
-
kv-cache` have no verb (below).
|
|
542
|
-
|
|
543
|
-
### mlx-lm entry points: covered / not covered
|
|
544
|
-
|
|
545
|
-
Against the console scripts the pinned oracle ships
|
|
546
|
-
(`mlx_lm-*.dist-info/entry_points.txt` in the oracle venv). The scoping
|
|
547
|
-
behind each "not covered" row is in
|
|
548
|
-
[docs/reference/cli.md](./cli.md).
|
|
549
|
-
|
|
550
|
-
| Entry point | Status | Where |
|
|
551
|
-
|---|---|---|
|
|
552
|
-
| `mlx_lm.server` | covered | `serve` (incl. `--draft-model` speculative decoding) |
|
|
553
|
-
| `mlx_lm.generate` | covered | `generate` |
|
|
554
|
-
| `mlx_lm.chat` | covered differently | `pi` (agent TUI) + web chat; no plain REPL |
|
|
555
|
-
| `mlx_lm.convert` | covered | `convert` (quantizing paths only) |
|
|
556
|
-
| `mlx_lm.dynamic_quant` | covered | `convert --target-bpw` (sensitivity scan + per-layer bits) |
|
|
557
|
-
| `mlx_lm.lora` | covered (train) | `train`; the `--test` evaluation mode is not covered |
|
|
558
|
-
| `mlx_lm.fuse` | covered | `fuse` (no dequantize / GGUF / upload) |
|
|
559
|
-
| `mlx_lm.upload` | covered | `upload` |
|
|
560
|
-
| `mlx_lm.perplexity` | covered | `perplexity` (local files only) |
|
|
561
|
-
| `mlx_lm.benchmark` | covered | `benchmark` (own flag names; `evals` views the DB) |
|
|
562
|
-
| `mlx_lm.manage` | covered | `get` / `scan` / `ls` / `gc` |
|
|
563
|
-
| `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 |
|
|
564
|
-
| `mlx_lm.evaluate` | not covered | no lm-evaluation-harness backend; `benchmark`/`evals`/`perplexity` are the native measurement, and the `/v1` API accepts external harnesses |
|
|
565
|
-
| `mlx_lm.awq` | not covered | activation-aware weight quantization |
|
|
566
|
-
| `mlx_lm.dwq` | not covered | distilled weight quantization |
|
|
567
|
-
| `mlx_lm.gptq` | not covered | Hessian-conditioned rounding |
|
|
568
|
-
| `mlx_lm.share` | not covered | distributed cache share |
|
|
569
|
-
| `mlx_lm` (umbrella `mlx_lm <verb>`) | covered | `mlx-bun <verb>` is the same shape |
|
|
570
|
-
|
|
571
|
-
Native verbs with no mlx-lm counterpart — `pi`, `harness pi`, `embed`,
|
|
572
|
-
`fit`, `train-watch`, `memory`, `evals` — are the surface that makes mlx-bun
|
|
573
|
-
more than a drop-in.
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
`--kv-quant turbo` composes with grouped lookup, standalone, Gemma assistant,
|
|
577
|
-
DeepSpec and DSpark drafting on supported targets. Sliding layers stay bf16.
|
|
578
|
-
See [batching design](../design/batching.md) for composition evidence and limits.
|
|
579
|
-
|
|
580
|
-
Paged KV retains the configured `--batch` size. Gemma4 bf16 requests use the shared executor and bypass the prompt cache; quantized KV and draft combinations remain unavailable. See [server configuration](server-config.md).
|
|
581
|
-
|
|
582
|
-
`--generation-checkpoint N` requires `--ssd-cache` and queues owned snapshots
|
|
583
|
-
for eligible ordinary requests. Shared continuation supports eligible Qwen, Llama, MiniCPM and Gemma4 requests with or without adapters, excluding media, grammar, fill, paging, logprobs or speculation.
|
|
584
|
-
Repeat the identical request to replay and resume; flush before shutdown for
|
|
585
|
-
eventual queued snapshots to become durable.
|