AnonimousA commited on
Commit
5fb294f
Β·
verified Β·
1 Parent(s): 0d79102

Card: prefill section -- the 26.8 GiB PLE table and --lazy-mode on-direct (PR 28136), measured cold on Windows

Browse files
Files changed (1) hide show
  1. README.md +34 -1
README.md CHANGED
@@ -125,11 +125,44 @@ but leaves under 1 GiB free.
125
  > make sure your timer sees the reasoning stream** β€” and require two independent clocks to
126
  > agree before you believe a number.
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  ## Traps (measured, not theoretical)
129
 
130
  1. `--parallel > 1` requires `--kv-unified`.
131
  2. Empty `content` with tight `max_tokens`: reasoning burns the budget. Detect and retry with a higher cap.
132
- 3. First requests after a cold load pay disk; throughput climbs over ~3-4 requests to its warm ceiling.
133
  4. **`--spec-type draft-mtp` exists in llama.cpp mainline but does not work here.** Mainline has the flag and not the MTP graph for `qwen4exp`, nor the tensor borrowing the *shared* heads need; it fails with `model doesn't contain MTP layers`. Use Unsloth's build.
134
  5. `"reasoning_effort": "none"` returns **HTTP 500** β€” the chat template accepts only `xhigh` / `medium` / `low`.
135
 
 
125
  > make sure your timer sees the reasoning stream** β€” and require two independent clocks to
126
  > agree before you believe a number.
127
 
128
+ ## New (2026-09-06): prefill β€” the PLE table is why your prompt speed swings 3Γ—, and `--lazy-mode on-direct` fixes it
129
+
130
+ Flash-Next carries a 26.8 GiB per-layer-embedding table (`per_layer_token_embd.weight`, 320M rows Γ— 90 B) that
131
+ is untouched by expert pruning and stays on the host. llama.cpp reads it through `mmap`: one page fault per
132
+ ~90-byte row, on every token of the prompt. Whether those pages are in the OS cache decides your prefill
133
+ speed β€” and on a machine that also loads other 20–60 GB models, they usually are not. Our production log
134
+ showed 245–2652 tok/s on 11–25k-token prompts for exactly this reason, and repetitive benchmark prompts
135
+ (few distinct rows) hide it completely.
136
+
137
+ [PR #28136](https://github.com/ggml-org/llama.cpp/pull/28136) adds `--lazy-mode on-direct`: positioned reads
138
+ from a worker pool instead of demand faults. Measured on the `Q2/` build (RTX 5090, Windows 11, 95 GB RAM,
139
+ NVMe) with a genuinely cold cache (`RAMMap -Et` + fresh process per arm), a real 25k-token mixed prose+code
140
+ prompt, `cache_prompt: false`, two cycles:
141
+
142
+ | prefill tok/s | cold | warm (same prompt) | different rows, warm process |
143
+ |---|---:|---:|---:|
144
+ | `--lazy-mode on` (mmap, the default) | **167** | 681 | 442 |
145
+ | **`--lazy-mode on-direct`** | **621** | 656 | 619 |
146
+ | `--lazy-mode off` (table resident, +26.8 GiB RAM) | 590 | 673 | 573 |
147
+
148
+ `on-direct` is the one that gives the same number every time; `off` is fast while the resident table
149
+ survives but loses it whenever Windows trims the working set. With Unsloth's MTP head loaded (same
150
+ protocol): 259 β†’ 506 cold, 404 β†’ 604 on new rows, decode unchanged (72 tok/s). A 28k-token prompt now
151
+ prefills cold in 44 s instead of 74–152 s.
152
+
153
+ To use it today: the PR is still open, it is **POSIX-only as written** (Windows prints
154
+ `--lazy-mode on-direct is not supported on this platform` and silently falls back to mmap β€” you need
155
+ [this Windows port](https://gist.github.com/mjungnickel18/083da5cde978ca3b102952029d4a991a) from the PR
156
+ thread), and the prebuilt Unsloth binaries reject the value. We build Unsloth's b10798 mix source + the PR +
157
+ the Windows port, which keeps the MTP head working. Full numbers, including the Windows-native table, are
158
+ [in the PR thread](https://github.com/ggml-org/llama.cpp/pull/28136). If you cannot build:
159
+ `--lazy-mode off` (mainline and Unsloth builds accept it) gets most of the cold gain for 26.8 GiB of RAM.
160
+
161
  ## Traps (measured, not theoretical)
162
 
163
  1. `--parallel > 1` requires `--kv-unified`.
164
  2. Empty `content` with tight `max_tokens`: reasoning burns the budget. Detect and retry with a higher cap.
165
+ 3. First requests after a cold load pay disk; throughput climbs over ~3-4 requests to its warm ceiling. The disk cost is the PLE table (see the prefill section above); `--lazy-mode on-direct` removes it.
166
  4. **`--spec-type draft-mtp` exists in llama.cpp mainline but does not work here.** Mainline has the flag and not the MTP graph for `qwen4exp`, nor the tensor borrowing the *shared* heads need; it fails with `model doesn't contain MTP layers`. Use Unsloth's build.
167
  5. `"reasoning_effort": "none"` returns **HTTP 500** β€” the chat template accepts only `xhigh` / `medium` / `low`.
168