SPB Git

spb/localvm-research Public License

Running LLMs larger than memory on a consumer Mac — falsification-driven research: margin-gated deferred refinement, out-of-core verification on Apple Silicon. TR-01 published.

Python 63.2% JavaScript 23.5% CSS 11.8% Shell 0.9% Makefile 0.5%

Web v2: major visual upgrade, hamburger mobile menu, comments, SVG logo + Phase 11 novelty check

- Redesign: blur sticky header, hero gradient, elevated cards, footer grid
- Mobile: slide-down hamburger menu, full responsive pass
- Comments: persistent JSON storage (data/, excluded from deploys),
  honeypot + per-IP cooldown, public discussion page
- Logo: thesis-as-image (large model, small resident set) used as favicon
- research/novelty_check.md: components anticipated (QSpec, Lever, CATS,
  UGSD, SpecExec, mlx-flash); composition not found; 4 narrow surviving
  claims (N1-N4); attribution obligations recorded

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simon-Pierre Boucher committed 4 h ago (Aug 12, 2026) parent 8e50d75

Showing 8 changed files with +658 and −159

added experiments/candidate_01/scale32b_w64.log +29 −0
@@ -0,0 +1,29 @@
1 + Fetching 14 files: 0%| | 0/14 [00:00<?, ?it/s] Fetching 14 files: 100%|██████████| 14/14 [00:00<00:00, 5206.62it/s]
2 + Fetching 17 files: 0%| | 0/17 [00:00<?, ?it/s] Fetching 17 files: 100%|██████████| 17/17 [00:00<00:00, 6735.61it/s]
3 +loading q4 resident …
4 +q8 checkpoint (streamed): 34.8 GB
5 +baseline: pure q4 …
6 + 1/12 (96 tok, 24.1 tok/s)
7 + 2/12 (96 tok, 26.6 tok/s)
8 + 3/12 (96 tok, 26.5 tok/s)
9 + 4/12 (96 tok, 26.7 tok/s)
10 + 5/12 (96 tok, 26.6 tok/s)
11 + 6/12 (96 tok, 26.7 tok/s)
12 + 7/12 (96 tok, 26.6 tok/s)
13 + 8/12 (96 tok, 26.5 tok/s)
14 + 9/12 (96 tok, 26.5 tok/s)
15 + 10/12 (96 tok, 26.6 tok/s)
16 + 11/12 (96 tok, 26.5 tok/s)
17 + 12/12 (96 tok, 26.3 tok/s)
18 +runtime: mode=verify-all tau=2.0 W=64 …
19 + 1/12 (96 tok, 4 sweeps, 3 rollbacks, last sweep io 3.0s)
20 + 2/12 (96 tok, 10 sweeps, 9 rollbacks, last sweep io 2.9s)
21 + 3/12 (96 tok, 7 sweeps, 6 rollbacks, last sweep io 2.9s)
22 + 4/12 (96 tok, 4 sweeps, 3 rollbacks, last sweep io 3.0s)
23 + 5/12 (74 tok, 10 sweeps, 10 rollbacks, last sweep io 3.0s)
24 + 6/12 (96 tok, 15 sweeps, 15 rollbacks, last sweep io 2.8s)
25 + 7/12 (96 tok, 12 sweeps, 12 rollbacks, last sweep io 2.9s)
26 + 8/12 (85 tok, 11 sweeps, 11 rollbacks, last sweep io 3.0s)
27 + 9/12 (96 tok, 6 sweeps, 5 rollbacks, last sweep io 3.0s)
28 + 10/12 (95 tok, 11 sweeps, 11 rollbacks, last sweep io 3.0s)
29 + 11/12 (93 tok, 13 sweeps, 13 rollbacks, last sweep io 3.0s)
modified research/LOG.md +31 −0
@@ -309,3 +309,34 @@ Format per entry: date/time (local, with timezone) · question · experiment ·
309 309 no window tuning.
310 310 - **Decision:** Phase 11 novelty check on the assembled architecture next; then throughput
311 311 levers or additional scale points.
312 +
313 +---
314 +
315 +## 2026-08-12 — Phase 11 novelty verification: composition survives narrowly; three components anticipated
316 +
317 +- **Question:** Charter §19 — is the candidate_01 architecture (resident q4 + margin-gated
318 + deferral + periodically streamed q8 verifier, bytes/token objective) already in the
319 + literature? Adversarial stance: assumed NOT novel.
320 +- **Experiment:** Targeted web/arXiv/GitHub search per component and for the composition
321 + (~45 sources verified, key papers read from full PDFs). Deliverable:
322 + `research/novelty_check.md`.
323 +- **Result:** Three 2025–2026 systems missed by the Phase 1 sweep materially shrink the
324 + claim: **Lever** (2605.16786 — DRAM-resident draft + flash-streamed target verifier,
325 + amortized per window, smartphones), **CATS** (2605.11186 — self-speculative shallow draft
326 + + verifier layers streamed from flash once per cycle, edge), **U-HLM/UGSD**
327 + (2412.12687 / 2603.11397 — draft-side uncertainty gates whether verification happens at
328 + all, cloud tier, incl. lossy top-R acceptance + rollback). QSpec/QuantSpec/ML-SpecQD own
329 + the shared-weights precision pair; mlx-flash owns MLX layer streaming
330 + (materialize→compute→release, every token).
331 +- **Interpretation:** "Resident draft + streamed verifier" and "uncertainty-gated
332 + verification skipping" are ANTICIPATED as categories. Surviving as not-found: (N1)
333 + margin-gating the **weight-streaming bytes** of the same model's higher-precision variant
334 + on one machine; (N2) bytes-streamed-per-token vs checkpoint size as explicit objective,
335 + with τ as a runtime bytes↔quality knob; (N3) the training-free same-checkpoint q4/q8 pair
336 + as the draft/verify split of an out-of-core runtime; (N4, engineering) the unified-memory
337 + Metal instantiation with incremental verify-KV-cache. All public claims must use the
338 + attribution table and README language in novelty_check.md §3–§4.
339 +- **Decision:** Proceed with narrowed claims only. Positioning for any writeup: extend
340 + Lever/CATS's regime with (a) precision-cast drafts (no training), (b) margin-priced
341 + verification I/O, (c) bytes/token accounting. Re-run this check before publication —
342 + prior-art density in this exact area is rising quarter over quarter.
added research/novelty_check.md +246 −0
@@ -0,0 +1,246 @@
1 +---
2 +project: localvm-research
3 +document: research/novelty_check
4 +author: Simon-Pierre Boucher
5 +contact: contact@spboucher.ai
6 +created: 2026-08-12
7 +status: draft
8 +---
9 +
10 +# Phase 11 — Novelty verification of candidate_01 (margin-gated deferred refinement with a streamed verifier)
11 +
12 +**Method.** Per charter §19, the working assumption was **NOT NOVEL until evidence suggests
13 +otherwise**. The search was adversarial: for each component of the architecture, and for the
14 +composition, I searched for conceptual equivalents (not just identical terminology) across
15 +arXiv (with emphasis on 2025–2026, i.e., after the Phase 1 sweep of 2026-08-11), ACL/EMNLP,
16 +MLSys/OSDI/ASPLOS-adjacent venues, OpenReview, and the llama.cpp / MLX / mlx-lm GitHub
17 +ecosystems. All sources are listed in §5 with access date 2026-08-12. The two closest prior
18 +systems (Lever, CATS — both May 2026, both absent from the Phase 1 notes) were read from
19 +their full PDFs, not abstracts.
20 +
21 +---
22 +
23 +## 1. The architecture under check (précis)
24 +
25 +A single-machine runtime for unified-memory consumer hardware (Apple Silicon, MLX/Metal):
26 +
27 +- A **q4 quantization of the model is resident** and decodes greedily at full speed,
28 + recording the top-1 logit margin of every token decision; **low-margin decisions are
29 + deferred** (margin mode) rather than escalated immediately.
30 +- Every W tokens (W=32 measured), a **q8 variant of the same model — which does not fit in
31 + memory beside the base** — is **streamed layer-by-layer from NVMe**
32 + (materialize → compute → re-lazify; one strictly sequential pass over the checkpoint per
33 + sweep at the SSD device ceiling, ~11.6 GB/s) and **teacher-forces the window in one pass**
34 + against a **persistent incremental q8 KV cache** (O(window), not O(context)).
35 +- On the first flip (checked at deferred positions only in margin mode; at all positions in
36 + verify-all mode) the runtime **rolls back via KV-cache trim**, accepts the q8 token, and
37 + resumes. Acceptance is deliberately approximate in margin mode (unchecked
38 + high-margin positions are trusted); verify-all is greedy-exact up to Metal numerics.
39 +- **Objective and headline metric: bytes streamed per generated token**, decoupled from
40 + checkpoint size (9.4× under the q8 checkpoint at W=32 on Qwen3-32B); the margin threshold
41 + τ is a runtime knob trading bytes for quality (47%/83%/~100% of the q4→q8 quality gap at
42 + 150/211/237 MB/token on 1.7B; +0.28 nats over pure-q4 at 32B where q8 cannot run at all).
43 +
44 +---
45 +
46 +## 2. Per-component prior-art tables
47 +
48 +Verdict scale: **ANTICIPATED** (the component exists in print, differences are cosmetic) ·
49 +**PARTIALLY ANTICIPATED** (the idea exists but in a materially different setting or without a
50 +load-bearing property) · **NOT FOUND** (no conceptual equivalent located).
51 +
52 +### 2.1 Precision-tiered self-speculation (q4 draft / q8 verify, shared weights)
53 +
54 +| Closest prior art | What it does | What it does NOT do | Verdict |
55 +|---|---|---|---|
56 +| **QSpec** (EMNLP 2025, arXiv 2410.11305) | Same W4 weights; W4A4 draft, W4A16 verify; near-zero switching cost; lossless; 1.64× | Both operand sets resident; verifies every token; objective is arithmetic speed, not capacity or bytes/token | ANTICIPATED (core mechanism) |
57 +| **QuantSpec** (Apple+Berkeley, ICML 2025) | Self-speculation with 4-bit weights + 4-bit hierarchical KV draft, full-precision verify; >90% acceptance; edge-motivated | Full-precision verifier fully resident and fully read; lossless only; latency objective | ANTICIPATED (core mechanism) |
58 +| **ML-SpecQD** (arXiv 2503.13565) | MXFP4 direct cast of the target as turnkey draft (no training), 16-bit verify, >2× | Same: verifier resident; verify-all; latency framing | ANTICIPATED (core mechanism) |
59 +| Sub-variant (a) verifier kept OUT of memory / streamed | **Lever** and **CATS** stream their verifier from flash (see §2.3/2.4) — but their drafts are a separate small model (Lever) or a distilled shallow sub-network (CATS), **never a precision cast of the same weights** | No published system pairs a low-bit resident cast with a streamed higher-precision variant of the *same* checkpoint | NOT FOUND (within the precision-tier family) |
60 +| Sub-variant (b) verify only uncertainty-flagged positions | Exists outside this family (U-HLM, UGSD, SPRINTER — §2.2) | No precision-tiered system gates which positions are verified | NOT FOUND (within the precision-tier family) |
61 +| Sub-variant (c) deliberately approximate acceptance | Rich lossy-verification literature (§2.2): rank/top-R acceptance, judge heads, relaxed acceptance in TensorRT-LLM/SGLang; BiLD thresholds; taxonomy in arXiv 2607.26627 | Not combined with precision tiers or a storage tier | ANTICIPATED (in other settings) |
62 +| Sub-variant (d) bytes-per-token objective | SpecExec's economics *imply* bytes/token ÷ acceptance length; CATS names flash↔DRAM traffic as the bottleneck | Nobody states or reports **bytes-streamed-per-token vs checkpoint size** as the optimization target and headline result | NOT FOUND |
63 +
64 +### 2.2 Confidence/margin-gated selective verification or escalation
65 +
66 +| Closest prior art | What it does | What it does NOT do | Verdict |
67 +|---|---|---|---|
68 +| **U-HLM** (arXiv 2412.12687, IEEE 2025) — the sharpest hit | On-device SLM drafts; tokens whose on-device uncertainty ≤ threshold **skip uplink transmission and LLM verification entirely** (74.8% of uplinks skipped); rejection-behavior predicted from draft-side uncertainty | Uncertainty via temperature-perturbation consistency, not logit margin; expensive tier is a **remote different model**, cost is radio bytes, not weight-streaming I/O; no rollback of committed tokens; no storage tier | PARTIALLY ANTICIPATED |
69 +| **UGSD** (arXiv 2603.11397, Mar 2026) | Edge draft; **entropy-gated escalation of only high-uncertainty token blocks** to a cloud verifier; top-R rank acceptance (lossy); suffix discarded on correction (rollback); adaptive block length; only 18.2% of tokens escalated | Cloud tier (communication cost), different model as verifier, domain-specific (speech emotion captioning); no weight streaming; no bytes/token framing | PARTIALLY ANTICIPATED |
70 +| **SPRINTER** (arXiv 2502.04557) | Tiny learned verifier predicts whether the target would accept; **target LLM invoked only when a token is deemed unacceptable** (approximate, not exact) | Verifier is a learned classifier, not the draft's own margin; both models resident; no storage tier | PARTIALLY ANTICIPATED |
71 +| **BiLD** (NeurIPS 2023) | Small model decodes; confidence-threshold fallback to large model + distance-threshold rollback of recent tokens | Two separate resident models; no storage tier; no exactness mode; latency objective | ANTICIPATED (gating + rollback pattern) |
72 +| **CALM** (NeurIPS 2022) / cascades (FrugalGPT, RouteLLM) | Margin/confidence-calibrated early exit with distribution-free risk control; request-level routing to expensive models | Depth axis / request granularity; nothing about weight loading | ANTICIPATED (signal + calibration recipe) |
73 +| Token-level margin gating of a **weight-loading (SSD-streaming) decision** | — | Searched: "uncertainty triggered precision escalation", "confidence-gated weight loading", "margin-gated verification bytes", dynamic-precision line (PMPD, HOBBIT, DP-LLM — all feed-forward, no verification), lossy-verification taxonomy (2607.26627 — no memory-constrained verifier) | **NOT FOUND** |
74 +
75 +### 2.3 Layer-by-layer weight streaming from storage during a forward pass (unified memory)
76 +
77 +| Closest prior art | What it does | What it does NOT do | Verdict |
78 +|---|---|---|---|
79 +| **AirLLM** (lyogavin/airllm) / **ZeRO-Inference** | Layer-by-layer load→compute→free; capacity decoupling only | Streams the whole model for **every token**; no draft; no selectivity | ANTICIPATED (streaming primitive) |
80 +| **mlx-flash** (GitHub, matt-k-wong) | Exactly materialize→compute→release per layer **in MLX on Apple Silicon** (StreamingProxy wrapping, predictive I/O scheduler prefetching layer N+1 during layer N); "30B on 16 GB, 70B+ on 32 GB+" | Streams on every token; **no draft/verify role for the streamed model**; no periodicity, no quality tiering | ANTICIPATED (the MLX materialize→compute→re-lazify scheduling itself is not ours) |
81 +| **mlx-moe**, **vMLX**, MLX issue #2878, MLX discussion #615 | SSD expert streaming for MoE in MLX; open feature request for out-of-core streaming (Dec 2025); maintainer position that weights must be materialized/wired for GPU use | Nothing combines a streamed model with a resident draft; #2878 does not mention speculation | supports NOT FOUND for the verifier-role variant |
82 +| **Lever** (arXiv 2605.16786, May 2026) | **DRAM-resident draft, flash-resident target streamed at each verification invocation** on smartphones; "the SSM can remain resident in DRAM … the LLM can be stored in flash and invoked only intermittently"; I/O is 78–93% of verification latency (their Table 1) | Separate small draft model (not same weights); CPU/NPU + UFS, not unified-memory Metal; verification invoked every speculative cycle (no margin-gated skipping); lossless greedy acceptance; latency objective | ANTICIPATED (streamed-verifier-while-resident-draft as a category) |
83 +| **CATS** (arXiv 2605.11186, May 2026) | Self-speculative on edge: shallow sub-network drafts under the DRAM budget; intermediate layers "**streamed from flash once per cycle**" for shallow verification; remaining layers "offloaded from the flash chunk by chunk" for target verify; peak memory = target model alone; 5.08× | Draft axis is **depth** (+ Reduced-KL distillation training), not a training-free precision cast; verification every cycle, not margin-deferred; no bytes/token metric; GPU/edge-Linux, not MLX/Metal | ANTICIPATED (periodic flash-streamed verifier, window-amortized) |
84 +| **llama.cpp discussion #10466** (Nov 2024) | Public proposal: fully-resident speculator + target layers ping-ponged into VRAM from CPU RAM for verification | Never implemented; CPU-RAM/PCIe tier, not SSD; verify-all, exact | corroborates ANTICIPATED (idea circulating) |
85 +
86 +### 2.4 Windowed/batched deferred verification with rollback, where verifier cost is I/O
87 +
88 +| Closest prior art | What it does | What it does NOT do | Verdict |
89 +|---|---|---|---|
90 +| **SpecExec** (NeurIPS 2024) | Huge draft trees verified by a RAM-offloaded 70B in one pass; ~20 accepted tokens per full-model weight sweep; 10.6–18.7× over sequential offloaded decoding — the amortization economics of one weight sweep per window | Separate 7B draft; CUDA/PCIe; exact sampling; never states bytes/token as metric | ANTICIPATED (window-amortized I/O-bound verification) |
91 +| **Lever / CATS** (above) | Explicitly amortize flash reads of the verifier over the accepted window ("the cost of loading and executing the LLM is amortized across several output tokens" — Lever §1) | See §2.3 | ANTICIPATED |
92 +| **SpecOffload** (arXiv 2505.10259) / **SpecMoEOff** (arXiv 2508.21706) / **SpecInfer** (ASPLOS 2024) / **TriForce** (COLM 2024) | Speculation embedded into offloading pipelines (weights or KV) to hide transfer latency; TriForce: resident sparse-KV draft of the same weights, offloaded full KV verify | Throughput/batch regimes; PCIe tiers; verify-all; exact | ANTICIPATED |
93 +| Rollback via KV-cache trim on first flip | Standard speculative-decoding machinery; BiLD rollback policy; UGSD suffix discard | — | ANTICIPATED (not claimable at all) |
94 +| Window-amortized verification whose cost is I/O **and** whose frequency/coverage is margin-gated | — | Lever/CATS/SpecExec verify every window; U-HLM/UGSD gate but have no weight I/O | NOT FOUND |
95 +
96 +### 2.5 The composition as a whole
97 +
98 +Search phrasings tried (plus synonyms): "resident draft streamed verifier", "quantized draft
99 +full model verification SSD", "deferred verification language model rollback", "amortized
100 +weight streaming verification", "two-tier quantization runtime offload verify", "speculative
101 +decoding out-of-core verifier", "verifier offloading speculative decoding", "uncertainty
102 +triggered precision escalation", "self-speculative decoding offloading edge", "flash-backed
103 +target model speculative decoding", plus GitHub sweeps of llama.cpp / ik_llama.cpp / mlx /
104 +mlx-lm issues and community MLX streaming projects.
105 +
106 +| Candidate | Overlap with our composition | Decisive differences |
107 +|---|---|---|
108 +| **CATS** (May 2026) — nearest overall | Resident cheap variant of the model drafts; verifier layers streamed from flash once per window; rollback; single memory-limited device; peak memory = one model | Cheap variant is a **depth truncation requiring distillation training**, not a training-free precision cast; **every** cycle verified (no margin deferral; no τ knob; no approximate mode); metric is wall-clock speedup, not bytes/token; not unified-memory/Metal |
109 +| **Lever** (May 2026) | DRAM-resident draft + flash-streamed target verifier, invocation cost amortized over the accepted window; I/O identified as the dominant verification cost | Separate draft model (no shared weights / no precision pair); verification never skipped by draft confidence; lossless; smartphone NPU/UFS |
110 +| **U-HLM + UGSD** (Dec 2024 / Mar 2026) | Draft-side uncertainty gates whether the expensive tier is invoked at all; UGSD adds block granularity, lossy top-R acceptance and suffix rollback | Expensive tier is a **remote, different** model; the gated cost is communication, not weight-streaming bytes; nothing resides on or streams from storage |
111 +| **QSpec / QuantSpec / ML-SpecQD** | The q4-drafts / q8-verifies-with-shared-weights pair, proven acceptance >90% | Verifier resident; verify-all; arithmetic-latency objective |
112 +
113 +**Composition verdict: NOT FOUND as assembled — but only by the conjunction, and the margin
114 +is thin.** Every load-bearing part exists separately, three of them in systems published
115 +in 2025–2026 that the Phase 1 sweep missed (Lever, CATS, UGSD). Prior-art density around
116 +this exact point is increasing quarter over quarter.
117 +
118 +---
119 +
120 +## 3. Honest bottom line — what survives, what must be attributed
121 +
122 +**Must be attributed (do not claim):**
123 +
124 +1. *Precision-tiered draft/verify on shared weights***QSpec, QuantSpec, ML-SpecQD** own it.
125 +2. *Resident draft + storage-streamed verifier, amortized over a token window***Lever**
126 + and **CATS** own the category (with SpecExec owning the amortization economics and
127 + llama.cpp #10466 as a public 2024 proposal). Our verify-all mode is, at the category
128 + level, "Lever/CATS with a precision-cast draft on Apple Silicon."
129 +3. *Uncertainty-gated skipping of verification / escalation to an expensive tier* — **U-HLM,
130 + UGSD, SPRINTER**, with the older lineage **BiLD / CALM / cascades**.
131 +4. *Deliberately lossy acceptance* — the relaxed/lossy-verification literature (top-R rank
132 + acceptance in UGSD; judge/relaxed acceptance lines; taxonomy in arXiv 2607.26627).
133 +5. *Rollback via KV trim; teacher-forcing a window in one pass* — standard speculative
134 + decoding machinery.
135 +6. *Layer-by-layer materialize→compute→release streaming in MLX on Apple Silicon*
136 + **mlx-flash** (and AirLLM/ZeRO-Inference generically). We did not invent the scheduling
137 + pattern; we gave the streamed pass a verifier role.
138 +
139 +**Surviving as (narrowly) novel contributions:**
140 +
141 +- **N1 — Margin-gated deferral of verification *bytes*.** Using the resident draft's top-1
142 + logit margin to decide **whether higher-precision weights are streamed from local storage
143 + at all** (which positions a sweep must check, and hence how much I/O the quality repair
144 + costs). Every located gating system gates compute or communication to a *different,
145 + remote or resident* model; none gates the weight-streaming I/O of the *same* model's
146 + higher-precision representation. NOT FOUND after targeted search.
147 +- **N2 — Bytes-streamed-per-token as the explicit objective**, reported against checkpoint
148 + size (9.4× under at W=32), with the τ threshold exposed as a **runtime bytes↔quality
149 + knob** (47%→83%→~100% of the q4→q8 gap at 150→211→237 MB/token). Dynamic-precision
150 + systems (PMPD, HOBBIT, DP-LLM) have precision knobs without verification; lossy
151 + verification has quality knobs without a storage tier; no system prices quality in
152 + bytes-of-weights-streamed. NOT FOUND as a stated objective/metric.
153 +- **N3 — The training-free same-checkpoint precision pair as the draft/verify split of an
154 + out-of-core runtime** (q4 resident / q8 streamed, no distillation, no auxiliary model),
155 + making "quality level that does not fit in RAM" usable on unified memory — demonstrated
156 + where the alternative (resident q8) is physically impossible (32B on 48 GB), judged
157 + +0.28 nats over the only configuration that fits. The conjunction is unoccupied; each
158 + half is not.
159 +- **N4 (engineering, weaker) — The unified-memory instantiation**: strictly sequential
160 + sweep at SSD device ceiling, persistent incremental verify-KV-cache (O(window) sweeps)
161 + with trim-rollback, measured on Metal with the prefill/decode numerics ceiling
162 + identified. Claimable only as a measured system contribution on this platform, not as a
163 + concept.
164 +
165 +**Claims that are now weaker than when candidate_01 was designed:** "first
166 +resident-draft/streamed-verifier runtime" (false — Lever, CATS), "first selective
167 +verification by draft uncertainty" (false — U-HLM, SPRINTER, UGSD), "first
168 +precision-pair self-speculation" (false — QSpec family), "first out-of-core amortized
169 +verification" (false — SpecExec, Lever, CATS).
170 +
171 +---
172 +
173 +## 4. Recommended claim language for the README (defensible phrasing)
174 +
175 +> **What is new here is the conjunction, and two specific properties of it.** Precision-pair
176 +> self-speculation (QSpec, QuantSpec, ML-SpecQD), storage-streamed verifiers behind a
177 +> resident draft (Lever, CATS), window-amortized verification of an offloaded target
178 +> (SpecExec), and uncertainty-gated escalation (BiLD, CALM, U-HLM, UGSD) all exist
179 +> separately. To our knowledge, no prior system (i) uses the draft's own top-1 logit margin
180 +> to gate **how many bytes of higher-precision weights are streamed from local NVMe** to
181 +> repair quality — making the margin threshold τ a runtime knob that prices output quality
182 +> in bytes-per-token — and (ii) does so with a **training-free precision pair of the same
183 +> checkpoint** (4-bit resident, 8-bit streamed) on unified-memory hardware, so that a
184 +> quality level whose weights cannot reside in RAM remains usable, with bytes streamed per
185 +> token decoupled from checkpoint size (measured 9.4× under the streamed checkpoint at
186 +> W=32). We explicitly do not claim novelty for precision-tiered drafting, streamed
187 +> verification, windowed rollback, or confidence-gated escalation taken individually; the
188 +> attribution table in `research/novelty_check.md` maps each component to its prior art.
189 +
190 +Avoid in all public text: "first", "novel runtime" unqualified, "no one has streamed a
191 +verifier", "quality becomes a runtime variable" without the qualifier *via verification
192 +bytes* (dynamic-precision papers already make quality a runtime variable without
193 +verification).
194 +
195 +---
196 +
197 +## 5. Sources
198 +
199 +All accessed 2026-08-12.
200 +
201 +- QSpec: Speculative Decoding with Complementary Quantization Schemes (EMNLP 2025) — https://arxiv.org/abs/2410.11305 (accessed 2026-08-12)
202 +- QuantSpec: Self-Speculative Decoding with Hierarchical Quantized KV Cache (Apple, ICML 2025) — https://machinelearning.apple.com/research/quantspec (accessed 2026-08-12)
203 +- ML-SpecQD: Multi-Level Speculative Decoding with Quantized Drafts — https://arxiv.org/pdf/2503.13565 (accessed 2026-08-12)
204 +- Lever: Speculative LLM Inference on Smartphones (Wang et al., May 2026) — https://arxiv.org/pdf/2605.16786 (accessed 2026-08-12)
205 +- CATS: Cascaded Adaptive Tree Speculation for Memory-Limited LLM Inference Acceleration (Han et al., May 2026) — https://arxiv.org/abs/2605.11186 (accessed 2026-08-12)
206 +- CATS code repository — https://github.com/ElizaFuLan/CATS.git (accessed 2026-08-12, via paper)
207 +- LLMCad: Fast and Scalable On-device Large Language Model Inference — https://arxiv.org/pdf/2309.04255 (accessed 2026-08-12)
208 +- EdgeLLM: Fast On-Device LLM Inference With Speculative Decoding (IEEE TMC) — https://ieeexplore.ieee.org/document/10812936/ (accessed 2026-08-12)
209 +- Dovetail: A CPU/GPU Heterogeneous Speculative Decoding for LLM inference (EMNLP 2025) — https://arxiv.org/abs/2412.18934 (accessed 2026-08-12)
210 +- SpecOffload: Unlocking Latent GPU Capacity for LLM Inference on Resource-Constrained Devices — https://arxiv.org/html/2505.10259v2 (accessed 2026-08-12)
211 +- Accelerating Mixture-of-Experts Inference by Hiding Offloading Latency with Speculative Decoding (SpecMoEOff) — https://arxiv.org/abs/2508.21706 (accessed 2026-08-12)
212 +- SpecExec: Massively Parallel Speculative Decoding for Interactive LLM Inference on Consumer Devices (NeurIPS 2024) — https://arxiv.org/html/2406.02532v1 (accessed 2026-08-12, re-verified)
213 +- SpecInfer: Accelerating LLM Serving with Tree-based Speculative Inference and Verification (ASPLOS 2024) — https://arxiv.org/abs/2305.09781 (accessed 2026-08-12, re-verified)
214 +- TriForce: Lossless Acceleration of Long Sequence Generation with Hierarchical Speculative Decoding (COLM 2024) — https://arxiv.org/abs/2404.11912 (accessed 2026-08-12)
215 +- MemSpec: Memory-Aware Runtime for Adaptive Draft Scheduling in Speculative Decoding on Edge Devices (LCTES 2026) — https://doi.org/10.1145/3814943.3816174 (accessed 2026-08-12)
216 +- HiSpec: Hierarchical Speculative Decoding for LLMs — https://arxiv.org/abs/2510.01336 (accessed 2026-08-12)
217 +- SPRINTER: Speeding up Speculative Decoding via Sequential Approximate Verification — https://arxiv.org/abs/2502.04557 (accessed 2026-08-12)
218 +- U-HLM: Uncertainty-Aware Hybrid Inference with On-Device Small and Remote Large Language Models — https://arxiv.org/abs/2412.12687 (accessed 2026-08-12)
219 +- Communication-Efficient Hybrid Language Model via Uncertainty-Aware Opportunistic and Compressed Transmission — https://arxiv.org/pdf/2505.11788 (accessed 2026-08-12)
220 +- Edge–Cloud Collaborative Speech Emotion Captioning via Token-Level Speculative Decoding (UGSD, Mar 2026) — https://arxiv.org/html/2603.11397v1 (accessed 2026-08-12)
221 +- Quantize-Sample-and-Verify: LLM Acceleration via Adaptive Edge-Cloud Speculative Decoding — https://arxiv.org/pdf/2507.00605 (accessed 2026-08-12)
222 +- Fast and Cost-effective Speculative Edge-Cloud Decoding with Early Exits — https://arxiv.org/abs/2505.21594 (accessed 2026-08-12)
223 +- DSD: A Distributed Speculative Decoding Solution for Edge-Cloud Agile Large Model Serving — https://arxiv.org/pdf/2511.21669 (accessed 2026-08-12)
224 +- Speculative Decoding with Big Little Decoder (BiLD, NeurIPS 2023) — https://arxiv.org/abs/2302.07863 (accessed 2026-08-12, re-verified)
225 +- Confident Adaptive Language Modeling (CALM, NeurIPS 2022) — https://arxiv.org/abs/2207.07061 (accessed 2026-08-12, re-verified)
226 +- Revisiting Lossy Verification in Speculative Decoding: Mechanisms, Trade-offs, and Failure Modes (Jul 2026) — https://arxiv.org/abs/2607.26627 (accessed 2026-08-12)
227 +- Training-Free Loosely Speculative Decoding: Accepting Semantically Correct Drafts Beyond Exact Match (FLy) — https://arxiv.org/pdf/2511.22972 (accessed 2026-08-12)
228 +- A Practical Investigation of Training-free Relaxed Speculative Decoding — https://arxiv.org/html/2607.08690 (accessed 2026-08-12)
229 +- Spec-VLA: Speculative Decoding for Vision-Language-Action Models with Relaxed Acceptance — https://arxiv.org/html/2507.22424v1 (accessed 2026-08-12)
230 +- When Is a Draft Accepted? A Theory of Acceptance in Speculative Decoding — https://arxiv.org/html/2606.30265 (accessed 2026-08-12)
231 +- Statistically-Lossless Quantization of Large Language Models (EAR metric; static, no runtime escalation) — https://arxiv.org/pdf/2605.02404 (accessed 2026-08-12)
232 +- Mixed-Precision Quantization for Language Models: Techniques and Prospects (incl. HOBBIT precision-on-miss loading) — https://arxiv.org/html/2510.16805v1 (accessed 2026-08-12)
233 +- Progressive Mixed-Precision Decoding for Efficient LLM Inference (PMPD) — https://arxiv.org/pdf/2410.13461 (accessed 2026-08-12, re-verified)
234 +- Lossless but Not Free: An Empirical Anatomy of Speculative Decoding on Consumer Hardware (Jul 2026) — https://arxiv.org/html/2607.17283v1 (accessed 2026-08-12)
235 +- Speculative Speculative Decoding (ICLR 2026) — https://arxiv.org/pdf/2603.03251 (accessed 2026-08-12)
236 +- llama.cpp discussion #10466: Speculative decoding potential for running big LLMs on consumer grade GPUs (resident speculator + layer ping-pong proposal, unimplemented) — https://github.com/ggml-org/llama.cpp/discussions/10466 (accessed 2026-08-12)
237 +- llama.cpp issue #21453: Research: Speculative Decoding for Low-Latency CPU Inference — https://github.com/ggml-org/llama.cpp/issues/21453 (accessed 2026-08-12)
238 +- ik_llama.cpp discussion #839: speculative decoding via network — https://github.com/ikawrakow/ik_llama.cpp/discussions/839 (accessed 2026-08-12)
239 +- mlx-flash: Flash weight streaming for MLX (per-layer StreamingProxy, predictive I/O, every-token streaming, no draft/verify) — https://github.com/matt-k-wong/mlx-flash (accessed 2026-08-12)
240 +- MLX issue #2878: On-disk (out-of-core) streaming of model weights for low-RAM inference (Dec 2025; no speculation proposed) — https://github.com/ml-explore/mlx/issues/2878 (accessed 2026-08-12)
241 +- mlx-moe: router-selected expert streaming from SSD with MLX — https://github.com/mu-hashmi/mlx-moe (accessed 2026-08-12)
242 +- vMLX: SSD expert streaming + disk cache for MoE on Apple Silicon — https://github.com/jjang-ai/vmlx (accessed 2026-08-12)
243 +- dflash-mlx: Lossless DFlash speculative decoding for MLX (adaptive verify block, KV SSD spill; target resident) — https://github.com/bstnxbt/dflash-mlx (accessed 2026-08-12)
244 +- MLX discussion #615: Loading models with mmap (0.025 tok/s overflow result) — https://github.com/ml-explore/mlx/discussions/615 (accessed 2026-08-12, re-verified)
245 +- LLM in a flash: Efficient LLM Inference with Limited Memory (Apple) — https://arxiv.org/abs/2312.11514 (accessed 2026-08-12, re-verified)
246 +- AirLLM (layer-by-layer streaming baseline) — https://github.com/lyogavin/airllm (accessed 2026-08-12)
modified web/lib/render.js +27 −6
@@ -132,6 +132,7 @@ const NAV = [
132 132 ["/results", "Results"],
133 133 ["/code", "Code"],
134 134 ["/doc/research/bibliography.md", "Bibliography"],
135 + ["/comments", "Comments"],
135 136 ["/about", "About"],
136 137 ];
137 138
@@ -150,21 +151,41 @@ function layout({ title, active, body, buildInfo = {} }) {
150 151 <title>${esc(title)} · localvm-research</title>
151 152 <meta name="description" content="localvm-research — running LLMs larger than memory on consumer Apple Silicon. Research by Simon-Pierre Boucher.">
152 153 <link rel="stylesheet" href="/static/style.css">
153 <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='0.9em' font-size='90'>🧠</text></svg>">
154 +<link rel="icon" type="image/svg+xml" href="/static/logo.svg">
155 +<link rel="apple-touch-icon" href="/static/logo.svg">
154 156 </head>
155 157 <body>
156 158 <header class="site-header">
157 159 <div class="wrap header-row">
158 <a class="brand" href="/">localvm<span class="brand-dim">-research</span></a>
159 <nav class="site-nav">${nav}</nav>
160 + <a class="brand" href="/"><img class="brand-logo" src="/static/logo.svg" alt="" width="26" height="26">localvm<span class="brand-dim">-research</span></a>
161 + <button class="nav-toggle" id="nav-toggle" aria-label="Menu" aria-expanded="false">
162 + <span></span><span></span><span></span>
163 + </button>
164 + <nav class="site-nav" id="site-nav">${nav}</nav>
160 165 </div>
161 166 </header>
162 167 <main class="wrap">${body}</main>
163 168 <footer class="site-footer">
164 <div class="wrap">
165 <span>© 2026 Simon-Pierre Boucher — <a href="mailto:contact@spboucher.ai">contact@spboucher.ai</a> · All rights reserved (research code)</span>
166 <span class="footer-meta">snapshot ${esc(commit)}${synced ? " · synced " + esc(synced) : ""} · Apple M5 Max / 48 GB / macOS 27</span>
169 + <div class="wrap footer-grid">
170 + <div>
171 + <span class="footer-brand">localvm-research</span>
172 + <p class="footer-tag">Running LLMs larger than memory on consumer Apple Silicon —
173 + an open, falsification-driven research trail.</p>
174 + </div>
175 + <div class="footer-col">
176 + <span class="footer-h">Project</span>
177 + <a href="/doc/CLAUDE.md">Charter</a>
178 + <a href="/doc/research/LOG.md">Research log</a>
179 + <a href="/experiments">Experiments</a>
180 + </div>
181 + <div class="footer-col">
182 + <span class="footer-h">Author</span>
183 + <span>Simon-Pierre Boucher</span>
184 + <a href="mailto:contact@spboucher.ai">contact@spboucher.ai</a>
185 + <span class="footer-meta">snapshot ${esc(commit)}${synced ? " · " + esc(synced) : ""}</span>
186 + </div>
167 187 </div>
188 + <div class="wrap footer-legal">© 2026 Simon-Pierre Boucher · All rights reserved (research code) · Apple M5 Max / 48 GB / macOS 27</div>
168 189 </footer>
169 190 <script src="/static/app.js" defer></script>
170 191 </body>
modified web/public/app.js +19 −0
@@ -11,6 +11,25 @@
11 11 // ============================================================================
12 12 "use strict";
13 13
14 +// mobile hamburger menu
15 +(function () {
16 + const toggle = document.getElementById("nav-toggle");
17 + const nav = document.getElementById("site-nav");
18 + if (!toggle || !nav) return;
19 + toggle.addEventListener("click", () => {
20 + const open = nav.classList.toggle("open");
21 + toggle.classList.toggle("open", open);
22 + toggle.setAttribute("aria-expanded", String(open));
23 + });
24 + nav.addEventListener("click", (e) => {
25 + if (e.target.tagName === "A") {
26 + nav.classList.remove("open");
27 + toggle.classList.remove("open");
28 + }
29 + });
30 +})();
31 +
32 +// chart hover tooltips
14 33 (function () {
15 34 const fig = document.querySelector(".chart-fig");
16 35 if (!fig) return;
added web/public/logo.svg +17 −0
@@ -0,0 +1,17 @@
1 +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="localvm-research logo">
2 + <!-- ==========================================================================
3 + Project : localvm-research | File: web/public/logo.svg
4 + Purpose : Logo/favicon — a large model (outline) with a small resident
5 + working set (solid) and streamed blocks (light), the project thesis
6 + Author : Simon-Pierre Boucher | Contact : contact@spboucher.ai
7 + Created : 2026-08-12 | Modified : 2026-08-12 | License: All rights reserved
8 + =========================================================================== -->
9 + <rect x="4" y="4" width="56" height="56" rx="14" fill="#fcfcfb"/>
10 + <rect x="6" y="6" width="52" height="52" rx="12" fill="#edf3fb" stroke="#2a78d6" stroke-width="3.5"/>
11 + <!-- streamed (cold) blocks -->
12 + <rect x="34" y="14" width="16" height="16" rx="4.5" fill="#9ec5f4"/>
13 + <rect x="34" y="34" width="16" height="16" rx="4.5" fill="#cde2fb"/>
14 + <rect x="14" y="14" width="16" height="16" rx="4.5" fill="#cde2fb"/>
15 + <!-- resident working set -->
16 + <rect x="14" y="34" width="16" height="16" rx="4.5" fill="#2a78d6"/>
17 +</svg>
modified web/public/style.css +221 −153
@@ -1,7 +1,7 @@
1 1 /* ============================================================================
2 2 * Project : localvm-research
3 3 * File : web/public/style.css
4 * Purpose : Light-theme styling for the research showcase platform
4 + * Purpose : Light-theme styling for the research showcase platform (v2)
5 5 * Author : Simon-Pierre Boucher
6 6 * Contact : contact@spboucher.ai
7 7 * Created : 2026-08-12
@@ -22,157 +22,239 @@
22 22 --border: rgba(11, 11, 11, 0.10);
23 23 --accent: #2a78d6;
24 24 --accent-dark: #1c5cab;
25 + --accent-wash: #edf3fb;
25 26 --good: #0ca30c;
26 27 --good-text: #006300;
27 --warn: #eda100;
28 + --radius: 12px;
29 + --shadow-1: 0 1px 2px rgba(11,11,11,0.04), 0 1px 3px rgba(11,11,11,0.05);
30 + --shadow-2: 0 4px 14px rgba(11,11,11,0.07), 0 2px 4px rgba(11,11,11,0.05);
28 31 }
29 32
30 33 * { box-sizing: border-box; }
31 html { -webkit-text-size-adjust: 100%; }
34 +html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
32 35 body {
33 36 margin: 0;
34 37 font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
35 38 background: var(--page);
36 39 color: var(--ink);
37 line-height: 1.6;
40 + line-height: 1.65;
38 41 font-size: 16px;
39 42 }
40 .wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
43 +.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
41 44 a { color: var(--accent-dark); text-decoration: none; }
42 45 a:hover { text-decoration: underline; }
43 46 code, pre, .mono-small { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
47 +::selection { background: #cde2fb; }
44 48
45 /* header */
49 +/* ---------------------------------------------------------------- header */
46 50 .site-header {
47 background: var(--surface);
51 + position: sticky; top: 0; z-index: 40;
52 + background: rgba(252, 252, 251, 0.85);
53 + -webkit-backdrop-filter: saturate(180%) blur(14px);
54 + backdrop-filter: saturate(180%) blur(14px);
48 55 border-bottom: 1px solid var(--grid);
49 position: sticky; top: 0; z-index: 10;
50 56 }
51 .header-row { display: flex; align-items: center; justify-content: space-between; height: 56px; }
52 .brand { font-weight: 700; font-size: 18px; color: var(--ink); letter-spacing: -0.02em; }
57 +.header-row { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
58 +.brand {
59 + font-weight: 750; font-size: 18.5px; color: var(--ink); letter-spacing: -0.02em;
60 + display: flex; align-items: center; gap: 8px; white-space: nowrap;
61 +}
62 +.brand-logo { display: block; border-radius: 7px; }
53 63 .brand-dim { color: var(--muted); font-weight: 500; }
54 .site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
64 +.site-nav { display: flex; gap: 2px; flex-wrap: wrap; }
55 65 .site-nav a {
56 padding: 6px 12px; border-radius: 6px; color: var(--ink-2); font-size: 14px; font-weight: 500;
66 + padding: 7px 13px; border-radius: 8px; color: var(--ink-2);
67 + font-size: 14px; font-weight: 550;
68 + transition: background 0.15s, color 0.15s;
57 69 }
58 .site-nav a:hover { background: var(--page); text-decoration: none; color: var(--ink); }
59 .site-nav a.active { color: var(--accent-dark); background: #edf3fb; }
70 +.site-nav a:hover { background: var(--accent-wash); text-decoration: none; color: var(--accent-dark); }
71 +.site-nav a.active { color: var(--accent-dark); background: var(--accent-wash); font-weight: 650; }
72 +.nav-toggle { display: none; }
60 73
61 /* hero */
62 .hero { padding: 56px 0 8px; }
74 +/* ---------------------------------------------------------------- hero */
75 +.hero {
76 + padding: 72px 0 16px;
77 + background:
78 + radial-gradient(1000px 380px at 15% -20%, rgba(42,120,214,0.10), transparent 65%),
79 + radial-gradient(800px 300px at 90% -30%, rgba(27,175,122,0.07), transparent 60%);
80 + margin: 0 -24px; padding-left: 24px; padding-right: 24px;
81 +}
63 82 .kicker {
64 text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; font-weight: 600;
65 color: var(--accent-dark); margin: 0 0 12px;
83 + text-transform: uppercase; letter-spacing: 0.1em; font-size: 12px; font-weight: 700;
84 + color: var(--accent-dark); margin: 0 0 14px;
85 + display: inline-flex; align-items: center; gap: 8px;
66 86 }
67 .hero h1 { font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 16px; }
68 .lede { font-size: 18px; color: var(--ink-2); max-width: 760px; margin: 0 0 12px; }
69 .lede-small { color: var(--ink-2); max-width: 760px; }
87 +.kicker::before { content: ""; width: 22px; height: 2px; background: var(--accent); border-radius: 2px; }
88 +.hero h1 { font-size: 46px; line-height: 1.08; letter-spacing: -0.028em; margin: 0 0 18px; font-weight: 780; }
89 +.lede { font-size: 18.5px; color: var(--ink-2); max-width: 780px; margin: 0 0 14px; }
90 +.lede-small { color: var(--ink-2); max-width: 780px; }
70 91 .lede-eq code {
71 92 font-size: 13px; background: var(--surface); border: 1px solid var(--grid);
72 border-radius: 6px; padding: 6px 10px; color: var(--ink-2); display: inline-block;
93 + border-radius: 8px; padding: 8px 14px; color: var(--ink-2); display: inline-block;
94 + box-shadow: var(--shadow-1);
73 95 }
74 96
75 /* stat tiles */
76 .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 32px 0; }
97 +/* ---------------------------------------------------------------- tiles */
98 +.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 36px 0; }
77 99 .tile {
78 background: var(--surface); border: 1px solid var(--grid); border-radius: 10px;
79 padding: 20px 22px; display: flex; flex-direction: column; gap: 2px;
100 + background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
101 + padding: 22px 24px; display: flex; flex-direction: column; gap: 2px;
102 + box-shadow: var(--shadow-1); position: relative; overflow: hidden;
103 +}
104 +.tile::before {
105 + content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
106 + background: linear-gradient(180deg, var(--accent), #6da7ec);
80 107 }
81 .tile-value { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
108 +.tile-value { font-size: 36px; font-weight: 760; letter-spacing: -0.025em; line-height: 1.1; }
82 109 .tile-denom { font-size: 20px; color: var(--muted); font-weight: 500; }
83 .tile-label { color: var(--ink-2); font-size: 13.5px; }
110 +.tile-label { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
84 111
85 /* layout blocks */
112 +/* ---------------------------------------------------------------- cards */
86 113 .split { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; margin: 8px 0 20px; }
87 @media (max-width: 880px) { .split { grid-template-columns: 1fr; } .hero h1 { font-size: 30px; } }
88 114 .card {
89 background: var(--surface); border: 1px solid var(--grid); border-radius: 10px;
90 padding: 24px 26px; margin-bottom: 20px;
115 + background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
116 + padding: 26px 28px; margin-bottom: 20px; box-shadow: var(--shadow-1);
117 +}
118 +.card h2 { margin-top: 0; font-size: 20px; letter-spacing: -0.015em; font-weight: 700; }
119 +.more { font-weight: 650; font-size: 14px; }
120 +.card-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
121 +.btn {
122 + display: inline-block; background: var(--accent); color: #fff; border: 0;
123 + padding: 10px 20px; border-radius: 9px; font-size: 14.5px; font-weight: 650;
124 + cursor: pointer; transition: background 0.15s, transform 0.1s; font-family: inherit;
91 125 }
92 .card h2 { margin-top: 0; font-size: 20px; letter-spacing: -0.01em; }
93 .more { font-weight: 600; font-size: 14px; }
126 +.btn:hover { background: var(--accent-dark); }
127 +.btn:active { transform: translateY(1px); }
94 128
95 /* phases */
129 +/* ---------------------------------------------------------------- phases */
96 130 .phases { list-style: none; margin: 0; padding: 0; }
97 .phase { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
131 +.phase { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--grid); }
98 132 .phase:last-child { border-bottom: 0; }
99 133 .phase strong { display: block; font-size: 14.5px; }
100 134 .phase-detail { font-size: 13px; color: var(--muted); }
101 135 .phase-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; background: var(--baseline); }
102 .phase.done .phase-dot { background: var(--good); }
103 .phase.in-progress .phase-dot { background: var(--accent); }
136 +.phase.done .phase-dot { background: var(--good); box-shadow: 0 0 0 3px rgba(12,163,12,0.14); }
137 +.phase.in-progress .phase-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(42,120,214,0.16); }
104 138 .phase .badge { margin-left: auto; }
105 139 .badge {
106 font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
140 + font-size: 11.5px; font-weight: 650; padding: 3px 10px; border-radius: 20px;
107 141 white-space: nowrap; align-self: center; border: 1px solid var(--grid); color: var(--ink-2);
108 142 }
109 143 .badge-done { color: var(--good-text); background: #eef7ee; border-color: #cfe8cf; }
110 .badge-in-progress, .badge-has-results { color: var(--accent-dark); background: #edf3fb; border-color: #cfe0f5; }
144 +.badge-in-progress, .badge-has-results { color: var(--accent-dark); background: var(--accent-wash); border-color: #cfe0f5; }
111 145 .badge-pending, .badge-scaffolded { color: var(--muted); background: var(--page); }
112 146
113 /* doc cards */
114 .page-title { font-size: 30px; letter-spacing: -0.02em; margin: 40px 0 8px; }
115 .section-title { font-size: 20px; margin: 32px 0 8px; }
116 .doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 16px 0; }
147 +/* ---------------------------------------------------------------- doc cards */
148 +.page-title { font-size: 32px; letter-spacing: -0.025em; margin: 44px 0 10px; font-weight: 760; }
149 +.section-title { font-size: 20px; margin: 34px 0 10px; font-weight: 700; }
150 +.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin: 18px 0; }
117 151 .doc-card {
118 background: var(--surface); border: 1px solid var(--grid); border-radius: 10px;
119 padding: 18px 20px; color: var(--ink); display: block;
152 + background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
153 + padding: 20px 22px; color: var(--ink); display: block; box-shadow: var(--shadow-1);
154 + transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
120 155 }
121 .doc-card:hover { border-color: var(--accent); text-decoration: none; }
156 +.doc-card:hover { border-color: #b9d2f0; text-decoration: none; box-shadow: var(--shadow-2); transform: translateY(-2px); }
122 157 .doc-card.disabled { opacity: 0.55; pointer-events: none; }
123 .doc-card h3 { margin: 0 0 6px; font-size: 16px; }
124 .doc-card p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-2); }
158 +.doc-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 680; }
159 +.doc-card p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
125 160 .runs { font-size: 12px; color: var(--muted); margin-left: 8px; }
126 161 .note-line { color: var(--ink-2); font-size: 14px; }
127 162
128 /* markdown body */
163 +/* ---------------------------------------------------------------- doc view */
129 164 .doc { max-width: 860px; margin: 32px auto; }
130 .crumb { font-size: 13px; color: var(--muted); margin: 24px 0 4px; }
165 +.crumb { font-size: 13px; color: var(--muted); margin: 26px 0 4px; }
131 166 .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
132 167 .chip {
133 168 font-size: 12px; background: var(--surface); border: 1px solid var(--grid);
134 169 border-radius: 20px; padding: 3px 12px; color: var(--ink-2);
135 170 }
136 171 .chip-k { color: var(--muted); margin-right: 6px; text-transform: uppercase; font-size: 10px; letter-spacing: 0.05em; }
172 +.doc-head { margin: 30px 0 6px; }
173 +.doc-head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
174 +.doc-head h1 { font-size: 32px; letter-spacing: -0.025em; margin: 0; font-weight: 760; }
175 +.doc-head h1::first-letter { text-transform: uppercase; }
176 +.doc-head-meta { color: var(--muted); font-size: 13px; margin: 6px 0 0; font-family: ui-monospace, Menlo, monospace; }
177 +.doc-layout { display: block; margin-top: 18px; }
178 +.doc-layout.has-toc { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; align-items: start; }
179 +.doc-layout .doc { margin: 0; max-width: 820px; }
180 +.toc {
181 + position: sticky; top: 80px; background: var(--surface); border: 1px solid var(--grid);
182 + border-radius: var(--radius); padding: 16px 18px; max-height: calc(100vh - 104px);
183 + overflow-y: auto; box-shadow: var(--shadow-1);
184 +}
185 +.toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
186 +.toc ul { list-style: none; margin: 10px 0 0; padding: 0; }
187 +.toc li { padding: 3px 0; line-height: 1.35; }
188 +.toc li a { color: var(--ink-2); font-size: 13px; display: block; border-left: 2px solid transparent; padding-left: 8px; margin-left: -8px; }
189 +.toc li a:hover { color: var(--accent-dark); text-decoration: none; border-left-color: var(--accent); }
190 +.toc-d3 { padding-left: 14px !important; }
191 +.toc-d3 a { font-size: 12.5px !important; color: var(--muted) !important; }
192 +.hanchor { opacity: 0; margin-left: 8px; font-weight: 400; color: var(--muted); font-size: 0.85em; }
193 +h2:hover .hanchor, h3:hover .hanchor, h4:hover .hanchor { opacity: 1; text-decoration: none; }
194 +
195 +/* markdown body */
137 196 .md { overflow-wrap: break-word; }
138 197 .md h1 { font-size: 28px; letter-spacing: -0.02em; }
139 .md h2 { font-size: 21px; margin-top: 36px; border-bottom: 1px solid var(--grid); padding-bottom: 6px; }
198 +.md h2 { font-size: 21px; margin-top: 38px; border-bottom: 1px solid var(--grid); padding-bottom: 7px; letter-spacing: -0.01em; }
140 199 .md h3 { font-size: 17px; margin-top: 28px; }
141 .md code { background: #f1f0ec; border-radius: 4px; padding: 1px 5px; font-size: 0.88em; }
200 +.md code { background: #f1f0ec; border-radius: 5px; padding: 1px 6px; font-size: 0.88em; }
142 201 .md pre code, .codeblock code { background: none; padding: 0; font-size: 13px; }
143 202 .codeblock, .md pre {
144 background: #f6f5f2; border: 1px solid var(--grid); border-radius: 8px;
145 padding: 14px 16px; overflow-x: auto; line-height: 1.5;
203 + background: #f6f5f2; border: 1px solid var(--grid); border-radius: 10px;
204 + padding: 15px 18px; overflow-x: auto; line-height: 1.55;
146 205 }
147 206 .md table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
148 .md th, .md td { border: 1px solid var(--grid); padding: 6px 10px; text-align: left; vertical-align: top; }
207 +.md th, .md td { border: 1px solid var(--grid); padding: 7px 11px; text-align: left; vertical-align: top; }
149 208 .md th { background: var(--page); }
150 209 .md blockquote { border-left: 3px solid var(--accent); margin-left: 0; padding-left: 16px; color: var(--ink-2); }
151 210
152 /* log */
153 .log-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
154 .log-entry h3 { font-size: 15px; margin: 0 0 8px; }
155 .log-entry .md { font-size: 13.5px; color: var(--ink-2); }
211 +/* ---------------------------------------------------------------- log */
212 +.log-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
213 +.log-entry h3 { font-size: 15px; margin: 2px 0 8px; }
214 +.timeline { margin: 26px 0; max-width: 880px; }
215 +.tl-entry { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; }
216 +.tl-rail { position: relative; }
217 +.tl-rail::before { content: ""; position: absolute; left: 11px; top: 4px; bottom: -18px; width: 2px; background: var(--grid); }
218 +.tl-entry:last-child .tl-rail::before { bottom: auto; height: 24px; }
219 +.tl-dot {
220 + position: absolute; left: 5px; top: 6px; width: 14px; height: 14px; border-radius: 50%;
221 + background: var(--accent); border: 3px solid var(--page); box-shadow: 0 0 0 1px var(--grid);
222 +}
223 +.tl-card {
224 + background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
225 + padding: 18px 22px; margin-bottom: 18px; min-width: 0; box-shadow: var(--shadow-1);
226 +}
227 +.tl-time { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
228 +.tl-card h3 { margin: 4px 0 10px; font-size: 16.5px; letter-spacing: -0.01em; }
229 +.md-compact { font-size: 14px; color: var(--ink-2); }
230 +.md-compact ul { padding-left: 18px; margin: 6px 0; }
231 +.md-compact li { margin: 3px 0; }
232 +.md-compact p { margin: 6px 0; }
233 +.md-compact strong { color: var(--ink); }
234 +.md-compact pre { font-size: 12px; padding: 10px 12px; }
156 235
157 /* results table / kv table / file lists */
158 .results-table, .kv-table { border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--surface); }
236 +/* ---------------------------------------------------------------- tables/files */
237 +.results-table, .kv-table {
238 + border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--surface);
239 + border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1);
240 +}
159 241 .results-table th, .results-table td, .kv-table th, .kv-table td {
160 border: 1px solid var(--grid); padding: 8px 12px; text-align: left;
242 + border: 1px solid var(--grid); padding: 9px 13px; text-align: left;
161 243 }
162 244 .results-table th { background: var(--page); }
163 .kv-table th { background: var(--page); width: 180px; }
245 +.kv-table th { background: var(--page); width: 190px; }
164 246 .file-list { list-style: none; padding: 0; }
165 .file-list li { padding: 6px 0; border-bottom: 1px solid var(--grid); }
247 +.file-list li { padding: 7px 0; border-bottom: 1px solid var(--grid); }
166 248 .tree { list-style: none; padding-left: 0; }
167 249 .tree ul { list-style: none; padding-left: 20px; }
168 250 .tree-root { margin-bottom: 14px; }
169 251 .tree li { padding: 2px 0; font-size: 14.5px; }
170 252 .mono-small { font-size: 12.5px; color: var(--muted); }
171 253 .file-card { padding: 0; overflow: hidden; }
172 .file-head { display: flex; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--grid); background: var(--page); }
254 +.file-head { display: flex; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--grid); background: var(--page); }
173 255 .file-card .codeblock { border: 0; border-radius: 0; margin: 0; }
174 256
175 /* chart */
257 +/* ---------------------------------------------------------------- chart */
176 258 .chart-fig { margin: 18px 0 8px; position: relative; }
177 259 .chart-fig svg { width: 100%; height: auto; }
178 260 .chart-fig .grid { stroke: var(--grid); stroke-width: 1; }
@@ -184,112 +266,98 @@ code, pre, .mono-small { font-family: ui-monospace, SFMono-Regular, Menlo, monos
184 266 .chart-fig figcaption { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
185 267 .chart-tip {
186 268 position: absolute; pointer-events: none; background: var(--ink); color: #fff;
187 font-size: 12.5px; padding: 5px 10px; border-radius: 6px; white-space: nowrap; z-index: 5;
269 + font-size: 12.5px; padding: 5px 10px; border-radius: 7px; white-space: nowrap; z-index: 5;
188 270 }
189 271
190 /* hljs light theme (subset, GitHub-like) */
191 .hljs { color: #24292e; }
192 .hljs-keyword, .hljs-meta .hljs-keyword { color: #d73a49; }
193 .hljs-string, .hljs-attr { color: #032f62; }
194 .hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
195 .hljs-number, .hljs-literal { color: #005cc5; }
196 .hljs-title, .hljs-function .hljs-title { color: #6f42c1; }
197 .hljs-built_in, .hljs-type { color: #e36209; }
198 .hljs-section { color: #005cc5; font-weight: 600; }
199 .hljs-params { color: #24292e; }
200 .hljs-variable, .hljs-template-variable { color: #e36209; }
201
202 /* footer */
203 .site-footer {
204 border-top: 1px solid var(--grid); margin-top: 48px; padding: 20px 0 32px;
205 background: var(--surface); font-size: 13px; color: var(--ink-2);
272 +/* ---------------------------------------------------------------- comments */
273 +.comment-grid { display: grid; grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); gap: 24px; margin: 24px 0; align-items: start; }
274 +.comment-form label { display: block; font-size: 13.5px; font-weight: 650; color: var(--ink-2); margin: 14px 0 4px; }
275 +.comment-form input, .comment-form textarea {
276 + width: 100%; border: 1px solid var(--grid); border-radius: 9px; background: var(--page);
277 + padding: 10px 12px; font-size: 14.5px; font-family: inherit; color: var(--ink);
278 + transition: border-color 0.15s, box-shadow 0.15s;
206 279 }
207 .site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
208 .footer-meta { color: var(--muted); }
209
210 /* ---- professional document view: header, TOC, anchors -------------------- */
211 .doc-head { margin: 28px 0 6px; }
212 .doc-head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
213 .doc-head h1 { font-size: 30px; letter-spacing: -0.02em; margin: 0; text-transform: none; }
214 .doc-head h1::first-letter { text-transform: uppercase; }
215 .doc-head-meta { color: var(--muted); font-size: 13px; margin: 6px 0 0; font-family: ui-monospace, Menlo, monospace; }
216 .doc-layout { display: block; margin-top: 18px; }
217 .doc-layout.has-toc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
218 .doc-layout .doc { margin: 0; max-width: 820px; }
219 .toc {
220 position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--grid);
221 border-radius: 10px; padding: 14px 16px; max-height: calc(100vh - 100px); overflow-y: auto;
280 +.comment-form input:focus, .comment-form textarea:focus {
281 + outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42,120,214,0.15);
222 282 }
223 .toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
224 .toc ul { list-style: none; margin: 8px 0 0; padding: 0; }
225 .toc li { padding: 3px 0; line-height: 1.35; }
226 .toc li a { color: var(--ink-2); font-size: 13px; display: block; }
227 .toc li a:hover { color: var(--accent-dark); text-decoration: none; }
228 .toc-d3 { padding-left: 14px !important; }
229 .toc-d3 a { font-size: 12.5px !important; color: var(--muted) !important; }
230 .hanchor { opacity: 0; margin-left: 8px; font-weight: 400; color: var(--muted); font-size: 0.85em; }
231 h2:hover .hanchor, h3:hover .hanchor, h4:hover .hanchor { opacity: 1; text-decoration: none; }
232 html { scroll-behavior: smooth; scroll-padding-top: 72px; }
233 .card-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
234
235 /* ---- research-log timeline ----------------------------------------------- */
236 .timeline { margin: 24px 0; max-width: 860px; }
237 .tl-entry { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 14px; }
238 .tl-rail { position: relative; }
239 .tl-rail::before {
240 content: ""; position: absolute; left: 11px; top: 4px; bottom: -18px; width: 2px; background: var(--grid);
283 +.comment-form .btn { margin-top: 16px; }
284 +.comment-form .hp { position: absolute; left: -9999px; height: 0; width: 0; border: 0; padding: 0; }
285 +.comment {
286 + background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius);
287 + padding: 16px 20px; margin-bottom: 14px; box-shadow: var(--shadow-1);
241 288 }
242 .tl-entry:last-child .tl-rail::before { bottom: auto; height: 24px; }
243 .tl-dot {
244 position: absolute; left: 5px; top: 6px; width: 14px; height: 14px; border-radius: 50%;
245 background: var(--accent); border: 3px solid var(--page); box-shadow: 0 0 0 1px var(--grid);
246 }
247 .tl-card {
248 background: var(--surface); border: 1px solid var(--grid); border-radius: 10px;
249 padding: 16px 20px; margin-bottom: 18px; min-width: 0;
289 +.comment-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
290 +.comment-name { font-weight: 700; font-size: 14.5px; }
291 +.comment-time { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
292 +.comment-body { margin: 8px 0 0; font-size: 14.5px; color: var(--ink-2); white-space: pre-wrap; }
293 +.flash {
294 + background: #eef7ee; border: 1px solid #cfe8cf; color: var(--good-text);
295 + border-radius: 9px; padding: 10px 16px; margin: 14px 0; font-size: 14px; font-weight: 600;
250 296 }
251 .tl-time { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
252 .tl-card h3 { margin: 4px 0 10px; font-size: 16.5px; letter-spacing: -0.01em; }
253 .md-compact { font-size: 14px; color: var(--ink-2); }
254 .md-compact ul { padding-left: 18px; margin: 6px 0; }
255 .md-compact li { margin: 3px 0; }
256 .md-compact p { margin: 6px 0; }
257 .md-compact strong { color: var(--ink); }
258 .md-compact pre { font-size: 12px; padding: 10px 12px; }
297 +.flash-err { background: #fdf0ef; border-color: #f2cfcc; color: #a13430; }
259 298
260 /* ---- smartphone adaptation ------------------------------------------------ */
299 +/* ---------------------------------------------------------------- footer */
300 +.site-footer { border-top: 1px solid var(--grid); margin-top: 56px; background: var(--surface); font-size: 14px; color: var(--ink-2); }
301 +.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; padding: 32px 24px 20px; }
302 +.footer-brand { font-weight: 750; color: var(--ink); font-size: 15px; }
303 +.footer-tag { font-size: 13px; color: var(--muted); max-width: 340px; margin: 6px 0 0; }
304 +.footer-h { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
305 +.footer-col { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
306 +.footer-meta { color: var(--muted); font-size: 12px; }
307 +.footer-legal { border-top: 1px solid var(--grid); padding: 14px 24px 26px; font-size: 12.5px; color: var(--muted); }
308 +
309 +/* ---------------------------------------------------------------- mobile */
310 +@media (max-width: 880px) {
311 + .split { grid-template-columns: 1fr; }
312 + .hero h1 { font-size: 32px; }
313 + .comment-grid { grid-template-columns: 1fr; }
314 +}
261 315 @media (max-width: 720px) {
262 316 body { font-size: 15px; }
263 317 .wrap { padding: 0 16px; }
264 .header-row { height: auto; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 0; }
265 .site-nav { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; padding-bottom: 4px; }
266 .site-nav a { white-space: nowrap; padding: 6px 10px; font-size: 13.5px; }
267 .site-header { position: static; }
268 html { scroll-padding-top: 12px; }
269 .hero { padding: 28px 0 4px; }
270 .hero h1 { font-size: 26px; }
318 + .header-row { height: 56px; }
319 + .nav-toggle {
320 + display: flex; flex-direction: column; justify-content: center; gap: 5px;
321 + background: none; border: 0; padding: 10px; cursor: pointer; z-index: 60;
322 + }
323 + .nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform 0.22s, opacity 0.18s; }
324 + .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
325 + .nav-toggle.open span:nth-child(2) { opacity: 0; }
326 + .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
327 + .site-nav {
328 + position: fixed; top: 56px; left: 0; right: 0; z-index: 50;
329 + background: var(--surface); border-bottom: 1px solid var(--grid);
330 + flex-direction: column; gap: 0; padding: 8px 12px 14px;
331 + box-shadow: var(--shadow-2);
332 + display: none;
333 + }
334 + .site-nav.open { display: flex; }
335 + .site-nav a { padding: 13px 12px; font-size: 16px; border-radius: 8px; border-bottom: 1px solid var(--grid); }
336 + .site-nav a:last-child { border-bottom: 0; }
337 + html { scroll-padding-top: 64px; }
338 + .hero { padding: 32px 16px 8px; margin: 0 -16px; }
339 + .hero h1 { font-size: 27px; }
271 340 .lede { font-size: 16px; }
272 341 .lede-eq code { font-size: 11px; white-space: normal; word-break: break-word; }
273 .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; }
274 .tile { padding: 14px 16px; }
275 .tile-value { font-size: 26px; }
276 .card { padding: 16px 16px; }
277 .page-title { font-size: 24px; margin-top: 24px; }
278 .doc-head h1 { font-size: 22px; }
342 + .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 22px 0; }
343 + .tile { padding: 15px 16px; }
344 + .tile-value { font-size: 27px; }
345 + .card { padding: 18px 18px; }
346 + .page-title { font-size: 25px; margin-top: 26px; }
347 + .doc-head h1 { font-size: 23px; }
279 348 .doc-layout.has-toc { display: block; }
280 349 .toc { position: static; max-height: none; margin-bottom: 16px; }
281 350 .tl-entry { grid-template-columns: 18px minmax(0, 1fr); gap: 10px; }
282 .tl-card { padding: 12px 14px; }
351 + .tl-card { padding: 13px 15px; }
283 352 .md h1 { font-size: 22px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; }
284 353 .md pre, .codeblock { font-size: 12px; padding: 10px 12px; }
285 .results-table, .kv-table { font-size: 13px; display: block; overflow-x: auto; }
354 + .results-table, .kv-table { font-size: 13px; display: block; overflow-x: auto; box-shadow: none; }
286 355 .kv-table th { width: auto; }
287 356 .file-head { flex-direction: column; gap: 2px; }
288 .site-footer .wrap { flex-direction: column; }
289 .chart-fig svg { min-width: 560px; }
357 + .footer-grid { grid-template-columns: 1fr; gap: 18px; }
290 358 .chart-fig { overflow-x: auto; -webkit-overflow-scrolling: touch; }
359 + .chart-fig svg { min-width: 560px; }
291 360 }
292 361 @media (max-width: 420px) {
293 .tiles { grid-template-columns: 1fr 1fr; }
294 .hero h1 { font-size: 23px; }
362 + .hero h1 { font-size: 24px; }
295 363 }
modified web/server.js +68 −0
@@ -11,6 +11,7 @@
11 11 // ============================================================================
12 12 "use strict";
13 13
14 +const fs = require("fs");
14 15 const path = require("path");
15 16 const express = require("express");
16 17 const C = require("./lib/content");
@@ -20,6 +21,26 @@ const app = express();
20 21 const PORT = process.env.PORT || 8120;
21 22
22 23 app.use("/static", express.static(path.join(__dirname, "public"), { maxAge: "1h" }));
24 +app.use(express.urlencoded({ extended: false, limit: "16kb" }));
25 +
26 +// ---- comments storage (data/ is excluded from deploy rsync — persistent) ----
27 +const DATA_DIR = path.join(__dirname, "data");
28 +const COMMENTS_FILE = path.join(DATA_DIR, "comments.json");
29 +fs.mkdirSync(DATA_DIR, { recursive: true });
30 +
31 +function readComments() {
32 + try {
33 + return JSON.parse(fs.readFileSync(COMMENTS_FILE, "utf8"));
34 + } catch {
35 + return [];
36 + }
37 +}
38 +function saveComment(entry) {
39 + const all = readComments();
40 + all.push(entry);
41 + fs.writeFileSync(COMMENTS_FILE, JSON.stringify(all, null, 2));
42 +}
43 +const lastPostByIp = new Map();
23 44
24 45 function page(res, opts) {
25 46 res.send(R.layout({ ...opts, buildInfo: C.buildInfo() }));
@@ -323,6 +344,53 @@ why an approach died, not just what survived.</p>
323 344 page(res, { title: "About", active: "About", body });
324 345 });
325 346
347 +// ---------------------------------------------------------------- comments
348 +app.get("/comments", (req, res) => {
349 + const comments = readComments().slice().reverse();
350 + const list = comments.length
351 + ? comments.map((c) => `<article class="comment">
352 + <div class="comment-head"><span class="comment-name">${R.esc(c.name)}</span>
353 + <time class="comment-time">${R.esc((c.ts || "").slice(0, 16).replace("T", " "))} UTC</time></div>
354 + <p class="comment-body">${R.esc(c.message)}</p>
355 + </article>`).join("")
356 + : `<p class="lede-small">No comments yet — be the first to leave one.</p>`;
357 + const posted = req.query.posted ? `<div class="flash">Thanks — your comment is posted.</div>` : "";
358 + const err = req.query.err ? `<div class="flash flash-err">${R.esc(String(req.query.err))}</div>` : "";
359 + const body = `<h1 class="page-title">Comments &amp; discussion</h1>
360 +<p class="lede-small">Questions, critiques, pointers to prior art, replication reports — all welcome.
361 +Comments are public and moderated after the fact; be civil, no links required.</p>
362 +${posted}${err}
363 +<div class="comment-grid">
364 + <form class="card comment-form" method="POST" action="/comments">
365 + <h2>Leave a comment</h2>
366 + <label>Name<input name="name" maxlength="60" required placeholder="Your name"></label>
367 + <label>Comment<textarea name="message" maxlength="2000" rows="5" required
368 + placeholder="Your comment — feedback, prior art we missed, questions…"></textarea></label>
369 + <input type="text" name="website" class="hp" tabindex="-1" autocomplete="off" aria-hidden="true">
370 + <button type="submit" class="btn">Post comment</button>
371 + <p class="mono-small">Stored on this server only. No tracking, no account.</p>
372 + </form>
373 + <div class="comment-list">
374 + <h2 class="section-title" style="margin-top:0">${comments.length} comment${comments.length === 1 ? "" : "s"}</h2>
375 + ${list}
376 + </div>
377 +</div>`;
378 + page(res, { title: "Comments", active: "Comments", body });
379 +});
380 +
381 +app.post("/comments", (req, res) => {
382 + const ip = req.headers["x-forwarded-for"] || req.socket.remoteAddress || "?";
383 + const name = String(req.body.name || "").trim().slice(0, 60);
384 + const message = String(req.body.message || "").trim().slice(0, 2000);
385 + if (String(req.body.website || "").length) return res.redirect("/comments?posted=1"); // honeypot
386 + if (!name || message.length < 3) return res.redirect("/comments?err=Name and comment are required.");
387 + const last = lastPostByIp.get(ip) || 0;
388 + if (Date.now() - last < 30_000) return res.redirect("/comments?err=Please wait a moment between comments.");
389 + lastPostByIp.set(ip, Date.now());
390 + saveComment({ name, message, ts: new Date().toISOString() });
391 + res.redirect("/comments?posted=1");
392 +});
393 +
326 394 // ---------------------------------------------------------------- misc
327 395 app.get("/health", (req, res) => res.json({ ok: true, app: "localvm-web", author: "Simon-Pierre Boucher" }));
328 396
329 397