mlx-bun 0.0.13 → 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.
- package/README.md +71 -578
- package/bin/mlx-bun.mjs +1 -1
- package/docs/README.md +91 -0
- package/docs/{design → archive}/hlg-sampling.md +3 -3
- package/docs/{design → archive/investigations}/audio-input-plan.md +4 -4
- package/docs/{design → archive/investigations}/colibri-glm52-port.md +1 -1
- package/docs/{design → archive/investigations}/diffusion-gemma-port.md +3 -3
- package/docs/{design → archive/investigations}/faithful-l1-consolidation.md +4 -4
- package/docs/{investigations → archive/investigations}/hlg-sampling-investigation.md +1 -1
- package/docs/{design → archive/investigations}/minicpm5-decode-megakernel.md +11 -11
- package/docs/{design → archive/investigations}/optimization_plan.md +1 -1
- package/docs/archive/investigations/pareto-specialized-runtime-findings.md +92 -0
- package/docs/{design → archive/investigations}/pre-colibri-stabilization.md +5 -5
- package/docs/{design → archive/investigations}/the-dreaming-handoff.md +2 -2
- package/docs/{planning → archive/planning}/chat-ui-vision.md +1 -1
- package/docs/{planning → archive/planning}/chunk-task-roadmap.md +1 -1
- package/docs/{planning → archive/planning}/curve-sampler-research-plan.md +4 -4
- package/docs/{planning → archive/planning}/memory-docs-and-dag-plan.md +1 -1
- package/docs/{planning → archive/planning}/release-notes-v0.0.9.md +1 -1
- package/docs/archive/planning/release-notes-v0.2.0.md +49 -0
- package/docs/{planning → archive/planning}/website-readme-pass-plan.md +1 -1
- package/docs/design/batching.md +569 -0
- package/docs/design/decode-speed-program.md +3178 -169
- package/docs/design/dreaming-nightly-pipeline.md +675 -282
- package/docs/design/generic-model-support.md +579 -334
- package/docs/design/kv-cache.md +680 -0
- package/docs/design/orpo-training.md +673 -1239
- package/docs/design/speculative-decoding.md +1627 -0
- package/docs/design/turboquant.md +2102 -0
- package/docs/design/unified-engine-frontier-plan.md +1831 -727
- package/docs/design/web-chat-redesign.md +666 -1083
- package/docs/planning/PRODUCT_ROADMAP.md +34 -1
- package/docs/planning/release-notes-v0.3.0.md +35 -0
- package/docs/planning/video-series.md +421 -0
- package/docs/reference/benchmarks.md +1162 -0
- package/docs/reference/cli.md +395 -149
- package/docs/reference/distribution.md +321 -181
- package/docs/reference/environment.md +348 -0
- package/docs/reference/glossary.md +39 -0
- package/docs/reference/library-api.md +580 -142
- package/docs/reference/memory.md +227 -64
- package/docs/reference/models.md +137 -6
- package/docs/reference/server-api.md +938 -422
- package/docs/reference/server-config.md +652 -320
- package/docs/reference/training.md +393 -254
- package/docs/reference/troubleshooting.md +166 -0
- package/package.json +10 -5
- package/src/admission-plan.ts +18 -0
- package/src/anthropic.ts +92 -3
- package/src/audio/decode.ts +2 -2
- package/src/audio/features.ts +2 -2
- package/src/backends/mlx/autoregressive.ts +108 -0
- package/src/backends/mlx/batch-group.ts +1646 -0
- package/src/backends/mlx/diffusion.ts +39 -0
- package/src/backends/mlx/draft-target.ts +47 -0
- package/src/backends/mlx/evaluation.ts +105 -0
- package/src/backends/mlx/fill-append.ts +45 -0
- package/src/backends/mlx/gateway-binding.ts +71 -0
- package/src/backends/mlx/graph.ts +38 -0
- package/src/backends/mlx/memory-client.ts +189 -0
- package/src/backends/mlx/memory-guard.ts +40 -0
- package/src/backends/mlx/methods.ts +90 -0
- package/src/backends/mlx/model-prompt.ts +164 -0
- package/src/backends/mlx/model-serving.ts +79 -0
- package/src/backends/mlx/prefill.ts +33 -0
- package/src/backends/mlx/request-policy.ts +20 -0
- package/src/backends/mlx/rollback.ts +51 -0
- package/src/backends/mlx/serial-executor.ts +273 -0
- package/src/backends/mlx/speculative.ts +114 -0
- package/src/backends/mlx/state-views.ts +26 -0
- package/src/backends/mlx/text-engine.ts +73 -0
- package/src/cli.ts +189 -61
- package/src/client.ts +66 -0
- package/src/config.ts +21 -4
- package/src/contracts/completion.ts +16 -0
- package/src/contracts/execution.ts +49 -0
- package/src/contracts/generation.ts +103 -0
- package/src/contracts/host.ts +7 -0
- package/src/contracts/jobs.ts +66 -0
- package/src/contracts/pi-provider.ts +30 -0
- package/src/contracts/pi.ts +259 -0
- package/src/contracts/resources.ts +18 -0
- package/src/contracts/scheduling.ts +27 -0
- package/src/contracts/tsconfig.json +14 -0
- package/src/diffusion/diffusion-generate.ts +218 -153
- package/src/embed.ts +1 -1
- package/src/engine/admission.ts +59 -0
- package/src/engine/cancellation.ts +38 -0
- package/src/engine/engine.ts +56 -0
- package/src/engine/execution-coordinator.ts +70 -0
- package/src/engine/execution-plan.ts +51 -0
- package/src/engine/resources.ts +42 -0
- package/src/engine/scheduler.ts +67 -0
- package/src/engine/session.ts +247 -0
- package/src/eval/README.md +44 -1
- package/src/eval/kl.ts +263 -23
- package/src/eval/reference-logits.ts +207 -0
- package/src/eval/runner.ts +10 -79
- package/src/eval/tasks/bfcl.ts +2 -1
- package/src/eval/tasks/gsm8k.ts +2 -1
- package/src/eval/tasks/hashhop.ts +2 -1
- package/src/eval/tasks/humaneval.ts +5 -4
- package/src/eval/tasks/ifeval.ts +2 -1
- package/src/eval/tasks/mmlu.ts +2 -1
- package/src/expert-io.ts +3 -1
- package/src/expert-offload.ts +3 -1
- package/src/fill/echo-index.ts +188 -0
- package/src/fill/fill-session.ts +452 -0
- package/src/fill/proposal.ts +68 -0
- package/src/fill/schema-rows.ts +506 -0
- package/src/fill/tool-boundary.ts +103 -0
- package/src/fit.ts +24 -43
- package/src/generate.ts +740 -337
- package/src/grammar.ts +14 -8
- package/src/harness-pi.ts +15 -34
- package/src/hub-rest.ts +4 -4
- package/src/index.ts +27 -0
- package/src/inference/denoising.ts +17 -0
- package/src/inference/graph.ts +33 -0
- package/src/inference/prefill.ts +39 -0
- package/src/inference/rollback.ts +7 -0
- package/src/jobs/db.ts +4 -0
- package/src/jobs/index.ts +2 -0
- package/src/jobs/job-entry.ts +15 -14
- package/src/jobs/runner.ts +98 -13
- package/src/jobs/task-client.ts +19 -0
- package/src/jobs/types.ts +2 -58
- package/src/kv-scheme.ts +199 -0
- package/src/kv-store.ts +459 -234
- package/src/lab/README.md +18 -0
- package/src/{assets → lab/curve}/curve-designer.html +2 -2
- package/src/{curve-sampler.ts → lab/curve/curve-sampler.ts} +2 -2
- package/src/{expert-trace.ts → lab/expert-trace/expert-trace.ts} +7 -5
- package/src/{model → lab/paged-kv}/paged-kv.ts +9 -6
- package/src/library.ts +40 -0
- package/src/lora.ts +18 -0
- package/src/media-fetch.ts +20 -4
- package/src/memory/article.ts +1 -1
- package/src/memory/chunk.ts +1 -1
- package/src/memory/model.ts +32 -170
- package/src/memory/prompts.ts +1 -1
- package/src/memory/rest.ts +1 -1
- package/src/memory/schedule.ts +1 -1
- package/src/memory/stages.ts +4 -1
- package/src/memory/vault.ts +3 -4
- package/src/mlx/array.ts +9 -10
- package/src/mlx/compile.ts +12 -2
- package/src/mlx/ffi.ts +66 -22
- package/src/mlx/materialize.ts +23 -0
- package/src/mlx/metal-kernel.ts +10 -11
- package/src/mlx/ops.ts +64 -19
- package/src/mlx/quantized-rows.ts +36 -0
- package/src/mlx/token-bitmask.ts +52 -0
- package/src/mlx/turboquant-kv-decode.ts +82 -0
- package/src/mlx/turboquant-kv-inverse.ts +122 -0
- package/src/mlx/turboquant-ops.ts +33 -3
- package/src/mlx/turboquant-tables.ts +2 -2
- package/src/model/batched-mask.ts +9 -3
- package/src/model/batched-quant.ts +2 -2
- package/src/model/batched-rotating-quant.ts +45 -99
- package/src/model/batched-rotating-state.ts +73 -0
- package/src/model/batched-rotating.ts +57 -106
- package/src/model/batched-row-storage.ts +127 -0
- package/src/model/compiled-decode.ts +4 -3
- package/src/model/diffusion-gemma.ts +8 -8
- package/src/model/factory.ts +87 -49
- package/src/model/fingerprint.ts +1 -1
- package/src/model/flash-attention.ts +3 -3
- package/src/model/gemma4-base.ts +187 -17
- package/src/model/gemma4.ts +6 -6
- package/src/model/generated/gemma4-12b.ts +52 -148
- package/src/model/generated/gemma4-26b.ts +34 -94
- package/src/model/generated/gemma4-e4b.ts +28 -76
- package/src/model/glm52-cache.ts +19 -9
- package/src/model/glm52-dsa.ts +13 -9
- package/src/model/glm52-memory.ts +28 -1
- package/src/model/implementation.ts +69 -0
- package/src/model/minicpm5.ts +7 -8
- package/src/model/profile.ts +443 -0
- package/src/model/qwen-append.ts +12 -0
- package/src/model/qwen-conv.ts +52 -0
- package/src/model/qwen3-delta.ts +98 -2
- package/src/model/qwen3-mrope.ts +252 -0
- package/src/model/qwen3_5-checkpoint.ts +164 -0
- package/src/model/qwen3_5.ts +336 -60
- package/src/model/support.ts +1 -1
- package/src/model/trellis-balanced-scatter.ts +51 -0
- package/src/model/trellis-linear.ts +672 -0
- package/src/model/trellis-shared-m.ts +151 -0
- package/src/model/trellis-shared-scatter.ts +144 -0
- package/src/model/trellis-splitk-prefill.ts +158 -0
- package/src/model/trellis-tiled-prefill.ts +136 -0
- package/src/model/trellis-vector-expand.ts +62 -0
- package/src/model/trellis-wide-prefill.ts +94 -0
- package/src/model/universal/dense.ts +1 -1
- package/src/model/universal/modules.ts +8 -1
- package/src/native/frame_extract.swift +140 -0
- package/src/native-pack.ts +15 -7
- package/src/pi-provider.ts +6 -64
- package/src/pi-web.ts +14 -320
- package/src/prompt-cache.ts +97 -54
- package/src/quantize/allocator.ts +1 -1
- package/src/quantize/atomic-output.ts +38 -0
- package/src/quantize/calibration.ts +2 -1
- package/src/quantize/config-writer.ts +16 -3
- package/src/quantize/index.ts +28 -1
- package/src/quantize/job.ts +11 -0
- package/src/quantize/quantizer.ts +265 -100
- package/src/quantize/rotate.ts +603 -0
- package/src/quantize/safetensors-writer.ts +79 -1
- package/src/quantize/sensitivity.ts +41 -59
- package/src/quantize/trellis.ts +586 -0
- package/src/quantize/weight-transform.ts +292 -0
- package/src/responses.ts +130 -3
- package/src/runtime-config.ts +81 -0
- package/src/sampler.ts +276 -4
- package/src/serve/admin-routes.ts +184 -0
- package/src/serve/aux-routes.ts +132 -0
- package/src/serve/batch-scheduler.ts +8 -1558
- package/src/serve/chat-request.ts +391 -0
- package/src/serve/chat-stage.ts +195 -0
- package/src/serve/checkpoint-identity.ts +64 -0
- package/src/serve/completion-executor.ts +354 -0
- package/src/serve/completion-sink.ts +157 -0
- package/src/serve/discovery-routes.ts +204 -0
- package/src/serve/generation-gateway.ts +211 -243
- package/src/serve/http.ts +159 -0
- package/src/serve/inference-request.ts +79 -0
- package/src/serve/isolate.ts +297 -105
- package/src/serve/kv-budget.ts +14 -0
- package/src/serve/lab-routes.ts +341 -0
- package/src/serve/lane-registry.ts +2 -1
- package/src/serve/model-admin-routes.ts +155 -0
- package/src/serve/model-binding.ts +43 -0
- package/src/serve/model-host.ts +512 -0
- package/src/serve/openai-wire.ts +103 -0
- package/src/serve/parent-application.ts +56 -0
- package/src/serve/pipeline.ts +33 -0
- package/src/serve/preparation.ts +33 -0
- package/src/serve/prompt-response-trace.ts +147 -0
- package/src/serve/request-plan.ts +162 -0
- package/src/serve/request-prep.ts +346 -0
- package/src/serve/response-lease.ts +24 -0
- package/src/serve/responses-client.ts +69 -0
- package/src/serve/session-completion-engine.ts +110 -0
- package/src/serve/session-search.ts +1 -1
- package/src/serve/static-routes.ts +101 -0
- package/src/serve/text-completion-stage.ts +104 -0
- package/src/serve/token-streams.ts +519 -0
- package/src/server.ts +523 -3551
- package/src/spec/assistant-source.ts +10 -44
- package/src/spec/deepspec-source.ts +6 -6
- package/src/spec/dflash-source.ts +9 -8
- package/src/spec/dspark/ab-stats.ts +3 -3
- package/src/spec/dspark/calibration.ts +2 -2
- package/src/spec/dspark/deepspec-module.ts +2 -2
- package/src/spec/dspark/generate-dflash.ts +2 -2
- package/src/spec/dspark/generate.ts +2 -2
- package/src/spec/dspark/loader.ts +1 -1
- package/src/spec/dspark/module-dflash.ts +5 -4
- package/src/spec/dspark/module.ts +3 -3
- package/src/spec/dspark/quantize-drafter.ts +1 -1
- package/src/spec/generate.ts +1 -1
- package/src/spec/glm52-mtp-source.ts +9 -1
- package/src/spec/ngram-source.ts +1 -1
- package/src/spec/prefix-state.ts +45 -0
- package/src/spec/qwen-mtp-source.ts +528 -0
- package/src/spec/serve-loop.ts +179 -213
- package/src/spec/source.ts +42 -10
- package/src/spec/two-model.ts +1 -1
- package/src/ssd-cache.ts +95 -24
- package/src/ssd-durability.ts +207 -0
- package/src/tool-call.ts +51 -14
- package/src/train/flash-cce.ts +14 -13
- package/src/train/forward.ts +38 -1
- package/src/train/loss.ts +3 -2
- package/src/train/prefix-shared.ts +5 -1
- package/src/train/segmented.ts +9 -6
- package/src/train/trainer.ts +9 -8
- package/src/vision/preprocess.ts +1 -1
- package/src/vision/prompt.ts +48 -2
- package/src/vision/qwen3vl-preprocess.ts +409 -0
- package/src/vision/qwen3vl-prompt.ts +196 -0
- package/src/vision/qwen3vl-tower.ts +555 -0
- package/src/vision/video-frames.ts +148 -0
- package/src/web/app.html +1 -1
- package/src/web/app.js +15 -6
- package/src/web/src/adapters-panel.ts +3 -3
- package/src/web/src/assistant.ts +2 -36
- package/src/web/src/chat.ts +16 -9
- package/src/web/src/composer.ts +4 -4
- package/src/web/src/hub.ts +1 -1
- package/src/web/src/markdown.ts +0 -0
- package/src/web/src/memory-panel.ts +1 -1
- package/src/web/src/model-picker.ts +1 -1
- package/src/web/src/palette.ts +1 -1
- package/src/web/src/protocol.ts +3 -39
- package/src/web/src/sessions.ts +1 -1
- package/src/web/src/ui-catalog.ts +4 -18
- package/src/web-assets.ts +47 -0
- package/src/weights.ts +134 -33
- package/docs/archive/mlx-bun-lab-report.html +0 -275
- package/docs/archive/wwdc-mlx-bun.html +0 -848
- package/docs/design/adapters-end-to-end.md +0 -205
- package/docs/design/batching-perf-path.md +0 -255
- package/docs/design/batching-v2-plan.md +0 -529
- package/docs/design/bucketing-stage.md +0 -197
- package/docs/design/compat-cli-surface-design.md +0 -230
- package/docs/design/docs-reorg-plan.md +0 -165
- package/docs/design/dspark-serving-program.md +0 -371
- package/docs/design/dspark-speculative-decoding.md +0 -268
- package/docs/design/grammar-spec-batching-integration.md +0 -301
- package/docs/design/memory-inference-path.md +0 -422
- package/docs/design/memory-synthesis.md +0 -287
- package/docs/design/memory-system.md +0 -237
- package/docs/design/mlx-lm-tool-parity-plan.md +0 -545
- package/docs/design/omlx-adoption-map.md +0 -98
- package/docs/design/orpo-dynamic-lambda.md +0 -220
- package/docs/design/orpo-future-enhancements.md +0 -340
- package/docs/design/paged-kv-cache.md +0 -214
- package/docs/design/parallel-slots.md +0 -567
- package/docs/design/parity-tier-dag.md +0 -161
- package/docs/design/repo-cleanup-plan.md +0 -189
- package/docs/design/runtime-isolation.md +0 -263
- package/docs/design/segmented-backward-training.md +0 -543
- package/docs/design/spec-decode-larger-targets.md +0 -229
- package/docs/design/ssd-kv-cold-tier.md +0 -288
- package/docs/design/structured-output.md +0 -484
- package/docs/design/tauri-desktop-app.md +0 -127
- package/docs/design/the-dreaming-master-plan.md +0 -445
- package/docs/design/turboquant-kv.md +0 -235
- package/docs/design/w4a16-compute-precision-spike.md +0 -232
- package/docs/design/web-chat-beat-matrix.md +0 -315
- package/docs/design/write-pipeline-entity.md +0 -468
- package/docs/investigations/curve-runs/bisector-route.json +0 -98
- package/docs/investigations/curve-runs/bisector-trace.json +0 -1393
- package/docs/investigations/curve-runs/curve-terrain.json +0 -1179
- package/docs/investigations/curve-runs/curve-terrain.svg +0 -42
- package/docs/investigations/hlg-ab.html +0 -34
- package/docs/investigations/hlg-explorer.html +0 -238
- package/docs/investigations/hlg-figs/cliff.svg +0 -1
- package/docs/investigations/hlg-figs/cross.svg +0 -1
- package/docs/investigations/hlg-figs/edges.svg +0 -1
- package/docs/investigations/hlg-figs/k20-grids.svg +0 -1
- package/docs/investigations/hlg-figs/k20-peaks.svg +0 -1
- package/docs/investigations/hlg-figs/lw-curve.svg +0 -1
- package/docs/investigations/hlg-figs/terrain.svg +0 -1
- package/docs/investigations/hlg-report.html +0 -262
- package/docs/investigations/hlg-runs/hlg-ab.json +0 -149
- package/docs/investigations/hlg-runs/hlg-blind-prompts.md +0 -87
- package/docs/investigations/hlg-runs/hlg-blind.json +0 -107
- package/docs/investigations/hlg-runs/hlg-cliff.json +0 -197
- package/docs/investigations/hlg-runs/hlg-cross.json +0 -505
- package/docs/investigations/hlg-runs/hlg-edge.json +0 -388
- package/docs/investigations/hlg-runs/hlg-eval1.json +0 -25
- package/docs/investigations/hlg-runs/hlg-frontier.json +0 -86
- package/docs/investigations/hlg-runs/hlg-grid.json +0 -242
- package/docs/investigations/hlg-runs/hlg-grid2.json +0 -343
- package/docs/investigations/hlg-runs/hlg-lw-coarse.json +0 -110
- package/docs/investigations/hlg-runs/hlg-map.json +0 -383
- package/docs/investigations/hlg-runs/run0-original.log +0 -159
- package/docs/investigations/hlg-runs/runA-recommended.log +0 -131
- package/docs/investigations/hlg-runs/runAA-cliff-cpm5.log +0 -26
- package/docs/investigations/hlg-runs/runAB-grid2-e4b.log +0 -18
- package/docs/investigations/hlg-runs/runAC-peak-e4b-partial.log +0 -25
- package/docs/investigations/hlg-runs/runAD-ab-samples.log +0 -8
- package/docs/investigations/hlg-runs/runAE-edge-e4b.log +0 -51
- package/docs/investigations/hlg-runs/runAF-logit-calibration.log +0 -10
- package/docs/investigations/hlg-runs/runAG-eval-config2.log +0 -16
- package/docs/investigations/hlg-runs/runB-gain-variants.log +0 -192
- package/docs/investigations/hlg-runs/runC-pivots.log +0 -162
- package/docs/investigations/hlg-runs/runD-oetf.log +0 -132
- package/docs/investigations/hlg-runs/runE-eotf.log +0 -162
- package/docs/investigations/hlg-runs/runF-shaper-working.log +0 -86
- package/docs/investigations/hlg-runs/runG-shaper-sweep.log +0 -101
- package/docs/investigations/hlg-runs/runH-wsweep.log +0 -176
- package/docs/investigations/hlg-runs/runI-asweep.log +0 -176
- package/docs/investigations/hlg-runs/runJ-knobmap.log +0 -49
- package/docs/investigations/hlg-runs/runK-frontier.log +0 -19
- package/docs/investigations/hlg-runs/runL-widemap.log +0 -65
- package/docs/investigations/hlg-runs/runM-frontier-emb.log +0 -15
- package/docs/investigations/hlg-runs/runN-verify.log +0 -116
- package/docs/investigations/hlg-runs/runO-frontier-seed5000.log +0 -15
- package/docs/investigations/hlg-runs/runP-grid-AxSm.log +0 -15
- package/docs/investigations/hlg-runs/runQ-grid-tgW.log +0 -15
- package/docs/investigations/hlg-runs/runR-blind-transcript.log +0 -79
- package/docs/investigations/hlg-runs/runS-cross-coherence.log +0 -33
- package/docs/investigations/hlg-runs/runT-cross-cpm5.log +0 -33
- package/docs/investigations/hlg-runs/runU-cross-12b.log +0 -33
- package/docs/investigations/hlg-runs/runV-lw-e4b.log +0 -22
- package/docs/investigations/hlg-runs/runW-lw-12b.log +0 -22
- package/docs/investigations/hlg-runs/runX-lw-cpm5.log +0 -22
- package/docs/investigations/hlg-runs/runY-cliff-e4b.log +0 -26
- package/docs/investigations/hlg-runs/runZ-cliff-12b.log +0 -26
- package/docs/planning/IDEAS.md +0 -69
- package/docs/reference/embedding.md +0 -197
- package/docs/reference/features-matrix.md +0 -100
- package/docs/reference/orpo-quickstart.md +0 -135
- package/src/flags.ts +0 -13
- /package/docs/{investigations → archive/investigations}/chunk-finetune-experiment.md +0 -0
- /package/docs/{investigations → archive/investigations}/colibri-oracle-pin.md +0 -0
- /package/docs/{investigations → archive/investigations}/curve-bisector-routing.md +0 -0
- /package/docs/{investigations → archive/investigations}/decode-roofline-lookagain.md +0 -0
- /package/docs/{investigations → archive/investigations}/dspark-handoff.md +0 -0
- /package/docs/{investigations → archive/investigations}/expert-offload-single-user-moe.md +0 -0
- /package/docs/{investigations → archive/investigations}/indexshare-performance-spike.md +0 -0
- /package/docs/{investigations → archive/investigations}/kernel-perf-review-2026-07.md +0 -0
- /package/docs/{investigations → archive/investigations}/lab-build-journal.md +0 -0
- /package/docs/{investigations → archive/investigations}/openwiki-evaluation.md +0 -0
- /package/docs/{investigations → archive/investigations}/orpo-base-uf-experiment-and-directions.md +0 -0
- /package/docs/{investigations → archive/investigations}/orpo-flash-cce-pin-leak.md +0 -0
- /package/docs/{investigations → archive/investigations}/orpo-uf-testing-handoff.md +0 -0
- /package/docs/{investigations → archive/investigations}/pi-builtin-investigation.md +0 -0
- /package/docs/{investigations → archive/investigations}/segmented-backward-handoff.md +0 -0
- /package/docs/{investigations → archive/investigations}/starter-model-port-handoff.md +0 -0
- /package/docs/{investigations → archive/investigations}/steel-flash-cce-handoff.md +0 -0
- /package/docs/{investigations → archive/investigations}/trainer-validation-experiment.md +0 -0
- /package/docs/{planning → archive/planning}/chat-ui-vision-memory-first.md +0 -0
- /package/docs/{planning → archive/planning}/journal.md +0 -0
- /package/docs/{planning → archive/planning}/pi-integration-review.md +0 -0
- /package/docs/{planning → archive/planning}/release-notes-v0.0.10.md +0 -0
- /package/docs/{planning → archive/planning}/release-notes-v0.0.11.md +0 -0
- /package/docs/{planning → archive/planning}/release-notes-v0.0.12.md +0 -0
- /package/docs/{planning → archive/planning}/release-notes-v0.0.13.md +0 -0
- /package/docs/{planning → archive/planning}/web-ui-pass-plan.md +0 -0
- /package/{docs/investigations → src/serve/assets}/curve-terrain.html +0 -0
- /package/{docs/dag → src/serve/assets}/training-inference-map.html +0 -0
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
# Bucketing / Classify stage — local build plan
|
|
2
|
-
|
|
3
|
-
Status: **design**, 2026-06-26. Companion to [memory-synthesis.md](./memory-synthesis.md).
|
|
4
|
-
Grounded in a research+critique workflow over the real Lucien classify + the local
|
|
5
|
-
foundation; re-centered on the governing principle below.
|
|
6
|
-
|
|
7
|
-
## Governing principle — capacity by decomposition
|
|
8
|
-
|
|
9
|
-
**A small local model's effective capacity scales inversely with task size. You don't
|
|
10
|
-
make the model smarter; you make each task narrower.** Every stage is a *ladder of
|
|
11
|
-
atomic, single-purpose tasks*, each one a single clear question. The full pipeline:
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
"what buckets should we have?" ← taxonomy (cold-start)
|
|
15
|
-
"which buckets need this chunk?" ← classify / assignment
|
|
16
|
-
"which section needs this info?" ← section routing
|
|
17
|
-
"integrate THIS chunk into THIS section" ← synthesis patch (most atomic)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
…and each rung decomposes *further* into the smallest decisive question. We never ask
|
|
21
|
-
the local model to "assign a chunk among 12 buckets and emit JSON" — that is still too
|
|
22
|
-
big. We ask **"does this chunk belong in bucket B? yes/no,"** one bucket at a time.
|
|
23
|
-
|
|
24
|
-
**Retrieval (embeddings, lexical) exists only to NARROW the candidate set so the model
|
|
25
|
-
makes the fewest, smallest, clearest calls. It never decides — the model decides, one
|
|
26
|
-
tiny question at a time.** This is the production home for the embedding work: a
|
|
27
|
-
candidate-narrower, not a classifier.
|
|
28
|
-
|
|
29
|
-
**Why brute-force decomposition is affordable: the model is LOCAL, so inference is ~free.**
|
|
30
|
-
A cloud model forces you to minimize calls (which is exactly why Lucien made one big
|
|
31
|
-
"reason over everything" call). A local model flips the economics — you can run **M×N tiny
|
|
32
|
-
binary checks** ("does chunk *i* belong in bucket *j*?" / "should chunk *i* update section
|
|
33
|
-
*j*?") where a cloud model would have to make one expensive combined decision. We trade one
|
|
34
|
-
big unreliable call for many tiny reliable ones. Local-ness is what makes radical
|
|
35
|
-
decomposition viable; retrieval just keeps M×N from getting silly.
|
|
36
|
-
|
|
37
|
-
This is adapting + improving Lucien, not duplicating it. Lucien put all 379 buckets in
|
|
38
|
-
Opus's context and let it reason globally in one shot — a capability a 1B model does not
|
|
39
|
-
have. We replace "one global decision" with "many tiny local decisions."
|
|
40
|
-
|
|
41
|
-
## What we keep from Lucien
|
|
42
|
-
|
|
43
|
-
- Classify on chunk **labels** (~49-char topic strings), not text or vectors.
|
|
44
|
-
- The `Bucketing.md` policy governs behavior, inlined into the task prompt — editing it
|
|
45
|
-
re-tunes routing with no code change.
|
|
46
|
-
- **Many-to-many** (a chunk → 0..3 buckets; empty is legal = the substance filter).
|
|
47
|
-
- **Create buckets by judgment** when nothing fits and the topic is substantive.
|
|
48
|
-
- **Existing-buckets-win** (re-scoped to global below — fix E).
|
|
49
|
-
- Idempotent set-difference resumption (`NOT IN chunk_buckets`).
|
|
50
|
-
|
|
51
|
-
## The bucketing stage, decomposed
|
|
52
|
-
|
|
53
|
-
### "which buckets need this chunk?" — assignment
|
|
54
|
-
|
|
55
|
-
For one chunk (its label):
|
|
56
|
-
1. **Narrow (no model):** embedding shortlist — cosine(label, bucket centroid) → top-K
|
|
57
|
-
candidates; PLUS a **lexical floor** (any bucket whose name token-overlaps the label)
|
|
58
|
-
so an embedding miss can't drop an obvious match [fix C].
|
|
59
|
-
2. **Decide (atomic model task, one per candidate):** *"Does this chunk — `<label>` —
|
|
60
|
-
belong in bucket `<name>: <description>`? Answer yes or no."* Run over the (few)
|
|
61
|
-
shortlisted candidates. No multi-item JSON, no batch indices → the JSON-fidelity and
|
|
62
|
-
batching failure modes (critique D) simply don't exist. A chunk can get "yes" on
|
|
63
|
-
several candidates (many-to-many falls out naturally) or none.
|
|
64
|
-
3. **New bucket (atomic task, only if every candidate was "no" AND substantive):**
|
|
65
|
-
*"This topic fits no existing bucket. Propose one Wikipedia-style bucket name (2–6
|
|
66
|
-
words) + one-line description, or answer NONE if too thin."* Then the **global gate
|
|
67
|
-
[fix E — the #1 correctness fix]:** re-embed the proposed name against the FULL bucket
|
|
68
|
-
centroid cache; if the nearest existing bucket clears a similarity threshold, downgrade
|
|
69
|
-
to it. This restores Lucien's "none of 379 fit" discipline that a shortlist-only view
|
|
70
|
-
would break (→ taxonomy explosion).
|
|
71
|
-
|
|
72
|
-
Each model call is a tiny yes/no or a single short proposal — the clear single tasks a
|
|
73
|
-
1B model can do reliably. Cost is more calls, but each is fast and reliable; embeddings
|
|
74
|
-
keep K small so it's bounded.
|
|
75
|
-
|
|
76
|
-
### "what buckets should we have?" — cold-start taxonomy (from zero)
|
|
77
|
-
|
|
78
|
-
There are **7308 distinct labels of 7316** — dedup collapses nothing, and a 1B model
|
|
79
|
-
cannot globally compress thousands of labels into a coherent 30–60-bucket taxonomy
|
|
80
|
-
(that is exactly Opus's global-reasoning ability). Decompose:
|
|
81
|
-
1. **Group (geometry, no model):** embed all labels → k-means (k∈[30,60], pick by
|
|
82
|
-
silhouette). The geometry does the grouping the model can't do globally.
|
|
83
|
-
2. **Purity-gate each group (atomic task) [fix B]:** *"Do these labels form ONE topic or
|
|
84
|
-
more than one?"* k-means optimizes cohesion and is blind to fusion (the ρ≈0.32 purity
|
|
85
|
-
blind spot we measured) — split any group the model flags before it becomes a bucket.
|
|
86
|
-
3. **Name each group (atomic task):** *"Here are ~15 representative labels. Give ONE
|
|
87
|
-
Wikipedia-style bucket name (2–6 words) + a one-line description. Be specific, not
|
|
88
|
-
generic."*
|
|
89
|
-
4. **Seed centroids from members [fix H]:** each new bucket's centroid = mean of the
|
|
90
|
-
cluster labels that birthed it (those vectors already exist) — so the first assignment
|
|
91
|
-
pass runs on strong member-based centroids, not weak name-only ones.
|
|
92
|
-
|
|
93
|
-
### later rungs (designed here, built after classify)
|
|
94
|
-
|
|
95
|
-
- **"which section needs this info?"** — the **M×N binary** pattern: for an article's
|
|
96
|
-
assigned bucket of *M* chunks and its *N* TOC sections, ask *"should chunk i update
|
|
97
|
-
section j? yes/no"* — M×N times. The "yes" pairs become atomic patches. A chunk that gets
|
|
98
|
-
**all "no" and is substantive → an atomic CREATE-NEW-SECTION task** (mirrors new-bucket).
|
|
99
|
-
(Embeddings can prune N, but with a local model you can also just run all M×N.)
|
|
100
|
-
- **"integrate THIS chunk into THIS section"** — the atomic synthesis patch (memory-synthesis.md),
|
|
101
|
-
applied to each (chunk, section) "yes" pair.
|
|
102
|
-
|
|
103
|
-
### The entities (distinct — do not conflate)
|
|
104
|
-
|
|
105
|
-
- **chunk** — one topical segment of a conversation (pointer + label).
|
|
106
|
-
- **bucket** — a single-topic GROUP OF CHUNKS (the classify output; the "Cameras and
|
|
107
|
-
Camera Gear" container you drop camera chunks into). **A bucket is NOT an article.**
|
|
108
|
-
- **article** — a synthesized wiki page. A bucket RELATES TO **one or more** articles
|
|
109
|
-
(many-to-many): the reflecting-pool-renovation bucket relates to the *Lincoln Memorial
|
|
110
|
-
Reflecting Pool* article AND a *Trump* article.
|
|
111
|
-
- **section** — a part of an article (its TOC entries).
|
|
112
|
-
|
|
113
|
-
### Hierarchical pruning (coarse gates fine)
|
|
114
|
-
|
|
115
|
-
Decompose top-down and **prune the subtree at every "no."** The levels are distinct:
|
|
116
|
-
chunk → bucket → article(s) → section(s). The coarse gate is **"does this bucket relate to
|
|
117
|
-
this article? yes/no"** — if no, skip *every* section of that article (a bucket can't
|
|
118
|
-
relate to a section of an article it doesn't relate to). So the M×N section checks run
|
|
119
|
-
*only inside the few articles a bucket relates to*, never "× every section in the wiki."
|
|
120
|
-
Same idea recursively: each coarser binary check prunes the finer ones beneath it.
|
|
121
|
-
Retrieval narrows candidates *within* a level; pruning eliminates whole levels.
|
|
122
|
-
|
|
123
|
-
### The uniform growth rule (no-match → create)
|
|
124
|
-
|
|
125
|
-
At *every* rung, "no existing candidate matched" branches on substance, it does not just
|
|
126
|
-
drop: **substantive → CREATE, trivial → drop.** A chunk that fits no bucket → new bucket;
|
|
127
|
-
a bucket that relates to no existing article → new article; a chunk that fits no section of
|
|
128
|
-
a related article → new section. Only non-substantive trivia is filtered. So substantive
|
|
129
|
-
content always lands *somewhere* — this is how the taxonomy grows new buckets, the wiki
|
|
130
|
-
grows new articles, and articles grow new sections (the Wikipedia editor adds a page or a
|
|
131
|
-
section for a fact that fits nowhere). Each create is its own atomic task, gated against
|
|
132
|
-
the existing set (the new-bucket global gate, fix E).
|
|
133
|
-
|
|
134
|
-
## Data model (`src/memory/db.ts`)
|
|
135
|
-
|
|
136
|
-
Rewrite the copy-schema to the pointer design (memory-synthesis.md; no live data):
|
|
137
|
-
`messages` (text once, `(conv, position)`), `chunks` (pointers + `label`, no text),
|
|
138
|
-
`buckets` (writable), `chunk_buckets` (M:N — the classify output). `PRAGMA foreign_keys
|
|
139
|
-
= ON` + `ON DELETE CASCADE` (fixes Lucien's 368 orphan edges / 570 dangling pointers).
|
|
140
|
-
**Keep `synthesized_bucket_chunks` per-(bucket,chunk) [fix G]** — do not rename the
|
|
141
|
-
working ledger for the unbuilt section feature; `chunk_sections` may exist as a
|
|
142
|
-
future-proof empty table only.
|
|
143
|
-
|
|
144
|
-
## Eval — embeddings as the test instrument
|
|
145
|
-
|
|
146
|
-
`scripts/experiments/bucket-cohesion-signal.ts` (mirrors `chunk-embedding-signal.ts`):
|
|
147
|
-
- **[measure FIRST — the #1 risk] shortlist recall ceiling:** is each gold bucket in its
|
|
148
|
-
chunk's embedding top-K? Report overall **and per bucket-size-bin** (122/379 buckets
|
|
149
|
-
have <5 chunks — the global number hides tail collapse [fix C]). If low, the shortlist
|
|
150
|
-
caps recall and must be re-tuned before building on it.
|
|
151
|
-
- **bucket cohesion / separation / subcluster-gap** baseline over the 379 cloud buckets.
|
|
152
|
-
- **purity (LLM judge)** on lowest-subcluster-gap buckets — embeddings can't grade purity
|
|
153
|
-
(ρ≈0.32); confirm the asymmetry so the judge stays load-bearing.
|
|
154
|
-
- **decision accuracy:** since each task is binary, eval is per-(chunk,candidate-bucket)
|
|
155
|
-
yes/no accuracy + per-chunk Jaccard vs the 8441 valid gold edges. Report **oracle-shortlist**
|
|
156
|
-
F1 (force gold into candidates → pure model judgment) vs **real-shortlist** F1 (end-to-end);
|
|
157
|
-
the gap is the retrieval tax. **The LoRA decision keys off the oracle F1 [fix F].**
|
|
158
|
-
|
|
159
|
-
## LoRA decision (staged)
|
|
160
|
-
|
|
161
|
-
- **Stage 0 — embedding-only:** top-K cosine + threshold vs the 8809 gold edges → F1/Jaccard.
|
|
162
|
-
Might end it (classify could be embedding-shaped).
|
|
163
|
-
- **Stage 1 — base MiniCPM5-1B, prompt-only, binary tasks + shortlist:** measure oracle-F1,
|
|
164
|
-
yes/no consistency. The binary framing is *much* easier for a small base model than JSON
|
|
165
|
-
multi-assignment — Stage 1 may clear the bar with no LoRA precisely because the tasks are atomic.
|
|
166
|
-
- **Stage 2 — train `memory-bucket` LoRA, only if Stage 0/1 miss.** Data from lucien.db, one
|
|
167
|
-
example per (chunk, candidate-bucket) binary decision (gold = belongs?), shortlist regime =
|
|
168
|
-
serve regime. Recipe = `chunk-finetune.ts` (sft, rank 16, lr 1e-5, seq 8192,
|
|
169
|
-
no train-flash; no env-flag sanitization needed since the 2026-07-05 kernel
|
|
170
|
-
deletions); adapter →
|
|
171
|
-
`~/.cache/mlx-bun/adapters/memory-bucket`; pick checkpoints by the F1 judge, not val loss.
|
|
172
|
-
**GPU-gated.**
|
|
173
|
-
|
|
174
|
-
## Build sequence
|
|
175
|
-
|
|
176
|
-
Runnable now (no GPU training, no server):
|
|
177
|
-
1. **[FIRST]** `bucket-cohesion-signal.ts` → shortlist recall ceiling (per size-bin) +
|
|
178
|
-
cohesion/sep/subcluster baseline. Verifies the shortlist foundation before any build.
|
|
179
|
-
2. Rewrite `db.ts` to the pointer schema + `foreign_keys` + helpers; in-memory test.
|
|
180
|
-
3. Stage-0 embedding-only baseline (oracle + real F1).
|
|
181
|
-
4. Purity judge on lowest-subcluster-gap buckets; confirm the asymmetry.
|
|
182
|
-
5. Implement `cluster.ts` as **atomic tasks**: shortlist → per-candidate yes/no → new-bucket
|
|
183
|
-
proposal + global gate; cold-start = cluster → purity-gate → name → member-seed.
|
|
184
|
-
6. Stage-1 eval (base, no adapter) → apply LoRA criteria.
|
|
185
|
-
|
|
186
|
-
GPU-gated (only if needed): 7. build binary SFT data · 8. train `memory-bucket` · 9. re-eval.
|
|
187
|
-
Integration: 10. wire `clusterChunks` into `pipeline.ts`.
|
|
188
|
-
|
|
189
|
-
**First command:** `bun scripts/experiments/bucket-cohesion-signal.ts`
|
|
190
|
-
|
|
191
|
-
## Open risks
|
|
192
|
-
|
|
193
|
-
- Shortlist recall ceiling (measure per size-bin first — step 1).
|
|
194
|
-
- More model calls per chunk (K binary vs 1 JSON) — bounded by K; each call is tiny/fast.
|
|
195
|
-
- Cold-start naming going generic — seed with distinctive labels + "specific not generic".
|
|
196
|
-
- Distilled labels ≠ ground truth — don't over-trust exact-match F1; use reference-free
|
|
197
|
-
silhouette + purity on divergences.
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
# Compat CLI surface + parity harness — design
|
|
2
|
-
|
|
3
|
-
Status: design (2026-06-12). Engineering tracking lives in PLAN.md
|
|
4
|
-
Phase 17. UX/DX rationale lives in docs/planning/PRODUCT_ROADMAP.md ("The three
|
|
5
|
-
modes"). This doc is the surface contract: every verb, the flag
|
|
6
|
-
vocabulary, how optiq is absorbed, the parity harness, and **the
|
|
7
|
-
matrix of what we still lack**.
|
|
8
|
-
|
|
9
|
-
**Update 2026-06-17:** Several items have shipped since the 2026-06-12 snapshot: **LoRA training** is live (`src/train/`, `scripts/chunk-finetune.ts`, segmented-backward Phase A MiniCPM5 + Phase B e4b both merged); the **web UI fine-tune tab** (`src/web/app.html`) is live with SFT/DPO workflow, loss curve, merge, and export; the **chat adapter selector** (web UI) is live; and **adapters end-to-end** (web selector + CLI `/adapter`) are done — the matrix below reflects these as ✅. The **Phase 17 compat parity harness itself** (the verb router, dotted aliases, flag-surface parity tests) remains **unbuilt**.
|
|
10
|
-
|
|
11
|
-
## Goal
|
|
12
|
-
|
|
13
|
-
Design mlx-bun's entire CLI/flag surface from scratch (nothing is
|
|
14
|
-
published, nothing is set in stone) so that one coherent set of verbs
|
|
15
|
-
serves three audiences at three depths — automatic / compat /
|
|
16
|
-
stick-shift (see PRODUCT_ROADMAP). mlx-lm is the vocabulary we borrow,
|
|
17
|
-
because it is the Apple-WWDC-referenced default and outweighs the
|
|
18
|
-
alternative ~425× on monthly installs (1.64M vs 3.85k; mlx-lm 5.8k
|
|
19
|
-
stars / 765 forks; mlx-optiq has no public repo — measured
|
|
20
|
-
2026-06-12).
|
|
21
|
-
|
|
22
|
-
## Scope boundary: surface parity ≠ architecture parity
|
|
23
|
-
|
|
24
|
-
This is CLI/flag-**surface** parity. It is NOT a promise to run every
|
|
25
|
-
model architecture mlx-lm supports — the design principle "scope is the
|
|
26
|
-
survival strategy: target Gemma, Qwen, one MoE; not parity with mlx-lm's
|
|
27
|
-
dozens" still holds. A compat verb invoked against an unsupported
|
|
28
|
-
architecture returns a clear `architecture not supported by mlx-bun yet
|
|
29
|
-
(supported: …)` error, never a silent failure or a wrong answer. The
|
|
30
|
-
flag is accepted; the model may not be.
|
|
31
|
-
|
|
32
|
-
## The three laws (from PRODUCT_ROADMAP, restated as surface rules)
|
|
33
|
-
|
|
34
|
-
1. **One surface, mlx-lm vocabulary.** `mlx-bun.<verb>` is a pure alias
|
|
35
|
-
of `mlx-bun <verb>`. Adopt mlx-lm's flag name wherever it is the
|
|
36
|
-
standard; name a flag ourselves only where mlx-lm has no concept for
|
|
37
|
-
it (free to beat optiq's name there).
|
|
38
|
-
2. **Superset, never intersection.** Every documented mlx-lm flag
|
|
39
|
-
behaves faithfully so scripts drop in unchanged; we never gate a free
|
|
40
|
-
capability to resemble an upstream (OpenAI+Anthropic+Responses all
|
|
41
|
-
stay on).
|
|
42
|
-
3. **Gate only on conflict.** A capability is always on unless leaving
|
|
43
|
-
it on would degrade the automatic or compat experience (changes
|
|
44
|
-
output determinism, trades quality, surprises a script) — only then
|
|
45
|
-
does it move behind a stick-shift flag.
|
|
46
|
-
|
|
47
|
-
## Verb map (the spine = mlx-lm)
|
|
48
|
-
|
|
49
|
-
Each verb is reachable as `mlx-bun <verb>` and the dotted alias
|
|
50
|
-
`mlx-bun.<verb>`. Flags follow `mlx_lm.<verb> --help` exactly for the
|
|
51
|
-
shared subset; optiq-only features are additive (marked ⊕).
|
|
52
|
-
|
|
53
|
-
| Verb | Maps to | mlx-bun engine today | Notes |
|
|
54
|
-
|---|---|---|---|
|
|
55
|
-
| `generate` | mlx_lm.generate | ✅ `generate.ts` (no CLI verb) | wire verb + full flag set |
|
|
56
|
-
| `chat` | mlx_lm.chat | engine ✅, web chat ✅; no terminal REPL (`tui.ts` is help-formatting) | build REPL frontend over `generate` |
|
|
57
|
-
| `server` | mlx_lm.server / optiq serve | ✅ `serve` | rename flags; ⊕ `--kv-config`, `--anthropic` honored (default on) |
|
|
58
|
-
| `convert` | mlx_lm.convert + optiq convert | ✅ `convert` (wraps `quantize/quantizer.ts`) | -q/--q-bits/--q-group-size/--mlx-path/--upload-repo parity (upload rides `hf-push.ts`); ⊕ `--target-bpw/--candidate-bits/--calibration-mix/--n-calibration` (mixed precision); no `--dtype`/`--dequantize`/plain non-quantizing convert |
|
|
59
|
-
| `lora` | mlx_lm.lora + optiq lora | serve/hot-swap ✅, train ✅ | `--train/--test`; ⊕ `--rank-scaling by_bits\|by_kl`; `lora info` |
|
|
60
|
-
| `fuse` | mlx_lm.fuse | ✅ `fuse` (`train/fuse.ts`) | --adapter-path/--save-path parity; preserves per-module quant layout; dequant/GGUF/upload not supported (says so, exits 1) |
|
|
61
|
-
| `cache_prompt` | mlx_lm.cache_prompt | runtime ✅, CLI ❌ | precompute + save reusable KV cache file |
|
|
62
|
-
| `benchmark` | mlx_lm.benchmark / optiq benchmark | ✅ `benchmark` | flag-name parity (`-p/-g/-b/-n`); ppl half ❌ |
|
|
63
|
-
| `evaluate` | mlx_lm.evaluate / optiq eval | ❌ (`evals` = our bench viewer) | task harness; ⊕ optiq task names |
|
|
64
|
-
| `perplexity` | mlx_lm.perplexity | ✅ `perplexity` (`eval/perplexity.ts`) | reference methodology (pack → non-overlapping rows → f32 CE, delta-method SE); data source is a LOCAL .txt/.jsonl, not an HF dataset |
|
|
65
|
-
| `upload` | mlx_lm.upload | ✅ `upload` (wraps `hf-push.ts`, the web push engine) | --path/--upload-repo parity; ⊕ `--private`; token from hf.json/$HF_TOKEN/hf auth login |
|
|
66
|
-
| `manage` | mlx_lm.manage | ✅ `get`/`scan`/`ls` | add `--delete/--pattern/--scan` parity |
|
|
67
|
-
| `kv-cache` | optiq kv-cache | runtime ✅, profiler ❌ | per-layer sensitivity → `kv_config.json` |
|
|
68
|
-
| `latency` | optiq latency | ✅ `fit` | alias + `--calibrate` |
|
|
69
|
-
| `awq` | mlx_lm.awq | ❌ | activation-aware quant |
|
|
70
|
-
| `dwq` | mlx_lm.dwq | ❌ | distilled quant |
|
|
71
|
-
| `dynamic_quant` | mlx_lm.dynamic_quant | ❌ | sensitivity mixed-bit (overlaps convert/TurboQuant) |
|
|
72
|
-
| `gptq` | mlx_lm.gptq | ❌ | GPTQ |
|
|
73
|
-
| `share` | mlx_lm.share | ❌ | distributed cache share (lowest priority) |
|
|
74
|
-
|
|
75
|
-
Our own verbs stay (`fit`, `pi`, `harness`, `doctor`, no-args
|
|
76
|
-
appliance) — they are the automatic/stick-shift surface and have no
|
|
77
|
-
mlx-lm equivalent. See the native-surface section below.
|
|
78
|
-
|
|
79
|
-
## mlx-bun-native surface (the differentiators)
|
|
80
|
-
|
|
81
|
-
These have NO mlx-lm/optiq equivalent — they are not parity items, they
|
|
82
|
-
are what makes mlx-bun *more* than a faster mlx-lm. The compat layer
|
|
83
|
-
(Phase 17) is the "drop-in for mlx-lm" half; this is the "more than
|
|
84
|
-
mlx-lm" half.
|
|
85
|
-
|
|
86
|
-
### pi — the built-in agentic coding CLI
|
|
87
|
-
|
|
88
|
-
(Phase 16; full plan in **docs/investigations/pi-builtin-investigation.md**.) pi is an
|
|
89
|
-
MIT, Bun-native (`bun build --compile`) coding agent — the "CLI
|
|
90
|
-
experience inside our package" that neither Python package has. Two
|
|
91
|
-
commands, one for each audience:
|
|
92
|
-
|
|
93
|
-
1. **`mlx-bun pi`** (the appliance, exists) — start the server (reuse if
|
|
94
|
-
healthy) and run pi's own `InteractiveMode` **in-process**: one
|
|
95
|
-
binary, one command, a real agent on a local model with nothing to
|
|
96
|
-
install (pi is a bundled dep). Custom mlx-bun coding-agent prompt,
|
|
97
|
-
full coding tools + web tools, pi's native approval prompts.
|
|
98
|
-
`-p`→`runPrintMode`, `--mode json/rpc`→`runPrintMode`/`runRpcMode`.
|
|
99
|
-
2. **`mlx-bun harness pi`** (for people who already use pi, exists) —
|
|
100
|
-
point the user's OWN pi at mlx-bun's local model, via a generated
|
|
101
|
-
extension that dynamically discovers models from our `/v1/models`.
|
|
102
|
-
No models.json surgery; reversible. This is where the full pi flag
|
|
103
|
-
surface (`--continue`, `--resume`, `@file`, extensions, themes) lives.
|
|
104
|
-
|
|
105
|
-
History: an earlier cut shipped `mlx-bun pi` as a subprocess launcher of
|
|
106
|
-
the user's own pi (and briefly a `--external-pi` flag); both were dropped
|
|
107
|
-
(2026-06-14) — a user who already has pi already knows how to run it, so
|
|
108
|
-
it was pure duplication. The embedded agent + `harness pi` is the clean
|
|
109
|
-
split.
|
|
110
|
-
|
|
111
|
-
### Built-in web UI (OptIQ-Lab parity, pi-powered)
|
|
112
|
-
|
|
113
|
-
The web UI's agent backbone is pi's RPC / `AgentSession.subscribe()`
|
|
114
|
-
event stream (investigation Option 4) — the SAME events drive the
|
|
115
|
-
embedded TUI and the browser, so tool calls / steering / progress come
|
|
116
|
-
for free. Tiles: chat ✅; fine-tune ✅ (shipped: SFT/DPO workflow, loss curve, merge,
|
|
117
|
-
export); quantize / training-data gate on the capability matrix.
|
|
118
|
-
|
|
119
|
-
## Flag-vocabulary reconciliation (where we currently diverge)
|
|
120
|
-
|
|
121
|
-
- `serve --kv-quant N` → adopt mlx-lm's `--kv-bits` + `--kv-group-size`
|
|
122
|
-
+ `--quantized-kv-start` (keep `--kv-quant` as a deprecated alias).
|
|
123
|
-
- `serve --prompt-cache` → mlx-lm's `--prompt-cache-size` (entries) +
|
|
124
|
-
`--prompt-cache-bytes` (our byte-cap is already the right model).
|
|
125
|
-
- Our runtime levers (`--compiled-decode`, `--compiled-activations`,
|
|
126
|
-
`--fused-sdpa`, `--force-wire`) have no mlx-lm equivalent → keep, these
|
|
127
|
-
are stick-shift flags. (`--perf-kernel` and `--fused-decode` were deleted
|
|
128
|
-
2026-07-05 — docs/design/unified-engine-frontier-plan.md §6.)
|
|
129
|
-
- Adopt mlx-lm's sampling names verbatim: `--temp`, `--top-p`,
|
|
130
|
-
`--top-k`, `--min-p`, `--max-tokens/-m`, `--seed`, `--xtc-*`.
|
|
131
|
-
|
|
132
|
-
## What we still lack — capability gap matrix
|
|
133
|
-
|
|
134
|
-
Legend: ✅ have · 🔌 wiring-only (engine exists, needs verb/flags) ·
|
|
135
|
-
🟥 missing capability (real build). The compat **layer** is the 🔌
|
|
136
|
-
column; the 🟥 column is the capability matrix that fills in behind it.
|
|
137
|
-
|
|
138
|
-
| Capability | Verb(s) | Status | Bucket / owning phase |
|
|
139
|
-
|---|---|---|---|
|
|
140
|
-
| One-shot generate | `generate` | 🔌 | Phase 17 (compat) |
|
|
141
|
-
| Chat REPL | `chat` | 🔌 | Phase 17 |
|
|
142
|
-
| OpenAI/Anthropic/Responses serve | `server` | ✅ | done (Phase 4/11) |
|
|
143
|
-
| Server flag parity | `server` | 🔌 | Phase 17 |
|
|
144
|
-
| Benchmark (throughput) | `benchmark` | ✅ flags 🔌 | Phase 17 |
|
|
145
|
-
| Latency prediction | `latency`/`fit` | ✅ | done; `--calibrate` 🔌 |
|
|
146
|
-
| Model cache manage | `manage` | 🔌 | Phase 17 |
|
|
147
|
-
| Precompute prompt cache | `cache_prompt` | 🔌 | Phase 17 |
|
|
148
|
-
| LoRA serve / hot-swap | `lora` (serve) | ✅ | done (Phase 8) |
|
|
149
|
-
| `lora info` reporting | `lora info` | 🔌 | Phase 17 |
|
|
150
|
-
| **HF→MLX convert → new model artifact** | `convert` | ✅ | done (CLI verb over the native quantize pipeline) |
|
|
151
|
-
| **Sensitivity / mixed-precision weights** | `convert`, `dynamic_quant` | ✅ (`convert --target-bpw`) | done via convert; `dynamic_quant` alias 🟥 |
|
|
152
|
-
| **AWQ / DWQ / GPTQ (weights)** | `awq`/`dwq`/`gptq` | 🟥 | Model-quant |
|
|
153
|
-
| KV-cache quant: bf16 / uniform / **mixed per-layer** (kv_config.json) | `server` (`off`/`N`/`config`) | ✅ | done (Phase 9/10; config.ts reads, generate.ts applies per-layer) |
|
|
154
|
-
| KV sensitivity *profiler* (authors a NEW kv_config.json) | `kv-cache` | 🟥 | model-prep, low pri (shipped artifacts already include one) |
|
|
155
|
-
| TurboQuant — optional extra quant *method* (rotation VQ) | scheme, not a verb | 🟥 | Phase 13 (KV plumbing already exists) |
|
|
156
|
-
| **LoRA / DoRA / full training** | `lora --train` | ✅ | Training (done: Phase A MiniCPM5 + Phase B e4b) |
|
|
157
|
-
| **Sensitivity-aware rank scaling** | `lora --rank-scaling` | 🟥 | Training |
|
|
158
|
-
| **Fuse adapters (+GGUF/upload)** | `fuse` | ✅ fuse; GGUF/dequant/upload 🟥 | done (fold-into-base, quant layout preserved) |
|
|
159
|
-
| **lm-eval-harness tasks** | `evaluate` | 🟥 | Eval (new phase) |
|
|
160
|
-
| **optiq eval suite (kl/gsm8k/ifeval/bfcl/hashhop…)** | `evaluate` | 🟥 | Eval |
|
|
161
|
-
| **Perplexity** | `perplexity` | ✅ | done (local text/jsonl datasets) |
|
|
162
|
-
| **HF upload** | `upload` | ✅ | done (native `hf-push.ts`; also `convert --upload-repo`) |
|
|
163
|
-
| **Distributed share** | `share` | 🟥 | Distribution (lowest pri) |
|
|
164
|
-
| **Web UI: quantize** | `lab`/UI | 🟥 | gated on Quantize |
|
|
165
|
-
| **Web UI: fine-tune** | `lab`/UI | ✅ | done (SFT/DPO workflow, loss curve, merge, export) |
|
|
166
|
-
| **Web UI: training-data template + gen** | `lab`/UI | 🟥 | new (no engine dep) |
|
|
167
|
-
| Web UI: chat | `/chat` | ✅ | done (publishing gate 2) |
|
|
168
|
-
| **Native: pi embedded** (`mlx-bun pi`, in-process TUI) | — | ✅ (P3/P4) | Phase 16 (flagship) |
|
|
169
|
-
| **Native: connect user's own pi** (`harness pi`) | — | ✅ (P1) | Phase 16 |
|
|
170
|
-
|
|
171
|
-
Summary: serving and the read-only/measurement verbs are **🔌
|
|
172
|
-
wiring-only** — the compat layer ships over what the engine already
|
|
173
|
-
does. The real capability work splits along two axes:
|
|
174
|
-
|
|
175
|
-
- **Model quantization** (offline, makes a new artifact): `convert`,
|
|
176
|
-
`awq`, `dwq`, `gptq`, `dynamic_quant`. Its own new phase.
|
|
177
|
-
- **Inference-time KV-cache quant** (online, no artifact): bf16 /
|
|
178
|
-
uniform / **mixed per-layer** from kv_config.json all ✅ today
|
|
179
|
-
(Phase 9/10 — we read & apply shipped configs). The only KV gaps are
|
|
180
|
-
optional and not inference plumbing: a *profiler* to author a new
|
|
181
|
-
kv_config.json (model-prep, low pri) and extra methods like TurboQuant
|
|
182
|
-
(Phase 13).
|
|
183
|
-
- **Training**: LoRA/DoRA/full training ✅ (shipped); `fuse` verb (adapter merge, GGUF export, upload) 🟥 remaining.
|
|
184
|
-
- **Eval**: harness + `perplexity`.
|
|
185
|
-
- **Distribution**: `upload` ✅ (CLI verb + `convert --upload-repo`); `share` 🟥.
|
|
186
|
-
|
|
187
|
-
The OptIQ-Lab web-UI tiles gate on these: quantize ← model-quant,
|
|
188
|
-
fine-tune ← training, training-data ← independent, chat ✅.
|
|
189
|
-
|
|
190
|
-
Plus the **native half** (no parity equivalent — the differentiators):
|
|
191
|
-
the pi agentic coding CLI (Phase 16: `mlx-bun pi` is the embedded
|
|
192
|
-
in-process agent, `harness pi` connects the user's own pi) and the web
|
|
193
|
-
UI, both riding pi's `AgentSession` event stream. Compat makes us a
|
|
194
|
-
drop-in for mlx-lm;
|
|
195
|
-
the native half makes us more than it.
|
|
196
|
-
|
|
197
|
-
## Parity harness (turns "drop-in" into a passing test)
|
|
198
|
-
|
|
199
|
-
Same discipline as logit parity. For each compat verb, a test diffs
|
|
200
|
-
mlx-bun against the Python oracle in `/Users/joshrossi/Code/mlx-lm/.venv`:
|
|
201
|
-
|
|
202
|
-
- **Flag-surface parity**: parse `mlx_lm.<verb> --help`, assert every
|
|
203
|
-
documented flag is accepted by `mlx-bun <verb>` (or explicitly
|
|
204
|
-
rejected with a clear message — never silently ignored).
|
|
205
|
-
- **Behavior parity** where deterministic: `generate --seed --temp 0`
|
|
206
|
-
output, `manage --scan` listing shape, `cache_prompt` round-trip,
|
|
207
|
-
`benchmark` column schema.
|
|
208
|
-
- **Gap honesty**: a not-yet-built verb (`convert`, `evaluate`, …)
|
|
209
|
-
exits non-zero with `not implemented in mlx-bun yet` — the harness
|
|
210
|
-
asserts the message, so gaps are visible, not silent.
|
|
211
|
-
|
|
212
|
-
Gated by `benchmark.sh`-style preflight only where it measures speed;
|
|
213
|
-
correctness diffs need no clean machine.
|
|
214
|
-
|
|
215
|
-
## Build sequencing
|
|
216
|
-
|
|
217
|
-
1. **Phase 17 — this layer**: verb router + dotted aliases + flag
|
|
218
|
-
vocabulary + reconcile existing commands + parity harness, over
|
|
219
|
-
existing capabilities (`generate`, `chat`, `server`, `benchmark`,
|
|
220
|
-
`manage`, `cache_prompt`, `lora info`, `latency`). Honest stubs for
|
|
221
|
-
🟥 verbs.
|
|
222
|
-
2. Model quantization (new phase) → `convert`/`dynamic_quant`/`awq`/
|
|
223
|
-
`dwq`/`gptq` (new model artifacts) + web-UI quantize tile.
|
|
224
|
-
3. Inference-time KV quant → already done (bf16 / uniform / mixed
|
|
225
|
-
per-layer via kv_config.json, Phase 9/10). Optional later: a profiler
|
|
226
|
-
to author new configs (low pri) + the TurboQuant method (Phase 13).
|
|
227
|
-
4. Training → ✅ `lora --train` + web-UI fine-tune tile (both shipped); remaining: `fuse` verb (adapter merge, GGUF export, upload).
|
|
228
|
-
5. Eval → `evaluate`/`perplexity`.
|
|
229
|
-
6. Distribution → `upload` ✅ (2026-07-01); `share` remaining.
|
|
230
|
-
7. Web UI training-data tile (independent of engine work).
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Docs & repo-organization cleanup plan
|
|
2
|
-
|
|
3
|
-
**Status:** executed 2026-06-14 (P0 + P1 + P2 #11). Held: P2 #9/#10
|
|
4
|
-
(src/ and scripts/ moves — they change import paths / script references
|
|
5
|
-
and need a test run, so deferred to their own pass). Authored 2026-06-14.
|
|
6
|
-
|
|
7
|
-
**Execution state (verified 2026-06-17):**
|
|
8
|
-
- P0 #1 — **DONE**: `AGENTS.md` is a symlink → `CLAUDE.md`; drift risk resolved.
|
|
9
|
-
- P0 #2 — **DONE**: `benchmarks/RESULTS.md` created; old committed benchmark artifacts `git rm`'d. Root untracked spew (`benchmarks-h2h-2026-06-13-*` etc.) is now cleaned — no untracked report files found at root.
|
|
10
|
-
- P0 #3 — **DONE**: root HTML/md spew cleared (no `benchmarks-h2h-*.md`, `benchmark-report-*.html`, `kernel-fusion-report-*.html`, or `project-review.html` at root).
|
|
11
|
-
- P0 #4 — **DONE**: hardcoded test count removed from CLAUDE.md (no "All 72 tests" present).
|
|
12
|
-
- P1 #5 — **DONE**: `STATUS.md` exists at root.
|
|
13
|
-
- P1 #6 — **DONE**: `docs/planning/` exists with `IDEAS.md`, `PRODUCT_ROADMAP.md`, `ResearchTopics.md`, `journal.md`.
|
|
14
|
-
- P1 #7 — open (optimization_plan.md still lives in docs/design/ as a standalone).
|
|
15
|
-
- P1 #8 — **RESOLVED (2026-07-01)**: the duplicate `archive/pi-builtin-investigation.html` is already gone; `docs/archive/` deliberately keeps 2 small demo artifacts (`mlx-bun-lab-report.html`, `wwdc-mlx-bun.html`, 76K total), tracked.
|
|
16
|
-
- P2 #9 — **NOT DONE**: `harness-pi.ts`, `pi-provider.ts`, `pi-terminal.ts`, `pi-web.ts` still live flat in `src/` root (no `src/pi/` subdirectory).
|
|
17
|
-
- P2 #10 — **PARTIALLY DONE**: ~57 one-off research/debug scripts moved to `scripts/experiments/`; production + tooling + bench-* + regen-* + parity-* + gen-model + eval/serve remain at `scripts/` root (the full bench/regen/build split was not applied).
|
|
18
|
-
- P2 #11 — **DONE**: CLI vocabulary reconciled.
|
|
19
|
-
|
|
20
|
-
**Scope & ethos.** Private repo, single author + agents, MLX-by-identity.
|
|
21
|
-
No OSS/community scaffolding (CONTRIBUTING, issue templates, badges) —
|
|
22
|
-
out of scope by design. **Prefer move / consolidate over delete.** The
|
|
23
|
-
one exception is regenerable benchmark *output* (md/json/html report
|
|
24
|
-
artifacts): those are noise, not experiments, and are explicitly
|
|
25
|
-
deletable per Josh's direction. Losing *experiments* and code paths are
|
|
26
|
-
never deleted (see memory: "don't delete optionality on one
|
|
27
|
-
measurement").
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## The centerpiece: benchmark provenance (corrected)
|
|
32
|
-
|
|
33
|
-
The original analysis mis-framed this. The correct policy:
|
|
34
|
-
|
|
35
|
-
- Benchmark **runs** are date- and machine-stamped, regenerable, and
|
|
36
|
-
machine-specific. They do **not** belong in the durable repo. The
|
|
37
|
-
existing `.gitignore` rule `benchmarks-h2h-*` (ignore all raw runs) is
|
|
38
|
-
**correct and stays**.
|
|
39
|
-
- The actual defect today: a handful of raw run files leaked into git
|
|
40
|
-
history (committed before that ignore rule existed), and the README's
|
|
41
|
-
headline performance claims cite one of them
|
|
42
|
-
(`benchmarks/benchmarks-h2h-2026-06-11-Joshs-MBP-2025.md`) as the
|
|
43
|
-
source of truth. The repo's central perf claim depends on exactly the
|
|
44
|
-
kind of ephemeral artifact the gitignore says shouldn't be tracked.
|
|
45
|
-
|
|
46
|
-
**The fix:** one curated, intentionally-maintained record, structured
|
|
47
|
-
around the **three distinct kinds of measurement** below; raw runs stay
|
|
48
|
-
local/ignored; the eval DB remains the structured backing record.
|
|
49
|
-
|
|
50
|
-
### The three kinds of benchmarks (the record's structure)
|
|
51
|
-
|
|
52
|
-
These are categorically different — one is pass/fail correctness, one is
|
|
53
|
-
a perf number, one is a quality delta — and `RESULTS.md` must keep them
|
|
54
|
-
in separate sections rather than one undifferentiated table. They map to
|
|
55
|
-
the project's three-tier parity model (L1/L2/L3).
|
|
56
|
-
|
|
57
|
-
1. **Parity (porting correctness) — pass/fail, not a number.** Are we
|
|
58
|
-
bit-for-bit with the upstream oracle under like-for-like config?
|
|
59
|
-
- mlx-lm + standard (bf16) KV cache → bit-exact (L1).
|
|
60
|
-
- mlx-optiq + mixed-precision KV cache → bit-exact (L2).
|
|
61
|
-
Record as a matrix of model × mode → ✓/✗ (+ commit, oracle versions).
|
|
62
|
-
This is the gate the perf/quality numbers are only meaningful *under*.
|
|
63
|
-
|
|
64
|
-
2. **Performance — like-for-like numbers, two comparison axes.** Under
|
|
65
|
-
the parity constraints above, measure tok/s, prefill/s, decode/s,
|
|
66
|
-
TTFT, startup, RSS, peak memory. Two axes:
|
|
67
|
-
- **vs the oracles** — mlx-bun vs mlx-lm / mlx-optiq, same model, same
|
|
68
|
-
mode, same machine, same day.
|
|
69
|
-
- **vs our own compat mode** — mlx-bun's NEW optimizations vs
|
|
70
|
-
mlx-bun's own compatible (bit-exact) path, to prove an optimization
|
|
71
|
-
actually beats the baseline it diverges from.
|
|
72
|
-
|
|
73
|
-
3. **Quality — for our non-bit-exact optimizations only (L3).** When a
|
|
74
|
-
custom path trades exactness for speed, quantify what the trade costs:
|
|
75
|
-
- **mean score across the 6 eval tasks** (`src/eval/tasks/`: bfcl,
|
|
76
|
-
gsm8k, hashhop, humaneval, ifeval, mmlu), vs the compatible upstream.
|
|
77
|
-
- **KL divergence** vs the compatible distribution.
|
|
78
|
-
Purpose: enable statements like *"the optimized path gains 23% tok/s
|
|
79
|
-
while holding ±5% on the 6-test mean"* — the perf win is only worth
|
|
80
|
-
claiming alongside its measured quality cost.
|
|
81
|
-
|
|
82
|
-
### B1. Create `benchmarks/RESULTS.md` (the new durable record)
|
|
83
|
-
- Three top-level sections: **Parity** (model × mode → ✓/✗), **Performance**
|
|
84
|
-
(oracle comparison + our-optimized-vs-our-compat), **Quality** (6-test
|
|
85
|
-
mean + KL for non-exact paths). Each row carries provenance (machine,
|
|
86
|
-
date, commit, model, mode, oracle versions).
|
|
87
|
-
- Named so it does **not** match `benchmarks-h2h-*`, so it's tracked
|
|
88
|
-
deliberately and future raw runs never auto-collide with it.
|
|
89
|
-
- Migrate the headline numbers Josh wants to keep (currently the 06-11
|
|
90
|
-
matrix, plus the 06-13/06-14 follow-ups) into the right section
|
|
91
|
-
**before** removing the raw files, so README's claims never lose their
|
|
92
|
-
source.
|
|
93
|
-
- Point README's "Full table" link at `benchmarks/RESULTS.md`.
|
|
94
|
-
|
|
95
|
-
### B2. Remove the old committed benchmark artifacts
|
|
96
|
-
`git rm` the leaked raw runs and verification dumps (numbers preserved in
|
|
97
|
-
B1 + the eval DB):
|
|
98
|
-
- `benchmarks/benchmarks-h2h-2026-06-10-Joshs-MBP-2025.md`
|
|
99
|
-
- `benchmarks/benchmarks-h2h-2026-06-10-Joshs-MacBook-Pro.md`
|
|
100
|
-
- `benchmarks/benchmarks-h2h-2026-06-10.md`
|
|
101
|
-
- `benchmarks/benchmarks-h2h-2026-06-11-Joshs-MBP-2025.md`
|
|
102
|
-
- `benchmarks/lab-verification.json`
|
|
103
|
-
- `benchmarks/lab-verification-mixed.json`
|
|
104
|
-
|
|
105
|
-
Also clear the loose **untracked** root spew (delete or move to an
|
|
106
|
-
ignored `reports/`): `benchmarks-h2h-2026-06-13-*.md`,
|
|
107
|
-
`benchmarks-h2h-2026-06-14-*.{md,html}`, `benchmark-report-*.html`,
|
|
108
|
-
`kernel-fusion-report-*.html`, `project-review.html`.
|
|
109
|
-
|
|
110
|
-
`scripts/verify-lab.ts` keeps writing `benchmarks/lab-verification.json`
|
|
111
|
-
locally — it'll just be gitignored now (add `benchmarks/lab-verification*.json`
|
|
112
|
-
to `.gitignore`).
|
|
113
|
-
|
|
114
|
-
### B3. Eval DB — leave where it is (decided 2026-06-14)
|
|
115
|
-
- `~/.cache/mlx-bun/evals.sqlite` ([src/evaldb.ts:8](../../src/evaldb.ts))
|
|
116
|
-
stays user-local — it is the structured backing record of every run.
|
|
117
|
-
**Not tracked in-repo** (binary SQLite in git doesn't diff, churns, and
|
|
118
|
-
grows history). `RESULTS.md` is the committed human-readable record; the
|
|
119
|
-
DB is its machine-local source. Decision confirmed by Josh — closed.
|
|
120
|
-
|
|
121
|
-
### Do NOT touch
|
|
122
|
-
`goldens/*.json` and `goldens/**` are the correctness oracle golden
|
|
123
|
-
files, not benchmark output. Leave entirely alone.
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## P0 — Quick, safe wins (low risk)
|
|
128
|
-
|
|
129
|
-
| # | Action | Why |
|
|
130
|
-
|---|---|---|
|
|
131
|
-
| 1 | Collapse `AGENTS.md` → `CLAUDE.md` (make AGENTS.md a 1-line pointer or symlink). | They're byte-identical except the title line — guaranteed to drift. |
|
|
132
|
-
| 2 | B1–B2 above: create `RESULTS.md`, migrate numbers, `git rm` old artifacts, point README at it, gitignore `lab-verification*.json`. | Fixes benchmark provenance; declutters; keeps gitignore policy honest. |
|
|
133
|
-
| 3 | Relocate untracked root HTML/md spew into an ignored `reports/` (or delete). | De-clutters the working-tree root. |
|
|
134
|
-
| 4 | Drop the hardcoded "All 72 tests" in CLAUDE.md (say "the suite" / reference the count command). | 57 test files now — a baked-in number that's already wrong. |
|
|
135
|
-
|
|
136
|
-
## P1 — Structural consolidation (the real navigability win)
|
|
137
|
-
|
|
138
|
-
| # | Action | Why |
|
|
139
|
-
|---|---|---|
|
|
140
|
-
| 5 | Add `STATUS.md` (or a pinned top section in PLAN.md) holding only live handoff: current state + next action + blockers. Move PLAN.md's `NEXT UP` / `NEXT SESSION PICKUP` / `SESSION SWEEP` blocks into it. | Separates transient "do this next" from 2,475 lines of durable phase history; gives agents one entry point. |
|
|
141
|
-
| 6 | Create `docs/planning/` and move `PRODUCT_ROADMAP.md`, `IDEAS.md`, `ResearchTopics.md`, `journal.md` under it. Leave only README + PLAN.md (+ STATUS.md) at root. Add a ~6-line "doc map" to README. | Root is currently a 6-file planning thicket; extends the taxonomy that already works in `docs/`. |
|
|
142
|
-
| 7 | Pick one home for the optimization plan: fold `docs/design/optimization_plan.md` into PLAN.md Phase A–E, or have PLAN.md link out to it as canonical. | Two homes for the same plan = drift. |
|
|
143
|
-
| 8 | Resolve the archive overlap: `archive/pi-builtin-investigation.html` duplicates [docs/investigations/pi-builtin-investigation.md](../investigations/pi-builtin-investigation.md). Decide whether `archive/` (tracked; 2 HTML files: `mlx-bun-lab-report.html` + `wwdc-mlx-bun.html`) should be tracked at all, or moved to an ignored location. Keep the `.md`, drop the duplicate. | Stops committing heavyweight generated HTML; one source per investigation. |
|
|
144
|
-
|
|
145
|
-
## P2 — Polish (optional)
|
|
146
|
-
|
|
147
|
-
| # | Action | Why |
|
|
148
|
-
|---|---|---|
|
|
149
|
-
| 9 | Group `src/pi/` (`harness-pi.ts`, `pi-provider.ts`, `pi-terminal.ts`, `pi-web.ts`). | `src/` root is 31 flat files; this is an obvious cohesive cluster. |
|
|
150
|
-
| 10 | Sort `scripts/` into `scripts/{bench,regen,build}/` (40 files, clear prefixes). | Navigability only; low urgency. |
|
|
151
|
-
| 11 | Reconcile CLI vocabulary: README quickstart uses the shipped `mlx-bun` verb (with a one-line "from a clone, `bun src/cli.ts` is the same"). | README/roadmap/package.json currently mix `bun src/cli.ts` and `mlx-bun`. |
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Execution order (after slots work is pushed)
|
|
156
|
-
|
|
157
|
-
1. P0 #1, #4 (trivial, isolated).
|
|
158
|
-
2. Benchmark block B1 → B2 → README relink (do B1 fully before B2).
|
|
159
|
-
3. P0 #3 (root spew).
|
|
160
|
-
4. Confirm B3 eval-DB decision with Josh.
|
|
161
|
-
5. P1 #5–#8 (the structural moves; one commit per item so history stays legible).
|
|
162
|
-
6. P2 as appetite allows.
|
|
163
|
-
|
|
164
|
-
Each step keeps the test suite green and changes no source behavior — this
|
|
165
|
-
is docs + file layout only.
|