Files
leleka/docs/experiments/models-move.md
T

65 lines
12 KiB
Markdown

# Models move into the work folder (2026-10-29)
Owner decision (final): every model lives inside the single work folder of its machine; outside it an agent only reads.
Server work folder `~/work/leleka` = `/home/para/work/leleka` (symlink to `/data/leleka-e2e`, data on `/data`). Laptop work folder `C:\Users\pavel\work\leleka`.
The same text is `~/work/leleka/models/MOVE-PLAN.md` on the server.
## Targets
| Was | Now | How |
| --- | --- | --- |
| `/data/models/deepseek-v41-flash/` (233 GiB, IQ2_XXS in 4 parts + Engram IQ4_NL + mmproj + docs) | `/home/para/work/leleka/models/deepseek-v41-flash/` | `mv`, same filesystem (`/data`) |
| `/home/para/leleka-gates/` (134 GiB: `assets/` 132 GiB, `stra169-ladder/` 2.3 GiB) on the 260 GB root disk | `/home/para/work/leleka/models/leleka-gates/` | `rsync -a` to `/data`, internal layout identical, verified by sha256 on both sides; the original is left in place (cross-filesystem, owner deletes it) |
Not moved, not ours: vanilla Strata keeps its own install data under `~/.local/share/strata/` (pack `packs/iq3_s/dense.bin` 1.5 GB, MTP `mtp/` 0.9 GB + `rt/`, `install/strata-iq3_s.json`, `components/`). It is the vanilla tool's state, rewritten by `strata launch`; the only model path in it that pointed at `leleka-gates` is in `install/strata-iq3_s.json` (`--native`, `--ple-gguf`), which `strata launch --model-path ...` regenerates on every launch (verified by the smoke run below).
Left alone because root-owned and unreadable by `para`: `leleka-gates/stra169-ladder/rust-work/kar-staging` and `mtp-staging` (mode 700, owner root). They were excluded from the copy. Nothing references them.
## Step 1: inventory of references (read only, before any change)
Searched for `/home/para/leleka-gates`, `$HOME/leleka-gates`, `~/leleka-gates`, `/data/models` in: repo (crates, deploy, scripts, docs, tools, engine/strata), server work folder `/data/leleka-e2e` (scripts, py, env, json, md; run outputs excluded), `~/work/gpu-runs/holder2` (jobs and helpers), `~/work/vanilla-strata`, the older trees `~/work/leleka-rest` and `~/work/leleka-e2e`, `~/.config`, `~/.local/share/strata`, `~/.bashrc`/`.profile`, user crontab (none), `/etc/cron*`, `/etc/systemd`, `/etc/fstab` (nothing found there), user systemd units (none relevant).
### A. Repository (30 files, all rewritten in this branch)
`/data/models` appears only as a synthetic mount-path literal in a unit test (`crates/deploy/src/facts.rs:608`, `fs_type_for(..., "/mnt/c/data/models")`), unrelated to the server model: unchanged. No Rust code, no deploy profile (`deploy/rust-runtime/profiles/*.json`) names a model path: models are given by `--assets` / `LELEKA_ASSETS`, so no Rust crate changed and no crate test is affected. `engine/strata` has no reference (vanilla `cmd.py` only has `--model-path /data/models/IQ3_XXS` in help text, not ours and not touched).
Docs (5): `docs/deploy.md`, `docs/e2e-run.md`, `docs/rust-runtime-run.md`, `docs/experiments/2026-10-28-s0-7-vanilla-arms.md`, `docs/experiments/2026-10-28-s0-7b-runbook.md` (the sha256 list there keeps its digests, only the path label changed).
Scripts and tools (24): `scripts/decode-sm120/jobs/sm120-replay-id.sh`, `scripts/e2e/codex/jobs/{947-e2e-replay,948-e2e-replay-arms,replay-template}.sh`, `scripts/e2e/decode/{drafttail-ab,drafttail-id,slots-footprint-ab,slots-id,speedtrain-ab,speedtrain2-ab,speedtrain2-id,speedtrain3-ab,speedtrain3-id}.sh`, `scripts/e2e/run-e2e.sh`, `scripts/memory/jobs/mem-common.sh`, `scripts/numerics/{100-numerics-ladder.sh,num_lad_tools.py}`, `scripts/perf3/common.sh`, `scripts/profile/jobs/ledger-common.sh`, `scripts/quality/q-common.sh` (also `ORIG_BIN`, the `stra169-ladder/build-sm120/strata` binary), `scripts/spec/spec-common.sh`, `scripts/startup-profile/{tmpl-load,tmpl-verify}.sh`, `tools/chain-probe/jobs/9c7-chain-vocab-replay.sh`, `tools/microbench/jobs/make_jobs.sh`.
`AGENTS.md` (Workspace layout): one bullet added, models live under `<work folder>/models/`.
Each script already had a single variable (`A=.../assets`, `G=...`, `ORIG_BIN=`, `--model-path`); only its value changed, no new mechanism.
### B. Server, live scripts (outside the repo, rewritten in place after the holder stopped)
`/data/leleka-e2e/decode/dt/jobs/*.sh` (26 files: dt-ab3, dt-ab7, dt-ab8, dt-eng, dt-eng2, dt-eng4, dt-id, dt-id2, dt-mem, dt-mem2, dt-mem3, dt-q, dt-q3, dt-q4, drafttail-ab, drafttail-id, ple-ab, ple-id, slots-footprint-ab, slots-footprint-ab2, slots-id, speedtrain-ab, speedtrain2-ab, speedtrain2-id, speedtrain3-ab, speedtrain3-id), `/data/leleka-e2e/decode/dt/scripts/e2e/run-e2e.sh` and `codex/jobs/{947,948,replay-template}`, `/data/leleka-e2e/parity-audit/scripts/e2e/run-e2e.sh` and `codex/jobs/{947,948,replay-template}`, `/data/leleka-e2e/sm120/jobs/sm120-replay-id.sh`, `/data/leleka-e2e/decode/jobs/decode-trace.sh`, `/data/leleka-e2e/decode/run_vanilla.sh`.
Not rewritten (reason): `/data/leleka-e2e/decode/dt/src/**` (a source snapshot of the repo used for builds, no job runs from it), run outputs under `/data/leleka-e2e/runs/**` and `decode/t1/vanilla/strata-launch/*.json` (records of past runs, evidence keeps its text), `decode/notes.md` (log, only appended).
### C. Server, outside the work folder (read only; only these were written)
* `~/work/gpu-runs/holder2/run_holder2.sh`: the holder start command (`kar_holder2.py $HOME/leleka-gates/assets/qwen-iq3-s-l2-v4.kar jobs`). Rewritten (authorised in the task); the old text is in `~/work/leleka/garbage/run_holder2.sh.pre-models-move`.
* `~/work/gpu-runs/holder2/jobs/PRIORITY` (backup `PRIORITY.bak-models-move`): `dt-id2`, `drafttail-ab`, `dt-ab8` removed (all three were already `.done`, so no effect on the queue) and `jobs/STOP` created and removed again for the holder stop.
* The smoke-test stub in `~/work/gpu-runs/holder2/jobs/`.
* Stale, read only, NOT rewritten (done jobs and old helper scripts of other trees; they would read the old copy, which the owner is about to delete): `~/work/gpu-runs/holder2/{dec-common.sh,seed-common.sh,spec-common.sh,run_holder.sh}`, 18+ done stubs in `holder2/jobs/` (e.g. 310-kv-long-context, 411-conversation-cache, 600/606/610 pool jobs, 702/707 prefill, 802/804/807 rounds, 930/931 deploy, 9c7, 9g2/9g6, 947, 992), `~/work/gpu-runs/numerics/*`, `~/work/gpu-runs/baseline/corpus/*` logs, `~/work/leleka-rest/**`, `~/work/leleka-e2e/scripts/**`, `~/work/vanilla-strata/control/{strata_cli/launch/cmd.py,docs}` (help text only). If any of them is run again it must be copied into the work folder and rewritten first.
* Vanilla Strata: model location comes from the `--model-path` argument of `strata launch` in the job scripts (B), not from a config file; `~/.local/share/strata/install/strata-iq3_s.json` holds a copy that the next launch regenerates.
* systemd units, cron: none reference the models.
### D. Laptop (read only; see the report)
Repo profiles `rtx3080-16g` / `rtx5090-32g` carry no model path (`--assets` / `LELEKA_ASSETS`). Scripts and docs that read the laptop models: `scripts/laptop/lap_run.sh` (`MODEL_DIR` default `$HOME/laptop/model`, `~/laptop/data/mtp-rt`, `~/laptop/data/expert-profile.bin`, `~/laptop/mtp-staging`), `scripts/memory/laptop_run.sh` (`$HOME/laptop/{model,data,mtp-staging}`), `scripts/startup-profile/laptop-verify.sh` (`~/laptop/model`), `docs/laptop-profile.md`, `docs/memory-safety.md`, `docs/windows.md` (`~/laptop` and the copy `~/leleka-assets` on the WSL ext4 disk, `D:\leleka-assets` for native runs), `scripts/windows/stage-model.ps1`. All of those paths are in the WSL home (`\\wsl.localhost\Ubuntu\home\para\...`) or on a Windows drive, i.e. outside `C:\Users\pavel\work\leleka`. Inside the work folder there are no `.gguf`, `.kar`, `dense.bin` or `.safetensors` files (searched to depth 6, build outputs excluded). On-disk sizes of the WSL copies were not measured: the owner rule "never browse outside the work folder on the laptop" applies, so only the documented locations are listed. Nothing on the laptop was moved or changed.
## Steps 2 and 3: move and verification (status at 2026-10-29 17:55Z, INTERRUPTED)
* 16:33Z `jobs/PRIORITY` backed up, three optional jobs dropped, `jobs/STOP` created. drafttail-id finished at 16:55Z; the holder exited by itself on STOP. The 55 GB memfd was still pinned by an orphaned `nvidia-smi -l 1` (pid 39569, parent init, 16 h old, writing to the deleted file `runs/sm120/base1/smi.csv`); it was terminated, after which `Shmem` fell from 54 GB to 1.7 MB and no process held a memfd. A `/proc/*/fd` scan found no open file under the model directories. `gpu.lock` was taken by this task (owner `models-move devops`) for the whole move.
* 16:56Z `mv /data/models/deepseek-v41-flash -> ~/work/leleka/models/deepseek-v41-flash`: same filesystem, 0.01 s, 17 entries, size listing before and after identical (`models/MOVE-deepseek-before.txt`, `MOVE-deepseek-after.txt`). `/data/models` is now an empty directory.
* 16:56Z-17:37Z `rsync -a` of `/home/para/leleka-gates/` to `models/leleka-gates/` (143.75 GB, 41 min, 56 MB/s because the root disk and `/data` are partitions of the same NVMe). rsync exit 23: 9 zero-byte cargo incremental `*.lock` files under `stra169-ladder/rust-cache/target/debug/incremental/` are root-owned and unreadable (irrelevant build artifacts, not copied); the two root-owned staging directories were excluded. File list and sizes of source and copy are otherwise identical (10,483 vs 10,474 files, the 9 missing are exactly those locks; 13 symlinks on both sides).
* sha256 of all 10,474 copied files finished at 17:45Z. The files that have recorded digests match them exactly: KAR `536d612c...a5` (recorded 2026-10-12, equals provenance `archive_sha256`), shards `4c1eb2ce...a3` and `316b46f3...61`, `iq3_s/dense.bin` `d2af3d83...13`, `expert-profile.bin` `8f59b4aa...baf` (equals `EXPERT_PROFILE_SHA256` in `crates/deploy/src/plan.rs`), `mtp-rt/{experts,dense,draft_vocab}.bin` `09398406`, `c724dc0b`, `b1e1d3a7`.
* The source-side sha256 pass (same script on `/home/para/leleka-gates`) was still running when the server stopped answering (17:49Z it was running, 17:5xZ sshd began resetting connections and `/usr/bin/pgrep` returned `Input/output error`: the root filesystem stopped serving reads). The file-by-file source-vs-copy hash comparison is therefore NOT done.
## Not done (server unreachable)
Source hash comparison, restart of the holder from the new paths, the smoke test (speedtrain3-ab, arms speedtrain3-noseed + v-def, RUN_TAG=m), merge into `main`. The live scripts on the server and `run_holder2.sh` already name the new paths, `gpu.lock` is still held by this task and `jobs/STOP` still exists (see the report for the recovery commands).
## Addendum 2026-10-30: why the first smoke arm failed (`leleka-load phase=Shard0 class=InvalidRequest`)
Cause: the copy was damaged, not the path. The NVMe aborted writes from 17:56Z (`nvme nvme0: I/O ... timeout, aborting req_op:WRITE`, journalctl -b -1) and the host rebooted; page-cache data that rsync had written was lost. After the reboot the copy had shard 1 at 52,210,696,192 bytes (source 54,817,524,224), shard 2 at 19,306,381,312 (source 28,800,138,432) and about 60 small files of the rust-cache with length 0. The sha256 pass at 17:45Z had read these files back from the page cache, so it did not see the loss. `VerifiedGgufFile::open` (crates/model-format/src/gguf.rs) has no symlink check and no path prefix check; `~/work/leleka` being a symlink is not involved, and no script needs the physical `/data/leleka-e2e/...` path.
Fix: `rsync -a --inplace --whole-file --bwlimit=80000 --fsync` of the same tree (84 GB re-sent, 03:00Z-03:20Z), then `dd iflag=direct | sha256sum` (bypasses the page cache) of the KAR, both shards, `dense.bin`, `expert-profile.bin` and the three MTP files: every digest equals the recorded one. Remaining difference to the source: the 9 unreadable zero-byte cargo `*.lock` files only. Lesson: after a bulk copy to this NVMe verify with direct IO and throttle the copy (the box aborts writes under sustained load); never trust a hash that was read through the page cache right after the copy.
Smoke rerun `models-smoke2` (ARMS `speedtrain3-noseed v-def`, RUN_TAG `m2`) started 03:23Z first in PRIORITY; the server stopped answering at about 04:30 local time before its result could be read.