mlx-bun 0.0.4 → 0.0.6
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 +175 -93
- package/docs/dag/training-inference-map.html +575 -0
- package/docs/design/adapters-end-to-end.md +50 -46
- package/docs/design/compat-cli-surface-design.md +10 -8
- package/docs/design/docs-reorg-plan.md +14 -1
- package/docs/design/hlg-sampling.md +12 -2
- package/docs/design/memory-system.md +193 -295
- package/docs/design/optimization_plan.md +4 -2
- package/docs/design/orpo-dynamic-lambda.md +179 -0
- package/docs/design/orpo-future-enhancements.md +340 -0
- package/docs/design/orpo-training.md +1212 -0
- package/docs/design/parallel-slots.md +34 -26
- package/docs/design/parity-tier-dag.md +143 -0
- package/docs/design/runtime-isolation.md +1 -1
- package/docs/design/segmented-backward-training.md +58 -39
- package/docs/design/tauri-desktop-app.md +127 -0
- package/docs/design/w4a16-compute-precision-spike.md +232 -0
- package/docs/investigations/orpo-base-uf-experiment-and-directions.md +120 -0
- package/docs/investigations/orpo-flash-cce-pin-leak.md +167 -0
- package/docs/investigations/orpo-uf-testing-handoff.md +126 -0
- package/docs/{segmented-backward-handoff.md → investigations/segmented-backward-handoff.md} +1 -1
- package/docs/investigations/starter-model-port-handoff.md +32 -13
- package/docs/investigations/steel-flash-cce-handoff.md +489 -0
- package/docs/investigations/trainer-validation-experiment.md +173 -0
- package/docs/planning/IDEAS.md +29 -0
- package/docs/planning/PRODUCT_ROADMAP.md +147 -27
- package/docs/planning/chunk-task-roadmap.md +1 -1
- package/docs/planning/journal.md +161 -0
- package/docs/reference/distribution.md +61 -5
- package/docs/reference/library-api.md +29 -14
- package/docs/reference/memory.md +77 -0
- package/docs/reference/orpo-quickstart.md +130 -0
- package/docs/reference/server-api.md +105 -7
- package/docs/reference/server-config.md +12 -5
- package/docs/reference/training.md +296 -0
- package/package.json +1 -1
- package/src/cli.ts +651 -18
- package/src/eval/ifeval.ts +138 -0
- package/src/eval/runner.ts +76 -6
- package/src/eval/tasks/bfcl.ts +49 -15
- package/src/eval/tasks/gsm8k.ts +21 -9
- package/src/eval/tasks/hashhop.ts +33 -4
- package/src/eval/tasks/humaneval.ts +30 -8
- package/src/eval/tasks/ifeval.ts +52 -18
- package/src/eval/tasks/mmlu.ts +85 -74
- package/src/eval/ultrafeedback.ts +60 -0
- package/src/jobs/runner.ts +6 -0
- package/src/lora.ts +12 -7
- package/src/memory/chunk.ts +25 -0
- package/src/memory/cluster.ts +24 -0
- package/src/memory/db.ts +114 -0
- package/src/memory/ingest.ts +22 -0
- package/src/memory/pipeline.ts +63 -0
- package/src/memory/prompts.ts +23 -0
- package/src/memory/schedule.ts +163 -0
- package/src/memory/synthesize.ts +29 -0
- package/src/memory/tools.ts +399 -0
- package/src/memory/vault.ts +694 -0
- package/src/memory/wikify.ts +23 -0
- package/src/mlx/metal-kernel.ts +31 -4
- package/src/model/flash-attention.ts +37 -19
- package/src/model/fused-geglu-kernel.ts +111 -0
- package/src/model/gemma4-base.ts +39 -1
- package/src/model/gemma4.ts +196 -21
- package/src/model/minicpm5.ts +44 -3
- package/src/pi-provider.ts +29 -13
- package/src/pi-session.ts +81 -0
- package/src/pi-terminal.ts +13 -24
- package/src/pi-web.ts +246 -166
- package/src/quantize/job.ts +17 -2
- package/src/quantize/quantizer.ts +26 -2
- package/src/server.ts +216 -47
- package/src/tokenizer.ts +6 -2
- package/src/train/dataset.ts +29 -6
- package/src/train/flash-cce.ts +1175 -0
- package/src/train/job.ts +64 -3
- package/src/train/lora-params.ts +53 -4
- package/src/train/loss.ts +947 -0
- package/src/train/optimizer.ts +10 -3
- package/src/train/prefix-shared.ts +435 -0
- package/src/train/rank.ts +36 -0
- package/src/train/segmented.ts +1148 -3
- package/src/train/steel-qmm-header.ts +1461 -0
- package/src/train/trainer.ts +570 -54
- package/src/train/watch.ts +542 -0
- package/src/web/app.html +285 -19
- package/src/web/skills/memory/SKILL.md +97 -0
- package/src/web/skills/web-research/SKILL.md +3 -1
- package/src/web/skills.ts +46 -8
- /package/{docs → src/assets}/curve-designer.html +0 -0
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Adapters end-to-end — notes / TODO (2026-06-16)
|
|
2
2
|
|
|
3
|
+
**Status legend:** ✅ DONE — shipped and verified in code | ⏳ PENDING — not yet implemented
|
|
4
|
+
|
|
5
|
+
| Section | Status |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| §A Pi CLI extension (`extensions/mlx-bun-adapter.ts`) | ✅ DONE |
|
|
8
|
+
| §B Web chat adapter selector (`src/web/app.html` + `before_provider_request` hook in `pi-web.ts`) | ✅ DONE |
|
|
9
|
+
| §C `/v1/adapters/available` discovery (`src/server.ts:1182`, `src/lora.ts:139`) | ✅ DONE |
|
|
10
|
+
| §D Overnight training from the web UI — monitor/stream endpoint + UI | ⏳ PENDING |
|
|
11
|
+
| §E `--force-adapter` CLI flag (absent from `src/cli.ts`) | ⏳ PENDING |
|
|
12
|
+
| Repo-id keying written into adapter configs at save time | ⏳ PENDING |
|
|
13
|
+
|
|
3
14
|
Working notes for wiring trained LoRA adapters through the whole stack: Pi (CLI +
|
|
4
15
|
web), the web Chat page UI, and the server's discovery surface. Captured from the
|
|
5
16
|
2026-06-16 session (serving verified working; pi-extension mechanism confirmed from
|
|
@@ -31,16 +42,16 @@ API should let you move an adapter between these states explicitly.
|
|
|
31
42
|
So **loaded** and **selected** are done. The gap is **available** (discovery) plus
|
|
32
43
|
the two front-ends (Pi extension, web Chat selector).
|
|
33
44
|
|
|
34
|
-
##
|
|
45
|
+
## Shipped (§A–§C) ✅
|
|
35
46
|
|
|
36
|
-
### A. Pi CLI/terminal — adapter via extension *(default none)*
|
|
47
|
+
### A. Pi CLI/terminal — adapter via extension *(default none)* ✅ DONE
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
is the right tool.
|
|
49
|
+
Wired a Pi extension using the `before_provider_request` hook to inject the `adapter`
|
|
50
|
+
field into the outgoing OpenAI-compatible payload. `models.json` can't add arbitrary
|
|
51
|
+
body fields — the hook was the right tool.
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
Shipped as `~/.pi/agent/extensions/mlx-bun-adapter.ts` (copy in-repo + one-liner
|
|
54
|
+
installer):
|
|
44
55
|
|
|
45
56
|
```ts
|
|
46
57
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
@@ -60,53 +71,44 @@ export default function (pi: ExtensionAPI) {
|
|
|
60
71
|
- Selection via `PI_MLX_ADAPTER=chunk pi --provider mlx-bun --model local -p "..."`
|
|
61
72
|
(no native `-p --adapter` flag; unknown CLI flags get rejected). Optional shell
|
|
62
73
|
helper: `pi-chunk() { PI_MLX_ADAPTER=chunk pi --provider mlx-bun --model local -p "$@"; }`.
|
|
63
|
-
-
|
|
64
|
-
`-p` too. `/reload`
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
state file the web UI / a `mlx-bun adapter use <id>` command writes, so CLI and web
|
|
68
|
-
share one selection.
|
|
74
|
+
- Lives in the global `~/.pi/agent/extensions/` dir so it loads for non-interactive
|
|
75
|
+
`-p` too. `/reload` picks it up.
|
|
76
|
+
- Also reads the *selected* adapter from a small state file the web UI / a
|
|
77
|
+
`mlx-bun adapter use <id>` command writes, so CLI and web share one selection.
|
|
69
78
|
|
|
70
|
-
### B. Web Chat page — selector + load/unload *(default none)*
|
|
79
|
+
### B. Web Chat page — selector + load/unload *(default none)* ✅ DONE
|
|
71
80
|
|
|
72
81
|
Path: `src/web/app.html` (UI) ↔ `/ws/chat` (`src/pi-web.ts`) ↔ in-process Pi ↔ model.
|
|
73
82
|
|
|
74
83
|
- **Selector** in `app.html`: a dropdown of *available* adapters with **"none"
|
|
75
84
|
selected by default**. Changing it sets the active selection for subsequent
|
|
76
|
-
messages.
|
|
85
|
+
messages. Multi-select → `"a+b"` (resolveSpec already supports stacking).
|
|
77
86
|
- **Load / unload controls**: buttons that call `POST /v1/adapters` (load) and
|
|
78
|
-
`DELETE /v1/adapters/:id` (unload).
|
|
79
|
-
selected) so the three concepts are visible.
|
|
80
|
-
it
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`pi.on("before_provider_request", (e) => ({ ...e.payload, adapter }))` drops in the
|
|
86
|
-
same way and reads the current selection from the WS session state. **No custom
|
|
87
|
+
`DELETE /v1/adapters/:id` (unload). Each adapter's state (available / loaded /
|
|
88
|
+
selected) is shown so the three concepts are visible. Selecting an unloaded adapter
|
|
89
|
+
auto-loads it (fires `POST /v1/adapters`) before injecting the id.
|
|
90
|
+
- **Injected via the `before_provider_request` hook — identical mechanism to the CLI
|
|
91
|
+
(§A).** `pi-web.ts` registers the inline extension in `createAgentSession`
|
|
92
|
+
(pi-web.ts:469/605), so `pi.on("before_provider_request", (e) => ({ ...e.payload,
|
|
93
|
+
adapter }))` reads the current selection from WS session state. **No custom
|
|
87
94
|
provider plumbing, no new model-call wiring.** The hook is the spine for BOTH UIs.
|
|
88
|
-
- **Selection → hook**: the dropdown
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### C. Server — adapter **discovery** (the missing "available" list)
|
|
98
|
-
|
|
99
|
-
- Add a store the server scans for available adapters:
|
|
100
|
-
- `~/.cache/mlx-bun/adapters/` (the trainer already defaults saves here —
|
|
101
|
-
`src/server.ts:1653`) and/or a **sidecar next to the model dir**.
|
|
102
|
-
- New endpoint, e.g. `GET /v1/adapters/available` →
|
|
95
|
+
- **Selection → hook**: the dropdown updates the session's selected-adapter value via
|
|
96
|
+
a small client→server message (reusing the `set_thinking`-style toggle path). Default
|
|
97
|
+
none → hook returns the payload unchanged → base model.
|
|
98
|
+
|
|
99
|
+
### C. Server — adapter **discovery** (`GET /v1/adapters/available`) ✅ DONE
|
|
100
|
+
|
|
101
|
+
- Scans `~/.cache/mlx-bun-finetunes/` and `~/.cache/mlx-bun/adapters/`
|
|
102
|
+
(`src/server.ts:1192`) and any sidecar next to the model dir.
|
|
103
|
+
- `GET /v1/adapters/available` (`src/server.ts:1182`, `src/lora.ts:139`) →
|
|
103
104
|
`[{ id, path, source_repo, rank, scale, compatible }]`, where each entry is read
|
|
104
105
|
from the adapter's `optiq_lora_config.json` (`source_model`, `rank`, `scale`).
|
|
105
|
-
- **
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
- **Filters by the served model** on **repo id**
|
|
107
|
+
(`mlx-community/MiniCPM5-1B-OptiQ-4bit`) rather than the fragile
|
|
108
|
+
machine/snapshot-specific path. The server already tracks `repoId` per model;
|
|
109
|
+
`compatible = adapter.source_repo === served.repoId`.
|
|
110
|
+
|
|
111
|
+
## TODO (§D–§E)
|
|
110
112
|
|
|
111
113
|
### D. Overnight training from the web UI
|
|
112
114
|
|
|
@@ -117,8 +119,10 @@ Training must be fully drivable from the web UI — not just a script.
|
|
|
117
119
|
(rank / scale / num_layers / LR / dropout / iters / seq / segmentSize — the
|
|
118
120
|
configurable-params task, mlx-lm defaults), **start**, and leave it running.
|
|
119
121
|
- **Monitor**: live loss / iter / ETA, and survives the browser closing (the run is
|
|
120
|
-
server-side; the page reconnects).
|
|
121
|
-
(`src/server.ts:
|
|
122
|
+
server-side; the page reconnects). The training backend already exists:
|
|
123
|
+
`POST /api/finetune/submit` (`src/server.ts:1781`). What §D still needs is a
|
|
124
|
+
status/stream endpoint + the overnight-monitoring UI. (Note: `GET /fit` is the
|
|
125
|
+
unrelated memory-fit solver in `src/fit.ts` — not a training endpoint.)
|
|
122
126
|
- **Completion**: the finished adapter lands in the store and shows up as *available*
|
|
123
127
|
(state A in the three-state model), ready to load/select or auto-serve.
|
|
124
128
|
- This closes the loop with the chunk-task roadmap: iterate data → train overnight →
|
|
@@ -6,6 +6,8 @@ modes"). This doc is the surface contract: every verb, the flag
|
|
|
6
6
|
vocabulary, how optiq is absorbed, the parity harness, and **the
|
|
7
7
|
matrix of what we still lack**.
|
|
8
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
|
+
|
|
9
11
|
## Goal
|
|
10
12
|
|
|
11
13
|
Design mlx-bun's entire CLI/flag surface from scratch (nothing is
|
|
@@ -54,7 +56,7 @@ shared subset; optiq-only features are additive (marked ⊕).
|
|
|
54
56
|
| `chat` | mlx_lm.chat | engine ✅, web chat ✅; no terminal REPL (`tui.ts` is help-formatting) | build REPL frontend over `generate` |
|
|
55
57
|
| `server` | mlx_lm.server / optiq serve | ✅ `serve` | rename flags; ⊕ `--kv-config`, `--anthropic` honored (default on) |
|
|
56
58
|
| `convert` | mlx_lm.convert + optiq convert | ❌ | quant pipeline; ⊕ `--target-bpw/--candidate-bits/--reference` |
|
|
57
|
-
| `lora` | mlx_lm.lora + optiq lora | serve/hot-swap ✅, train
|
|
59
|
+
| `lora` | mlx_lm.lora + optiq lora | serve/hot-swap ✅, train ✅ | `--train/--test`; ⊕ `--rank-scaling by_bits\|by_kl`; `lora info` |
|
|
58
60
|
| `fuse` | mlx_lm.fuse | ❌ | fuse adapters, dequant, GGUF export, upload |
|
|
59
61
|
| `cache_prompt` | mlx_lm.cache_prompt | runtime ✅, CLI ❌ | precompute + save reusable KV cache file |
|
|
60
62
|
| `benchmark` | mlx_lm.benchmark / optiq benchmark | ✅ `benchmark` | flag-name parity (`-p/-g/-b/-n`); ppl half ❌ |
|
|
@@ -83,7 +85,7 @@ mlx-lm" half.
|
|
|
83
85
|
|
|
84
86
|
### pi — the built-in agentic coding CLI
|
|
85
87
|
|
|
86
|
-
(Phase 16; full plan in **docs/pi-builtin-investigation.md**.) pi is an
|
|
88
|
+
(Phase 16; full plan in **docs/investigations/pi-builtin-investigation.md**.) pi is an
|
|
87
89
|
MIT, Bun-native (`bun build --compile`) coding agent — the "CLI
|
|
88
90
|
experience inside our package" that neither Python package has. Two
|
|
89
91
|
commands, one for each audience:
|
|
@@ -111,8 +113,8 @@ split.
|
|
|
111
113
|
The web UI's agent backbone is pi's RPC / `AgentSession.subscribe()`
|
|
112
114
|
event stream (investigation Option 4) — the SAME events drive the
|
|
113
115
|
embedded TUI and the browser, so tool calls / steering / progress come
|
|
114
|
-
for free. Tiles: chat ✅;
|
|
115
|
-
the capability matrix.
|
|
116
|
+
for free. Tiles: chat ✅; fine-tune ✅ (shipped: SFT/DPO workflow, loss curve, merge,
|
|
117
|
+
export); quantize / training-data gate on the capability matrix.
|
|
116
118
|
|
|
117
119
|
## Flag-vocabulary reconciliation (where we currently diverge)
|
|
118
120
|
|
|
@@ -150,7 +152,7 @@ column; the 🟥 column is the capability matrix that fills in behind it.
|
|
|
150
152
|
| 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) |
|
|
151
153
|
| KV sensitivity *profiler* (authors a NEW kv_config.json) | `kv-cache` | 🟥 | model-prep, low pri (shipped artifacts already include one) |
|
|
152
154
|
| TurboQuant — optional extra quant *method* (rotation VQ) | scheme, not a verb | 🟥 | Phase 13 (KV plumbing already exists) |
|
|
153
|
-
| **LoRA / DoRA / full training** | `lora --train` |
|
|
155
|
+
| **LoRA / DoRA / full training** | `lora --train` | ✅ | Training (done: Phase A MiniCPM5 + Phase B e4b) |
|
|
154
156
|
| **Sensitivity-aware rank scaling** | `lora --rank-scaling` | 🟥 | Training |
|
|
155
157
|
| **Fuse adapters (+GGUF/upload)** | `fuse` | 🟥 | Training |
|
|
156
158
|
| **lm-eval-harness tasks** | `evaluate` | 🟥 | Eval (new phase) |
|
|
@@ -159,7 +161,7 @@ column; the 🟥 column is the capability matrix that fills in behind it.
|
|
|
159
161
|
| **HF upload** | `upload` | 🟥 | Distribution |
|
|
160
162
|
| **Distributed share** | `share` | 🟥 | Distribution (lowest pri) |
|
|
161
163
|
| **Web UI: quantize** | `lab`/UI | 🟥 | gated on Quantize |
|
|
162
|
-
| **Web UI: fine-tune** | `lab`/UI |
|
|
164
|
+
| **Web UI: fine-tune** | `lab`/UI | ✅ | done (SFT/DPO workflow, loss curve, merge, export) |
|
|
163
165
|
| **Web UI: training-data template + gen** | `lab`/UI | 🟥 | new (no engine dep) |
|
|
164
166
|
| Web UI: chat | `/chat` | ✅ | done (publishing gate 2) |
|
|
165
167
|
| **Native: pi embedded** (`mlx-bun pi`, in-process TUI) | — | ✅ (P3/P4) | Phase 16 (flagship) |
|
|
@@ -177,7 +179,7 @@ does. The real capability work splits along two axes:
|
|
|
177
179
|
optional and not inference plumbing: a *profiler* to author a new
|
|
178
180
|
kv_config.json (model-prep, low pri) and extra methods like TurboQuant
|
|
179
181
|
(Phase 13).
|
|
180
|
-
- **Training**: LoRA/DoRA/full
|
|
182
|
+
- **Training**: LoRA/DoRA/full training ✅ (shipped); `fuse` verb (adapter merge, GGUF export, upload) 🟥 remaining.
|
|
181
183
|
- **Eval**: harness + `perplexity`.
|
|
182
184
|
- **Distribution**: `upload`/`share`.
|
|
183
185
|
|
|
@@ -221,7 +223,7 @@ correctness diffs need no clean machine.
|
|
|
221
223
|
3. Inference-time KV quant → already done (bf16 / uniform / mixed
|
|
222
224
|
per-layer via kv_config.json, Phase 9/10). Optional later: a profiler
|
|
223
225
|
to author new configs (low pri) + the TurboQuant method (Phase 13).
|
|
224
|
-
4. Training → `lora --train
|
|
226
|
+
4. Training → ✅ `lora --train` + web-UI fine-tune tile (both shipped); remaining: `fuse` verb (adapter merge, GGUF export, upload).
|
|
225
227
|
5. Eval → `evaluate`/`perplexity`.
|
|
226
228
|
6. Distribution → `upload`/`share`.
|
|
227
229
|
7. Web UI training-data tile (independent of engine work).
|
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
(src/ and scripts/ moves — they change import paths / script references
|
|
5
5
|
and need a test run, so deferred to their own pass). Authored 2026-06-14.
|
|
6
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 — status unknown (archive/ not verified in this pass).
|
|
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
|
+
|
|
7
20
|
**Scope & ethos.** Private repo, single author + agents, MLX-by-identity.
|
|
8
21
|
No OSS/community scaffolding (CONTRIBUTING, issue templates, badges) —
|
|
9
22
|
out of scope by design. **Prefer move / consolidate over delete.** The
|
|
@@ -127,7 +140,7 @@ files, not benchmark output. Leave entirely alone.
|
|
|
127
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. |
|
|
128
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/`. |
|
|
129
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. |
|
|
130
|
-
| 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;
|
|
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. |
|
|
131
144
|
|
|
132
145
|
## P2 — Polish (optional)
|
|
133
146
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# HLG sampling — a piecewise tone curve on the logits
|
|
2
2
|
|
|
3
|
-
Status: **
|
|
3
|
+
Status: **implemented, found neutral, superseded by Curve Designer** — `applyHlg` shipped in `src/sampler.ts`; investigation found HLG a wash vs plain temperature; the Curve Designer (`src/curve-sampler.ts`) is its v2 replacement. See [docs/investigations/hlg-sampling-investigation.md](../investigations/hlg-sampling-investigation.md) for findings. This doc remains as the design rationale.
|
|
4
4
|
Owner: sampling layer (`src/sampler.ts`)
|
|
5
5
|
Default: **off** (`--hlg-sampling off` = today's temperature sampler, untouched)
|
|
6
6
|
|
|
@@ -10,6 +10,12 @@ Default: **off** (`--hlg-sampling off` = today's temperature sampler, untouched)
|
|
|
10
10
|
> [docs/reference/server-config.md](../reference/server-config.md) and
|
|
11
11
|
> [docs/reference/server-api.md](../reference/server-api.md) once shipped.
|
|
12
12
|
|
|
13
|
+
## Outcome / Retrospective
|
|
14
|
+
|
|
15
|
+
HLG was implemented through **Piece 2** (pure curve + neutrality tests + serial wiring, `applyHlg` live in `src/sampler.ts`). Evaluation found it **neutral vs plain temperature** — no measurable gain in diversity or quality at matched output entropy. As a result, HLG is **superseded by the Curve Designer** (`src/curve-sampler.ts`), which generalizes the same region-shaping idea with an editable control-point interface and cleaner UX. Full empirical findings are in [docs/investigations/hlg-sampling-investigation.md](../investigations/hlg-sampling-investigation.md).
|
|
16
|
+
|
|
17
|
+
The sections below (Goal through Correctness) remain as design rationale. Pieces 3–6 of Phasing and the Open Questions were never executed; see the [Phasing](#phasing-the-piece-n-increments) and [Open Questions](#open-questions--risks) sections for historical context.
|
|
18
|
+
|
|
13
19
|
## Goal
|
|
14
20
|
|
|
15
21
|
Add a sampling transform — gated entirely behind `--hlg-sampling on` and a
|
|
@@ -290,6 +296,8 @@ quality + diversity rather than parity — except for the degeneracy gates, whic
|
|
|
290
296
|
|
|
291
297
|
## Phasing (the "piece N" increments)
|
|
292
298
|
|
|
299
|
+
> **Historical / superseded.** Pieces 1–2 shipped. Pieces 3–6 were never executed — HLG was evaluated after Piece 2 and found neutral; the feature was superseded by the Curve Designer before Piece 3 began.
|
|
300
|
+
|
|
293
301
|
1. **Pure curve + neutrality tests** — `applyHlg(lp, params)` in `sampler.ts`,
|
|
294
302
|
top-anchored pivot only; degeneracy + monotonicity tests green across all
|
|
295
303
|
four models. (No flag wired yet — pure, fully-tested function.)
|
|
@@ -305,6 +313,8 @@ quality + diversity rather than parity — except for the degeneracy gates, whic
|
|
|
305
313
|
|
|
306
314
|
## Open questions / risks
|
|
307
315
|
|
|
316
|
+
> **Historical / superseded.** These questions were open at the time of design. HLG evaluation concluded with a neutral verdict before they were answered; the Curve Designer supersedes this path. Questions are preserved as design context.
|
|
317
|
+
|
|
308
318
|
- **Default knob values** are calibration-pending — set empirically by the
|
|
309
319
|
Piece 5 sweep, not guessed. Initial exploration points: `c ≈ 6`, `w ≈ 4`,
|
|
310
320
|
`β_h ≈ 4`, `β_t ≈ 6` nats; confirm or replace with measured values.
|
|
@@ -337,4 +347,4 @@ for it. That a transfer function is standard practice in another domain says
|
|
|
337
347
|
nothing about whether it helps token sampling — that is decided only by
|
|
338
348
|
measurement (the KL characterization, the capability guardrail, and the
|
|
339
349
|
diversity lens in [Correctness](#correctness--evaluation)). The full empirical
|
|
340
|
-
write-up
|
|
350
|
+
write-up is in [docs/investigations/hlg-sampling-investigation.md](../investigations/hlg-sampling-investigation.md).
|