{"site":"https://openfluke.com","importedAt":"2026-09-11T04:23:15.738Z","overview":[{"question":"What is OpenFluke?","answer":"OpenFluke is the independent AI and artificial-life research practice of Samuel Watson in Australia. It brings together the Welvet AI engine, the ALife prototype, and ALife OS, the product now in development."},{"question":"What is Welvet?","answer":"Welvet is the AI engine underneath the work: software for running and training neural networks. Written in Go, it explores different ways to store, calculate, and update models on CPU and WebGPU hardware. Paragon and Loom are earlier engine designs whose lessons continue in Welvet."},{"question":"What is ALife OS?","answer":"ALife OS is the product in development, bringing artificial life, a simulated world, and learning systems together. Its current multiplayer world has connected planets, physics, and three companion forms. The wider vision includes abilities, buildcraft, and learning from mastered activities."},{"question":"How is ALife different from ALife OS?","answer":"ALife is the prototype. ALife OS is the current product direction. The prototype is part of the research history and informs the product, rather than being a separate competing product."},{"question":"What happened to the earlier projects?","answer":"Primecraft, Biocraft, Birdkit, and SoulGlitch explored different places and configurations for the chaos simulation engine. Those experiments and pivots led toward ALife OS. Paragon and Loom sit on the engine side of that history, leading into Welvet."},{"question":"Do I need to understand AI to explore this work?","answer":"No. Start with the product and engine overviews. The book and examples are there when you want the technical detail, including source code, recorded outputs, and the limitations documented in the original work."}],"chapters":[{"slug":"01-welvet","title":"What Welvet is","group":"I · Orientation","description":"Loom’s flat poly/ package hit import-cycle and honesty walls (QAT morph, silent fallbacks, god-layer). Welvet is the rewrite: one feature per folder, storage-truth dtypes/quants, Dense as th","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet</span><span class=\"status ok\">✅ engine</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Loom’s flat <code>poly/</code> package hit import-cycle and honesty walls (QAT morph, silent fallbacks, god-layer). Welvet is the rewrite: one feature per folder, storage-truth dtypes/quants, Dense as the shared MatVec microkernel, tests only in <code>w2a</code>, apps only in <code>apps/</code>.</p>\n<h2>What it is</h2>\n<p>An AI engine in Go: layers, 34 dtypes, 20 quant formats, and three backends (CPU tiled · Plan 9 SIMD · WebGPU). Version tracks a 100-point scorecard (today <strong>v1.1.1</strong> · 100/100).</p>\n<figure class=\"diagram\"><pre class=\"ascii\">Rules\n  1. No tests in engine packages          → w2a/\n  2. No silent fallbacks                  → hard error\n  3. No hardcoded float32                 → Tensor[T]\n  4. No QAT                               → DType + Format = truth\n  5. Train keeps storage truth            → in-dtype / re-Pack SGD, no retained f32 master\n  6. One feature → one folder\n  7. v1.0 = scorecard 100/100</pre><figcaption>Non-negotiable engine rules.</figcaption></figure>\n<div class=\"callout\"><strong>v1.0</strong>Engine board is full. w2a <code>[0] Run ALL</code> stamped\n<strong>246,032</strong> matrix cells with <strong>FAIL 0</strong> (RESULT: PASS). GAP cells are declared\nskips, not silent fails. Apps, stubs, and NPU sit <em>off</em> this board — they are sibling trees, not missing Welvet.\nTraining credit (29 named <code>TrainMode</code>s) and cameral sandwiches are first-class; Lucy races live in AAI\n(chapters <a href=\"/book/67-train-modes\">67</a> · <a href=\"/book/68-cameral\">68</a> · <a href=\"/book/70-cam-sync\">70</a>).</div>\n<h2>Origin</h2>\n<p class=\"origin-byline\"><strong>Samuel Watson</strong></p>\n<p>Samuel Watson created OpenFluke after intensive T-ALL treatment (post-2018), from a simple frustration: AI tooling was heavy, opaque, and not portable enough to move models cleanly across operating systems or personal devices. Setting up GPU paths often meant large, brittle installs before experimentation could even begin.</p>\n<p>That gap drove a long detour through cybersecurity, MBA, and psychology before returning through applied AI study - and finding that most paths still taught framework usage more than system construction. The result was a build journey across <a href=\"https://github.com/planetbridging\">planetbridging</a> into OpenFluke projects, from paragon and loom to Welvet.</p>\n<p>The early breakthroughs were practical and hard-won: first dense nets in Go, then WebGPU proof points (for example <a href=\"https://github.com/openfluke/iso-demo/releases/tag/v0.1.0\">iso-demo v0.1.0</a>), then repeated cycles of speed, layers, 3D, tiling, SIMD, and bit-oriented model paths for personal intelligence.</p>\n<p><strong>Why \"OpenFluke\"</strong>: open source values plus a life-saving fluke blood test that caught cancer early.<br />\n<strong>Why \"Welvet\"</strong>: a name shaped in gaming sessions with family.</p>\n<blockquote>\n<p>I wish this tool existed in 2018 to keep trying things in AI and asking \"what if I try this?\" - and maybe help deterministic medical deployment of AI models.</p>\n</blockquote>\n<p class=\"example-meta\">\"Our duty, as soldiers, is to protect humanity. Whatever the cost.\" - Master Chief</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/01-welvet/main.go\">examples/01-welvet/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/01-welvet &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n)\n\nfunc main() {\n\tl, err := dense.New(8, 4, core.ActivationReLU, core.DTypeFloat32)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.Exec.Backend = core.BackendCPUTiled\n\n\tx := core.NewTensor[float32](1, 8)\n\tfor i := range x.Data {\n\t\tx.Data[i] = float32(i) * 0.1\n\t}\n\tpre, post, err := dense.Forward(l, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"pre\", len(pre.Data), \"post\", len(post.Data))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>pre 4 post 4</code></pre>\n<h3>Validate (harness)</h3><pre><code>cd welvet &amp;&amp; go build ./...\ncd w2a &amp;&amp; go test ./tests/dense -v</code></pre>\n</section>\n\n\n\n","text":"github.com/openfluke/welvet✅ engine\n\nWhy it exists\nLoom’s flat poly/ package hit import-cycle and honesty walls (QAT morph, silent fallbacks, god-layer). Welvet is the rewrite: one feature per folder, storage-truth dtypes/quants, Dense as the shared MatVec microkernel, tests only in w2a, apps only in apps/.\nWhat it is\nAn AI engine in Go: layers, 34 dtypes, 20 quant formats, and three backends (CPU tiled · Plan 9 SIMD · WebGPU). Version tracks a 100-point scorecard (today v1.1.1 · 100/100).\nRules\n  1. No tests in engine packages          → w2a/\n  2. No silent fallbacks                  → hard error\n  3. No hardcoded float32                 → Tensor[T]\n  4. No QAT                               → DType + Format = truth\n  5. Train keeps storage truth            → in-dtype / re-Pack SGD, no retained f32 master\n  6. One feature → one folder\n  7. v1.0 = scorecard 100/100Non-negotiable engine rules.\nv1.0Engine board is full. w2a [0] Run ALL stamped\n246,032 matrix cells with FAIL 0 (RESULT: PASS). GAP cells are declared\nskips, not silent fails. Apps, stubs, and NPU sit off this board — they are sibling trees, not missing Welvet.\nTraining credit (29 named TrainModes) and cameral sandwiches are first-class; Lucy races live in AAI\n(chapters 67 · 68 · 70).\nOrigin\nSamuel Watson\nSamuel Watson created OpenFluke after intensive T-ALL treatment (post-2018), from a simple frustration: AI tooling was heavy, opaque, and not portable enough to move models cleanly across operating systems or personal devices. Setting up GPU paths often meant large, brittle installs before experimentation could even begin.\nThat gap drove a long detour through cybersecurity, MBA, and psychology before returning through applied AI study - and finding that most paths still taught framework usage more than system construction. The result was a build journey across planetbridging into OpenFluke projects, from paragon and loom to Welvet.\nThe early breakthroughs were practical and hard-won: first dense nets in Go, then WebGPU proof points (for example iso-demo v0.1.0), then repeated cycles of speed, layers, 3D, tiling, SIMD, and bit-oriented model paths for personal intelligence.\nWhy \"OpenFluke\": open source values plus a life-saving fluke blood test that caught cancer early.\nWhy \"Welvet\": a name shaped in gaming sessions with family.\n\nI wish this tool existed in 2018 to keep trying things in AI and asking \"what if I try this?\" - and maybe help deterministic medical deployment of AI models.\n\n\"Our duty, as soldiers, is to protect humanity. Whatever the cost.\" - Master Chief\n\n\n\nGo example\nexamples/01-welvet/main.go\nRun:cd welvet/examples/01-welvet && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n)\n\nfunc main() {\n\tl, err := dense.New(8, 4, core.ActivationReLU, core.DTypeFloat32)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.Exec.Backend = core.BackendCPUTiled\n\n\tx := core.NewTensor[float32](1, 8)\n\tfor i := range x.Data {\n\t\tx.Data[i] = float32(i) * 0.1\n\t}\n\tpre, post, err := dense.Forward(l, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"pre\", len(pre.Data), \"post\", len(post.Data))\n}\nOutput\nexit 0 · last run via go run .pre 4 post 4\nValidate (harness)cd welvet && go build ./...\ncd w2a && go test ./tests/dense -v\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/01-welvet.html","url":"https://openfluke.com/book/01-welvet"},{"slug":"02-tree","title":"Repository map","group":"I · Orientation","description":"Readers need a single map of what is engine vs harness vs app vs stub.","html":"\n\n\n\n<p><span class=\"status ok\">✅ layout</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Readers need a single map of what is engine vs harness vs app vs stub.</p>\n<h2>What it is</h2>\n<p>Top-level folders and their ownership. Engine packages never import w2a.</p>\n<figure class=\"diagram\"><pre class=\"ascii\">welvet/\n  core weights quant simd webgpu tiling architecture fusedgpu\n  layers/*          ← one folder per op (parallel = MoE + cameral)\n  runtime/{forward,backward,training,step}\n  systems/{dna,evolution,tween,tanhi,telemetry}\n  lucy/             ← Score / Finalize / BuildLPD density (shared by hosts)\n  model/{entity,hf,tokenizer,sampling,transformer}\n  apps/{octo,flux2,mosstts}\n  stub/*            ← designed surfaces, partial or empty\n  w2a/              ← harness (separate module)\n  tools/            ← eval / test tooling</pre></figure>\n<p>Engine never imports apps. Lucy <em>measuring</em> is <code>lucy/</code> (public). Lucy <em>races</em>\n(test41 / test48 / test50) live in the AAI tree and <code>replace</code> this module — see\n<a href=\"/book/68-cameral\">§68 cameral + AAI</a>. w2a owns every timed matrix, including Test49 (all 23 train modes\non origin-only cubes).</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/02-tree/main.go\">examples/02-tree/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/02-tree &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\t// Mental model only — list engine roots you depend on:\n\troots := []string{\n\t\t\"core\", \"weights\", \"quant\", \"simd\", \"webgpu\", \"tiling\",\n\t\t\"architecture\", \"fusedgpu\", \"layers\", \"runtime\", \"systems\", \"lucy\", \"model\",\n\t}\n\tfor _, r := range roots {\n\t\tfmt.Println(\"import github.com/openfluke/welvet/\" + r + \"/…\")\n\t}\n\t_ = os.Getenv // apps/stub/w2a are separate concerns\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>import github.com/openfluke/welvet/core/…\nimport github.com/openfluke/welvet/weights/…\nimport github.com/openfluke/welvet/quant/…\nimport github.com/openfluke/welvet/simd/…\nimport github.com/openfluke/welvet/webgpu/…\nimport github.com/openfluke/welvet/tiling/…\nimport github.com/openfluke/welvet/architecture/…\nimport github.com/openfluke/welvet/fusedgpu/…\nimport github.com/openfluke/welvet/layers/…\nimport github.com/openfluke/welvet/runtime/…\nimport github.com/openfluke/welvet/systems/…\nimport github.com/openfluke/welvet/lucy/…\nimport github.com/openfluke/welvet/model/…</code></pre>\n\n</section>\n\n\n\n","text":"✅ layout\n\nWhy it exists\nReaders need a single map of what is engine vs harness vs app vs stub.\nWhat it is\nTop-level folders and their ownership. Engine packages never import w2a.\nwelvet/\n  core weights quant simd webgpu tiling architecture fusedgpu\n  layers/*          ← one folder per op (parallel = MoE + cameral)\n  runtime/{forward,backward,training,step}\n  systems/{dna,evolution,tween,tanhi,telemetry}\n  lucy/             ← Score / Finalize / BuildLPD density (shared by hosts)\n  model/{entity,hf,tokenizer,sampling,transformer}\n  apps/{octo,flux2,mosstts}\n  stub/*            ← designed surfaces, partial or empty\n  w2a/              ← harness (separate module)\n  tools/            ← eval / test tooling\nEngine never imports apps. Lucy measuring is lucy/ (public). Lucy races\n(test41 / test48 / test50) live in the AAI tree and replace this module — see\n§68 cameral + AAI. w2a owns every timed matrix, including Test49 (all 23 train modes\non origin-only cubes).\n\n\n\nGo example\nexamples/02-tree/main.go\nRun:cd welvet/examples/02-tree && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\t// Mental model only — list engine roots you depend on:\n\troots := []string{\n\t\t\"core\", \"weights\", \"quant\", \"simd\", \"webgpu\", \"tiling\",\n\t\t\"architecture\", \"fusedgpu\", \"layers\", \"runtime\", \"systems\", \"lucy\", \"model\",\n\t}\n\tfor _, r := range roots {\n\t\tfmt.Println(\"import github.com/openfluke/welvet/\" + r + \"/…\")\n\t}\n\t_ = os.Getenv // apps/stub/w2a are separate concerns\n}\nOutput\nexit 0 · last run via go run .import github.com/openfluke/welvet/core/…\nimport github.com/openfluke/welvet/weights/…\nimport github.com/openfluke/welvet/quant/…\nimport github.com/openfluke/welvet/simd/…\nimport github.com/openfluke/welvet/webgpu/…\nimport github.com/openfluke/welvet/tiling/…\nimport github.com/openfluke/welvet/architecture/…\nimport github.com/openfluke/welvet/fusedgpu/…\nimport github.com/openfluke/welvet/layers/…\nimport github.com/openfluke/welvet/runtime/…\nimport github.com/openfluke/welvet/systems/…\nimport github.com/openfluke/welvet/lucy/…\nimport github.com/openfluke/welvet/model/…\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/02-tree.html","url":"https://openfluke.com/book/02-tree"},{"slug":"03-core","title":"core — types & backends","group":"II · Foundation","description":"Every polymorphic path needs one place for DType, LayerType, Activation, Backend, Tensor[T], and slim Layer metadata — without QAT morph defaults.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/core</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Every polymorphic path needs one place for DType, LayerType, Activation, Backend, Tensor[T], and slim Layer metadata — without QAT morph defaults.</p>\n<h2>What it is</h2>\n<p>34 storage dtypes, Numeric generics, Tensor[T], ExecConfig (BackendCPUTiled | BackendSIMD | BackendWebGPU), Activate/ActivateDeriv, and converters for f16/bf16/fp8/fp4.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/03-core/main.go\">examples/03-core/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/03-core &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n)\n\nfunc main() {\n\tt := core.NewTensor[float32](2, 4)\n\tt.Data[0] = -1\n\tt.Data[0] = core.Activate(t.Data[0], core.ActivationReLU) // 0\n\n\tcfg := core.ExecConfig{\n\t\tBackend:   core.BackendSIMD,\n\t\tMultiCore: true,\n\t\tTileSize:  32,\n\t}\n\tfmt.Println(cfg.Backend.String(), core.ParseDType(\"bfloat16\"), t.Len())\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>simd bfloat16 8</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/core✅\n\nWhy it exists\nEvery polymorphic path needs one place for DType, LayerType, Activation, Backend, Tensor[T], and slim Layer metadata — without QAT morph defaults.\nWhat it is\n34 storage dtypes, Numeric generics, Tensor[T], ExecConfig (BackendCPUTiled | BackendSIMD | BackendWebGPU), Activate/ActivateDeriv, and converters for f16/bf16/fp8/fp4.\n\n\n\nGo example\nexamples/03-core/main.go\nRun:cd welvet/examples/03-core && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n)\n\nfunc main() {\n\tt := core.NewTensor[float32](2, 4)\n\tt.Data[0] = -1\n\tt.Data[0] = core.Activate(t.Data[0], core.ActivationReLU) // 0\n\n\tcfg := core.ExecConfig{\n\t\tBackend:   core.BackendSIMD,\n\t\tMultiCore: true,\n\t\tTileSize:  32,\n\t}\n\tfmt.Println(cfg.Backend.String(), core.ParseDType(\"bfloat16\"), t.Len())\n}\nOutput\nexit 0 · last run via go run .simd bfloat16 8\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/03-core.html","url":"https://openfluke.com/book/03-core"},{"slug":"04-weights","title":"weights — FormatNone MatVec","group":"II · Foundation","description":"Unquantized matrices still need a typed store that streams MatVec and SGD without forcing a float32 master or Morph-as-training.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/weights</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Unquantized matrices still need a typed store that streams MatVec and SGD without forcing a float32 master or Morph-as-training.</p>\n<h2>What it is</h2>\n<p>Store holds DType + Format + Native/Packed bytes. New[T], MatVec, MatVecT, DecodeRow, SelectWire (F32/F64/I8), ApplySGD. FormatNone: update in native lanes (float32 payload is the only f32 buffer; float64 uses native ALU; other dtypes decode→update→re-encode). Packed: unpack→update→re-Pack then drop scratch. RetainsF32Master() is true only for FormatNone+float32. Dense and composite projs share this store.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/04-weights/main.go\">examples/04-weights/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/04-weights &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/weights\"\n)\n\nfunc main() {\n\ts, err := weights.New[float32](2, 2, []float32{1, 0, 0, 1}, core.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ty := make([]float32, 2)\n\tif err := weights.MatVec(s, []float32{3, 4}, y); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(y) // ≈ [3, 4]\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[3 4]</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/weights✅\n\nWhy it exists\nUnquantized matrices still need a typed store that streams MatVec and SGD without forcing a float32 master or Morph-as-training.\nWhat it is\nStore holds DType + Format + Native/Packed bytes. New[T], MatVec, MatVecT, DecodeRow, SelectWire (F32/F64/I8), ApplySGD. FormatNone: update in native lanes (float32 payload is the only f32 buffer; float64 uses native ALU; other dtypes decode→update→re-encode). Packed: unpack→update→re-Pack then drop scratch. RetainsF32Master() is true only for FormatNone+float32. Dense and composite projs share this store.\n\n\n\nGo example\nexamples/04-weights/main.go\nRun:cd welvet/examples/04-weights && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/weights\"\n)\n\nfunc main() {\n\ts, err := weights.New[float32](2, 2, []float32{1, 0, 0, 1}, core.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ty := make([]float32, 2)\n\tif err := weights.MatVec(s, []float32{3, 4}, y); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(y) // ≈ [3, 4]\n}\nOutput\nexit 0 · last run via go run .[3 4]\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/04-weights.html","url":"https://openfluke.com/book/04-weights"},{"slug":"05-quant","title":"quant — 20 pack formats","group":"II · Foundation","description":"Inference, storage, and train need classic Q-packs, k-quants, IQ, Ternary/Binary, and Affine without a separate QAT mode or retained f32 master. Format is storage truth.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/quant</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Inference, storage, and train need classic Q-packs, k-quants, IQ, Ternary/Binary, and Affine without a separate QAT mode or retained f32 master. Format is storage truth.</p>\n<h2>What it is</h2>\n<p>Pack / Unpack / MatVec / MatVecT for FormatNone…AffinePacked. Dense SIMD once-projects codes into Int8QS + scales (EnsureQ* / EnsureK/IQ/AffineSIMDCache) — no full-matrix F32 inflate for k/IQ/Affine. SGD on packed stores: short-lived unpack scratch → update → re-Pack; Packed stays truth.</p>\n<p>Families: classic Q8/Q4/Q5 · K-quants · IQ · TernaryPacked/BinaryPacked · AffinePacked.</p><p>Honesty: fused Dense SIMD for all 20 quants (group DotKRow / DotIQRow / DotAffineRow + classic Q*/BitNet). Peak dedicated k/IQ Plan 9 <code>.s</code> remains scorecard §12.</p>\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/05-quant/main.go\">examples/05-quant/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/05-quant &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tw := []float32{0.1, -0.2, 0.3, 0.4, -0.5, 0.6, 0.05, -0.15}\n\tb, err := quant.Pack(quant.FormatQ4_0, w, 2, 4)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ty := make([]float32, 2)\n\tif err := quant.MatVec(b, []float32{1, 1, 1, 1}, y); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"rows\", b.Rows, \"cols\", b.Cols, \"y\", y)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>rows 2 cols 4 y [0.6857143 -1.4901161e-08]</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/quant✅\n\nWhy it exists\nInference, storage, and train need classic Q-packs, k-quants, IQ, Ternary/Binary, and Affine without a separate QAT mode or retained f32 master. Format is storage truth.\nWhat it is\nPack / Unpack / MatVec / MatVecT for FormatNone…AffinePacked. Dense SIMD once-projects codes into Int8QS + scales (EnsureQ* / EnsureK/IQ/AffineSIMDCache) — no full-matrix F32 inflate for k/IQ/Affine. SGD on packed stores: short-lived unpack scratch → update → re-Pack; Packed stays truth.\nFamilies: classic Q8/Q4/Q5 · K-quants · IQ · TernaryPacked/BinaryPacked · AffinePacked.Honesty: fused Dense SIMD for all 20 quants (group DotKRow / DotIQRow / DotAffineRow + classic Q*/BitNet). Peak dedicated k/IQ Plan 9 .s remains scorecard §12.\n\n\nGo example\nexamples/05-quant/main.go\nRun:cd welvet/examples/05-quant && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tw := []float32{0.1, -0.2, 0.3, 0.4, -0.5, 0.6, 0.05, -0.15}\n\tb, err := quant.Pack(quant.FormatQ4_0, w, 2, 4)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ty := make([]float32, 2)\n\tif err := quant.MatVec(b, []float32{1, 1, 1, 1}, y); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"rows\", b.Rows, \"cols\", b.Cols, \"y\", y)\n}\nOutput\nexit 0 · last run via go run .rows 2 cols 4 y [0.6857143 -1.4901161e-08]\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/05-quant.html","url":"https://openfluke.com/book/05-quant"},{"slug":"06-simd","title":"simd — Plan 9 kernels","group":"II · Foundation","description":"CPU peak needs hand-written AVX2/NEON without a silent Go fallback that pretends SIMD ran.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/simd</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>CPU peak needs hand-written AVX2/NEON without a silent Go fallback that pretends SIMD ran.</p>\n<h2>What it is</h2>\n<p>amd64/arm64 .s kernels: DotTile, DotI8/U8, DotQ4_0, Saxpy, BitNet helpers, packed f16/bf16/fp8/fp4 dots; amd64 AVX2 DotTileF64 (WireF64); Go fused DotKRow / DotIQRow / DotAffineRow for k/IQ/Affine. SimdEnabled() false → BackendSIMD hard-errors.</p>\n\n<p><strong>v1.0.3:</strong> Dense FormatNone forward finished the remaining Plan 9 wires —\n<code>DotTileF64</code> (amd64), BF16 convert, expand-once → <code>DotTile</code>. Backward still uses\nsaxpy/DecodeRow paths. Universal sizes (any in/out/batch).</p>\n<table><thead><tr><th>dtype family</th><th>x86 AVX2</th><th>arm64 NEON</th></tr></thead><tbody>\n<tr><td>float32 DotTile · int8/narrow DotI8 · uint* expand · lowp · nf4/fp6</td><td>✓</td><td>✓</td></tr>\n<tr><td>float64 / int16·32·64 / int / complex* (<code>DotTileF64</code>)</td><td>✓</td><td>✗ scalar</td></tr>\n</tbody></table>\n<p>Arm still runs every FormatNone dtype through the right Dense strategy; the f64 wire is scalar\nuntil a NEON <code>DotTileF64</code> lands. Hot traffic (f32 / i8) already has NEON.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/06-simd/main.go\">examples/06-simd/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/06-simd &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/simd\"\n)\n\nfunc main() {\n\tif !simd.SimdEnabled() {\n\t\tfmt.Println(\"SIMD not available on this arch — BackendSIMD must hard-error\")\n\t\treturn\n\t}\n\tacc := simd.DotTile([]float32{1, 2, 3, 4}, []float32{1, 1, 1, 1}, 0, 4, 0)\n\tfmt.Println(acc)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>10</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/simd✅\n\nWhy it exists\nCPU peak needs hand-written AVX2/NEON without a silent Go fallback that pretends SIMD ran.\nWhat it is\namd64/arm64 .s kernels: DotTile, DotI8/U8, DotQ4_0, Saxpy, BitNet helpers, packed f16/bf16/fp8/fp4 dots; amd64 AVX2 DotTileF64 (WireF64); Go fused DotKRow / DotIQRow / DotAffineRow for k/IQ/Affine. SimdEnabled() false → BackendSIMD hard-errors.\n\nv1.0.3: Dense FormatNone forward finished the remaining Plan 9 wires —\nDotTileF64 (amd64), BF16 convert, expand-once → DotTile. Backward still uses\nsaxpy/DecodeRow paths. Universal sizes (any in/out/batch).\ndtype familyx86 AVX2arm64 NEON\nfloat32 DotTile · int8/narrow DotI8 · uint* expand · lowp · nf4/fp6✓✓\nfloat64 / int16·32·64 / int / complex* (DotTileF64)✓✗ scalar\n\nArm still runs every FormatNone dtype through the right Dense strategy; the f64 wire is scalar\nuntil a NEON DotTileF64 lands. Hot traffic (f32 / i8) already has NEON.\n\n\n\nGo example\nexamples/06-simd/main.go\nRun:cd welvet/examples/06-simd && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/simd\"\n)\n\nfunc main() {\n\tif !simd.SimdEnabled() {\n\t\tfmt.Println(\"SIMD not available on this arch — BackendSIMD must hard-error\")\n\t\treturn\n\t}\n\tacc := simd.DotTile([]float32{1, 2, 3, 4}, []float32{1, 1, 1, 1}, 0, 4, 0)\n\tfmt.Println(acc)\n}\nOutput\nexit 0 · last run via go run .10\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/06-simd.html","url":"https://openfluke.com/book/06-simd"},{"slug":"07-webgpu","title":"webgpu — device GEMV & shaders","group":"II · Foundation","description":"GPU paths must bind a real adapter. Host “fake GPU” was banned so suites cannot stamp WebGPU done when ALU ran on CPU.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/webgpu</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>GPU paths must bind a real adapter. Host “fake GPU” was banned so suites cannot stamp WebGPU done when ALU ran on CPU.</p>\n<h2>What it is</h2>\n<p>DenseGEMV family (incl. quant/I8/resident), DenseGEMVT/DenseDW, RMSNorm, LayerNorm fwd, Softmax family, SwiGLUFuse. Available()/InitError() gate use.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/07-webgpu/main.go\">examples/07-webgpu/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/07-webgpu &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/webgpu\"\n)\n\nfunc main() {\n\tif !webgpu.Available() {\n\t\tfmt.Println(\"no adapter:\", webgpu.InitError())\n\t\treturn\n\t}\n\ty := make([]float32, 2)\n\terr := webgpu.DenseGEMV(\n\t\t[]float32{1, 0, 0, 1},\n\t\t[]float32{1.5, 2.5},\n\t\ty, 1, 2, 2,\n\t)\n\tfmt.Println(y, err, webgpu.AdapterName())\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>webgpu probe goos=linux goarch=amd64 WELVET_WGPU_BACKEND=\"\"\n  adapter high-perf: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  → selected high-perf\n  adapter low-power: name=\"Intel(R) UHD Graphics 630 (CML GT2)\" vendor=\"Intel open-source Mesa driver\" arch=\"\" driver=\"Mesa 26.1.8\" backend=vulkan type=integrated-gpu | maxBuf=2147483647 maxSSBO=2147483644 maxSSBO/stage=103 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter force-fallback: name=\"llvmpipe (LLVM 22.1.8, 256 bits)\" vendor=\"llvmpipe\" arch=\"\" driver=\"Mesa 26.1.8 (LLVM 22.1.8)\" backend=vulkan type=cpu | maxBuf=2147483647 maxSSBO=134217728 maxSSBO/stage=48 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter default: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  try RequestDevice inflated: maxBuf=2147483648 maxSSBO=1073741824 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\nRESULT: OK via=inflated adapter=\"NVIDIA GeForce GTX 1650 SUPER\" backend=vulkan maxSSBO=2147483644 maxBuf=1099511627776\n[1.5 2.5] &lt;nil&gt; NVIDIA GeForce GTX 1650 SUPER</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/webgpu✅\n\nWhy it exists\nGPU paths must bind a real adapter. Host “fake GPU” was banned so suites cannot stamp WebGPU done when ALU ran on CPU.\nWhat it is\nDenseGEMV family (incl. quant/I8/resident), DenseGEMVT/DenseDW, RMSNorm, LayerNorm fwd, Softmax family, SwiGLUFuse. Available()/InitError() gate use.\n\n\n\nGo example\nexamples/07-webgpu/main.go\nRun:cd welvet/examples/07-webgpu && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/webgpu\"\n)\n\nfunc main() {\n\tif !webgpu.Available() {\n\t\tfmt.Println(\"no adapter:\", webgpu.InitError())\n\t\treturn\n\t}\n\ty := make([]float32, 2)\n\terr := webgpu.DenseGEMV(\n\t\t[]float32{1, 0, 0, 1},\n\t\t[]float32{1.5, 2.5},\n\t\ty, 1, 2, 2,\n\t)\n\tfmt.Println(y, err, webgpu.AdapterName())\n}\nOutput\nexit 0 · last run via go run .webgpu probe goos=linux goarch=amd64 WELVET_WGPU_BACKEND=\"\"\n  adapter high-perf: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  → selected high-perf\n  adapter low-power: name=\"Intel(R) UHD Graphics 630 (CML GT2)\" vendor=\"Intel open-source Mesa driver\" arch=\"\" driver=\"Mesa 26.1.8\" backend=vulkan type=integrated-gpu | maxBuf=2147483647 maxSSBO=2147483644 maxSSBO/stage=103 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter force-fallback: name=\"llvmpipe (LLVM 22.1.8, 256 bits)\" vendor=\"llvmpipe\" arch=\"\" driver=\"Mesa 26.1.8 (LLVM 22.1.8)\" backend=vulkan type=cpu | maxBuf=2147483647 maxSSBO=134217728 maxSSBO/stage=48 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter default: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  try RequestDevice inflated: maxBuf=2147483648 maxSSBO=1073741824 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\nRESULT: OK via=inflated adapter=\"NVIDIA GeForce GTX 1650 SUPER\" backend=vulkan maxSSBO=2147483644 maxBuf=1099511627776\n[1.5 2.5] <nil> NVIDIA GeForce GTX 1650 SUPER\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/07-webgpu.html","url":"https://openfluke.com/book/07-webgpu"},{"slug":"08-tiling","title":"tiling — SC/MC & workgroups","group":"II · Foundation","description":"MatVec throughput depends on tile size and when to go multi-core vs GPU workgroups. Centralizing caps keeps Dense and friends consistent.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/tiling</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>MatVec throughput depends on tile size and when to go multi-core vs GPU workgroups. Centralizing caps keeps Dense and friends consistent.</p>\n<h2>What it is</h2>\n<p>DefaultCPUTile, DefaultGPUWG, CPUTile, PreferMultiCore, GPUWorkgroupsX.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/08-tiling/main.go\">examples/08-tiling/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/08-tiling &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/tiling\"\n)\n\nfunc main() {\n\ttile := tiling.CPUTile(0) // default 32\n\tmc := tiling.PreferMultiCore(8, 256, tile)\n\twg := tiling.GPUWorkgroupsX(1024, 0)\n\tfmt.Println(tile, mc, wg)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>32 true 16</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/tiling✅\n\nWhy it exists\nMatVec throughput depends on tile size and when to go multi-core vs GPU workgroups. Centralizing caps keeps Dense and friends consistent.\nWhat it is\nDefaultCPUTile, DefaultGPUWG, CPUTile, PreferMultiCore, GPUWorkgroupsX.\n\n\n\nGo example\nexamples/08-tiling/main.go\nRun:cd welvet/examples/08-tiling && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/tiling\"\n)\n\nfunc main() {\n\ttile := tiling.CPUTile(0) // default 32\n\tmc := tiling.PreferMultiCore(8, 256, tile)\n\twg := tiling.GPUWorkgroupsX(1024, 0)\n\tfmt.Println(tile, mc, wg)\n}\nOutput\nexit 0 · last run via go run .32 true 16\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/08-tiling.html","url":"https://openfluke.com/book/08-tiling"},{"slug":"09-architecture","title":"architecture — volumetric grid","group":"II · Foundation","description":"Networks are spatial (Depth×Rows×Cols×LayersPerCell), not only linear stacks. Topology lives here; compute lives in layer packages.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/architecture</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Networks are spatial (Depth×Rows×Cols×LayersPerCell), not only linear stacks. Topology lives here; compute lives in layer packages.</p>\n<h2>What it is</h2>\n<p>Grid/Cell/Coord, NewGrid, BindOp, HopOrder, SetRemoteLink/ResolveHop. VolumetricNetwork is an alias for Grid.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/09-architecture/main.go\">examples/09-architecture/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/09-architecture &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 2, 1) // depth, rows, cols, layersPerCell\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\tif err := dense.Place(g, 0, 0, 0, 0, l); err != nil {\n\t\tpanic(err)\n\t}\n\t_ = g.SetRemoteLink(0, 0, 1, 0, 0, 0, 0, 0) // spatial feedback hop\n\tfmt.Println(\"cells\", len(g.HopOrder()))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>cells 2</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/architecture✅\n\nWhy it exists\nNetworks are spatial (Depth×Rows×Cols×LayersPerCell), not only linear stacks. Topology lives here; compute lives in layer packages.\nWhat it is\nGrid/Cell/Coord, NewGrid, BindOp, HopOrder, SetRemoteLink/ResolveHop. VolumetricNetwork is an alias for Grid.\n\n\n\nGo example\nexamples/09-architecture/main.go\nRun:cd welvet/examples/09-architecture && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 2, 1) // depth, rows, cols, layersPerCell\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\tif err := dense.Place(g, 0, 0, 0, 0, l); err != nil {\n\t\tpanic(err)\n\t}\n\t_ = g.SetRemoteLink(0, 0, 1, 0, 0, 0, 0, 0) // spatial feedback hop\n\tfmt.Println(\"cells\", len(g.HopOrder()))\n}\nOutput\nexit 0 · last run via go run .cells 2\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/09-architecture.html","url":"https://openfluke.com/book/09-architecture"},{"slug":"10-fusedgpu","title":"fusedgpu — decoder on device","group":"II · Foundation","description":"Token-by-token host round-trips kill decode. A fused engine keeps weights and scratch resident for Q4_0 and BinaryG128 hybrid paths.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/fusedgpu</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Token-by-token host round-trips kill decode. A fused engine keeps weights and scratch resident for Q4_0 and BinaryG128 hybrid paths.</p>\n<h2>What it is</h2>\n<p>Engine from Spec (AppendTokens/Reset/Close); HybridEngine (PrefillSample/DecodeSample/DecodeChunk). Specs come from model/transformer export.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/10-fusedgpu/main.go\">examples/10-fusedgpu/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/10-fusedgpu &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/fusedgpu\"\n\t\"github.com/openfluke/welvet/model/transformer\"\n)\n\nfunc main() {\n\tm, err := transformer.LoadEntity(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(\"need an ENTITY file:\", err)\n\t\treturn\n\t}\n\tspec, err := m.ExportFusedGPUSpec()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\teng, err := fusedgpu.NewFromSpec(spec)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer eng.Close()\n\tlogits, err := eng.AppendTokens([]uint32{1, 2, 3})\n\tfmt.Println(len(logits), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>need an ENTITY file: open model.entity: no such file or directory</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/fusedgpu✅\n\nWhy it exists\nToken-by-token host round-trips kill decode. A fused engine keeps weights and scratch resident for Q4_0 and BinaryG128 hybrid paths.\nWhat it is\nEngine from Spec (AppendTokens/Reset/Close); HybridEngine (PrefillSample/DecodeSample/DecodeChunk). Specs come from model/transformer export.\n\n\n\nGo example\nexamples/10-fusedgpu/main.go\nRun:cd welvet/examples/10-fusedgpu && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/fusedgpu\"\n\t\"github.com/openfluke/welvet/model/transformer\"\n)\n\nfunc main() {\n\tm, err := transformer.LoadEntity(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(\"need an ENTITY file:\", err)\n\t\treturn\n\t}\n\tspec, err := m.ExportFusedGPUSpec()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\teng, err := fusedgpu.NewFromSpec(spec)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer eng.Close()\n\tlogits, err := eng.AppendTokens([]uint32{1, 2, 3})\n\tfmt.Println(len(logits), err)\n}\nOutput\nexit 0 · last run via go run .need an ENTITY file: open model.entity: no such file or directory\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/10-fusedgpu.html","url":"https://openfluke.com/book/10-fusedgpu"},{"slug":"11-dense","title":"layers/dense — MatVec microkernel","group":"III · Layers","description":"Most FLOPs are W@x. One Dense stack owns FormatNone×34 and all quants × three backends so every composite proj shares one correctness surface — including native in-dtype SGD.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/dense</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Most FLOPs are W@x. One Dense stack owns FormatNone×34 and all quants × three backends so every composite proj shares one correctness surface — including native in-dtype SGD.</p>\n<h2>What it is</h2>\n<p>New / NewConfigured[T], Forward/Backward (dispatch on Exec.Backend), Place, ApplyGradSGD (→ weights.ApplySGD on the store). SIMD forward (v1.0.3): dtype switch by MatVec strategy — DotTile / DotI8 / lowp packed / expand-once→DotTile / WireF64+DotTileF64; fused Dot* for classic Q*, k/IQ, AffinePacked. Composites (MHA, SwiGLU, CNN im2col, RNN/LSTM/Mamba, residual·sequential·parallel) reuse Dense children via syncProjExec. BackwardSIMD still DecodeRow/saxpy (not the new expand wires).</p>\n\n<div class=\"callout\"><strong>v1.0.3 — FormatNone SIMD forward</strong>\nDeep profile (batch=8, 8×256→256, SIMD-only, 34 dtypes): Go vs tiny C++/Rust ports, bit-identical hashes.\nGo refreshed kernels → suite ~<strong>4.3×</strong> geo-mean vs prior Go; wins flipped <strong>2→24</strong>\n(C++ 9, Rust 1). Forward only. Source numbers:\n<a href=\"https://github.com/openfluke/welvet-to-rust_n_cpp\">welvet-to-rust_n_cpp</a>.</div>\n\n<h3>forwardSIMDByWire (strategy groups)</h3>\n<table><thead><tr><th>case</th><th>dtypes</th><th>kernel</th></tr></thead><tbody>\n<tr><td>narrow i8</td><td>int4, int2, ternary, binary</td><td>expand → DotI8Tile</td></tr>\n<tr><td>uint affine</td><td>uint4/2/3/5/6, uint16…uintptr</td><td>expand once → DotTile</td></tr>\n<tr><td>lowp packed</td><td>f16, bf16, fp8, fp4</td><td>convert tiles → DotTile</td></tr>\n<tr><td>expand f32</td><td>nf4, fp6, int3/5/6</td><td>expand once → DotTile (exact)</td></tr>\n<tr><td>stream f64</td><td>float64, int16/32/64, int, complex*</td><td>WireF64 → DotTileF64</td></tr>\n<tr><td>SelectWire</td><td>float32, int8, uint8, …</td><td>DotTile / DotI8 / affine u8</td></tr>\n</tbody></table>\n\n<h3>Before → after (µs/op, Go Δ)</h3>\n<p>Full Go/C++/Rust columns: before wins <strong>Go 2 / C++ 31 / Rust 1</strong>; after\n<strong>Go 24 / C++ 9 / Rust 1</strong>. Highlight Go speedups (before→after):</p>\n<table><thead><tr><th>dtype</th><th>Go before</th><th>Go after</th><th>Go Δ</th><th>best after</th></tr></thead><tbody>\n<tr><td>float32</td><td>1023.1</td><td><strong>929.5</strong></td><td>1.10×</td><td>go</td></tr>\n<tr><td>float64</td><td>9565.4</td><td><strong>1017.4</strong></td><td>9.40×</td><td>go</td></tr>\n<tr><td>bfloat16</td><td>12538.9</td><td>5045.3</td><td>2.49×</td><td>cpp</td></tr>\n<tr><td>int8</td><td>708.1</td><td>659.3</td><td>1.07×</td><td>cpp</td></tr>\n<tr><td>int64</td><td>22271.0</td><td><strong>1059.9</strong></td><td>21×</td><td>go</td></tr>\n<tr><td>int32</td><td>22495.4</td><td><strong>964.1</strong></td><td>23×</td><td>go</td></tr>\n<tr><td>int16</td><td>22147.5</td><td><strong>953.5</strong></td><td>23×</td><td>go</td></tr>\n<tr><td>int / complex*</td><td>~30k</td><td>~1.0k</td><td>~29–31×</td><td>go</td></tr>\n<tr><td>uint* / nf4 / fp6 / int3–6</td><td>~20–77k</td><td>~3.7–10.6k</td><td>~5–7×</td><td>go</td></tr>\n<tr><td>uint8</td><td>4322.3</td><td>7575.0</td><td>0.57×</td><td>cpp</td></tr>\n</tbody></table>\n<p>C++ still owns int8/narrow, uint8, bf16/fp8. float32 DotTile remains Go’s race\n(<strong>929.5</strong> vs C++ 1162 / Rust 1335). uint8 affine is a known Go follow-up.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/11-dense/main.go\">examples/11-dense/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/11-dense &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tinit := make([]float32, 4*8)\n\tl, err := dense.NewConfigured(8, 4, core.ActivationReLU, core.DTypeFloat32, quant.FormatNone, init)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.Exec.Backend = core.BackendCPUTiled\n\tx := core.NewTensor[float32](1, 8)\n\tpre, post, err := dense.Forward(l, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tgIn, gW, err := dense.Backward(l, post, x, pre)\n\t_ = dense.ApplyGradSGD(l, gW, 1e-3)\n\tfmt.Println(len(gIn.Data), len(gW.Data))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>8 32</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/dense✅\n\nWhy it exists\nMost FLOPs are W@x. One Dense stack owns FormatNone×34 and all quants × three backends so every composite proj shares one correctness surface — including native in-dtype SGD.\nWhat it is\nNew / NewConfigured[T], Forward/Backward (dispatch on Exec.Backend), Place, ApplyGradSGD (→ weights.ApplySGD on the store). SIMD forward (v1.0.3): dtype switch by MatVec strategy — DotTile / DotI8 / lowp packed / expand-once→DotTile / WireF64+DotTileF64; fused Dot* for classic Q*, k/IQ, AffinePacked. Composites (MHA, SwiGLU, CNN im2col, RNN/LSTM/Mamba, residual·sequential·parallel) reuse Dense children via syncProjExec. BackwardSIMD still DecodeRow/saxpy (not the new expand wires).\n\nv1.0.3 — FormatNone SIMD forward\nDeep profile (batch=8, 8×256→256, SIMD-only, 34 dtypes): Go vs tiny C++/Rust ports, bit-identical hashes.\nGo refreshed kernels → suite ~4.3× geo-mean vs prior Go; wins flipped 2→24\n(C++ 9, Rust 1). Forward only. Source numbers:\nwelvet-to-rust_n_cpp.\n\nforwardSIMDByWire (strategy groups)\ncasedtypeskernel\nnarrow i8int4, int2, ternary, binaryexpand → DotI8Tile\nuint affineuint4/2/3/5/6, uint16…uintptrexpand once → DotTile\nlowp packedf16, bf16, fp8, fp4convert tiles → DotTile\nexpand f32nf4, fp6, int3/5/6expand once → DotTile (exact)\nstream f64float64, int16/32/64, int, complex*WireF64 → DotTileF64\nSelectWirefloat32, int8, uint8, …DotTile / DotI8 / affine u8\n\n\nBefore → after (µs/op, Go Δ)\nFull Go/C++/Rust columns: before wins Go 2 / C++ 31 / Rust 1; after\nGo 24 / C++ 9 / Rust 1. Highlight Go speedups (before→after):\ndtypeGo beforeGo afterGo Δbest after\nfloat321023.1929.51.10×go\nfloat649565.41017.49.40×go\nbfloat1612538.95045.32.49×cpp\nint8708.1659.31.07×cpp\nint6422271.01059.921×go\nint3222495.4964.123×go\nint1622147.5953.523×go\nint / complex*~30k~1.0k~29–31×go\nuint* / nf4 / fp6 / int3–6~20–77k~3.7–10.6k~5–7×go\nuint84322.37575.00.57×cpp\n\nC++ still owns int8/narrow, uint8, bf16/fp8. float32 DotTile remains Go’s race\n(929.5 vs C++ 1162 / Rust 1335). uint8 affine is a known Go follow-up.\n\n\n\nGo example\nexamples/11-dense/main.go\nRun:cd welvet/examples/11-dense && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tinit := make([]float32, 4*8)\n\tl, err := dense.NewConfigured(8, 4, core.ActivationReLU, core.DTypeFloat32, quant.FormatNone, init)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.Exec.Backend = core.BackendCPUTiled\n\tx := core.NewTensor[float32](1, 8)\n\tpre, post, err := dense.Forward(l, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tgIn, gW, err := dense.Backward(l, post, x, pre)\n\t_ = dense.ApplyGradSGD(l, gW, 1e-3)\n\tfmt.Println(len(gIn.Data), len(gW.Data))\n}\nOutput\nexit 0 · last run via go run .8 32\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/11-dense.html","url":"https://openfluke.com/book/11-dense"},{"slug":"12-mha","title":"layers/mha — attention","group":"III · Layers","description":"Transformers need multi-head attention with masks, RoPE/ALiBi, GQA/MQA, and cross-attn — without forking MatVec for every projection.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/mha</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Transformers need multi-head attention with masks, RoPE/ALiBi, GQA/MQA, and cross-attn — without forking MatVec for every projection.</p>\n<h2>What it is</h2>\n<p>Q/K/V/O are Dense children. Presets: DecoderCausal, EncoderBidirectional, CrossAttention, … Attn/RoPE ALU is host today; on-device attn shaders are still open.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/12-mha/main.go\">examples/12-mha/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/12-mha &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/mha\"\n)\n\nfunc main() {\n\tl, err := mha.New(mha.DecoderCausal(32, 4, 4))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8, 32) // [batch, seq, dim]\n\tpre, post, err := mha.Forward(l, x)\n\tfmt.Println(pre != nil, len(post.Data), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>true 256 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/mha✅\n\nWhy it exists\nTransformers need multi-head attention with masks, RoPE/ALiBi, GQA/MQA, and cross-attn — without forking MatVec for every projection.\nWhat it is\nQ/K/V/O are Dense children. Presets: DecoderCausal, EncoderBidirectional, CrossAttention, … Attn/RoPE ALU is host today; on-device attn shaders are still open.\n\n\n\nGo example\nexamples/12-mha/main.go\nRun:cd welvet/examples/12-mha && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/mha\"\n)\n\nfunc main() {\n\tl, err := mha.New(mha.DecoderCausal(32, 4, 4))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8, 32) // [batch, seq, dim]\n\tpre, post, err := mha.Forward(l, x)\n\tfmt.Println(pre != nil, len(post.Data), err)\n}\nOutput\nexit 0 · last run via go run .true 256 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/12-mha.html","url":"https://openfluke.com/book/12-mha"},{"slug":"13-swiglu","title":"layers/swiglu — gated FFN","group":"III · Layers","description":"Modern decoder FFNs are SiLU(gate)⊙up → down. Projections must share Dense’s quant/backend matrix.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/swiglu</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Modern decoder FFNs are SiLU(gate)⊙up → down. Projections must share Dense’s quant/backend matrix.</p>\n<h2>What it is</h2>\n<p>Gate/Up/Down Dense children; DefaultFFN(dModel); WebGPU SiLU⊙ fuse on forward.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/13-swiglu/main.go\">examples/13-swiglu/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/13-swiglu &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/swiglu\"\n)\n\nfunc main() {\n\tl, err := swiglu.New(swiglu.DefaultFFN(64))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 64)\n\t_, post, err := swiglu.Forward(l, x)\n\tfmt.Println(len(post.Data), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>64 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/swiglu✅\n\nWhy it exists\nModern decoder FFNs are SiLU(gate)⊙up → down. Projections must share Dense’s quant/backend matrix.\nWhat it is\nGate/Up/Down Dense children; DefaultFFN(dModel); WebGPU SiLU⊙ fuse on forward.\n\n\n\nGo example\nexamples/13-swiglu/main.go\nRun:cd welvet/examples/13-swiglu && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/swiglu\"\n)\n\nfunc main() {\n\tl, err := swiglu.New(swiglu.DefaultFFN(64))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 64)\n\t_, post, err := swiglu.Forward(l, x)\n\tfmt.Println(len(post.Data), err)\n}\nOutput\nexit 0 · last run via go run .64 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/13-swiglu.html","url":"https://openfluke.com/book/13-swiglu"},{"slug":"14-rmsnorm","title":"layers/rmsnorm","group":"III · Layers","description":"Llama-style blocks normalize by RMS, not mean+var. Needs native fwd/bwd and WebGPU shaders.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/rmsnorm</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Llama-style blocks normalize by RMS, not mean+var. Needs native fwd/bwd and WebGPU shaders.</p>\n<h2>What it is</h2>\n<p>Per-token RMS + γ on weights.Store; WebGPU fwd+bwd; SIMD DotTile stats + host scale.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/14-rmsnorm/main.go\">examples/14-rmsnorm/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/14-rmsnorm &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/rmsnorm\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tgamma := []float32{1, 1, 1, 1}\n\tl, err := rmsnorm.NewConfigured(rmsnorm.Config{Dim: 4}, core.DTypeFloat32, quant.FormatNone, gamma)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4)\n\t_, y, err := rmsnorm.Forward(l, x)\n\tfmt.Println(y.Data, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[0 0 0 0] &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/rmsnorm✅\n\nWhy it exists\nLlama-style blocks normalize by RMS, not mean+var. Needs native fwd/bwd and WebGPU shaders.\nWhat it is\nPer-token RMS + γ on weights.Store; WebGPU fwd+bwd; SIMD DotTile stats + host scale.\n\n\n\nGo example\nexamples/14-rmsnorm/main.go\nRun:cd welvet/examples/14-rmsnorm && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/rmsnorm\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tgamma := []float32{1, 1, 1, 1}\n\tl, err := rmsnorm.NewConfigured(rmsnorm.Config{Dim: 4}, core.DTypeFloat32, quant.FormatNone, gamma)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4)\n\t_, y, err := rmsnorm.Forward(l, x)\n\tfmt.Println(y.Data, err)\n}\nOutput\nexit 0 · last run via go run .[0 0 0 0] <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/14-rmsnorm.html","url":"https://openfluke.com/book/14-rmsnorm"},{"slug":"15-layernorm","title":"layers/layernorm","group":"III · Layers","description":"Classic mean+var normalization with γ/β — still required for many HF architectures.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/layernorm</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Classic mean+var normalization with γ/β — still required for many HF architectures.</p>\n<h2>What it is</h2>\n<p>WebGPU forward; backward host today. Same dtype×quant axes as other weighted layers.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/15-layernorm/main.go\">examples/15-layernorm/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/15-layernorm &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/layernorm\"\n)\n\nfunc main() {\n\tl, err := layernorm.New(layernorm.Config{Dim: 8})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8)\n\t_, y, err := layernorm.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>8 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/layernorm✅\n\nWhy it exists\nClassic mean+var normalization with γ/β — still required for many HF architectures.\nWhat it is\nWebGPU forward; backward host today. Same dtype×quant axes as other weighted layers.\n\n\n\nGo example\nexamples/15-layernorm/main.go\nRun:cd welvet/examples/15-layernorm && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/layernorm\"\n)\n\nfunc main() {\n\tl, err := layernorm.New(layernorm.Config{Dim: 8})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8)\n\t_, y, err := layernorm.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\nOutput\nexit 0 · last run via go run .8 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/15-layernorm.html","url":"https://openfluke.com/book/15-layernorm"},{"slug":"16-embedding","title":"layers/embedding","group":"III · Layers","description":"Token IDs must gather rows from a table — not a Dense MatVec — with scatter grads on backward.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/embedding</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Token IDs must gather rows from a table — not a Dense MatVec — with scatter grads on backward.</p>\n<h2>What it is</h2>\n<p>Config{VocabSize, EmbeddingDim, SeqLen}; table on weights.Store; host gather on SIMD/WebGPU today.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/16-embedding/main.go\">examples/16-embedding/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/16-embedding &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/embedding\"\n)\n\nfunc main() {\n\tl, err := embedding.New(embedding.Config{VocabSize: 32, EmbeddingDim: 16, SeqLen: 4})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tids := core.NewTensor[float32](1, 4)\n\tids.Data[0], ids.Data[1] = 3, 7\n\t_, y, err := embedding.Forward(l, ids)\n\tfmt.Println(y.Shape, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[1 4 16] &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/embedding✅\n\nWhy it exists\nToken IDs must gather rows from a table — not a Dense MatVec — with scatter grads on backward.\nWhat it is\nConfig{VocabSize, EmbeddingDim, SeqLen}; table on weights.Store; host gather on SIMD/WebGPU today.\n\n\n\nGo example\nexamples/16-embedding/main.go\nRun:cd welvet/examples/16-embedding && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/embedding\"\n)\n\nfunc main() {\n\tl, err := embedding.New(embedding.Config{VocabSize: 32, EmbeddingDim: 16, SeqLen: 4})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tids := core.NewTensor[float32](1, 4)\n\tids.Data[0], ids.Data[1] = 3, 7\n\t_, y, err := embedding.Forward(l, ids)\n\tfmt.Println(y.Shape, err)\n}\nOutput\nexit 0 · last run via go run .[1 4 16] <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/16-embedding.html","url":"https://openfluke.com/book/16-embedding"},{"slug":"17-softmax","title":"layers/softmax","group":"III · Layers","description":"Classification heads and attention need stable softmax variants, including sparse/Gumbel/Entmax for research paths.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/softmax</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Classification heads and attention need stable softmax variants, including sparse/Gumbel/Entmax for research paths.</p>\n<h2>What it is</h2>\n<p>Weightless layer; KindStandard/Temperature/Grid/Hierarchical/Gumbel/Masked/Sparse/… WebGPU covers std family; exotic kinds hard-error on GPU (no silent host).</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/17-softmax/main.go\">examples/17-softmax/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/17-softmax &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/softmax\"\n)\n\nfunc main() {\n\tl, err := softmax.New(softmax.Config{Dim: 4, Kind: softmax.KindStandard})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4)\n\tcopy(x.Data, []float32{2, 1, 0.1, -1})\n\t_, y, err := softmax.Forward(l, x)\n\tfmt.Println(y.Data, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[0.6380664 0.23473153 0.09543471 0.031767454] &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/softmax✅\n\nWhy it exists\nClassification heads and attention need stable softmax variants, including sparse/Gumbel/Entmax for research paths.\nWhat it is\nWeightless layer; KindStandard/Temperature/Grid/Hierarchical/Gumbel/Masked/Sparse/… WebGPU covers std family; exotic kinds hard-error on GPU (no silent host).\n\n\n\nGo example\nexamples/17-softmax/main.go\nRun:cd welvet/examples/17-softmax && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/softmax\"\n)\n\nfunc main() {\n\tl, err := softmax.New(softmax.Config{Dim: 4, Kind: softmax.KindStandard})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4)\n\tcopy(x.Data, []float32{2, 1, 0.1, -1})\n\t_, y, err := softmax.Forward(l, x)\n\tfmt.Println(y.Data, err)\n}\nOutput\nexit 0 · last run via go run .[0.6380664 0.23473153 0.09543471 0.031767454] <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/17-softmax.html","url":"https://openfluke.com/book/17-softmax"},{"slug":"18-sequential","title":"layers/sequential","group":"III · Layers","description":"Some cells need an ordered Dense chain without burning grid hops.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/sequential</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Some cells need an ordered Dense chain without burning grid hops.</p>\n<h2>What it is</h2>\n<p>Dense→Dense compose, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as a child is parallel.ResidualGraft / a Sandwich — Sequential cannot import parallel.</p>\n\n<p><code>NewFromOps</code> walks mixed children (Dense, SwiGLU, RMSNorm, LayerNorm) through the same\nfwd/bwd as a Dense chain. Parallel is not a Sequential child (import cycle) — wrap F with\n<code>parallel.ResidualGraft</code> or put Parallel in a Sandwich. w2a covers mixed Sequential cells;\nthis is on the v1.0 board, not a leftover “open.”</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/18-sequential/main.go\">examples/18-sequential/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/18-sequential &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/sequential\"\n)\n\nfunc main() {\n\tl, err := sequential.New(sequential.Config{Dim: 16, Depth: 3})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := sequential.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>16 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/sequential✅\n\nWhy it exists\nSome cells need an ordered Dense chain without burning grid hops.\nWhat it is\nDense→Dense compose, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as a child is parallel.ResidualGraft / a Sandwich — Sequential cannot import parallel.\n\nNewFromOps walks mixed children (Dense, SwiGLU, RMSNorm, LayerNorm) through the same\nfwd/bwd as a Dense chain. Parallel is not a Sequential child (import cycle) — wrap F with\nparallel.ResidualGraft or put Parallel in a Sandwich. w2a covers mixed Sequential cells;\nthis is on the v1.0 board, not a leftover “open.”\n\n\n\nGo example\nexamples/18-sequential/main.go\nRun:cd welvet/examples/18-sequential && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/sequential\"\n)\n\nfunc main() {\n\tl, err := sequential.New(sequential.Config{Dim: 16, Depth: 3})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := sequential.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\nOutput\nexit 0 · last run via go run .16 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/18-sequential.html","url":"https://openfluke.com/book/18-sequential"},{"slug":"19-residual","title":"layers/residual","group":"III · Layers","description":"Skip connections stabilize deep stacks: y = F(x) + x with correct skip grads.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/residual</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Skip connections stabilize deep stacks: y = F(x) + x with correct skip grads.</p>\n<h2>What it is</h2>\n<p>F is Dense Dim→Dim, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as F is parallel.ResidualGraft (y = F(x)+x) — Residual cannot import parallel.</p>\n\n<p><code>NewFromOps</code> builds F over mixed Ops. Parallel as F is\n<code>parallel.ResidualGraft</code> → <code>y = F(x)+x</code>. Skip grads still land on F and the identity path.\nNested mixed Residual is on the v1.0 board.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/19-residual/main.go\">examples/19-residual/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/19-residual &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/residual\"\n)\n\nfunc main() {\n\tl, err := residual.New(residual.Config{Dim: 16, Depth: 2})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := residual.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>16 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/residual✅\n\nWhy it exists\nSkip connections stabilize deep stacks: y = F(x) + x with correct skip grads.\nWhat it is\nF is Dense Dim→Dim, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as F is parallel.ResidualGraft (y = F(x)+x) — Residual cannot import parallel.\n\nNewFromOps builds F over mixed Ops. Parallel as F is\nparallel.ResidualGraft → y = F(x)+x. Skip grads still land on F and the identity path.\nNested mixed Residual is on the v1.0 board.\n\n\n\nGo example\nexamples/19-residual/main.go\nRun:cd welvet/examples/19-residual && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/residual\"\n)\n\nfunc main() {\n\tl, err := residual.New(residual.Config{Dim: 16, Depth: 2})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := residual.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\nOutput\nexit 0 · last run via go run .16 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/19-residual.html","url":"https://openfluke.com/book/19-residual"},{"slug":"20-cnn","title":"layers/cnn1 · cnn2 · cnn3","group":"III · Layers","description":"Conv nets must sit on the same dtype×quant×backend matrix as Dense. im2col → Dense GEMV is the intentional first cut.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/cnn2</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Conv nets must sit on the same dtype×quant×backend matrix as Dense. im2col → Dense GEMV is the intentional first cut.</p>\n<h2>What it is</h2>\n<p>cnn1/cnn2/cnn3: host im2col then Proj Dense. Full timed matrices. Tiled conv shaders still ⬜.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/20-cnn/main.go\">examples/20-cnn/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/20-cnn &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/cnn2\"\n)\n\nfunc main() {\n\tl, err := cnn2.New(cnn2.Config{\n\t\tInChannels: 1, Filters: 4, Height: 8, Width: 8, Kernel: 3, Stride: 1,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 1, 8, 8)\n\t_, y, err := cnn2.Forward(l, x)\n\tfmt.Println(y.Shape, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[1 4 6 6] &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/cnn2✅\n\nWhy it exists\nConv nets must sit on the same dtype×quant×backend matrix as Dense. im2col → Dense GEMV is the intentional first cut.\nWhat it is\ncnn1/cnn2/cnn3: host im2col then Proj Dense. Full timed matrices. Tiled conv shaders still ⬜.\n\n\n\nGo example\nexamples/20-cnn/main.go\nRun:cd welvet/examples/20-cnn && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/cnn2\"\n)\n\nfunc main() {\n\tl, err := cnn2.New(cnn2.Config{\n\t\tInChannels: 1, Filters: 4, Height: 8, Width: 8, Kernel: 3, Stride: 1,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 1, 8, 8)\n\t_, y, err := cnn2.Forward(l, x)\n\tfmt.Println(y.Shape, err)\n}\nOutput\nexit 0 · last run via go run .[1 4 6 6] <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/20-cnn.html","url":"https://openfluke.com/book/20-cnn"},{"slug":"21-rnn-lstm","title":"layers/rnn · lstm","group":"III · Layers","description":"Sequence models before transformers still need vanilla RNN and LSTM with BPTT on the shared MatVec stack.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/lstm</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Sequence models before transformers still need vanilla RNN and LSTM with BPTT on the shared MatVec stack.</p>\n<h2>What it is</h2>\n<p>IH/HH (and LSTM gates) via Dense; recurrence ALU host; device required for WebGPU path.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/21-rnn-lstm/main.go\">examples/21-rnn-lstm/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/21-rnn-lstm &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/lstm\"\n\t\"github.com/openfluke/welvet/layers/rnn\"\n)\n\nfunc main() {\n\tr, _ := rnn.New(rnn.Config{InputSize: 8, HiddenSize: 16, SeqLen: 4})\n\tl, _ := lstm.New(lstm.Config{InputSize: 8, HiddenSize: 16, SeqLen: 4})\n\tx := core.NewTensor[float32](1, 4, 8)\n\t_, yr, _ := rnn.Forward(r, x)\n\t_, yl, _ := lstm.Forward(l, x)\n\tfmt.Println(len(yr.Data), len(yl.Data))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>64 64</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/lstm✅\n\nWhy it exists\nSequence models before transformers still need vanilla RNN and LSTM with BPTT on the shared MatVec stack.\nWhat it is\nIH/HH (and LSTM gates) via Dense; recurrence ALU host; device required for WebGPU path.\n\n\n\nGo example\nexamples/21-rnn-lstm/main.go\nRun:cd welvet/examples/21-rnn-lstm && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/lstm\"\n\t\"github.com/openfluke/welvet/layers/rnn\"\n)\n\nfunc main() {\n\tr, _ := rnn.New(rnn.Config{InputSize: 8, HiddenSize: 16, SeqLen: 4})\n\tl, _ := lstm.New(lstm.Config{InputSize: 8, HiddenSize: 16, SeqLen: 4})\n\tx := core.NewTensor[float32](1, 4, 8)\n\t_, yr, _ := rnn.Forward(r, x)\n\t_, yl, _ := lstm.Forward(l, x)\n\tfmt.Println(len(yr.Data), len(yl.Data))\n}\nOutput\nexit 0 · last run via go run .64 64\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/21-rnn-lstm.html","url":"https://openfluke.com/book/21-rnn-lstm"},{"slug":"22-seqmix","title":"layers/seqmix — mixer contract","group":"III · Layers","description":"Attention, SSM, linear attn, and conv mixers must not be accidental forks of mha. Naming the contract keeps packages honest.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/seqmix</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Attention, SSM, linear attn, and conv mixers must not be accidental forks of mha. Naming the contract keeps packages honest.</p>\n<h2>What it is</h2>\n<p>KindAttention | KindSSM | KindLinearAttn | KindConvMix and Contract{Kind,DModel,MaxT}. No compute here.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/22-seqmix/main.go\">examples/22-seqmix/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/22-seqmix &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/seqmix\"\n)\n\nfunc main() {\n\tc := seqmix.Contract{Kind: seqmix.KindAttention, DModel: 64, MaxT: 2048}\n\tfmt.Println(c.Kind.String()) // attention\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>attention</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/seqmix✅\n\nWhy it exists\nAttention, SSM, linear attn, and conv mixers must not be accidental forks of mha. Naming the contract keeps packages honest.\nWhat it is\nKindAttention | KindSSM | KindLinearAttn | KindConvMix and Contract{Kind,DModel,MaxT}. No compute here.\n\n\n\nGo example\nexamples/22-seqmix/main.go\nRun:cd welvet/examples/22-seqmix && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/seqmix\"\n)\n\nfunc main() {\n\tc := seqmix.Contract{Kind: seqmix.KindAttention, DModel: 64, MaxT: 2048}\n\tfmt.Println(c.Kind.String()) // attention\n}\nOutput\nexit 0 · last run via go run .attention\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/22-seqmix.html","url":"https://openfluke.com/book/22-seqmix"},{"slug":"23-gdn","title":"layers/gdn — gated delta net","group":"III · Layers","description":"Linear attention / decode-first mixers (Gated DeltaNet) need a first-class package under KindLinearAttn.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/gdn</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Linear attention / decode-first mixers (Gated DeltaNet) need a first-class package under KindLinearAttn.</p>\n<h2>What it is</h2>\n<p>Exec CPU/SIMD/WebGPU; ForwardDecode; truncated BPTT. Timed matrix is Float32-primary: PermutationOK is f32 × FormatNone/BinaryPacked × CPU/SIMD/WebGPU; other cells GAP (declared), not FAIL.</p>\n\n<div class=\"callout warn\"><strong>Honesty: GDN GAP ≠ fail</strong>\n<code>PermutationOK</code> is Float32 × FormatNone/BinaryPacked × CPU/SIMD/WebGPU only.\nExotic dtypes and other packed formats are declared GAP in the timed matrix. Truncated BPTT;\nblobs are not on the Dense Store dtype axis. Do not read GAP as “GDN is broken.”</div>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/23-gdn/main.go\">examples/23-gdn/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/23-gdn &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/gdn\"\n)\n\nfunc main() {\n\tl, err := gdn.New(gdn.Config{\n\t\tHiddenSize: 64, NumKeyHeads: 4, NumValueHeads: 4,\n\t\tKeyHeadDim: 16, ValueHeadDim: 16, ConvKernel: 4,\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"config rejected:\", err)\n\t\treturn\n\t}\n\tl.Reset()\n\tx := make([]float32, 64)\n\ty := make([]float32, 64)\n\tfmt.Println(l.ForwardDecode(x, y))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>&lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/gdn✅\n\nWhy it exists\nLinear attention / decode-first mixers (Gated DeltaNet) need a first-class package under KindLinearAttn.\nWhat it is\nExec CPU/SIMD/WebGPU; ForwardDecode; truncated BPTT. Timed matrix is Float32-primary: PermutationOK is f32 × FormatNone/BinaryPacked × CPU/SIMD/WebGPU; other cells GAP (declared), not FAIL.\n\nHonesty: GDN GAP ≠ fail\nPermutationOK is Float32 × FormatNone/BinaryPacked × CPU/SIMD/WebGPU only.\nExotic dtypes and other packed formats are declared GAP in the timed matrix. Truncated BPTT;\nblobs are not on the Dense Store dtype axis. Do not read GAP as “GDN is broken.”\n\n\n\nGo example\nexamples/23-gdn/main.go\nRun:cd welvet/examples/23-gdn && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/gdn\"\n)\n\nfunc main() {\n\tl, err := gdn.New(gdn.Config{\n\t\tHiddenSize: 64, NumKeyHeads: 4, NumValueHeads: 4,\n\t\tKeyHeadDim: 16, ValueHeadDim: 16, ConvKernel: 4,\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"config rejected:\", err)\n\t\treturn\n\t}\n\tl.Reset()\n\tx := make([]float32, 64)\n\ty := make([]float32, 64)\n\tfmt.Println(l.ForwardDecode(x, y))\n}\nOutput\nexit 0 · last run via go run .<nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/23-gdn.html","url":"https://openfluke.com/book/23-gdn"},{"slug":"24-mamba","title":"layers/mamba — selective SSM","group":"III · Layers","description":"SSM mixers (KindSSM) are not MHA clones — they need their own selective-scan path.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/mamba</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>SSM mixers (KindSSM) are not MHA clones — they need their own selective-scan path.</p>\n<h2>What it is</h2>\n<p>InProj → softplus(Δ) scan → OutProj. Full timed matrix + train grids (scan ALU host).</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/24-mamba/main.go\">examples/24-mamba/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/24-mamba &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/mamba\"\n)\n\nfunc main() {\n\tl, err := mamba.New(mamba.Config{DModel: 32, DState: 16, Expand: 2, SeqLen: 8})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tx := core.NewTensor[float32](1, 8, 32)\n\t_, y, err := mamba.Forward(l, x)\n\tfmt.Println(y != nil, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>true &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/mamba✅\n\nWhy it exists\nSSM mixers (KindSSM) are not MHA clones — they need their own selective-scan path.\nWhat it is\nInProj → softplus(Δ) scan → OutProj. Full timed matrix + train grids (scan ALU host).\n\n\n\nGo example\nexamples/24-mamba/main.go\nRun:cd welvet/examples/24-mamba && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/mamba\"\n)\n\nfunc main() {\n\tl, err := mamba.New(mamba.Config{DModel: 32, DState: 16, Expand: 2, SeqLen: 8})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tx := core.NewTensor[float32](1, 8, 32)\n\t_, y, err := mamba.Forward(l, x)\n\tfmt.Println(y != nil, err)\n}\nOutput\nexit 0 · last run via go run .true <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/24-mamba.html","url":"https://openfluke.com/book/24-mamba"},{"slug":"25-convt","title":"layers/convt1 · convt2 · convt3","group":"III · Layers","description":"Generators and U-Nets need transposed convolution as a peer of CNN, on the same Dense proj surface.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/convt1</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Generators and U-Nets need transposed convolution as a peer of CNN, on the same Dense proj surface.</p>\n<h2>What it is</h2>\n<p>Scatter upsample + Dense Proj. Full timed matrix + train grids (tiled transpose shaders still §12).</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/25-convt/main.go\">examples/25-convt/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/25-convt &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/convt1\"\n)\n\nfunc main() {\n\tl, err := convt1.New(convt1.Config{InChannels: 4, Filters: 2, SeqLen: 8, Kernel: 3, Stride: 2})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4, 8)\n\t_, y, err := convt1.Forward(l, x)\n\tfmt.Println(y.Shape, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[1 2 17] &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/convt1✅\n\nWhy it exists\nGenerators and U-Nets need transposed convolution as a peer of CNN, on the same Dense proj surface.\nWhat it is\nScatter upsample + Dense Proj. Full timed matrix + train grids (tiled transpose shaders still §12).\n\n\n\nGo example\nexamples/25-convt/main.go\nRun:cd welvet/examples/25-convt && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/convt1\"\n)\n\nfunc main() {\n\tl, err := convt1.New(convt1.Config{InChannels: 4, Filters: 2, SeqLen: 8, Kernel: 3, Stride: 2})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4, 8)\n\t_, y, err := convt1.Forward(l, x)\n\tfmt.Println(y.Shape, err)\n}\nOutput\nexit 0 · last run via go run .[1 2 17] <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/25-convt.html","url":"https://openfluke.com/book/25-convt"},{"slug":"26-kmeans","title":"layers/kmeans","group":"III · Layers","description":"Soft clustering as a differentiable layer lets topology experiments sit inside the same train loop.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/kmeans</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Soft clustering as a differentiable layer lets topology experiments sit inside the same train loop.</p>\n<h2>What it is</h2>\n<p>Centers on Dense (K×FeatureDim); soft assignment outputs. Full timed matrix + train grids.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/26-kmeans/main.go\">examples/26-kmeans/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/26-kmeans &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/kmeans\"\n)\n\nfunc main() {\n\tl, err := kmeans.New(kmeans.Config{NumClusters: 4, FeatureDim: 8})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8)\n\t_, y, err := kmeans.Forward(l, x)\n\tfmt.Println(y.Shape, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[1 4] &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/kmeans✅\n\nWhy it exists\nSoft clustering as a differentiable layer lets topology experiments sit inside the same train loop.\nWhat it is\nCenters on Dense (K×FeatureDim); soft assignment outputs. Full timed matrix + train grids.\n\n\n\nGo example\nexamples/26-kmeans/main.go\nRun:cd welvet/examples/26-kmeans && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/kmeans\"\n)\n\nfunc main() {\n\tl, err := kmeans.New(kmeans.Config{NumClusters: 4, FeatureDim: 8})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8)\n\t_, y, err := kmeans.Forward(l, x)\n\tfmt.Println(y.Shape, err)\n}\nOutput\nexit 0 · last run via go run .[1 4] <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/26-kmeans.html","url":"https://openfluke.com/book/26-kmeans"},{"slug":"27-parallel","title":"layers/parallel — MoE + cameral","group":"III · Layers","description":"Mixture-of-experts and multi-path cells need concat/add/avg/filter combines. Cameral graphs need sibling hemispheres that share input, merge outputs, and optionally train under distinct mode","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/parallel</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Mixture-of-experts and multi-path cells need concat/add/avg/filter combines. Cameral graphs need sibling hemispheres that share input, merge outputs, and optionally train under distinct modes.</p>\n<h2>What it is</h2>\n<p>Parallel branches + Stack sandwiches. Hemispheres / Bicameral / Sandwich build nested multi-cameral nets. SetBranchModes + TrainStackMSE let each hemi use a different TrainMode (all 29 named updates — BP, Tween, Split, FastProxy, Sparse, Step*, Mesh*, …).</p>\n<figure class=\"diagram\"><pre class=\"ascii\">input x\n   │\n   ▼\n Dense stem\n   │\n   ├──────────┐\n   ▼          ▼\n Hemi L     Hemi R     ← own Dense weights\n StepBP     TweenChain ← BranchModes\n   │          │\n   └──── add ─┘\n         │\n         ▼\n    Dense head → ŷ → MSE</pre><figcaption>Cameral Mix: one TrainMode per hemisphere; one loss on the merge.</figcaption></figure>\n<h2>Cameral API (v1.0)</h2>\n<ul>\n<li><code>Hemispheres</code> / <code>HemispheresFrom</code> — n twins (Dense or mixed Ops), merged by add/avg/concat/filter</li>\n<li><code>Bicameral</code> / <code>Sandwich</code> / <code>BicameralFrom</code> — stem → Parallel → head Stack</li>\n<li><code>SetBranchModes(...)</code> — stamp per-hemi <code>TrainMode</code></li>\n<li><code>TrainStackMSE</code> — forward → MSE → per-branch update (honours BranchModes)</li>\n<li><code>ResidualGraft</code> — skip around a Parallel F without Residual importing this package</li>\n<li><code>WriteCameralFile</code> / <code>LoadCameral</code> — cameral <code>.entity</code> (in <code>model/entity</code>)</li>\n<li><code>CamSyncConfig</code> / <code>SetCamSync</code> / <code>SyncNow</code> — soft/hard inter-cameral weight blend + cross-layer same-shape pairs → <a href=\"/book/70-cam-sync\">§70</a></li>\n</ul>\n<p>Uniform Bi/Tri/Quad can train via Grid <code>training.Step</code> (one mode for the net).\nMix jobs need the Stack path so each cameral actually uses its own mode.</p>\n<p>Why hemispheres exist, and how AAI Lucy benches use them:\n<a href=\"/book/68-cameral\">§68</a>. Inter-cameral weight sync (crazy cross-mesh same-shape blends):\n<a href=\"/book/70-cam-sync\">§70</a>. All 29 named updates and their equations:\n<a href=\"/book/67-train-modes\">§67</a>.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/27-parallel/main.go\">examples/27-parallel/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/27-parallel &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\t// Dense stem → 2 hemispheres (add) → Dense head\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Mix: left hemi StepBP, right hemi StepTweenChain\n\themi := s.Children[1].(*parallel.Layer)\n\themi.SetBranchModes(parallel.ModeStepBP, parallel.ModeStepTweenChain)\n\n\tx := core.NewTensor[float32](1, 8)\n\tt := core.NewTensor[float32](1, 1)\n\tt.Data[0] = 0.5\n\tloss, err := parallel.TrainStackMSE(s, x, t, parallel.ModeStepBP, 0.01)\n\tfmt.Println(\"loss\", loss, \"err\", err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>loss 0 err &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/parallel✅\n\nWhy it exists\nMixture-of-experts and multi-path cells need concat/add/avg/filter combines. Cameral graphs need sibling hemispheres that share input, merge outputs, and optionally train under distinct modes.\nWhat it is\nParallel branches + Stack sandwiches. Hemispheres / Bicameral / Sandwich build nested multi-cameral nets. SetBranchModes + TrainStackMSE let each hemi use a different TrainMode (all 29 named updates — BP, Tween, Split, FastProxy, Sparse, Step*, Mesh*, …).\ninput x\n   │\n   ▼\n Dense stem\n   │\n   ├──────────┐\n   ▼          ▼\n Hemi L     Hemi R     ← own Dense weights\n StepBP     TweenChain ← BranchModes\n   │          │\n   └──── add ─┘\n         │\n         ▼\n    Dense head → ŷ → MSECameral Mix: one TrainMode per hemisphere; one loss on the merge.\nCameral API (v1.0)\n\nHemispheres / HemispheresFrom — n twins (Dense or mixed Ops), merged by add/avg/concat/filter\nBicameral / Sandwich / BicameralFrom — stem → Parallel → head Stack\nSetBranchModes(...) — stamp per-hemi TrainMode\nTrainStackMSE — forward → MSE → per-branch update (honours BranchModes)\nResidualGraft — skip around a Parallel F without Residual importing this package\nWriteCameralFile / LoadCameral — cameral .entity (in model/entity)\nCamSyncConfig / SetCamSync / SyncNow — soft/hard inter-cameral weight blend + cross-layer same-shape pairs → §70\n\nUniform Bi/Tri/Quad can train via Grid training.Step (one mode for the net).\nMix jobs need the Stack path so each cameral actually uses its own mode.\nWhy hemispheres exist, and how AAI Lucy benches use them:\n§68. Inter-cameral weight sync (crazy cross-mesh same-shape blends):\n§70. All 29 named updates and their equations:\n§67.\n\n\n\nGo example\nexamples/27-parallel/main.go\nRun:cd welvet/examples/27-parallel && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\t// Dense stem → 2 hemispheres (add) → Dense head\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Mix: left hemi StepBP, right hemi StepTweenChain\n\themi := s.Children[1].(*parallel.Layer)\n\themi.SetBranchModes(parallel.ModeStepBP, parallel.ModeStepTweenChain)\n\n\tx := core.NewTensor[float32](1, 8)\n\tt := core.NewTensor[float32](1, 1)\n\tt.Data[0] = 0.5\n\tloss, err := parallel.TrainStackMSE(s, x, t, parallel.ModeStepBP, 0.01)\n\tfmt.Println(\"loss\", loss, \"err\", err)\n}\nOutput\nexit 0 · last run via go run .loss 0 err <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/27-parallel.html","url":"https://openfluke.com/book/27-parallel"},{"slug":"28-metacognition","title":"layers/metacognition","group":"III · Layers","description":"Observed layers can apply heuristic stability rules (gate/scale/reset) without dtype morph/QAT.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/metacognition</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Observed layers can apply heuristic stability rules (gate/scale/reset) without dtype morph/QAT.</p>\n<h2>What it is</h2>\n<p>Wraps Dense + DefaultStabilityRules(); Stats exposed. Full timed matrix + train grids.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/28-metacognition/main.go\">examples/28-metacognition/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/28-metacognition &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/metacognition\"\n)\n\nfunc main() {\n\tl, err := metacognition.New(metacognition.Config{\n\t\tDim: 16, Rules: metacognition.DefaultStabilityRules(),\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := metacognition.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>16 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/metacognition✅\n\nWhy it exists\nObserved layers can apply heuristic stability rules (gate/scale/reset) without dtype morph/QAT.\nWhat it is\nWraps Dense + DefaultStabilityRules(); Stats exposed. Full timed matrix + train grids.\n\n\n\nGo example\nexamples/28-metacognition/main.go\nRun:cd welvet/examples/28-metacognition && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/metacognition\"\n)\n\nfunc main() {\n\tl, err := metacognition.New(metacognition.Config{\n\t\tDim: 16, Rules: metacognition.DefaultStabilityRules(),\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := metacognition.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\nOutput\nexit 0 · last run via go run .16 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/28-metacognition.html","url":"https://openfluke.com/book/28-metacognition"},{"slug":"29-forward","title":"runtime/forward","group":"IV · Runtime","description":"A grid of heterogeneous ops needs one walker that dispatches by concrete type and fails loudly on unknowns.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/runtime/forward</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>A grid of heterogeneous ops needs one walker that dispatches by concrete type and fails loudly on unknowns.</p>\n<h2>What it is</h2>\n<p>Forward[T](grid, input) → Result tape; Cell[T] for single-cell dispatch. Covers Dense…Residual + extended wired ops.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/29-forward/main.go\">examples/29-forward/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/29-forward &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(8, 8, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tres, err := forward.Forward(g, core.NewTensor[float32](1, 8))\n\tfmt.Println(res != nil, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>true &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/runtime/forward✅\n\nWhy it exists\nA grid of heterogeneous ops needs one walker that dispatches by concrete type and fails loudly on unknowns.\nWhat it is\nForward[T](grid, input) → Result tape; Cell[T] for single-cell dispatch. Covers Dense…Residual + extended wired ops.\n\n\n\nGo example\nexamples/29-forward/main.go\nRun:cd welvet/examples/29-forward && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(8, 8, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tres, err := forward.Forward(g, core.NewTensor[float32](1, 8))\n\tfmt.Println(res != nil, err)\n}\nOutput\nexit 0 · last run via go run .true <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/29-forward.html","url":"https://openfluke.com/book/29-forward"},{"slug":"30-backward","title":"runtime/backward","group":"IV · Runtime","description":"Training needs a reverse tape over the same ops forward used — no separate graph framework.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/runtime/backward</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Training needs a reverse tape over the same ops forward used — no separate graph framework.</p>\n<h2>What it is</h2>\n<p>Backward[T](fwdResult, gradOut) walks the tape and returns per-op weight grads.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/30-backward/main.go\">examples/30-backward/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/30-backward &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/backward\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tfwd, _ := forward.Forward(g, core.NewTensor[float32](1, 4))\n\tbwd, err := backward.Backward(fwd, core.NewTensor[float32](1, 4))\n\tfmt.Println(bwd != nil, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>true &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/runtime/backward✅\n\nWhy it exists\nTraining needs a reverse tape over the same ops forward used — no separate graph framework.\nWhat it is\nBackward[T](fwdResult, gradOut) walks the tape and returns per-op weight grads.\n\n\n\nGo example\nexamples/30-backward/main.go\nRun:cd welvet/examples/30-backward && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/backward\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tfwd, _ := forward.Forward(g, core.NewTensor[float32](1, 4))\n\tbwd, err := backward.Backward(fwd, core.NewTensor[float32](1, 4))\n\tfmt.Println(bwd != nil, err)\n}\nOutput\nexit 0 · last run via go run .true <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/30-backward.html","url":"https://openfluke.com/book/30-backward"},{"slug":"31-training","title":"runtime/training","group":"IV · Runtime","description":"Suites and small nets need MSE+SGD and tween hooks without inventing an external trainer or a retained float32 master beside storage.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/runtime/training</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Suites and small nets need MSE+SGD and tween hooks without inventing an external trainer or a retained float32 master beside storage.</p>\n<h2>What it is</h2>\n<p>MSE/MSEGrad, SGD, Step, ApplyTween/StepTween, StepMesh. Layer-agnostic ApplyGradSGD dispatch (Dense…Mamba/GDN/…). FormatNone: in-dtype ApplySGD; packed: unpack→update→re-Pack. No QAT dual path — storage dtype/format is truth after every step. Sandwich credit (Split / FastProxy / Sparse / …) lives in layers/parallel TrainMode — see §67.</p>\n\n<p>Grid <code>training.Step</code> is MSE + backprop on a volumetric tape. Cameral Mix and the 29 named\ncredit updates use <code>parallel.TrainStackMSE</code> (and Mesh* schedulers) so hemispheres can disagree.\nEquations, rival metric (hard Acc vs StepBP), and Lucy Score honesty: <a href=\"/book/67-train-modes\">§67</a>.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/31-training/main.go\">examples/31-training/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/31-training &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n\t\"github.com/openfluke/welvet/runtime/training\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tfwd, _ := forward.Forward(g, core.NewTensor[float32](1, 4))\n\tloss, err := training.Step(fwd, core.NewTensor[float32](1, 4), 1e-2)\n\tfmt.Println(loss, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>0 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/runtime/training✅\n\nWhy it exists\nSuites and small nets need MSE+SGD and tween hooks without inventing an external trainer or a retained float32 master beside storage.\nWhat it is\nMSE/MSEGrad, SGD, Step, ApplyTween/StepTween, StepMesh. Layer-agnostic ApplyGradSGD dispatch (Dense…Mamba/GDN/…). FormatNone: in-dtype ApplySGD; packed: unpack→update→re-Pack. No QAT dual path — storage dtype/format is truth after every step. Sandwich credit (Split / FastProxy / Sparse / …) lives in layers/parallel TrainMode — see §67.\n\nGrid training.Step is MSE + backprop on a volumetric tape. Cameral Mix and the 29 named\ncredit updates use parallel.TrainStackMSE (and Mesh* schedulers) so hemispheres can disagree.\nEquations, rival metric (hard Acc vs StepBP), and Lucy Score honesty: §67.\n\n\n\nGo example\nexamples/31-training/main.go\nRun:cd welvet/examples/31-training && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n\t\"github.com/openfluke/welvet/runtime/training\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tfwd, _ := forward.Forward(g, core.NewTensor[float32](1, 4))\n\tloss, err := training.Step(fwd, core.NewTensor[float32](1, 4), 1e-2)\n\tfmt.Println(loss, err)\n}\nOutput\nexit 0 · last run via go run .0 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/31-training.html","url":"https://openfluke.com/book/31-training"},{"slug":"32-step","title":"runtime/step — step mesh","group":"IV · Runtime","description":"Spatial feedback (remote links) needs a discrete-time mesh where every cell updates from a double buffer — different from a decoder wavefront. Cross-numeric train also needs the same mesh wi","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/runtime/step</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Spatial feedback (remote links) needs a discrete-time mesh where every cell updates from a double buffer — different from a decoder wavefront. Cross-numeric train also needs the same mesh with weight DType ⊥ activation Tensor[T].</p>\n<h2>What it is</h2>\n<p>State[T], StepForward/StepBackward/StepApplyTween / StepMesh across the grid for all wired Ops × dtype × quant × CPU/SIMD. W2A Cross-Numeric Train: polyops.AllKinds() × weight dtype × act host (smoke ~21×7×5 ≈ 735; full ~21×34×15 ≈ 10.7k) — asserts no retained f32 master after StepMesh. Stack Step* is a different clock: IsLineStep / TrainLine (1D pipe) — see §67.</p>\n\n<h2>Two clocks named Step</h2>\n<p><strong>This package</strong> is the volumetric mesh: every grid cell hops from a double buffer. MeshBP / MeshTween / MeshTweenChain call it.</p>\n<p><strong>Stack Step*</strong> (<code>IsLineStep</code>) is a 1D systolic pipe on a Sandwich — not this mesh.\nOne sample enters child 0 per <code>TrainStackMSE</code> tick; every in-flight sample advances one layer; the output/train event is the sample that entered <em>depth</em> ticks ago. Fill ticks do not update. Serve stays a full <code>ForwardStack</code>. Mesh* still needs a Grid. Named updates: <a href=\"/book/67-train-modes\">§67</a>.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/32-step/main.go\">examples/32-step/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/32-step &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/step\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tst := step.New[float32](g)\n\t_, err := step.StepForward(g, st, false)\n\tfmt.Println(err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>&lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/runtime/step✅\n\nWhy it exists\nSpatial feedback (remote links) needs a discrete-time mesh where every cell updates from a double buffer — different from a decoder wavefront. Cross-numeric train also needs the same mesh with weight DType ⊥ activation Tensor[T].\nWhat it is\nState[T], StepForward/StepBackward/StepApplyTween / StepMesh across the grid for all wired Ops × dtype × quant × CPU/SIMD. W2A Cross-Numeric Train: polyops.AllKinds() × weight dtype × act host (smoke ~21×7×5 ≈ 735; full ~21×34×15 ≈ 10.7k) — asserts no retained f32 master after StepMesh. Stack Step* is a different clock: IsLineStep / TrainLine (1D pipe) — see §67.\n\nTwo clocks named Step\nThis package is the volumetric mesh: every grid cell hops from a double buffer. MeshBP / MeshTween / MeshTweenChain call it.\nStack Step* (IsLineStep) is a 1D systolic pipe on a Sandwich — not this mesh.\nOne sample enters child 0 per TrainStackMSE tick; every in-flight sample advances one layer; the output/train event is the sample that entered depth ticks ago. Fill ticks do not update. Serve stays a full ForwardStack. Mesh* still needs a Grid. Named updates: §67.\n\n\n\nGo example\nexamples/32-step/main.go\nRun:cd welvet/examples/32-step && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/step\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tst := step.New[float32](g)\n\t_, err := step.StepForward(g, st, false)\n\tfmt.Println(err)\n}\nOutput\nexit 0 · last run via go run .<nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/32-step.html","url":"https://openfluke.com/book/32-step"},{"slug":"33-dna","title":"systems/dna","group":"V · Systems","description":"Quant and train must be measurable as topology/weight fingerprints — DNA detects logic shifts.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/systems/dna</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Quant and train must be measurable as topology/weight fingerprints — DNA detects logic shifts.</p>\n<h2>What it is</h2>\n<p>ExtractDNA, CompareNetworks, CosineSimilarity, FlattenOp / CollectStores across dtype×quant.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/33-dna/main.go\">examples/33-dna/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/33-dna &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/systems/dna\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\ta := dna.ExtractDNA(g)\n\tfmt.Println(dna.CompareNetworks(a, a))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>{1 map[0,0,0,0:1] []}</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/systems/dna✅\n\nWhy it exists\nQuant and train must be measurable as topology/weight fingerprints — DNA detects logic shifts.\nWhat it is\nExtractDNA, CompareNetworks, CosineSimilarity, FlattenOp / CollectStores across dtype×quant.\n\n\n\nGo example\nexamples/33-dna/main.go\nRun:cd welvet/examples/33-dna && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/systems/dna\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\ta := dna.ExtractDNA(g)\n\tfmt.Println(dna.CompareNetworks(a, a))\n}\nOutput\nexit 0 · last run via go run .{1 map[0,0,0,0:1] []}\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/33-dna.html","url":"https://openfluke.com/book/33-dna"},{"slug":"34-evolution","title":"systems/evolution","group":"V · Systems","description":"Topology search and weight crossover need first-class splice + NEAT on CPU-resident grids.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/systems/evolution</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Topology search and weight crossover need first-class splice + NEAT on CPU-resident grids.</p>\n<h2>What it is</h2>\n<p>SpliceDNA, NEATMutate, NewNEATPopulation, CloneGrid — dtype/quant preserved via SetFromF32.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/34-evolution/main.go\">examples/34-evolution/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/34-evolution &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/evolution\"\n)\n\nfunc main() {\n\ta, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)\n\tchild, err := evolution.SpliceDNA(a, b, evolution.DefaultSpliceConfig())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\t_, err = evolution.NEATMutate(child, evolution.DefaultNEATConfig(16))\n\tfmt.Println(err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>&lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/systems/evolution✅\n\nWhy it exists\nTopology search and weight crossover need first-class splice + NEAT on CPU-resident grids.\nWhat it is\nSpliceDNA, NEATMutate, NewNEATPopulation, CloneGrid — dtype/quant preserved via SetFromF32.\n\n\n\nGo example\nexamples/34-evolution/main.go\nRun:cd welvet/examples/34-evolution && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/evolution\"\n)\n\nfunc main() {\n\ta, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)\n\tchild, err := evolution.SpliceDNA(a, b, evolution.DefaultSpliceConfig())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\t_, err = evolution.NEATMutate(child, evolution.DefaultNEATConfig(16))\n\tfmt.Println(err)\n}\nOutput\nexit 0 · last run via go run .<nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/34-evolution.html","url":"https://openfluke.com/book/34-evolution"},{"slug":"35-tween","title":"systems/tween","group":"V · Systems","description":"Target propagation (chain-rule or Hebbian layerwise gaps) is an alternative credit-assignment path. Not the same package as TrainMode Tween / TweenChain on a Sandwich (those are layers/paral","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/systems/tween</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Target propagation (chain-rule or Hebbian layerwise gaps) is an alternative credit-assignment path. Not the same package as TrainMode Tween / TweenChain on a Sandwich (those are layers/parallel — §67).</p>\n<h2>What it is</h2>\n<p>NewState, Forward, BackwardChainRule / BackwardLayerwise, ApplyGaps; SIMD DotTile/Saxpy budgets.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/35-tween/main.go\">examples/35-tween/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/35-tween &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/systems/tween\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tst := tween.NewState[float32](g, tween.DefaultConfig())\n\t_, err := tween.Forward(g, st, core.NewTensor[float32](1, 4))\n\tfmt.Println(err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>forward: no op at {0 0 0 0} (type Dense)</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/systems/tween✅\n\nWhy it exists\nTarget propagation (chain-rule or Hebbian layerwise gaps) is an alternative credit-assignment path. Not the same package as TrainMode Tween / TweenChain on a Sandwich (those are layers/parallel — §67).\nWhat it is\nNewState, Forward, BackwardChainRule / BackwardLayerwise, ApplyGaps; SIMD DotTile/Saxpy budgets.\n\n\n\nGo example\nexamples/35-tween/main.go\nRun:cd welvet/examples/35-tween && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/systems/tween\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tst := tween.NewState[float32](g, tween.DefaultConfig())\n\t_, err := tween.Forward(g, st, core.NewTensor[float32](1, 4))\n\tfmt.Println(err)\n}\nOutput\nexit 0 · last run via go run .forward: no op at {0 0 0 0} (type Dense)\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/35-tween.html","url":"https://openfluke.com/book/35-tween"},{"slug":"36-tanhi","title":"systems/tanhi — TANHI · UDP HUD","group":"V · Systems","description":"Training visualization must never block the engine — best-effort UDP JSON-lines to a HUD.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/systems/tanhi</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Training visualization must never block the engine — best-effort UDP JSON-lines to a HUD.</p>\n<h2>What it is</h2>\n<p><strong>TANHI</strong> = <em>Tensor Activation Network Holographic Interface</em>. Sparse non-blocking JSON-line UDP events for per-layer forward/backward HUD visualization (timing, dtypes, shapes, routing links, parallel branches/combine). <strong>v1.1.1:</strong> grid BP, cameral stack/parallel train (all mode families), step mesh; <code>ConfigureGrid</code>, <code>SetTanhi</code>, topology bridge. <code>ConfigFromGrid</code>, <code>Emit</code>/<code>EmitSweep</code>, <code>DefaultUDPPort</code> (17481). SoulGlitch-style consumers.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/36-tanhi/main.go\">examples/36-tanhi/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/36-tanhi &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/tanhi\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tcfg := tanhi.ConfigFromGrid(g)\n\ttanhi.EmitSweep(cfg, \"epoch-0\") // non-blocking best-effort\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>(no output)</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/systems/tanhi✅\n\nWhy it exists\nTraining visualization must never block the engine — best-effort UDP JSON-lines to a HUD.\nWhat it is\nTANHI = Tensor Activation Network Holographic Interface. Sparse non-blocking JSON-line UDP events for per-layer forward/backward HUD visualization (timing, dtypes, shapes, routing links, parallel branches/combine). v1.1.1: grid BP, cameral stack/parallel train (all mode families), step mesh; ConfigureGrid, SetTanhi, topology bridge. ConfigFromGrid, Emit/EmitSweep, DefaultUDPPort (17481). SoulGlitch-style consumers.\n\n\n\nGo example\nexamples/36-tanhi/main.go\nRun:cd welvet/examples/36-tanhi && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/tanhi\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tcfg := tanhi.ConfigFromGrid(g)\n\ttanhi.EmitSweep(cfg, \"epoch-0\") // non-blocking best-effort\n}\nOutput\nexit 0 · last run via go run .(no output)\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/36-tanhi.html","url":"https://openfluke.com/book/36-tanhi"},{"slug":"37-telemetry","title":"systems/telemetry","group":"V · Systems","description":"Static structural blueprints (sizes, op kinds) differ from live TANHI events.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/systems/telemetry</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Static structural blueprints (sizes, op kinds) differ from live TANHI events.</p>\n<h2>What it is</h2>\n<p>ExtractNetworkBlueprint, ExtractLayerTelemetry for introspection/UIs.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/37-telemetry/main.go\">examples/37-telemetry/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/37-telemetry &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/telemetry\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tbp := telemetry.ExtractNetworkBlueprint(g, \"demo\")\n\tfmt.Printf(\"%+v\\n\", bp)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>{ID:demo TotalLayers:1 TotalParams:0 Layers:[{Z:0 Y:0 X:0 L:0 Type:Dense Activation:ReLU Parameters:0 InputShape:[] OutputShape:[] Branches:[] CombineMode:}]}</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/systems/telemetry✅\n\nWhy it exists\nStatic structural blueprints (sizes, op kinds) differ from live TANHI events.\nWhat it is\nExtractNetworkBlueprint, ExtractLayerTelemetry for introspection/UIs.\n\n\n\nGo example\nexamples/37-telemetry/main.go\nRun:cd welvet/examples/37-telemetry && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/telemetry\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tbp := telemetry.ExtractNetworkBlueprint(g, \"demo\")\n\tfmt.Printf(\"%+v\\n\", bp)\n}\nOutput\nexit 0 · last run via go run .{ID:demo TotalLayers:1 TotalParams:0 Layers:[{Z:0 Y:0 X:0 L:0 Type:Dense Activation:ReLU Parameters:0 InputShape:[] OutputShape:[] Branches:[] CombineMode:}]}\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/37-telemetry.html","url":"https://openfluke.com/book/37-telemetry"},{"slug":"38-entity","title":"model/entity — .entity files","group":"VI · Model IO","description":"HF safetensors are awkward for native topology + packed weights. ENTITY is the Welvet checkpoint.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/model/entity</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>HF safetensors are awkward for native topology + packed weights. ENTITY is the Welvet checkpoint.</p>\n<h2>What it is</h2>\n<p>Open/Inspect/IsEntity, LoadBlob/LoadQuantBlob, PackFromHF/ImportFromHF, WriteTransformerFile, SerializeNetwork, WriteCameralFile / LoadCameral (sandwich Stack + TrainMode).</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/38-entity/main.go\">examples/38-entity/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/38-entity &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/entity\"\n)\n\nfunc main() {\n\tinfo, err := entity.Inspect(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tef, err := entity.Open(\"model.entity\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer ef.Close()\n\tfmt.Println(info, ef.HasTokenizerBlob())\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>open model.entity: no such file or directory</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/model/entity✅\n\nWhy it exists\nHF safetensors are awkward for native topology + packed weights. ENTITY is the Welvet checkpoint.\nWhat it is\nOpen/Inspect/IsEntity, LoadBlob/LoadQuantBlob, PackFromHF/ImportFromHF, WriteTransformerFile, SerializeNetwork, WriteCameralFile / LoadCameral (sandwich Stack + TrainMode).\n\n\n\nGo example\nexamples/38-entity/main.go\nRun:cd welvet/examples/38-entity && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/entity\"\n)\n\nfunc main() {\n\tinfo, err := entity.Inspect(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tef, err := entity.Open(\"model.entity\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer ef.Close()\n\tfmt.Println(info, ef.HasTokenizerBlob())\n}\nOutput\nexit 0 · last run via go run .open model.entity: no such file or directory\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/38-entity.html","url":"https://openfluke.com/book/38-entity"},{"slug":"39-hf","title":"model/hf — snapshots","group":"VI · Model IO","description":"Import starts with probing HF/MLX layouts before packing ENTITY.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/model/hf</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Import starts with probing HF/MLX layouts before packing ENTITY.</p>\n<h2>What it is</h2>\n<p>InspectSnapshot, DetectArchitecture, safetensors/MLX loaders, Qwen3.5 hybrid helpers.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/39-hf/main.go\">examples/39-hf/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/39-hf &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/hf\"\n)\n\nfunc main() {\n\tinfo, err := hf.InspectSnapshot(\"/path/to/hf-snapshot\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(info)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>hf: config.json: stat /path/to/hf-snapshot/config.json: no such file or directory</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/model/hf✅\n\nWhy it exists\nImport starts with probing HF/MLX layouts before packing ENTITY.\nWhat it is\nInspectSnapshot, DetectArchitecture, safetensors/MLX loaders, Qwen3.5 hybrid helpers.\n\n\n\nGo example\nexamples/39-hf/main.go\nRun:cd welvet/examples/39-hf && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/hf\"\n)\n\nfunc main() {\n\tinfo, err := hf.InspectSnapshot(\"/path/to/hf-snapshot\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(info)\n}\nOutput\nexit 0 · last run via go run .hf: config.json: stat /path/to/hf-snapshot/config.json: no such file or directory\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/39-hf.html","url":"https://openfluke.com/book/39-hf"},{"slug":"40-tokenizer","title":"model/tokenizer","group":"VI · Model IO","description":"Generate needs encode/decode of HF tokenizer.json without pulling Python.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/model/tokenizer</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Generate needs encode/decode of HF tokenizer.json without pulling Python.</p>\n<h2>What it is</h2>\n<p>LoadTokenizer, Encode/Decode, LoadForEntity.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/40-tokenizer/main.go\">examples/40-tokenizer/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/40-tokenizer &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/tokenizer\"\n)\n\nfunc main() {\n\ttok, err := tokenizer.LoadTokenizer(\"tokenizer.json\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tids := tok.Encode(\"hello welvet\", true)\n\tfmt.Println(ids, tok.Decode(ids, true))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>failed to read tokenizer file: open tokenizer.json: no such file or directory</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/model/tokenizer✅\n\nWhy it exists\nGenerate needs encode/decode of HF tokenizer.json without pulling Python.\nWhat it is\nLoadTokenizer, Encode/Decode, LoadForEntity.\n\n\n\nGo example\nexamples/40-tokenizer/main.go\nRun:cd welvet/examples/40-tokenizer && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/tokenizer\"\n)\n\nfunc main() {\n\ttok, err := tokenizer.LoadTokenizer(\"tokenizer.json\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tids := tok.Encode(\"hello welvet\", true)\n\tfmt.Println(ids, tok.Decode(ids, true))\n}\nOutput\nexit 0 · last run via go run .failed to read tokenizer file: open tokenizer.json: no such file or directory\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/40-tokenizer.html","url":"https://openfluke.com/book/40-tokenizer"},{"slug":"41-sampling","title":"model/sampling","group":"VI · Model IO","description":"Logits → token ID needs ArgMax, TopK+temperature, penalties, and chat hygiene in one place.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/model/sampling</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Logits → token ID needs ArgMax, TopK+temperature, penalties, and chat hygiene in one place.</p>\n<h2>What it is</h2>\n<p>ArgMax, SampleTopK, ApplyRepetitionPenalty, BanIDs, SanitizeChatReply.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/41-sampling/main.go\">examples/41-sampling/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/41-sampling &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/sampling\"\n)\n\nfunc main() {\n\tlogits := []float32{0.1, 2.4, 0.3, -1}\n\tfmt.Println(sampling.ArgMax(logits))\n\tfmt.Println(sampling.SampleTopK(logits, 2, 0.8, true))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>1\n1</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/model/sampling✅\n\nWhy it exists\nLogits → token ID needs ArgMax, TopK+temperature, penalties, and chat hygiene in one place.\nWhat it is\nArgMax, SampleTopK, ApplyRepetitionPenalty, BanIDs, SanitizeChatReply.\n\n\n\nGo example\nexamples/41-sampling/main.go\nRun:cd welvet/examples/41-sampling && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/sampling\"\n)\n\nfunc main() {\n\tlogits := []float32{0.1, 2.4, 0.3, -1}\n\tfmt.Println(sampling.ArgMax(logits))\n\tfmt.Println(sampling.SampleTopK(logits, 2, 0.8, true))\n}\nOutput\nexit 0 · last run via go run .1\n1\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/41-sampling.html","url":"https://openfluke.com/book/41-sampling"},{"slug":"42-transformer","title":"model/transformer — generate","group":"VI · Model IO","description":"ENTITY packs must run as Llama-style decoders with KV cache, profiles (SIMD/WebGPU/fused), and chat templates.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/model/transformer</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>ENTITY packs must run as Llama-style decoders with KV cache, profiles (SIMD/WebGPU/fused), and chat templates.</p>\n<h2>What it is</h2>\n<p>LoadEntity → Model; Generate; ApplyExec profiles; ExportFusedGPUSpec / hybrid sync.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/42-transformer/main.go\">examples/42-transformer/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/42-transformer &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/tokenizer\"\n\t\"github.com/openfluke/welvet/model/transformer\"\n)\n\nfunc main() {\n\tm, err := transformer.LoadEntity(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\ttok, err := tokenizer.LoadTokenizer(\"tokenizer.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := m.ApplyExec(transformer.ProfileSIMDMultiCore()); err != nil {\n\t\tpanic(err)\n\t}\n\ttext, _, err := m.Generate(\n\t\ttok.Encode, tok.Decode, nil,\n\t\t\"You are helpful.\", \"Say hi.\",\n\t\ttransformer.GenOptions{MaxTokens: 32, Silent: true},\n\t)\n\tfmt.Println(text, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>open model.entity: no such file or directory</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/model/transformer✅\n\nWhy it exists\nENTITY packs must run as Llama-style decoders with KV cache, profiles (SIMD/WebGPU/fused), and chat templates.\nWhat it is\nLoadEntity → Model; Generate; ApplyExec profiles; ExportFusedGPUSpec / hybrid sync.\n\n\n\nGo example\nexamples/42-transformer/main.go\nRun:cd welvet/examples/42-transformer && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/tokenizer\"\n\t\"github.com/openfluke/welvet/model/transformer\"\n)\n\nfunc main() {\n\tm, err := transformer.LoadEntity(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\ttok, err := tokenizer.LoadTokenizer(\"tokenizer.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := m.ApplyExec(transformer.ProfileSIMDMultiCore()); err != nil {\n\t\tpanic(err)\n\t}\n\ttext, _, err := m.Generate(\n\t\ttok.Encode, tok.Decode, nil,\n\t\t\"You are helpful.\", \"Say hi.\",\n\t\ttransformer.GenOptions{MaxTokens: 32, Silent: true},\n\t)\n\tfmt.Println(text, err)\n}\nOutput\nexit 0 · last run via go run .open model.entity: no such file or directory\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/42-transformer.html","url":"https://openfluke.com/book/42-transformer"},{"slug":"43-apps","title":"apps — octo · flux2 · mosstts","group":"VII · Apps","description":"Products must not pollute engine packages. Octo is the model shell; flux2/mosstts are domain apps. Lucy races (AAI test41 / test48 / test50) are benches, not Welvet packages.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/apps/…</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Products must not pollute engine packages. Octo is the model shell; flux2/mosstts are domain apps. Lucy <em>races</em> (AAI test41 / test48 / test50) are benches, not Welvet packages.</p>\n<h2>What it is</h2>\n<p>octo (own module): download/convert/chat, see §44. flux2: MMDiT image. mosstts: Speak/SpeakToFile pipeline. AAI sandwiches race TrainMode on toys — see §68. Off the v1.0 engine board.</p>\n\n<p>The engine never imports apps. AAI is a separate Lucy harness that <code>replace</code>s\n<code>github.com/openfluke/welvet</code>. It is how we talk about cameral Mix and credit modes with numbers\n(hard Acc, SoftAcc, Score) instead of slogans. Public API stays in <code>layers/parallel</code> + <code>lucy</code>.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/43-apps/main.go\">examples/43-apps/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/43-apps &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Apps import the engine — the engine never imports apps.\")\n\tfmt.Println(\"  cd apps/octo &amp;&amp; go run .\")\n\tfmt.Println(\"  cd apps/flux2 &amp;&amp; go run .\")\n\tfmt.Println(\"  cd apps/mosstts &amp;&amp; go run .\")\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>Apps import the engine — the engine never imports apps.\n  cd apps/octo &amp;&amp; go run .\n  cd apps/flux2 &amp;&amp; go run .\n  cd apps/mosstts &amp;&amp; go run .</code></pre>\n<h3>Validate (harness)</h3><pre><code>cd apps/octo &amp;&amp; go run .   # when module wired</code></pre>\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/apps/…🚧\n\nWhy it exists\nProducts must not pollute engine packages. Octo is the model shell; flux2/mosstts are domain apps. Lucy races (AAI test41 / test48 / test50) are benches, not Welvet packages.\nWhat it is\nocto (own module): download/convert/chat, see §44. flux2: MMDiT image. mosstts: Speak/SpeakToFile pipeline. AAI sandwiches race TrainMode on toys — see §68. Off the v1.0 engine board.\n\nThe engine never imports apps. AAI is a separate Lucy harness that replaces\ngithub.com/openfluke/welvet. It is how we talk about cameral Mix and credit modes with numbers\n(hard Acc, SoftAcc, Score) instead of slogans. Public API stays in layers/parallel + lucy.\n\n\n\nGo example\nexamples/43-apps/main.go\nRun:cd welvet/examples/43-apps && source ../env.sh && go run .\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Apps import the engine — the engine never imports apps.\")\n\tfmt.Println(\"  cd apps/octo && go run .\")\n\tfmt.Println(\"  cd apps/flux2 && go run .\")\n\tfmt.Println(\"  cd apps/mosstts && go run .\")\n}\nOutput\nexit 0 · last run via go run .Apps import the engine — the engine never imports apps.\n  cd apps/octo && go run .\n  cd apps/flux2 && go run .\n  cd apps/mosstts && go run .\nValidate (harness)cd apps/octo && go run .   # when module wired\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/43-apps.html","url":"https://openfluke.com/book/43-apps"},{"slug":"44-octo","title":"Octo — model shell","group":"VII · Apps","description":"A model is only useful with a shell around it: pull weights from Hugging Face, convert them to a Welvet .entity, then chat, serve, or benchmark. Octo is that shell, kept in its own module so","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/apps/octo</span><span class=\"status ok\">✅ runs</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>A model is only useful with a shell around it: pull weights from Hugging Face, convert them to a Welvet <code>.entity</code>, then chat, serve, or benchmark. Octo is that shell, kept in its own module so the engine never depends on an app.</p>\n<h2>What it is</h2>\n<p>Subcommands cover the whole loop: <code>hub</code> download/ensure repos, <code>convert</code> pack to a single <code>.entity</code>, interactive <code>run</code>/<code>serve</code>/chat, plus image and speech menus. Its <code>bench</code> harness sweeps every quant format across a CPU Plan 9 SIMD fused profile and a WebGPU fused profile.</p>\n\n<h3>Bench: SmolLM2-135M-Instruct across quant formats</h3>\n<p class=\"example-meta\">template smol2-135m-fuse · linux/amd64 · NVIDIA GTX 1650 SUPER · 3m17s · 80 runs (76 ok, 4 skipped: \"none\" has no fused kernel). Throughput is total tokens/s on the first prompt; entity is on-disk size.</p>\n<table>\n<thead><tr><th>Quant</th><th>GPU-fused tok/s</th><th>SIMD-fused tok/s</th><th>Entity MB</th></tr></thead>\n<tbody>\n<tr><td>Q8_0</td><td>108.2</td><td>33.2</td><td>252.5</td></tr>\n<tr><td>Q6_K</td><td>73.5</td><td>4.9</td><td>216.4</td></tr>\n<tr><td>Q5_K</td><td>71.7</td><td>6.3</td><td>208.4</td></tr>\n<tr><td>Q4_K</td><td>73.4</td><td>7.8</td><td>192.3</td></tr>\n<tr><td>Q4_0</td><td>112.1</td><td>36.8</td><td>188.3</td></tr>\n<tr><td>IQ4_XS</td><td>105.5</td><td>7.6</td><td>204.4</td></tr>\n<tr><td>IQ4_NL</td><td>84.1</td><td>8.8</td><td>188.3</td></tr>\n<tr><td>TernaryPacked</td><td>106.9</td><td>18.9</td><td>172.3</td></tr>\n<tr><td>BinaryPacked</td><td>88.3</td><td>21.0</td><td>140.2</td></tr>\n</tbody></table>\n<p class=\"example-meta\">21 quant formats run end to end; the table shows a representative slice. Full report: <code>apps/octo/dist/octo-run-v0.76.txt</code>.</p>\n<div class=\"callout warn\"><strong>Honest low-bit note</strong>High-bit formats (Q8, Q6, Q5, Q4, IQ4) stay coherent. Sub-2-bit formats (IQ1/IQ2, Ternary, Binary) are fast and tiny but degrade into gibberish. The bench keeps them in to show the speed, size, and quality trade honestly rather than hiding it.</div>\n<h3>Sample replies</h3>\n<pre class=\"ascii\">Q8_0  / gpu   I'm a helpful assistant. I'm here to help you with your inquiries.\nQ4_0  / gpu   I'm ready to help. What can I help you with?\nQ6_K  / gpu   2 + 2 is 4.\nQ6_K  / simd  I'm a helpful assistant.\nIQ2_XXS/gpu   ,))hidAPAAPAAPAAPAAPA...   (sub-2-bit degrades)</pre>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/44-octo/main.go\">examples/44-octo/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/44-octo &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Octo is its own module — the engine never imports it.\")\n\tfmt.Println(\"  cd apps/octo &amp;&amp; go run .\")\n\tfmt.Println(\"  download -&gt; convert -&gt; .entity -&gt; chat / serve / bench\")\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>Octo is its own module — the engine never imports it.\n  cd apps/octo &amp;&amp; go run .\n  download -&gt; convert -&gt; .entity -&gt; chat / serve / bench</code></pre>\n<h3>Validate (harness)</h3><pre><code>cd apps/octo &amp;&amp; go run .</code></pre>\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/apps/octo✅ runs\n\nWhy it exists\nA model is only useful with a shell around it: pull weights from Hugging Face, convert them to a Welvet .entity, then chat, serve, or benchmark. Octo is that shell, kept in its own module so the engine never depends on an app.\nWhat it is\nSubcommands cover the whole loop: hub download/ensure repos, convert pack to a single .entity, interactive run/serve/chat, plus image and speech menus. Its bench harness sweeps every quant format across a CPU Plan 9 SIMD fused profile and a WebGPU fused profile.\n\nBench: SmolLM2-135M-Instruct across quant formats\ntemplate smol2-135m-fuse · linux/amd64 · NVIDIA GTX 1650 SUPER · 3m17s · 80 runs (76 ok, 4 skipped: \"none\" has no fused kernel). Throughput is total tokens/s on the first prompt; entity is on-disk size.\n\nQuantGPU-fused tok/sSIMD-fused tok/sEntity MB\n\nQ8_0108.233.2252.5\nQ6_K73.54.9216.4\nQ5_K71.76.3208.4\nQ4_K73.47.8192.3\nQ4_0112.136.8188.3\nIQ4_XS105.57.6204.4\nIQ4_NL84.18.8188.3\nTernaryPacked106.918.9172.3\nBinaryPacked88.321.0140.2\n\n21 quant formats run end to end; the table shows a representative slice. Full report: apps/octo/dist/octo-run-v0.76.txt.\nHonest low-bit noteHigh-bit formats (Q8, Q6, Q5, Q4, IQ4) stay coherent. Sub-2-bit formats (IQ1/IQ2, Ternary, Binary) are fast and tiny but degrade into gibberish. The bench keeps them in to show the speed, size, and quality trade honestly rather than hiding it.\nSample replies\nQ8_0  / gpu   I'm a helpful assistant. I'm here to help you with your inquiries.\nQ4_0  / gpu   I'm ready to help. What can I help you with?\nQ6_K  / gpu   2 + 2 is 4.\nQ6_K  / simd  I'm a helpful assistant.\nIQ2_XXS/gpu   ,))hidAPAAPAAPAAPAAPA...   (sub-2-bit degrades)\n\n\n\nGo example\nexamples/44-octo/main.go\nRun:cd welvet/examples/44-octo && source ../env.sh && go run .\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Octo is its own module — the engine never imports it.\")\n\tfmt.Println(\"  cd apps/octo && go run .\")\n\tfmt.Println(\"  download -> convert -> .entity -> chat / serve / bench\")\n}\nOutput\nexit 0 · last run via go run .Octo is its own module — the engine never imports it.\n  cd apps/octo && go run .\n  download -> convert -> .entity -> chat / serve / bench\nValidate (harness)cd apps/octo && go run .\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/44-octo.html","url":"https://openfluke.com/book/44-octo"},{"slug":"45-stub-seed","title":"stub/seed","group":"VIII · Stubs","description":"Ship topology recipes (layer seeds → He-init) without weight blobs.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/seed</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Ship topology recipes (layer seeds → He-init) without weight blobs.</p>\n<h2>What it is</h2>\n<p>SeedFrom/From, RNG, InitStoreHe, Dense/MHA/SwiGLU/CNN infinite manifests.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/45-stub-seed/main.go\">examples/45-stub-seed/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/45-stub-seed &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/seed\"\n)\n\nfunc main() {\n\ts := seed.From(\"demo-net\", 0)\n\trng := seed.New(s)\n\tfmt.Println(rng.NormFloat64())\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>0.4118750632366808</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/seed🚧\n\nWhy it exists\nShip topology recipes (layer seeds → He-init) without weight blobs.\nWhat it is\nSeedFrom/From, RNG, InitStoreHe, Dense/MHA/SwiGLU/CNN infinite manifests.\n\n\n\nGo example\nexamples/45-stub-seed/main.go\nRun:cd welvet/examples/45-stub-seed && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/seed\"\n)\n\nfunc main() {\n\ts := seed.From(\"demo-net\", 0)\n\trng := seed.New(s)\n\tfmt.Println(rng.NormFloat64())\n}\nOutput\nexit 0 · last run via go run .0.4118750632366808\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/45-stub-seed.html","url":"https://openfluke.com/book/45-stub-seed"},{"slug":"46-stub-serialization","title":"stub/serialization","group":"VIII · Stubs","description":"Volumetric grids need JSON/ENTITY persist beyond transformer packs.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/serialization</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Volumetric grids need JSON/ENTITY persist beyond transformer packs.</p>\n<h2>What it is</h2>\n<p>SerializeEntity/LoadEntity, SerializeGrid/GridFromSpec — native FormatNone bytes; packed via wire.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/46-stub-serialization/main.go\">examples/46-stub-serialization/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/46-stub-serialization &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/serialization\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\traw, err := serialization.SerializeGrid(g)\n\tfmt.Println(len(raw), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>101 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/serialization🚧\n\nWhy it exists\nVolumetric grids need JSON/ENTITY persist beyond transformer packs.\nWhat it is\nSerializeEntity/LoadEntity, SerializeGrid/GridFromSpec — native FormatNone bytes; packed via wire.\n\n\n\nGo example\nexamples/46-stub-serialization/main.go\nRun:cd welvet/examples/46-stub-serialization && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/serialization\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\traw, err := serialization.SerializeGrid(g)\n\tfmt.Println(len(raw), err)\n}\nOutput\nexit 0 · last run via go run .101 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/46-stub-serialization.html","url":"https://openfluke.com/book/46-stub-serialization"},{"slug":"47-stub-memory","title":"stub/memory","group":"VIII · Stubs","description":"HF→ENTITY and GPU upload need footprint accounting and optional history charts.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/memory</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>HF→ENTITY and GPU upload need footprint accounting and optional history charts.</p>\n<h2>What it is</h2>\n<p>FromGrid, Footprint, InitScavenger, ReleaseTransient; WELVET_MEMORY_HISTORY=1.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/47-stub-memory/main.go\">examples/47-stub-memory/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/47-stub-memory &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/memory\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tfp := memory.FromGrid(g)\n\tfmt.Printf(\"%+v\\n\", fp)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>{HostWeightsMB:0 GPUWeightsMB:0 GPUKVMB:0}</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/memory🚧\n\nWhy it exists\nHF→ENTITY and GPU upload need footprint accounting and optional history charts.\nWhat it is\nFromGrid, Footprint, InitScavenger, ReleaseTransient; WELVET_MEMORY_HISTORY=1.\n\n\n\nGo example\nexamples/47-stub-memory/main.go\nRun:cd welvet/examples/47-stub-memory && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/memory\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tfp := memory.FromGrid(g)\n\tfmt.Printf(\"%+v\\n\", fp)\n}\nOutput\nexit 0 · last run via go run .{HostWeightsMB:0 GPUWeightsMB:0 GPUKVMB:0}\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/47-stub-memory.html","url":"https://openfluke.com/book/47-stub-memory"},{"slug":"48-stub-donate","title":"stub/donate","group":"VIII · Stubs","description":"LAN donors should accept framed JSON jobs without embedding HTTP in the engine.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/donate</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>LAN donors should accept framed JSON jobs without embedding HTTP in the engine.</p>\n<h2>What it is</h2>\n<p>u32-LE + JSON frames; ServeTCP/Dial; model_push vs local_lm. v0 workers echo.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/48-stub-donate/main.go\">examples/48-stub-donate/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/48-stub-donate &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/donate\"\n)\n\nfunc main() {\n\tfmt.Println(\"default port\", donate.DefaultPort)\n\t// ln, err := donate.ServeTCP(donate.ServerOptions{Addr: \":17001\", Mode: donate.ServerLocalLM})\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>default port 17001</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/donate🚧\n\nWhy it exists\nLAN donors should accept framed JSON jobs without embedding HTTP in the engine.\nWhat it is\nu32-LE + JSON frames; ServeTCP/Dial; model_push vs local_lm. v0 workers echo.\n\n\n\nGo example\nexamples/48-stub-donate/main.go\nRun:cd welvet/examples/48-stub-donate && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/donate\"\n)\n\nfunc main() {\n\tfmt.Println(\"default port\", donate.DefaultPort)\n\t// ln, err := donate.ServeTCP(donate.ServerOptions{Addr: \":17001\", Mode: donate.ServerLocalLM})\n}\nOutput\nexit 0 · last run via go run .default port 17001\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/48-stub-donate.html","url":"https://openfluke.com/book/48-stub-donate"},{"slug":"49-stub-fountain","title":"stub/fountain","group":"VIII · Stubs","description":"Recover specialist weight blobs over lossy links via LT fountain codes, then ensemble.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/fountain</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Recover specialist weight blobs over lossy links via LT fountain codes, then ensemble.</p>\n<h2>What it is</h2>\n<p>NewLTEncoder/Decoder, RecoverWeightBlobs, Neural/DenseFactory helpers.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/49-stub-fountain/main.go\">examples/49-stub-fountain/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/49-stub-fountain &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/fountain\"\n)\n\nfunc main() {\n\tsrc := [][]byte{make([]byte, 64), make([]byte, 64), make([]byte, 64)}\n\tenc, err := fountain.NewLTEncoder(src, 42)\n\tfmt.Printf(\"%T %v\\n\", enc, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>*fountain.LTEncoder &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/fountain🚧\n\nWhy it exists\nRecover specialist weight blobs over lossy links via LT fountain codes, then ensemble.\nWhat it is\nNewLTEncoder/Decoder, RecoverWeightBlobs, Neural/DenseFactory helpers.\n\n\n\nGo example\nexamples/49-stub-fountain/main.go\nRun:cd welvet/examples/49-stub-fountain && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/fountain\"\n)\n\nfunc main() {\n\tsrc := [][]byte{make([]byte, 64), make([]byte, 64), make([]byte, 64)}\n\tenc, err := fountain.NewLTEncoder(src, 42)\n\tfmt.Printf(\"%T %v\\n\", enc, err)\n}\nOutput\nexit 0 · last run via go run .*fountain.LTEncoder <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/49-stub-fountain.html","url":"https://openfluke.com/book/49-stub-fountain"},{"slug":"50-stub-hardware","title":"stub/hardware","group":"VIII · Stubs","description":"Dispatchers and UIs need a portable host audit (OS/CPU/RAM/GPU).","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/hardware</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Dispatchers and UIs need a portable host audit (OS/CPU/RAM/GPU).</p>\n<h2>What it is</h2>\n<p>Audit() → SystemAudit with linux /proc or platform fallbacks.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/50-stub-hardware/main.go\">examples/50-stub-hardware/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/50-stub-hardware &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/hardware\"\n)\n\nfunc main() {\n\ta := hardware.Audit()\n\tfmt.Printf(\"%+v\\n\", a.CPU)\n\tfmt.Println(hardware.Description())\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>{Model:Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Logical:12 GOMAXPROCS:12}\nOS: linux | CPU: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz (12) | RAM: 31.12 GB | GPU: Unknown GPU (0.0 GB)</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/hardware🚧\n\nWhy it exists\nDispatchers and UIs need a portable host audit (OS/CPU/RAM/GPU).\nWhat it is\nAudit() → SystemAudit with linux /proc or platform fallbacks.\n\n\n\nGo example\nexamples/50-stub-hardware/main.go\nRun:cd welvet/examples/50-stub-hardware && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/hardware\"\n)\n\nfunc main() {\n\ta := hardware.Audit()\n\tfmt.Printf(\"%+v\\n\", a.CPU)\n\tfmt.Println(hardware.Description())\n}\nOutput\nexit 0 · last run via go run .{Model:Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Logical:12 GOMAXPROCS:12}\nOS: linux | CPU: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz (12) | RAM: 31.12 GB | GPU: Unknown GPU (0.0 GB)\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/50-stub-hardware.html","url":"https://openfluke.com/book/50-stub-hardware"},{"slug":"51-stub-accel","title":"stub/accel — NPU/Metal/QNN","group":"VIII · Stubs","description":"Vendor accelerators (Intel NPU, Qualcomm QNN, Apple Metal) will plug beside WebGPU — not replace it.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/accel</span><span class=\"status missing\">⬜</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Vendor accelerators (Intel NPU, Qualcomm QNN, Apple Metal) will plug beside WebGPU — not replace it.</p>\n<h2>What it is</h2>\n<p>Package is doc.go only today (⬜). No symbols yet; reserved for plugin loader design.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/51-stub-accel/main.go\">examples/51-stub-accel/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/51-stub-accel &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\n// import \"github.com/openfluke/welvet/stub/accel\"\n// No exported API yet — see package doc.go for intent.\n\nfunc main() {}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>(no output)</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/accel⬜\n\nWhy it exists\nVendor accelerators (Intel NPU, Qualcomm QNN, Apple Metal) will plug beside WebGPU — not replace it.\nWhat it is\nPackage is doc.go only today (⬜). No symbols yet; reserved for plugin loader design.\n\n\n\nGo example\nexamples/51-stub-accel/main.go\nRun:cd welvet/examples/51-stub-accel && source ../env.sh && go run .\npackage main\n\n// import \"github.com/openfluke/welvet/stub/accel\"\n// No exported API yet — see package doc.go for intent.\n\nfunc main() {}\nOutput\nexit 0 · last run via go run .(no output)\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/51-stub-accel.html","url":"https://openfluke.com/book/51-stub-accel"},{"slug":"52-stub-clustering","title":"stub/clustering","group":"VIII · Stubs","description":"Offline clustering helpers on tensors without inventing a second math stack.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/clustering</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Offline clustering helpers on tensors without inventing a second math stack.</p>\n<h2>What it is</h2>\n<p>KMeansCluster, HierarchicalGroup, distance/silhouette helpers.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/52-stub-clustering/main.go\">examples/52-stub-clustering/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/52-stub-clustering &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/stub/clustering\"\n)\n\nfunc main() {\n\tpts := []*core.Tensor[float32]{\n\t\tcore.NewTensor[float32](2),\n\t\tcore.NewTensor[float32](2),\n\t}\n\tpts[0].Data[0], pts[0].Data[1] = 0, 0\n\tpts[1].Data[0], pts[1].Data[1] = 1, 1\n\tcent, assign := clustering.KMeansCluster(pts, 2, 10, false)\n\tfmt.Println(len(cent), assign)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>2 [0 1]</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/clustering🚧\n\nWhy it exists\nOffline clustering helpers on tensors without inventing a second math stack.\nWhat it is\nKMeansCluster, HierarchicalGroup, distance/silhouette helpers.\n\n\n\nGo example\nexamples/52-stub-clustering/main.go\nRun:cd welvet/examples/52-stub-clustering && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/stub/clustering\"\n)\n\nfunc main() {\n\tpts := []*core.Tensor[float32]{\n\t\tcore.NewTensor[float32](2),\n\t\tcore.NewTensor[float32](2),\n\t}\n\tpts[0].Data[0], pts[0].Data[1] = 0, 0\n\tpts[1].Data[0], pts[1].Data[1] = 1, 1\n\tcent, assign := clustering.KMeansCluster(pts, 2, 10, false)\n\tfmt.Println(len(cent), assign)\n}\nOutput\nexit 0 · last run via go run .2 [0 1]\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/52-stub-clustering.html","url":"https://openfluke.com/book/52-stub-clustering"},{"slug":"53-stub-ensemble","title":"stub/ensemble","group":"VIII · Stubs","description":"Combine multiple model votes and find complementary specialists.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/ensemble</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Combine multiple model votes and find complementary specialists.</p>\n<h2>What it is</h2>\n<p>MajorityVote, FindComplementaryMatches, PerformanceSimilarity.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/53-stub-ensemble/main.go\">examples/53-stub-ensemble/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/53-stub-ensemble &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/ensemble\"\n)\n\nfunc main() {\n\tvotes := [][]int{{0, 1, 1}, {0, 0, 1}, {0, 1, 0}}\n\tfmt.Println(ensemble.MajorityVote(votes))\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>[0 1 1]</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/ensemble🚧\n\nWhy it exists\nCombine multiple model votes and find complementary specialists.\nWhat it is\nMajorityVote, FindComplementaryMatches, PerformanceSimilarity.\n\n\n\nGo example\nexamples/53-stub-ensemble/main.go\nRun:cd welvet/examples/53-stub-ensemble && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/ensemble\"\n)\n\nfunc main() {\n\tvotes := [][]int{{0, 1, 1}, {0, 0, 1}, {0, 1, 0}}\n\tfmt.Println(ensemble.MajorityVote(votes))\n}\nOutput\nexit 0 · last run via go run .[0 1 1]\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/53-stub-ensemble.html","url":"https://openfluke.com/book/53-stub-ensemble"},{"slug":"54-stub-evaluation","title":"stub/evaluation","group":"VIII · Stubs","description":"Benchmark grids through runtime/forward with deviation metrics.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/evaluation</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Benchmark grids through runtime/forward with deviation metrics.</p>\n<h2>What it is</h2>\n<p>EvaluateNetwork, MultiNetworkEvaluation, DeviationMetrics.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/54-stub-evaluation/main.go\">examples/54-stub-evaluation/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/54-stub-evaluation &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/stub/evaluation\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tin := []*core.Tensor[float32]{core.NewTensor[float32](1, 4)}\n\trep, err := evaluation.EvaluateNetwork(g, in, []float64{0, 0, 0, 0})\n\tfmt.Println(rep, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>&lt;nil&gt; evaluation: length mismatch inputs=1 expected=4</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/evaluation🚧\n\nWhy it exists\nBenchmark grids through runtime/forward with deviation metrics.\nWhat it is\nEvaluateNetwork, MultiNetworkEvaluation, DeviationMetrics.\n\n\n\nGo example\nexamples/54-stub-evaluation/main.go\nRun:cd welvet/examples/54-stub-evaluation && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/stub/evaluation\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tin := []*core.Tensor[float32]{core.NewTensor[float32](1, 4)}\n\trep, err := evaluation.EvaluateNetwork(g, in, []float64{0, 0, 0, 0})\n\tfmt.Println(rep, err)\n}\nOutput\nexit 0 · last run via go run .<nil> evaluation: length mismatch inputs=1 expected=4\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/54-stub-evaluation.html","url":"https://openfluke.com/book/54-stub-evaluation"},{"slug":"55-stub-grafting","title":"stub/grafting","group":"VIII · Stubs","description":"Merge grids into Parallel/Residual structures for topology experiments.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/grafting</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Merge grids into Parallel/Residual structures for topology experiments.</p>\n<h2>What it is</h2>\n<p>GraftGrids, ResidualGraft, GraftToGrid — Dense branches in v0.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/55-stub-grafting/main.go\">examples/55-stub-grafting/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/55-stub-grafting &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/stub/grafting\"\n)\n\nfunc main() {\n\ta, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)\n\tout, err := grafting.GraftGrids([]*architecture.Grid{a, b}, parallel.CombineConcat)\n\tfmt.Println(out != nil, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>false grafting: no valid branches</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/grafting🚧\n\nWhy it exists\nMerge grids into Parallel/Residual structures for topology experiments.\nWhat it is\nGraftGrids, ResidualGraft, GraftToGrid — Dense branches in v0.\n\n\n\nGo example\nexamples/55-stub-grafting/main.go\nRun:cd welvet/examples/55-stub-grafting && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/stub/grafting\"\n)\n\nfunc main() {\n\ta, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)\n\tout, err := grafting.GraftGrids([]*architecture.Grid{a, b}, parallel.CombineConcat)\n\tfmt.Println(out != nil, err)\n}\nOutput\nexit 0 · last run via go run .false grafting: no valid branches\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/55-stub-grafting.html","url":"https://openfluke.com/book/55-stub-grafting"},{"slug":"56-stub-grouping","title":"stub/grouping","group":"VIII · Stubs","description":"Detect layer archetypes from safetensor-style names before mounting.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/grouping</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Detect layer archetypes from safetensor-style names before mounting.</p>\n<h2>What it is</h2>\n<p>GroupRelatedTensors, DetectMHA/DetectSwiGLU/DetectRMSNorm → ArchetypeHint.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/56-stub-grouping/main.go\">examples/56-stub-grouping/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/56-stub-grouping &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/grouping\"\n)\n\nfunc main() {\n\ttensors := []grouping.DetectedTensor{\n\t\t{Name: \"model.layers.0.self_attn.q_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.k_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.v_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.o_proj.weight\"},\n\t}\n\tok, hint := grouping.DetectMHA(\"block0\", tensors, 64, 4)\n\tfmt.Println(ok, hint)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>true {MultiHeadAttention 64 4}</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/grouping🚧\n\nWhy it exists\nDetect layer archetypes from safetensor-style names before mounting.\nWhat it is\nGroupRelatedTensors, DetectMHA/DetectSwiGLU/DetectRMSNorm → ArchetypeHint.\n\n\n\nGo example\nexamples/56-stub-grouping/main.go\nRun:cd welvet/examples/56-stub-grouping && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/grouping\"\n)\n\nfunc main() {\n\ttensors := []grouping.DetectedTensor{\n\t\t{Name: \"model.layers.0.self_attn.q_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.k_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.v_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.o_proj.weight\"},\n\t}\n\tok, hint := grouping.DetectMHA(\"block0\", tensors, 64, 4)\n\tfmt.Println(ok, hint)\n}\nOutput\nexit 0 · last run via go run .true {MultiHeadAttention 64 4}\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/56-stub-grouping.html","url":"https://openfluke.com/book/56-stub-grouping"},{"slug":"57-stub-introspection","title":"stub/introspection","group":"VIII · Stubs","description":"UIs and FFI need to list Grid methods without hardcoding every export.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/introspection</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>UIs and FFI need to list Grid methods without hardcoding every export.</p>\n<h2>What it is</h2>\n<p>GetMethods, GetMethodsJSON, GetMethodSignature.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/57-stub-introspection/main.go\">examples/57-stub-introspection/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/57-stub-introspection &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/introspection\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tmethods, err := introspection.GetMethods(g)\n\tfmt.Println(len(methods), err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>9 &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/introspection🚧\n\nWhy it exists\nUIs and FFI need to list Grid methods without hardcoding every export.\nWhat it is\nGetMethods, GetMethodsJSON, GetMethodSignature.\n\n\n\nGo example\nexamples/57-stub-introspection/main.go\nRun:cd welvet/examples/57-stub-introspection && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/introspection\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tmethods, err := introspection.GetMethods(g)\n\tfmt.Println(len(methods), err)\n}\nOutput\nexit 0 · last run via go run .9 <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/57-stub-introspection.html","url":"https://openfluke.com/book/57-stub-introspection"},{"slug":"58-stub-observer","title":"stub/observer","group":"VIII · Stubs","description":"Attach forward/backward observers for debugging without coupling to tanhi UDP.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/observer</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Attach forward/backward observers for debugging without coupling to tanhi UDP.</p>\n<h2>What it is</h2>\n<p>Observer interface; ConsoleObserver / HTTPObserver / BufferObserver; ComputeLayerStats.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/58-stub-observer/main.go\">examples/58-stub-observer/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/58-stub-observer &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/observer\"\n)\n\nfunc main() {\n\tvar obs observer.Observer = &amp;observer.ConsoleObserver{}\n\tfmt.Printf(\"%T\\n\", obs)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>*observer.ConsoleObserver</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/observer🚧\n\nWhy it exists\nAttach forward/backward observers for debugging without coupling to tanhi UDP.\nWhat it is\nObserver interface; ConsoleObserver / HTTPObserver / BufferObserver; ComputeLayerStats.\n\n\n\nGo example\nexamples/58-stub-observer/main.go\nRun:cd welvet/examples/58-stub-observer && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/observer\"\n)\n\nfunc main() {\n\tvar obs observer.Observer = &observer.ConsoleObserver{}\n\tfmt.Printf(\"%T\\n\", obs)\n}\nOutput\nexit 0 · last run via go run .*observer.ConsoleObserver\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/58-stub-observer.html","url":"https://openfluke.com/book/58-stub-observer"},{"slug":"59-stub-pipeline","title":"stub/pipeline","group":"VIII · Stubs","description":"Decoder wavefront stats helpers — not a full Lucy-style pipeline runner yet.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/pipeline</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Decoder wavefront stats helpers — not a full Lucy-style pipeline runner yet.</p>\n<h2>What it is</h2>\n<p>PipelineForwardStats, TokenTimelineSummary.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/59-stub-pipeline/main.go\">examples/59-stub-pipeline/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/59-stub-pipeline &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/pipeline\"\n)\n\nfunc main() {\n\tvar s pipeline.PipelineForwardStats\n\tfmt.Printf(\"%+v\\n\", s)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>{PipelineTicks:0 SubLayerOps:0 MaxActiveJobs:0 MaxBlockSpread:0 MaxDistinctBlocks:0 MaxPendingTokens:0 StallFallback:false TokenDoneTick:[]}</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/pipeline🚧\n\nWhy it exists\nDecoder wavefront stats helpers — not a full Lucy-style pipeline runner yet.\nWhat it is\nPipelineForwardStats, TokenTimelineSummary.\n\n\n\nGo example\nexamples/59-stub-pipeline/main.go\nRun:cd welvet/examples/59-stub-pipeline && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/pipeline\"\n)\n\nfunc main() {\n\tvar s pipeline.PipelineForwardStats\n\tfmt.Printf(\"%+v\\n\", s)\n}\nOutput\nexit 0 · last run via go run .{PipelineTicks:0 SubLayerOps:0 MaxActiveJobs:0 MaxBlockSpread:0 MaxDistinctBlocks:0 MaxPendingTokens:0 StallFallback:false TokenDoneTick:[]}\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/59-stub-pipeline.html","url":"https://openfluke.com/book/59-stub-pipeline"},{"slug":"60-stub-templates","title":"stub/templates","group":"VIII · Stubs","description":"Chat prompts must match model families (ChatML, Llama3, BitNet) without app-specific string glue.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/templates</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Chat prompts must match model families (ChatML, Llama3, BitNet) without app-specific string glue.</p>\n<h2>What it is</h2>\n<p>Template.BuildPrompt; presets ChatML, Llama3, BitNetInstruction, MicrosoftBitNetChat.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/60-stub-templates/main.go\">examples/60-stub-templates/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/60-stub-templates &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/templates\"\n)\n\nfunc main() {\n\tp := templates.ChatML.BuildPrompt(nil, \"You are helpful.\", \"Say hi\")\n\tfmt.Println(p)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>&lt;|im_start|&gt;system\nYou are helpful.\n&lt;|im_start|&gt;user\nSay hi\n&lt;|im_start|&gt;assistant</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/templates🚧\n\nWhy it exists\nChat prompts must match model families (ChatML, Llama3, BitNet) without app-specific string glue.\nWhat it is\nTemplate.BuildPrompt; presets ChatML, Llama3, BitNetInstruction, MicrosoftBitNetChat.\n\n\n\nGo example\nexamples/60-stub-templates/main.go\nRun:cd welvet/examples/60-stub-templates && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/templates\"\n)\n\nfunc main() {\n\tp := templates.ChatML.BuildPrompt(nil, \"You are helpful.\", \"Say hi\")\n\tfmt.Println(p)\n}\nOutput\nexit 0 · last run via go run .<|im_start|>system\nYou are helpful.\n<|im_start|>user\nSay hi\n<|im_start|>assistant\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/60-stub-templates.html","url":"https://openfluke.com/book/60-stub-templates"},{"slug":"61-stub-universal","title":"stub/universal","group":"VIII · Stubs","description":"Probe unknown safetensor geometry and mount placeholder grids until full weight import lands.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/stub/universal</span><span class=\"status partial\">🚧</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Probe unknown safetensor geometry and mount placeholder grids until full weight import lands.</p>\n<h2>What it is</h2>\n<p>LoadUniversal / LoadUniversalDetailed, ProbeDeepGeometry, MountGeometrically.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/61-stub-universal/main.go\">examples/61-stub-universal/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/61-stub-universal &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/universal\"\n)\n\nfunc main() {\n\tg, err := universal.LoadUniversal(\"/path/to/snapshot\")\n\tfmt.Println(g != nil, err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>false universal: \"/path/to/snapshot\": open /path/to/snapshot: no such file or directory</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/stub/universal🚧\n\nWhy it exists\nProbe unknown safetensor geometry and mount placeholder grids until full weight import lands.\nWhat it is\nLoadUniversal / LoadUniversalDetailed, ProbeDeepGeometry, MountGeometrically.\n\n\n\nGo example\nexamples/61-stub-universal/main.go\nRun:cd welvet/examples/61-stub-universal && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/universal\"\n)\n\nfunc main() {\n\tg, err := universal.LoadUniversal(\"/path/to/snapshot\")\n\tfmt.Println(g != nil, err)\n}\nOutput\nexit 0 · last run via go run .false universal: \"/path/to/snapshot\": open /path/to/snapshot: no such file or directory\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/61-stub-universal.html","url":"https://openfluke.com/book/61-stub-universal"},{"slug":"62-w2a","title":"w2a — validation harness","group":"IX · Validate","description":"Engine packages must stay free of tests. w2a owns timed 34×20×3 matrices, gap census, honesty stamps, and the train-mode permutation smoke (Test49). See §63 for a live full-suite run.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/w2a</span><span class=\"status ok\">✅ harness</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Engine packages must stay free of tests. w2a owns timed 34×20×3 matrices, gap census, honesty stamps, and the train-mode permutation smoke (Test49). See §63 for a live full-suite run.</p>\n<h2>What it is</h2>\n<p>Interactive go run . ([0] Run ALL). Suites under suites/*. StampBackendNote / AffinePackable prevent fake ✅. Test49: AllNamedTrainModes × 1³/2³/3³ × Parallel/Bicameral/poly, origin-only — included in [0].</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/62-w2a/main.go\">examples/62-w2a/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/62-w2a &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"w2a is a separate module — engine packages never contain tests.\")\n\tfmt.Println(\"\")\n\tfmt.Println(\"  cd w2a\")\n\tfmt.Println(\"  go run .                                      # interactive; [0] = ALL\")\n\tfmt.Println(\"  go test ./tests/dense -v\")\n\tfmt.Println(\"  go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v\")\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>w2a is a separate module — engine packages never contain tests.\n\n  cd w2a\n  go run .                                      # interactive; [0] = ALL\n  go test ./tests/dense -v\n  go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v</code></pre>\n<h3>Validate (harness)</h3><pre><code>cd w2a &amp;&amp; go run .\ncd w2a &amp;&amp; go test ./tests/dense -v &amp;&amp; go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v</code></pre>\n</section>\n\n\n\n","text":"github.com/openfluke/w2a✅ harness\n\nWhy it exists\nEngine packages must stay free of tests. w2a owns timed 34×20×3 matrices, gap census, honesty stamps, and the train-mode permutation smoke (Test49). See §63 for a live full-suite run.\nWhat it is\nInteractive go run . ([0] Run ALL). Suites under suites/*. StampBackendNote / AffinePackable prevent fake ✅. Test49: AllNamedTrainModes × 1³/2³/3³ × Parallel/Bicameral/poly, origin-only — included in [0].\n\n\n\nGo example\nexamples/62-w2a/main.go\nRun:cd welvet/examples/62-w2a && source ../env.sh && go run .\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"w2a is a separate module — engine packages never contain tests.\")\n\tfmt.Println(\"\")\n\tfmt.Println(\"  cd w2a\")\n\tfmt.Println(\"  go run .                                      # interactive; [0] = ALL\")\n\tfmt.Println(\"  go test ./tests/dense -v\")\n\tfmt.Println(\"  go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v\")\n}\nOutput\nexit 0 · last run via go run .w2a is a separate module — engine packages never contain tests.\n\n  cd w2a\n  go run .                                      # interactive; [0] = ALL\n  go test ./tests/dense -v\n  go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v\nValidate (harness)cd w2a && go run .\ncd w2a && go test ./tests/dense -v && go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/62-w2a.html","url":"https://openfluke.com/book/62-w2a"},{"slug":"63-validation","title":"Validation report — full suite","group":"IX · Validate","description":"Claims are cheap; a stamped matrix is not. This is the actual output of one full w2a [0] Run ALL so the book's ✅ marks are backed by numbers you can reproduce, not asserted.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/w2a</span><span class=\"status ok\">✅ 246k cells</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Claims are cheap; a stamped matrix is not. This is the actual output of one full w2a [0] Run ALL so the book's ✅ marks are backed by numbers you can reproduce, not asserted.</p>\n<h2>What it is</h2>\n<p>Every timed layer sweeps its dtype × format × backend matrix; every suite runs its case checks. v1.0 board: 246,032 matrix cells, FAIL 0, RESULT PASS. GAP cells are declared skips (not silent fails).</p>\n\n<div class=\"callout\"><strong>Full suite: PASS</strong>\n<code>[0] Run ALL</code> — <strong>246,032</strong> matrix cells — FAIL 0 — RESULT: PASS.\nGAP remains (honesty stamps): GDN non-float32 / non-packable formats, AffinePacked, exotic hemi9 dtypes,\ncensus + cross-numeric train declared skips, a handful of ser cells. GAP ≠ fail. Case-only stubs\n(seed, serialization, memory, donate, fountain, hardware) stay off the engine scorecard.</div>\n<h3>What grew since the 228k board</h3>\n<ul>\n<li><strong>Test49</strong> — 29 named TrainModes × 1³/2³/3³ × Parallel + Bicameral + poly kinds (origin-only). All cells OK.</li>\n<li><strong>Cameral perm</strong> — Mix / BranchModes / credit on sandwiches (OK cells + declared GAP on exotic dtypes).</li>\n<li><strong>Nested Sequential / Residual</strong> mixed children + <code>ResidualGraft</code>.</li>\n<li><strong>Mesh*</strong> credit tokens on the named-mode list (stack family on a grid walk).</li>\n</ul>\n<p>Do not quote this stamp as a Lucy race or “beats PyTorch.” It is surface coverage: every claimed path either\nruns or is stamped GAP. Lucy Acc vs Score lives in AAI test50 (<a href=\"/book/68-cameral\">§68</a>).</p>\n<h3>Cross-numeric train</h3>\n<p>W2A Step includes <strong>Cross-Numeric Train</strong> (kinds × weight dtype × act host; full census ~10.7k under the <code>train</code> op). Storage truth checked after <code>StepMesh</code> — no retained f32 master for non-float32 FormatNone. Public Dense demotion + W×A showcase: <a href=\"https://github.com/openfluke/down-the-dem\">down-the-dem</a> (chapter <a href=\"/book/65-cross-numeric\">65</a>).</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/63-validation/main.go\">examples/63-validation/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/63-validation &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport \"fmt\"\n\nfunc main() {\n\tcells := 246032\n\tfmt.Printf(\"w2a [0] ALL: %d cells  FAIL 0  RESULT PASS\\n\", cells)\n\tfmt.Println(\"GAP = declared skip (GDN non-f32, AffinePacked, …) — not a fail\")\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>w2a [0] ALL: 246032 cells  FAIL 0  RESULT PASS\nGAP = declared skip (GDN non-f32, AffinePacked, …) — not a fail</code></pre>\n<h3>Validate (harness)</h3><pre><code>cd w2a &amp;&amp; go run .   # [0] Run ALL; writes logs/suite.txt</code></pre>\n</section>\n\n\n\n","text":"github.com/openfluke/w2a✅ 246k cells\n\nWhy it exists\nClaims are cheap; a stamped matrix is not. This is the actual output of one full w2a [0] Run ALL so the book's ✅ marks are backed by numbers you can reproduce, not asserted.\nWhat it is\nEvery timed layer sweeps its dtype × format × backend matrix; every suite runs its case checks. v1.0 board: 246,032 matrix cells, FAIL 0, RESULT PASS. GAP cells are declared skips (not silent fails).\n\nFull suite: PASS\n[0] Run ALL — 246,032 matrix cells — FAIL 0 — RESULT: PASS.\nGAP remains (honesty stamps): GDN non-float32 / non-packable formats, AffinePacked, exotic hemi9 dtypes,\ncensus + cross-numeric train declared skips, a handful of ser cells. GAP ≠ fail. Case-only stubs\n(seed, serialization, memory, donate, fountain, hardware) stay off the engine scorecard.\nWhat grew since the 228k board\n\nTest49 — 29 named TrainModes × 1³/2³/3³ × Parallel + Bicameral + poly kinds (origin-only). All cells OK.\nCameral perm — Mix / BranchModes / credit on sandwiches (OK cells + declared GAP on exotic dtypes).\nNested Sequential / Residual mixed children + ResidualGraft.\nMesh* credit tokens on the named-mode list (stack family on a grid walk).\n\nDo not quote this stamp as a Lucy race or “beats PyTorch.” It is surface coverage: every claimed path either\nruns or is stamped GAP. Lucy Acc vs Score lives in AAI test50 (§68).\nCross-numeric train\nW2A Step includes Cross-Numeric Train (kinds × weight dtype × act host; full census ~10.7k under the train op). Storage truth checked after StepMesh — no retained f32 master for non-float32 FormatNone. Public Dense demotion + W×A showcase: down-the-dem (chapter 65).\n\n\n\nGo example\nexamples/63-validation/main.go\nRun:cd welvet/examples/63-validation && source ../env.sh && go run .\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tcells := 246032\n\tfmt.Printf(\"w2a [0] ALL: %d cells  FAIL 0  RESULT PASS\\n\", cells)\n\tfmt.Println(\"GAP = declared skip (GDN non-f32, AffinePacked, …) — not a fail\")\n}\nOutput\nexit 0 · last run via go run .w2a [0] ALL: 246032 cells  FAIL 0  RESULT PASS\nGAP = declared skip (GDN non-f32, AffinePacked, …) — not a fail\nValidate (harness)cd w2a && go run .   # [0] Run ALL; writes logs/suite.txt\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/63-validation.html","url":"https://openfluke.com/book/63-validation"},{"slug":"64-scorecard","title":"Scorecard → v1.0 / minors","group":"IX · Validate","description":"Version is earned from a weighted board, not marketing. v1.0 is 100/100 on the engine board. Minor/patch tags (v1.1.0, v1.1.1, …) pack features without a new board. Apps, stubs, and NPU sit ","html":"\n\n\n\n<p><span class=\"status ok\">v1.1.1</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Version is earned from a weighted board, not marketing. v1.0 is 100/100 on the engine board. Minor/patch tags (v1.1.0, v1.1.1, …) pack features without a new board. Apps, stubs, and NPU sit off-board.</p>\n<h2>What it is</h2>\n<p>version = 0.{round(earned)} until 100 → v1.0. Scorecard today <strong>100/100</strong>; this book tags <strong>v1.1.1</strong>. Training credit is §9 on the board (8 pts), not an afterthought.</p>\n\n<table><thead><tr><th>§</th><th>Area</th><th>Wt</th><th>Earned</th></tr></thead><tbody>\n<tr><td>1</td><td>Foundation</td><td>15</td><td>15</td></tr>\n<tr><td>2</td><td>Dense MatVec microkernel</td><td>15</td><td>15</td></tr>\n<tr><td>3</td><td>Transformer stack</td><td>14</td><td>14</td></tr>\n<tr><td>4</td><td>CNN / RNN / LSTM</td><td>6</td><td>6</td></tr>\n<tr><td>5</td><td>Extended layers (GDN, ConvT, Mamba, Parallel, …)</td><td>7</td><td>7</td></tr>\n<tr><td>6</td><td>Runtime + architecture</td><td>8</td><td>8</td></tr>\n<tr><td>7</td><td>Systems</td><td>5</td><td>5</td></tr>\n<tr><td>8</td><td>Model / IO</td><td>8</td><td>8</td></tr>\n<tr><td>9</td><td>Training credit (29 named TrainModes + BranchModes)</td><td>8</td><td>8</td></tr>\n<tr><td>10</td><td>Peak fused / no host ALU</td><td>14</td><td>14</td></tr>\n<tr><td></td><td><strong>Total → v1.0 board</strong></td><td>100</td><td><strong>100</strong></td></tr>\n</tbody></table>\n<h3>v1.0 cut</h3>\n<ul>\n<li><strong>w2a [0] ALL</strong> — 246,032 cells, FAIL 0, RESULT PASS (<a href=\"/book/63-validation\">§63</a>)</li>\n<li><strong>Training credit</strong> — StepBP, Tween*, Split, Alt, HeadProxy, FastProxy, Linear, Sparse, Step* pipe twins, Mesh* (<a href=\"/book/67-train-modes\">§67</a>)</li>\n<li><strong>Cameral</strong> — Hemispheres, Mix BranchModes, Sandwich, ResidualGraft, cameral .entity (<a href=\"/book/68-cameral\">§68</a>)</li>\n<li><strong>CamSync</strong> — soft/hard inter-cameral + cross-layer same-shape weight blend (<a href=\"/book/70-cam-sync\">§70</a>)</li>\n<li><strong>Nested Sequential/Residual</strong> mixed children (Dense/SwiGLU/RMSNorm/LayerNorm)</li>\n<li><strong>lucy</strong> — SoftAcc / Availability / Score + <code>BuildLPD</code> density (<a href=\"/book/66-lucy\">§66</a> · <a href=\"/book/69-lucy-density\">§69</a>)</li>\n<li><strong>v1.0.3</strong> — Dense FormatNone SIMD <em>forward</em>: WireF64/<code>DotTileF64</code>, expand-once,\nBF16 convert; ~4.3× geo-mean on 34-dtype deep suite vs prior Go; Dense-backed projs inherit\n(<a href=\"/book/06-simd\">§6</a> · <a href=\"/book/11-dense\">§11</a>)</li>\n<li><strong>v1.1.1</strong> — Cam adjusting fixed: CamSync on <strong>all layers</strong>\n(<a href=\"/book/70-cam-sync\">§70</a>)</li>\n<li><strong>v1.1.0</strong> — CamSync + <code>training_modes.md</code> + Lucy Lean density + book §70\n(<a href=\"/book/70-cam-sync\">§70</a> · <a href=\"/book/69-lucy-density\">§69</a>)</li>\n</ul>\n<div class=\"callout warn\"><strong>Off this board</strong>\n<code>apps/octo</code>, <code>stub/*</code>, NPU/Metal/QNN (later <code>welvet.cpp</code>).\nFastProxy can match/beat StepBP <em>Acc</em> on sine/copy toys; Sparse wins Lucy <em>Score</em> via Avail.\nDo not write “Sparse is better backprop.” Engine v1 ≠ “beats PyTorch.”</div>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/64-scorecard/main.go\">examples/64-scorecard/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/64-scorecard &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport \"fmt\"\n\nfunc main() {\n\tearned := 100.0\n\tfmt.Println(\"v1.1.1\")\n\tfmt.Printf(\"scorecard %.0f/100\\n\", earned)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>v1.1.1\nscorecard 100/100</code></pre>\n\n</section>\n\n\n\n","text":"v1.1.1\n\nWhy it exists\nVersion is earned from a weighted board, not marketing. v1.0 is 100/100 on the engine board. Minor/patch tags (v1.1.0, v1.1.1, …) pack features without a new board. Apps, stubs, and NPU sit off-board.\nWhat it is\nversion = 0.{round(earned)} until 100 → v1.0. Scorecard today 100/100; this book tags v1.1.1. Training credit is §9 on the board (8 pts), not an afterthought.\n\n§AreaWtEarned\n1Foundation1515\n2Dense MatVec microkernel1515\n3Transformer stack1414\n4CNN / RNN / LSTM66\n5Extended layers (GDN, ConvT, Mamba, Parallel, …)77\n6Runtime + architecture88\n7Systems55\n8Model / IO88\n9Training credit (29 named TrainModes + BranchModes)88\n10Peak fused / no host ALU1414\nTotal → v1.0 board100100\n\nv1.0 cut\n\nw2a [0] ALL — 246,032 cells, FAIL 0, RESULT PASS (§63)\nTraining credit — StepBP, Tween*, Split, Alt, HeadProxy, FastProxy, Linear, Sparse, Step* pipe twins, Mesh* (§67)\nCameral — Hemispheres, Mix BranchModes, Sandwich, ResidualGraft, cameral .entity (§68)\nCamSync — soft/hard inter-cameral + cross-layer same-shape weight blend (§70)\nNested Sequential/Residual mixed children (Dense/SwiGLU/RMSNorm/LayerNorm)\nlucy — SoftAcc / Availability / Score + BuildLPD density (§66 · §69)\nv1.0.3 — Dense FormatNone SIMD forward: WireF64/DotTileF64, expand-once,\nBF16 convert; ~4.3× geo-mean on 34-dtype deep suite vs prior Go; Dense-backed projs inherit\n(§6 · §11)\nv1.1.1 — Cam adjusting fixed: CamSync on all layers\n(§70)\nv1.1.0 — CamSync + training_modes.md + Lucy Lean density + book §70\n(§70 · §69)\n\nOff this board\napps/octo, stub/*, NPU/Metal/QNN (later welvet.cpp).\nFastProxy can match/beat StepBP Acc on sine/copy toys; Sparse wins Lucy Score via Avail.\nDo not write “Sparse is better backprop.” Engine v1 ≠ “beats PyTorch.”\n\n\n\nGo example\nexamples/64-scorecard/main.go\nRun:cd welvet/examples/64-scorecard && source ../env.sh && go run .\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tearned := 100.0\n\tfmt.Println(\"v1.1.1\")\n\tfmt.Printf(\"scorecard %.0f/100\\n\", earned)\n}\nOutput\nexit 0 · last run via go run .v1.1.1\nscorecard 100/100\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/64-scorecard.html","url":"https://openfluke.com/book/64-scorecard"},{"slug":"65-cross-numeric","title":"Cross-numeric train + down-the-dem","group":"IV · Runtime","description":"Weight storage dtype and activation Tensor[T] are independent axes. Proving train without a retained float32 master means sweeping W×A — not only matched float32 acts.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/runtime/training</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Weight storage dtype and activation Tensor[T] are independent axes. Proving train without a retained float32 master means sweeping W×A — not only matched float32 acts.</p>\n<h2>What it is</h2>\n<p>W2A Step Cross-Numeric Train: polyops.AllKinds() × FormatNone weight dtype × Go Numeric act host (smoke ~735; full ~10.7k) via StepMesh, then assert no retained f32 master. Public Dense volumetric showcase: down-the-dem — dtype demotion ladder, packed quants, and the full 34×15×3 perm matrix with charts/PDF.</p>\n\n<p><strong>down-the-dem</strong> — same 5-layer Dense stack on cubes 1³ / 2³ / 3³; only the number story changes:</p>\n<ul>\n<li><strong>dtype</strong> — FormatNone demotion (wide → 1-bit), in-dtype SGD</li>\n<li><strong>quant</strong> — packed formats; unpack → update → re-Pack</li>\n<li><strong>perm</strong> — every weight dtype × every act host (1,530 cells on three grids)</li>\n</ul>\n<p>Repo + report: <a href=\"https://github.com/openfluke/down-the-dem\">github.com/openfluke/down-the-dem</a>\n · PDF: <code>report/down-the-dem.pdf</code> in that repo.\n Honesty: runnable storage-truth train ≠ task accuracy or native low-precision GEMV ALU.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/65-cross-numeric/main.go\">examples/65-cross-numeric/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/65-cross-numeric &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/runtime/training\"\n)\n\nfunc main() {\n\t// Weight storage: int8 FormatNone. Activations/grads: Tensor[int8].\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tinit := make([]float32, 4*4)\n\tfor i := range init {\n\t\tinit[i] = 0.1\n\t}\n\tl, err := dense.NewConfigured(4, 4, core.ActivationLinear, core.DTypeInt8, quant.FormatNone, init)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := dense.Place(g, 0, 0, 0, 0, l); err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[int8](1, 4)\n\ty := core.NewTensor[int8](1, 4)\n\tfor i := 0; i &lt; 4; i++ {\n\t\tx.Data[i] = int8(i + 1)\n\t\ty.Data[i] = int8(i)\n\t}\n\tloss, _, err := training.StepMesh(g, x, y, 1, 0.05)\n\tfmt.Println(loss, err, l.Weights.RetainsF32Master())\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>1.5 &lt;nil&gt; false</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/runtime/training✅\n\nWhy it exists\nWeight storage dtype and activation Tensor[T] are independent axes. Proving train without a retained float32 master means sweeping W×A — not only matched float32 acts.\nWhat it is\nW2A Step Cross-Numeric Train: polyops.AllKinds() × FormatNone weight dtype × Go Numeric act host (smoke ~735; full ~10.7k) via StepMesh, then assert no retained f32 master. Public Dense volumetric showcase: down-the-dem — dtype demotion ladder, packed quants, and the full 34×15×3 perm matrix with charts/PDF.\n\ndown-the-dem — same 5-layer Dense stack on cubes 1³ / 2³ / 3³; only the number story changes:\n\ndtype — FormatNone demotion (wide → 1-bit), in-dtype SGD\nquant — packed formats; unpack → update → re-Pack\nperm — every weight dtype × every act host (1,530 cells on three grids)\n\nRepo + report: github.com/openfluke/down-the-dem\n · PDF: report/down-the-dem.pdf in that repo.\n Honesty: runnable storage-truth train ≠ task accuracy or native low-precision GEMV ALU.\n\n\n\nGo example\nexamples/65-cross-numeric/main.go\nRun:cd welvet/examples/65-cross-numeric && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/runtime/training\"\n)\n\nfunc main() {\n\t// Weight storage: int8 FormatNone. Activations/grads: Tensor[int8].\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tinit := make([]float32, 4*4)\n\tfor i := range init {\n\t\tinit[i] = 0.1\n\t}\n\tl, err := dense.NewConfigured(4, 4, core.ActivationLinear, core.DTypeInt8, quant.FormatNone, init)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := dense.Place(g, 0, 0, 0, 0, l); err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[int8](1, 4)\n\ty := core.NewTensor[int8](1, 4)\n\tfor i := 0; i < 4; i++ {\n\t\tx.Data[i] = int8(i + 1)\n\t\ty.Data[i] = int8(i)\n\t}\n\tloss, _, err := training.StepMesh(g, x, y, 1, 0.05)\n\tfmt.Println(loss, err, l.Weights.RetainsF32Master())\n}\nOutput\nexit 0 · last run via go run .1.5 <nil> false\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/65-cross-numeric.html","url":"https://openfluke.com/book/65-cross-numeric"},{"slug":"66-lucy","title":"lucy — SoftAcc / Score measuring","group":"V · Systems","description":"Adaptation benches (test41-w, tide, live_gpt) need one shared measuring math — SoftAcc, Availability, AdaptPct, Score — not three copies of the formulas.","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/lucy</span><span class=\"status ok\">✅</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Adaptation benches (test41-w, tide, live_gpt) need one shared measuring math — SoftAcc, Availability, AdaptPct, Score — not three copies of the formulas.</p>\n<h2>What it is</h2>\n<p>Pure measuring package: SoftAcc / SoftAccProb, Window + Snapshot, Finalize. No datasets, no train loops. Sine scale 0.10; classification SoftAccProb scale 1.0. Density / synthetic-organism board is <a href=\"/book/69-lucy-density\">§69</a>.</p>\n<figure class=\"diagram\"><pre class=\"ascii\">SoftAcc      = 100 × (1 − |pred−target| / scale)   clamped [0,100]\nAvailability = InferMs / (InferMs + TrainMs) × 100\nScore        = Throughput × Availability × Acc / 10_000\nAcc          = hard argmax % (AvgAccuracy) — the Acc pillar\nAdaptPct     = mean SoftAcc in AdaptWindows after each switch</pre><figcaption>Lucy Score terms. Acc is argmax. SoftAcc is serve-confidence, not Score.</figcaption></figure>\n<p><code>tide/metrics</code> re-exports this package for existing tide callers.\nEngine tests for lucy live under <code>w2a/tests/lucy</code>.</p>\n<div class=\"callout\"><strong>Acc ≠ Score</strong>Hard Acc is the rival vs StepBP.\nScore = Throughput × Availability × <em>Acc</em> / 10_000. Sparse can win Score (skip-GEMV Avail) and lose Acc.\nAAI test50 copy: Split family +5 to +12 Acc vs StepBP; Sparse Score ~8k–10k while Acc is often worse than StepBP.\nSine: many modes sit at 100% hard Acc; FastProxy SoftAcc is the knife. XOR is a 4-point parking lot (75%) — smoke, not a ranking.\nConsciousness / density: <a href=\"/book/69-lucy-density\">§69</a>.</div>\n<p>AAI Lucy benches (private tree, <code>replace</code> → public Welvet): test41 native cam, test48 credit sweep, test50 23-mode FP32 race.\nHarness is not an engine package. Pulse math is this chapter. Density board: <a href=\"/book/69-lucy-density\">§69</a>.\nModes + equations: <a href=\"/book/67-train-modes\">§67</a>. Cameral sandwiches: <a href=\"/book/68-cameral\">§68</a>.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/66-lucy/main.go\">examples/66-lucy/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/66-lucy &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/lucy\"\n)\n\nfunc main() {\n\ta := lucy.SoftAccOne(0.72, 0.80) // sine scale 0.10\n\tp := lucy.SoftAccProb(0.91, 1.0) // class scale 1.0\n\tvar snap lucy.Snapshot\n\tsnap.AvgAccuracy = 80\n\tsnap.SoftAcc = a\n\tsnap.InferMs = 8\n\tsnap.TrainMs = 2\n\tsnap.Throughput = 12000\n\tlucy.Finalize(&amp;snap, lucy.Options{AdaptWindows: 10})\n\tfmt.Printf(\"soft=%.1f class=%.1f avail=%.1f score=%.0f\\n\",\n\t\ta, p, snap.Availability, snap.Score)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>soft=20.0 class=91.0 avail=80.0 score=7680</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/lucy✅\n\nWhy it exists\nAdaptation benches (test41-w, tide, live_gpt) need one shared measuring math — SoftAcc, Availability, AdaptPct, Score — not three copies of the formulas.\nWhat it is\nPure measuring package: SoftAcc / SoftAccProb, Window + Snapshot, Finalize. No datasets, no train loops. Sine scale 0.10; classification SoftAccProb scale 1.0. Density / synthetic-organism board is §69.\nSoftAcc      = 100 × (1 − |pred−target| / scale)   clamped [0,100]\nAvailability = InferMs / (InferMs + TrainMs) × 100\nScore        = Throughput × Availability × Acc / 10_000\nAcc          = hard argmax % (AvgAccuracy) — the Acc pillar\nAdaptPct     = mean SoftAcc in AdaptWindows after each switchLucy Score terms. Acc is argmax. SoftAcc is serve-confidence, not Score.\ntide/metrics re-exports this package for existing tide callers.\nEngine tests for lucy live under w2a/tests/lucy.\nAcc ≠ ScoreHard Acc is the rival vs StepBP.\nScore = Throughput × Availability × Acc / 10_000. Sparse can win Score (skip-GEMV Avail) and lose Acc.\nAAI test50 copy: Split family +5 to +12 Acc vs StepBP; Sparse Score ~8k–10k while Acc is often worse than StepBP.\nSine: many modes sit at 100% hard Acc; FastProxy SoftAcc is the knife. XOR is a 4-point parking lot (75%) — smoke, not a ranking.\nConsciousness / density: §69.\nAAI Lucy benches (private tree, replace → public Welvet): test41 native cam, test48 credit sweep, test50 23-mode FP32 race.\nHarness is not an engine package. Pulse math is this chapter. Density board: §69.\nModes + equations: §67. Cameral sandwiches: §68.\n\n\n\nGo example\nexamples/66-lucy/main.go\nRun:cd welvet/examples/66-lucy && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/lucy\"\n)\n\nfunc main() {\n\ta := lucy.SoftAccOne(0.72, 0.80) // sine scale 0.10\n\tp := lucy.SoftAccProb(0.91, 1.0) // class scale 1.0\n\tvar snap lucy.Snapshot\n\tsnap.AvgAccuracy = 80\n\tsnap.SoftAcc = a\n\tsnap.InferMs = 8\n\tsnap.TrainMs = 2\n\tsnap.Throughput = 12000\n\tlucy.Finalize(&snap, lucy.Options{AdaptWindows: 10})\n\tfmt.Printf(\"soft=%.1f class=%.1f avail=%.1f score=%.0f\\n\",\n\t\ta, p, snap.Availability, snap.Score)\n}\nOutput\nexit 0 · last run via go run .soft=20.0 class=91.0 avail=80.0 score=7680\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/66-lucy.html","url":"https://openfluke.com/book/66-lucy"},{"slug":"67-train-modes","title":"TrainMode — 29 named updates","group":"IV · Runtime","description":"Backprop is one update, not the only one. Credit assignment (broadcast gap, head proxy, sparse duty clock) has to be a named axis you can race — not a comment in a notebook. Cameral Mix also","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/parallel</span><span class=\"status ok\">✅ 29 modes</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Backprop is one update, not the only one. Credit assignment (broadcast gap, head proxy, sparse duty clock) has to be a named axis you can race — not a comment in a notebook. Cameral Mix also needs one TrainMode per hemisphere on the same loss.</p>\n<h2>What it is</h2>\n<p>parallel.TrainMode: AllNamedTrainModes() = 29 (Inherit omitted). Stack-local Split/Alt plus Step* 1D pipe twins and Mesh* grid schedulers. TrainStackMSE / TrainStackCE honour BranchModes. Display names use Short() / ShortTrainMode. Rival metric is hard Acc vs StepBP; Lucy Score is Tput × Avail × Acc — do not mix those sentences.</p>\n\n<div class=\"callout\"><strong>Honesty</strong>Rival = hard Acc vs StepBP. Lucy Score rewards skip-GEMV (Sparse Avail).\nTweenChain on a Sandwich is chain-rule BP under another name. Mesh* on an origin-only cube collapses to the family\n(not 8/27 trained copies). FastProxy is DFA with B := W_head^T, not a learned random B. Do not write\n“Sparse beat backprop.”</div>\n<h2>Loss gap (MSE or CE)</h2>\n<pre class=\"ascii\">MSE:  L = (1/d) ||ŷ − t||²     g_y = (2/d)(ŷ − t)\nCE:   L = −mean log softmax(ŷ)_class     g_y = (p − t) / B</pre>\n<p>Head always sees <code>g_y</code>. Classification hosts call <code>TrainStackCE</code> so Acc can leave chance;\nMSE on a one-hot stays uniform. What each mode does with <code>g_y</code> is the whole story.</p>\n<h2>Families (29 named tokens)</h2>\n<table>\n<thead><tr><th>Family</th><th>Tokens</th><th>Update</th></tr></thead>\n<tbody>\n<tr><td>Backprop</td><td>NormalBP · StepBP · MeshBP</td><td>chain rule J^T through the tape / volumetric Step</td></tr>\n<tr><td>Tween</td><td>Tween · StepTween · MeshTween</td><td>broadcast P(g_y) onto every leaf; η ← η/2</td></tr>\n<tr><td>TweenChain</td><td>TweenChain · StepTweenChain · MeshTweenChain</td><td>same math as BP on a Sandwich</td></tr>\n<tr><td>Split</td><td>TweenSplit · StepTweenSplit · MeshTweenSplit</td><td>g_i = (1/N) P(g_y)</td></tr>\n<tr><td>Alt</td><td>TweenAlt · StepTweenAlt · MeshTweenAlt</td><td>Split then re-forward then Tween (half LR)</td></tr>\n<tr><td>HeadProxy</td><td>TweenSplitHeadProxy · StepTweenSplitHeadProxy</td><td>head J^T g_y (with act′); hidden dW only</td></tr>\n<tr><td>FastProxy</td><td>TweenSplitFastProxy · StepTweenSplitFastProxy · MeshTweenSplitFastProxy</td><td>g_proxy = W_head^T g_y (skip act′)</td></tr>\n<tr><td>Linear</td><td>TweenSplitLinear · StepTweenSplitLinear</td><td>affine W^T walk; skip ⊙ act′; hemispheres share the down-vector</td></tr>\n<tr><td>LinearCache</td><td>TweenSplitLinearCache · StepTweenSplitLinearCache</td><td>cache every 20 steps; dead on sine — control</td></tr>\n<tr><td>HeadProxyAsync</td><td>TweenSplitHeadProxyAsync · StepTweenSplitHeadProxyAsync</td><td>hidden uses proxy from T−1; not EMA</td></tr>\n<tr><td>Sparse</td><td>TweenSplitSparse · StepTweenSplitSparse · MeshTweenSplitSparse</td><td>head + one rotating hidden; other dW = 0</td></tr>\n</tbody>\n</table>\n<p><code>AllCreditTrainModes()</code> = 16 stack-local Split/Alt plus Step* credit twins (no Mesh).\n<code>AllMeshCreditTrainModes()</code> = 4 Mesh credit (no HeadProxy / Linear / LinearCache / HeadProxyAsync Mesh twins).\n<code>AllStackLocalTrainModes()</code> = 22 (no Inherit, no Mesh*).\n<code>AllNamedTrainModes()</code> = 29 — the Test49 / test50 set.\n<code>IsLineStep()</code> = 11 (StepBP, StepTween, StepTweenChain, StepTweenSplit, StepTweenAlt, plus the six Step* credit twins).</p>\n<p>Tables and logs use <code>Short()</code> / <code>ShortTrainMode</code> (legend: <code>[T]=Tween  [S]=Split  [FP]=FastProxy  [L]=Linear  [HP]=HeadProxy</code>). Persistence and <code>ParseTrainMode</code> still use the full <code>String()</code> token. New Step* iota values were appended so old uint8 numbers stay stable.</p>\n<h2>Equations</h2>\n<h3>Backprop (the rival)</h3>\n<pre class=\"ascii\">head:   g_head = J_head^T g_y\nhemi:   g_hemi = J_hemi^T g_head\nstem:   g_stem = J_stem^T g_hemi\ndW_i from local Backward(g_i, x_i)</pre>\n<p>SIMD GEMV. This is who FastProxy has to beat on hard Acc — not Lucy Score.</p>\n<h3>Tween — broadcast, half LR</h3>\n<pre class=\"ascii\">g_i = P(g_y)     η ← η/2\ndW_i = localBackward(g_i, x_i)</pre>\n<p>Blind to W^T sign. Sine Acc collapses. MeshTween is the volumetric scheduler of this family, not a secret FastProxy.</p>\n<h3>TweenSplit — even split</h3>\n<pre class=\"ascii\">g_i = (1/N) P(g_y)</pre>\n<p>Still not J^T. Cheap Acc ceiling. Score can rise because the update is cheap (Avail), not because g is better.</p>\n<h3>TweenAlt — Split then Tween</h3>\n<p>Per sample, AltTimes times (default 1): Split from live g_y → re-forward → Tween from g_y′ (half LR). Extra forwards kill Avail → Score last.</p>\n<h3>HeadProxy</h3>\n<pre class=\"ascii\">g_proxy = J_head^T g_y = W_head^T (g_y ⊙ act′(pre_head))\nhidden i = 1…N−1:  g_i = 1/(N−1) P(g_proxy)\n                   dW_i = g_i x_i^T     (no discarded W^T)</pre>\n<p>One real J_head^T. Hemispheres do <em>not</em> get J_hemi^T.</p>\n<h3>FastProxy</h3>\n<pre class=\"ascii\">g_proxy = W_head^T g_y          ← skip act′\nhead dW still uses act′\nhidden: same 1/(N−1) P(g_proxy) dW-only as HeadProxy</pre>\n<p>DFA with B := W_head^T, not a learned random B. On AAI test50 sine, FastProxy SoftAcc often sits above StepBP while both are at 100% hard Acc — that is the FastProxy vs BP sentence.</p>\n<h3>Linear</h3>\n<pre class=\"ascii\">g_head↓  = g_y\ng_hemi↓  = W_head^T g_y          (siblings share the vector)\ng_stem↓  = Σ_hemi W_hemi^T g_hemi↓\nthen every leaf: g_i = (1/N) P(g_i↓),  dW_i = g_i x_i^T</pre>\n<p>Same O(N²) class as backprop. Score stays StepBP-class unless Acc is way up.</p>\n<h3>LinearCache — dead control</h3>\n<pre class=\"ascii\">every 20 steps: full Linear walk, cache g_i↓\nelse: g_i ← g_i^cache · ||g_y||_live / ||g_y||_cache</pre>\n<p>Norm scaling cannot recover sign flips after a frequency switch. If this wins sine, the board is lying.</p>\n<h3>HeadProxyAsync</h3>\n<pre class=\"ascii\">g_hidden^(T) = 1/(N−1) P(g_proxy^(T−1))\nhead computes g_proxy^(T) = W_head^T g_y^(T) for next step</pre>\n<p>First sample seeds live. Stale sign on XOR. Not EMA.</p>\n<h3>Sparse — duty clock</h3>\n<pre class=\"ascii\">g_proxy = W_head^T g_y\ndW_head = g_y x_head^T\nk = t mod (N−1)\ndW_k    = P(g_proxy) x_k^T\nother leaves: dW = 0 this sample</pre>\n<p>Real FLOP cut → Avail 40–50% → Lucy Score explodes. That is a duty clock, not a smaller big-O than backprop and not a better chain rule. On test50 copy, Sparse often <em>loses</em> Acc vs StepBP while winning Score.</p>\n<h2>Step* — 1D systolic pipe</h2>\n<p>The Step prefix on a stack mode is a <em>schedule</em>, not a second leftover-forward pass and not Mesh*.\n<code>IsLineStep</code> → <code>TrainLine</code> / <code>trainStackLine</code>: one sample enters child 0 per tick; every in-flight sample advances one layer; the output (and the train event) is the sample that entered <em>D</em> ticks ago. Fill ticks do not update. Serve stays a full <code>ForwardStack</code>.</p>\n<p>Same family update on the Sandwich whether Step or not — HeadProxy / Linear / FastProxy / Sparse / Async credit walk <code>trainTweenSplitLeaves</code> on both twins. Mesh* still requires a Grid (<code>RequiresGrid</code>). There is no Mesh HeadProxy / Linear / LinearCache / HeadProxyAsync.</p>\n<h2>Mesh*</h2>\n<p>MeshBP = volumetric <code>training.Step</code>. MeshTween = <code>StepMesh</code>. MeshTweenChain = <code>StepTween</code>.\nMesh Split / Alt / FastProxy / Sparse credit the placed stack under a grid walk.\nOn origin-only 1³/2³/3³ (rest <code>IsDisabled</code>) Mesh* usually matches the stack twin. Cube size is hop topology, not 27 sandwiches.</p>\n<h2>Where it is raced</h2>\n<ul>\n<li><strong>w2a Test49</strong> — permutation smoke: 29 modes × 1³/2³/3³ × Parallel / Bicameral / poly kinds, origin-only. In <code>[0] Run ALL</code>. Not a Lucy race.</li>\n<li><strong>AAI test48</strong> — credit sweep (layers × dtypes × short jobs) with these equations.</li>\n<li><strong>AAI test50</strong> — FP32 Lucy race, all 29, cams 1–3, cubes 1–3. Copy: Split/Alt family +5 to +12 Acc vs StepBP. Sine: Acc ceiling; FastProxy SoftAcc is the knife. XOR: 4-point parking lot (75%). Sparse wins Score, not Acc.</li>\n</ul>\n<p>Cameral why + sandwich stem→mid→head: <a href=\"/book/68-cameral\">§68</a>. Measuring math: <a href=\"/book/66-lucy\">§66</a>.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/67-train-modes/main.go\">examples/67-train-modes/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/67-train-modes &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/parallel\"\n)\n\nfunc main() {\n\tnamed := parallel.AllNamedTrainModes()\n\tline := 0\n\tfor _, m := range named {\n\t\tif m.IsLineStep() {\n\t\t\tline++\n\t\t}\n\t}\n\tfp, err := parallel.ParseTrainMode(\"stepfastproxy\")\n\tfmt.Println(\"named\", len(named), \"linestep\", line)\n\tfmt.Println(\"stepfastproxy\", fp.Short(), err)\n\tfmt.Println(parallel.ShortTrainModeLegend)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>named 31 linestep 11\nstepfastproxy Step[T][S][FP] &lt;nil&gt;\n[T]=Tween  [S]=Split  [FP]=FastProxy  [L]=Linear  [HP]=HeadProxy  [F]=Freeze  [Sh]=Shadow  [A]=Adv  [M]=Memory</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/parallel✅ 29 modes\n\nWhy it exists\nBackprop is one update, not the only one. Credit assignment (broadcast gap, head proxy, sparse duty clock) has to be a named axis you can race — not a comment in a notebook. Cameral Mix also needs one TrainMode per hemisphere on the same loss.\nWhat it is\nparallel.TrainMode: AllNamedTrainModes() = 29 (Inherit omitted). Stack-local Split/Alt plus Step* 1D pipe twins and Mesh* grid schedulers. TrainStackMSE / TrainStackCE honour BranchModes. Display names use Short() / ShortTrainMode. Rival metric is hard Acc vs StepBP; Lucy Score is Tput × Avail × Acc — do not mix those sentences.\n\nHonestyRival = hard Acc vs StepBP. Lucy Score rewards skip-GEMV (Sparse Avail).\nTweenChain on a Sandwich is chain-rule BP under another name. Mesh* on an origin-only cube collapses to the family\n(not 8/27 trained copies). FastProxy is DFA with B := W_head^T, not a learned random B. Do not write\n“Sparse beat backprop.”\nLoss gap (MSE or CE)\nMSE:  L = (1/d) ||ŷ − t||²     g_y = (2/d)(ŷ − t)\nCE:   L = −mean log softmax(ŷ)_class     g_y = (p − t) / B\nHead always sees g_y. Classification hosts call TrainStackCE so Acc can leave chance;\nMSE on a one-hot stays uniform. What each mode does with g_y is the whole story.\nFamilies (29 named tokens)\n\nFamilyTokensUpdate\n\nBackpropNormalBP · StepBP · MeshBPchain rule J^T through the tape / volumetric Step\nTweenTween · StepTween · MeshTweenbroadcast P(g_y) onto every leaf; η ← η/2\nTweenChainTweenChain · StepTweenChain · MeshTweenChainsame math as BP on a Sandwich\nSplitTweenSplit · StepTweenSplit · MeshTweenSplitg_i = (1/N) P(g_y)\nAltTweenAlt · StepTweenAlt · MeshTweenAltSplit then re-forward then Tween (half LR)\nHeadProxyTweenSplitHeadProxy · StepTweenSplitHeadProxyhead J^T g_y (with act′); hidden dW only\nFastProxyTweenSplitFastProxy · StepTweenSplitFastProxy · MeshTweenSplitFastProxyg_proxy = W_head^T g_y (skip act′)\nLinearTweenSplitLinear · StepTweenSplitLinearaffine W^T walk; skip ⊙ act′; hemispheres share the down-vector\nLinearCacheTweenSplitLinearCache · StepTweenSplitLinearCachecache every 20 steps; dead on sine — control\nHeadProxyAsyncTweenSplitHeadProxyAsync · StepTweenSplitHeadProxyAsynchidden uses proxy from T−1; not EMA\nSparseTweenSplitSparse · StepTweenSplitSparse · MeshTweenSplitSparsehead + one rotating hidden; other dW = 0\n\n\nAllCreditTrainModes() = 16 stack-local Split/Alt plus Step* credit twins (no Mesh).\nAllMeshCreditTrainModes() = 4 Mesh credit (no HeadProxy / Linear / LinearCache / HeadProxyAsync Mesh twins).\nAllStackLocalTrainModes() = 22 (no Inherit, no Mesh*).\nAllNamedTrainModes() = 29 — the Test49 / test50 set.\nIsLineStep() = 11 (StepBP, StepTween, StepTweenChain, StepTweenSplit, StepTweenAlt, plus the six Step* credit twins).\nTables and logs use Short() / ShortTrainMode (legend: [T]=Tween  [S]=Split  [FP]=FastProxy  [L]=Linear  [HP]=HeadProxy). Persistence and ParseTrainMode still use the full String() token. New Step* iota values were appended so old uint8 numbers stay stable.\nEquations\nBackprop (the rival)\nhead:   g_head = J_head^T g_y\nhemi:   g_hemi = J_hemi^T g_head\nstem:   g_stem = J_stem^T g_hemi\ndW_i from local Backward(g_i, x_i)\nSIMD GEMV. This is who FastProxy has to beat on hard Acc — not Lucy Score.\nTween — broadcast, half LR\ng_i = P(g_y)     η ← η/2\ndW_i = localBackward(g_i, x_i)\nBlind to W^T sign. Sine Acc collapses. MeshTween is the volumetric scheduler of this family, not a secret FastProxy.\nTweenSplit — even split\ng_i = (1/N) P(g_y)\nStill not J^T. Cheap Acc ceiling. Score can rise because the update is cheap (Avail), not because g is better.\nTweenAlt — Split then Tween\nPer sample, AltTimes times (default 1): Split from live g_y → re-forward → Tween from g_y′ (half LR). Extra forwards kill Avail → Score last.\nHeadProxy\ng_proxy = J_head^T g_y = W_head^T (g_y ⊙ act′(pre_head))\nhidden i = 1…N−1:  g_i = 1/(N−1) P(g_proxy)\n                   dW_i = g_i x_i^T     (no discarded W^T)\nOne real J_head^T. Hemispheres do not get J_hemi^T.\nFastProxy\ng_proxy = W_head^T g_y          ← skip act′\nhead dW still uses act′\nhidden: same 1/(N−1) P(g_proxy) dW-only as HeadProxy\nDFA with B := W_head^T, not a learned random B. On AAI test50 sine, FastProxy SoftAcc often sits above StepBP while both are at 100% hard Acc — that is the FastProxy vs BP sentence.\nLinear\ng_head↓  = g_y\ng_hemi↓  = W_head^T g_y          (siblings share the vector)\ng_stem↓  = Σ_hemi W_hemi^T g_hemi↓\nthen every leaf: g_i = (1/N) P(g_i↓),  dW_i = g_i x_i^T\nSame O(N²) class as backprop. Score stays StepBP-class unless Acc is way up.\nLinearCache — dead control\nevery 20 steps: full Linear walk, cache g_i↓\nelse: g_i ← g_i^cache · ||g_y||_live / ||g_y||_cache\nNorm scaling cannot recover sign flips after a frequency switch. If this wins sine, the board is lying.\nHeadProxyAsync\ng_hidden^(T) = 1/(N−1) P(g_proxy^(T−1))\nhead computes g_proxy^(T) = W_head^T g_y^(T) for next step\nFirst sample seeds live. Stale sign on XOR. Not EMA.\nSparse — duty clock\ng_proxy = W_head^T g_y\ndW_head = g_y x_head^T\nk = t mod (N−1)\ndW_k    = P(g_proxy) x_k^T\nother leaves: dW = 0 this sample\nReal FLOP cut → Avail 40–50% → Lucy Score explodes. That is a duty clock, not a smaller big-O than backprop and not a better chain rule. On test50 copy, Sparse often loses Acc vs StepBP while winning Score.\nStep* — 1D systolic pipe\nThe Step prefix on a stack mode is a schedule, not a second leftover-forward pass and not Mesh*.\nIsLineStep → TrainLine / trainStackLine: one sample enters child 0 per tick; every in-flight sample advances one layer; the output (and the train event) is the sample that entered D ticks ago. Fill ticks do not update. Serve stays a full ForwardStack.\nSame family update on the Sandwich whether Step or not — HeadProxy / Linear / FastProxy / Sparse / Async credit walk trainTweenSplitLeaves on both twins. Mesh* still requires a Grid (RequiresGrid). There is no Mesh HeadProxy / Linear / LinearCache / HeadProxyAsync.\nMesh*\nMeshBP = volumetric training.Step. MeshTween = StepMesh. MeshTweenChain = StepTween.\nMesh Split / Alt / FastProxy / Sparse credit the placed stack under a grid walk.\nOn origin-only 1³/2³/3³ (rest IsDisabled) Mesh* usually matches the stack twin. Cube size is hop topology, not 27 sandwiches.\nWhere it is raced\n\nw2a Test49 — permutation smoke: 29 modes × 1³/2³/3³ × Parallel / Bicameral / poly kinds, origin-only. In [0] Run ALL. Not a Lucy race.\nAAI test48 — credit sweep (layers × dtypes × short jobs) with these equations.\nAAI test50 — FP32 Lucy race, all 29, cams 1–3, cubes 1–3. Copy: Split/Alt family +5 to +12 Acc vs StepBP. Sine: Acc ceiling; FastProxy SoftAcc is the knife. XOR: 4-point parking lot (75%). Sparse wins Score, not Acc.\n\nCameral why + sandwich stem→mid→head: §68. Measuring math: §66.\n\n\n\nGo example\nexamples/67-train-modes/main.go\nRun:cd welvet/examples/67-train-modes && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/parallel\"\n)\n\nfunc main() {\n\tnamed := parallel.AllNamedTrainModes()\n\tline := 0\n\tfor _, m := range named {\n\t\tif m.IsLineStep() {\n\t\t\tline++\n\t\t}\n\t}\n\tfp, err := parallel.ParseTrainMode(\"stepfastproxy\")\n\tfmt.Println(\"named\", len(named), \"linestep\", line)\n\tfmt.Println(\"stepfastproxy\", fp.Short(), err)\n\tfmt.Println(parallel.ShortTrainModeLegend)\n}\nOutput\nexit 0 · last run via go run .named 31 linestep 11\nstepfastproxy Step[T][S][FP] <nil>\n[T]=Tween  [S]=Split  [FP]=FastProxy  [L]=Linear  [HP]=HeadProxy  [F]=Freeze  [Sh]=Shadow  [A]=Adv  [M]=Memory\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/67-train-modes.html","url":"https://openfluke.com/book/67-train-modes"},{"slug":"68-cameral","title":"Cameral sandwiches + AAI Lucy","group":"VII · Apps","description":"A single Dense chain cannot host two independent weight copies that share an input, merge, and optionally train under different updates. That is the cameral graph: hemispheres, not screen-sp","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/parallel</span><span class=\"status ok\">✅ cameral</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>A single Dense chain cannot host two independent weight copies that share an input, merge, and optionally train under different updates. That is the cameral graph: hemispheres, not screen-space sprites and not a second hidden size.</p>\n<h2>What it is</h2>\n<p>Hemispheres / Bicameral / Sandwich / Mix. Stem → Parallel mid → Dense head. SetBranchModes + TrainStackMSE. Lucy races in AAI (test41 / test48 / test50) import this API; measuring is lucy/; harness is not engine.</p>\n<figure class=\"diagram\"><pre class=\"ascii\">x  →  Dense stem  →  ┬→ Hemi 1 (own W, own TrainMode)\n                     ├→ Hemi 2\n                     └→ Hemi n     merge add|avg|concat|filter\n                              → Dense head → ŷ\n                              MSE → g_y → each branch’s update</pre><figcaption>Sandwich: stem and head are shared; hemispheres are sibling copies.</figcaption></figure>\n<h2>Why cameral exists</h2>\n<p>Welvet already has Sequential (ordered compose) and Residual (skip). Neither is “two brains on one x.”\nA hemisphere is an independent sub-net with its own weights. Bi / Tri / Quad are n hemispheres plus a merge.\n<strong>Mix</strong> stamps a different <code>TrainMode</code> per hemi (<code>SetBranchModes</code>) so left can be StepBP\nwhile right is TweenChain — one loss on the merge. Grid <code>training.Step</code> applies one mode to the whole net;\nMix needs <code>TrainStackMSE</code> or the BranchModes stamp is a lie.</p>\n<p>The sandwich (stem → mid → head) is not extra depth for its own sake. Credit modes need a <em>head Jacobian</em>\n(or a W_head^T proxy). Without a head, FastProxy / HeadProxy have nothing to inject. Stem gets the down-going\nvector after hemispheres merge. That is why AAI Lucy jobs are sandwiches even when cameral count is 1\n(mid is a single Dense, not Parallel).</p>\n<h2>API (engine, public)</h2>\n<ul>\n<li><code>Hemispheres</code> / <code>HemispheresFrom</code> — n twins; merge add/avg/concat/filter</li>\n<li><code>Bicameral</code> / <code>BicameralFrom</code> / <code>Sandwich</code> — stem → Parallel → head Stack</li>\n<li><code>SetBranchModes</code> / <code>TrainStackMSE</code> — Mix path</li>\n<li><code>ResidualGraft</code> — y = F(x)+x when F is Parallel</li>\n<li><code>WriteCameralFile</code> / <code>LoadCameral</code> — cameral <code>.entity</code> (in <code>model/entity</code>)</li>\n<li><code>CamSync</code> — optional weight averaging across cams / layers → <a href=\"/book/70-cam-sync\">§70</a></li>\n</ul>\n<p>Layer package chapter: <a href=\"/book/27-parallel\">§27</a>. Named updates: <a href=\"/book/67-train-modes\">§67</a>.\nWeight sync across cams (and across mesh layouts when shapes match): <a href=\"/book/70-cam-sync\">§70</a>.</p>\n<h2>AAI Lucy benches</h2>\n<p>AAI is a separate tree. It <code>replace</code>s <code>github.com/openfluke/welvet</code> (public chaosglue module).\nThe engine does not import AAI. Lucy <em>math</em> is <a href=\"/book/66-lucy\">§66</a>.</p>\n<table>\n<thead><tr><th>Bench</th><th>What it answers</th></tr></thead>\n<tbody>\n<tr><td>test41</td><td>Native cameral Lucy (Bi/Tri/Mix) on toys — does the sandwich train at all.</td></tr>\n<tr><td>test48</td><td>Credit sweep: layers × dtypes × short jobs. Home of the equations in §67.</td></tr>\n<tr><td>test50</td><td>Deep FP32 race: all 29 named modes × Dense/Bi/Tri × 1³/2³/3³ origin-only. Rival = hard Acc vs StepBP.</td></tr>\n</tbody>\n</table>\n<p>test50 copy: Split / Alt / MeshSplit family about <strong>+5 to +12 Acc</strong> over StepBP (~68–74%).\nSine: Acc ceiling (many modes 100% including StepBP); FastProxy SoftAcc ~56–68 vs StepBP ~42–53.\nXOR: almost everyone at 75% (3 of 4 bits) — parking lot. Sparse wins Score, not Acc.\nOrigin-only cubes: extra cells are disabled; 3³ is hop topology, not 27 copies.</p>\n<p>w2a Test49 is the <em>permutation smoke</em> of those 29 modes (in <code>[0] Run ALL</code>), not a Lucy race.\nDo not quote Test49 as “we beat backprop.”</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/68-cameral/main.go\">examples/68-cameral/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/68-cameral &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\themi := s.Children[1].(*parallel.Layer)\n\themi.SetBranchModes(parallel.ModeStepBP, parallel.ModeTweenSplitFastProxy)\n\n\tx := core.NewTensor[float32](1, 8)\n\tt := core.NewTensor[float32](1, 1)\n\tt.Data[0] = 0.5\n\tloss, err := parallel.TrainStackMSE(s, x, t, parallel.ModeStepBP, 0.01)\n\tfmt.Println(\"mix loss\", loss, \"err\", err)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>mix loss 0 err &lt;nil&gt;</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/parallel✅ cameral\n\nWhy it exists\nA single Dense chain cannot host two independent weight copies that share an input, merge, and optionally train under different updates. That is the cameral graph: hemispheres, not screen-space sprites and not a second hidden size.\nWhat it is\nHemispheres / Bicameral / Sandwich / Mix. Stem → Parallel mid → Dense head. SetBranchModes + TrainStackMSE. Lucy races in AAI (test41 / test48 / test50) import this API; measuring is lucy/; harness is not engine.\nx  →  Dense stem  →  ┬→ Hemi 1 (own W, own TrainMode)\n                     ├→ Hemi 2\n                     └→ Hemi n     merge add|avg|concat|filter\n                              → Dense head → ŷ\n                              MSE → g_y → each branch’s updateSandwich: stem and head are shared; hemispheres are sibling copies.\nWhy cameral exists\nWelvet already has Sequential (ordered compose) and Residual (skip). Neither is “two brains on one x.”\nA hemisphere is an independent sub-net with its own weights. Bi / Tri / Quad are n hemispheres plus a merge.\nMix stamps a different TrainMode per hemi (SetBranchModes) so left can be StepBP\nwhile right is TweenChain — one loss on the merge. Grid training.Step applies one mode to the whole net;\nMix needs TrainStackMSE or the BranchModes stamp is a lie.\nThe sandwich (stem → mid → head) is not extra depth for its own sake. Credit modes need a head Jacobian\n(or a W_head^T proxy). Without a head, FastProxy / HeadProxy have nothing to inject. Stem gets the down-going\nvector after hemispheres merge. That is why AAI Lucy jobs are sandwiches even when cameral count is 1\n(mid is a single Dense, not Parallel).\nAPI (engine, public)\n\nHemispheres / HemispheresFrom — n twins; merge add/avg/concat/filter\nBicameral / BicameralFrom / Sandwich — stem → Parallel → head Stack\nSetBranchModes / TrainStackMSE — Mix path\nResidualGraft — y = F(x)+x when F is Parallel\nWriteCameralFile / LoadCameral — cameral .entity (in model/entity)\nCamSync — optional weight averaging across cams / layers → §70\n\nLayer package chapter: §27. Named updates: §67.\nWeight sync across cams (and across mesh layouts when shapes match): §70.\nAAI Lucy benches\nAAI is a separate tree. It replaces github.com/openfluke/welvet (public chaosglue module).\nThe engine does not import AAI. Lucy math is §66.\n\nBenchWhat it answers\n\ntest41Native cameral Lucy (Bi/Tri/Mix) on toys — does the sandwich train at all.\ntest48Credit sweep: layers × dtypes × short jobs. Home of the equations in §67.\ntest50Deep FP32 race: all 29 named modes × Dense/Bi/Tri × 1³/2³/3³ origin-only. Rival = hard Acc vs StepBP.\n\n\ntest50 copy: Split / Alt / MeshSplit family about +5 to +12 Acc over StepBP (~68–74%).\nSine: Acc ceiling (many modes 100% including StepBP); FastProxy SoftAcc ~56–68 vs StepBP ~42–53.\nXOR: almost everyone at 75% (3 of 4 bits) — parking lot. Sparse wins Score, not Acc.\nOrigin-only cubes: extra cells are disabled; 3³ is hop topology, not 27 copies.\nw2a Test49 is the permutation smoke of those 29 modes (in [0] Run ALL), not a Lucy race.\nDo not quote Test49 as “we beat backprop.”\n\n\n\nGo example\nexamples/68-cameral/main.go\nRun:cd welvet/examples/68-cameral && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\themi := s.Children[1].(*parallel.Layer)\n\themi.SetBranchModes(parallel.ModeStepBP, parallel.ModeTweenSplitFastProxy)\n\n\tx := core.NewTensor[float32](1, 8)\n\tt := core.NewTensor[float32](1, 1)\n\tt.Data[0] = 0.5\n\tloss, err := parallel.TrainStackMSE(s, x, t, parallel.ModeStepBP, 0.01)\n\tfmt.Println(\"mix loss\", loss, \"err\", err)\n}\nOutput\nexit 0 · last run via go run .mix loss 0 err <nil>\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/68-cameral.html","url":"https://openfluke.com/book/68-cameral"},{"slug":"69-lucy-density","title":"Lucy density — synthetic organism","group":"V · Systems","description":"A new host (char LM, MNIST, a layer sprint) should not copy tide's goldilocks math. The question is always the same: can the net run and train at the same time in a small box, then how far t","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/lucy</span><span class=\"status ok\">✅ BuildLPD</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>A new host (char LM, MNIST, a layer sprint) should not copy tide's goldilocks math. The question is always the same: can the net <em>run and train at the same time</em> in a small box, then how far that live-fit condenses without becoming a trap. That ruler belongs in the engine.</p>\n<h2>What it is</h2>\n<p>lucy.BuildLPD ranks Samples for consciousness (Acc / Throughput / Availability keep vs learner peaks) then Lucy density (Q × shrink vs Acc-champ RAM). Gold / near / keep / trap bands, consciousness radar, and memory-density radar are computed here. Tide dash and Lucy PDF only draw the board.</p>\n<figure class=\"diagram\"><pre class=\"ascii\">WHY\n  Industry ships dead calculators: INT8 inference, no on-device train.\n  Synthetic organism = serve while learning, then shrink without falling\n  into chance-Acc \"tiny &amp; fast\" traps.\n\nPILLARS (consciousness)\n  Acc    = argmax %          (did it learn?)\n  Thru   = outputs / second  (can it act while live?)\n  Avail  = InferMs / busy    (can you still talk to it while it trains?)\n  Score  = T × Avail × Acc / 10_000     live-fit\n  SoftAcc is serve-confidence — not a pillar.\n\nDENSITY (memory intelligence)\n  Acc champ = RAM reference (best learner, not the Score champ)\n  Learner   = RelAcc ≥ 70% of Acc champ   (traps do not set Thru/Avail peaks)\n  Q         = geomean(RelAcc, RelThru, RelAvail)\n  shrink    = AccChampRAM / thisRAM   (capped ×32)\n  LPD       = Q × shrink    if RelAcc ≥ 70% else 0\n\nBANDS\n  gold  all 3 pillars ≥80% and RAM ≤20% of Acc champ\n  near  Acc + (Thru or Avail) ≥80% at ≤50% RAM\n  trap  RAM ≤20% and Acc keep &lt;70%     (binary looking dense)\n  Score/MiB is the trap metric — do not use it for goldilocks.\n\nRADARS (for PDF / dash — math here, drawing in tide)\n  Consciousness  = (RelAcc, RelThru, RelAvail)\n  Memory density = (RelAcc, RelThru, RelAvail) × shrink   traps at origin</pre><figcaption>One ruler. Any host feeds Samples; tide is just the display.</figcaption></figure>\n<h2>Why we measure this</h2>\n<p>The goal is not a better chatbot and not a paper for a faculty board. It is a\n<strong>synthetic organism</strong>: a net that owns time — continuous serve, continuous train,\nno turn-based halt, no phone-home. Lucy Score asks the thermodynamic question\ntide was built for: <em>does SGD that blocks inference die, and do proxy / Split / Sparse\npaths keep the live loop while still learning?</em></p>\n<p>Hard Acc is whether it learned. Availability is whether it still breathes.\nThroughput is how many actions it took while both were happening. Multiply them\nand you get live-fit. SoftAcc is how confident the serve looked — useful, not the Acc term.</p>\n<p>Memory density asks the second question: once you have a learner, how far can\ndtype / quant / cameral width <em>condense</em> that live-fit versus the Acc champ's RAM\nwithout collapsing to chance Acc. A binary cell that is 30× smaller and 4× faster\nwith 12% Acc is a <strong>trap</strong> (LPD = 0). An int8 that keeps ≥70% of Acc-champ Acc\nat a fifth the RAM is goldilocks.</p>\n<h2>Formulas</h2>\n<table>\n<thead><tr><th>Symbol</th><th>Formula</th><th>Meaning</th></tr></thead>\n<tbody>\n<tr><td>Availability</td><td><code>InferMs / (InferMs + TrainMs) × 100</code></td><td>Duty cycle. SGD that blocks serve dies here.</td></tr>\n<tr><td>Throughput T</td><td><code>TotalOutputs / duration_s</code></td><td>Actions per second while the sweep is live.</td></tr>\n<tr><td>Acc</td><td>argmax % (<code>AvgAccuracy</code>)</td><td>Learning. Acc champ is the RAM reference.</td></tr>\n<tr><td>Lucy Score</td><td><code>T × Avail × Acc / 10_000</code></td><td>Live-fit. SoftAcc is not this term.</td></tr>\n<tr><td>Realtime</td><td><code>T × Avail / 100</code></td><td>Duty-cycle speed without Acc.</td></tr>\n<tr><td>ZeroDowntime</td><td><code>Acc × Avail / 100</code></td><td>Still serving while learning.</td></tr>\n<tr><td>RelAcc / RelThru / RelAvail</td><td>value / learner peak, clamped [0,1]</td><td>Keep vs cells that actually learn.</td></tr>\n<tr><td>Q</td><td>geomean of the three Rel*</td><td>Consciousness mix. Traps do not set Thru/Avail peaks.</td></tr>\n<tr><td>shrink</td><td><code>min(AccChampRAM / thisRAM, 32)</code></td><td>How much smaller than the Acc champ.</td></tr>\n<tr><td>LPD</td><td><code>Q × shrink</code> if RelAcc ≥ 0.70 else 0</td><td>Lucy density. Weeds Score/MiB traps.</td></tr>\n<tr><td>Gold</td><td>all 3 Rel* ≥ 0.80 and RAM ≤ 20% Acc champ</td><td>Trifecta in a small box.</td></tr>\n<tr><td>Gold-std</td><td>Acc ≥ 80% plus Thru or Avail, then smallest then fastest</td><td>Two-or-more of the trifecta.</td></tr>\n<tr><td>Trap</td><td>RAM ≤ 20% Acc champ and RelAcc &lt; 0.70</td><td>Tiny and fast with chance Acc.</td></tr>\n<tr><td>MobileScore</td><td><code>Score / WeightMiB</code></td><td>The binary trap. Use LPD instead.</td></tr>\n</tbody></table>\n<h2>What tide still owns</h2>\n<p>Tide is the <em>race</em>: serve+train pulses, permute matrix, dashboard, Lucy PDF\n(including drawing the two radars). <code>tide/report.BuildLPD</code> pretty-prints cell IDs\nthen calls <code>lucy.BuildLPD</code>. A new thing that only needs the ruler:</p>\n<pre><code>import \"github.com/openfluke/welvet/lucy\"\nboard := lucy.BuildLPD(samples)\n_ = board.Top[0].Consciousness()  // Acc, Thru, Avail keep\n_ = board.Top[0].MemoryDensity()  // same × shrink; traps at 0</code></pre>\n<p>Classification hosts should train with <code>TrainStackCE</code> so the Acc pillar can leave chance;\nMSE on a one-hot stays uniform. That is a loss gap in <code>layers/parallel</code>, not a Lucy formula.</p>\n<p>Pulse math: <a href=\"/book/66-lucy\">§66</a>. Train modes: <a href=\"/book/67-train-modes\">§67</a>.</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/69-lucy-density/main.go\">examples/69-lucy-density/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/69-lucy-density &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/lucy\"\n)\n\nfunc main() {\n\tboard := lucy.BuildLPD([]lucy.Sample{\n\t\t{ID: \"f32\", Mode: \"sgd\", Acc: 90, Thru: 200, Avail: 40, Score: 100, RAMKiB: 1000},\n\t\t{ID: \"int8\", Mode: \"sgd\", Acc: 82, Thru: 180, Avail: 38, Score: 85, RAMKiB: 180},\n\t\t{ID: \"bin\", Mode: \"sgd\", Acc: 12, Thru: 400, Avail: 50, Score: 40, RAMKiB: 40},\n\t})\n\ttop := board.Top[0]\n\tfmt.Printf(\"lead=%s band=%s LPD=%.2f trap=%s\\n\",\n\t\ttop.ID, top.Band, top.LPD, board.Trap[0].ID)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>lead=int8 band=gold LPD=5.11 trap=bin</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/lucy✅ BuildLPD\n\nWhy it exists\nA new host (char LM, MNIST, a layer sprint) should not copy tide's goldilocks math. The question is always the same: can the net run and train at the same time in a small box, then how far that live-fit condenses without becoming a trap. That ruler belongs in the engine.\nWhat it is\nlucy.BuildLPD ranks Samples for consciousness (Acc / Throughput / Availability keep vs learner peaks) then Lucy density (Q × shrink vs Acc-champ RAM). Gold / near / keep / trap bands, consciousness radar, and memory-density radar are computed here. Tide dash and Lucy PDF only draw the board.\nWHY\n  Industry ships dead calculators: INT8 inference, no on-device train.\n  Synthetic organism = serve while learning, then shrink without falling\n  into chance-Acc \"tiny & fast\" traps.\n\nPILLARS (consciousness)\n  Acc    = argmax %          (did it learn?)\n  Thru   = outputs / second  (can it act while live?)\n  Avail  = InferMs / busy    (can you still talk to it while it trains?)\n  Score  = T × Avail × Acc / 10_000     live-fit\n  SoftAcc is serve-confidence — not a pillar.\n\nDENSITY (memory intelligence)\n  Acc champ = RAM reference (best learner, not the Score champ)\n  Learner   = RelAcc ≥ 70% of Acc champ   (traps do not set Thru/Avail peaks)\n  Q         = geomean(RelAcc, RelThru, RelAvail)\n  shrink    = AccChampRAM / thisRAM   (capped ×32)\n  LPD       = Q × shrink    if RelAcc ≥ 70% else 0\n\nBANDS\n  gold  all 3 pillars ≥80% and RAM ≤20% of Acc champ\n  near  Acc + (Thru or Avail) ≥80% at ≤50% RAM\n  trap  RAM ≤20% and Acc keep <70%     (binary looking dense)\n  Score/MiB is the trap metric — do not use it for goldilocks.\n\nRADARS (for PDF / dash — math here, drawing in tide)\n  Consciousness  = (RelAcc, RelThru, RelAvail)\n  Memory density = (RelAcc, RelThru, RelAvail) × shrink   traps at originOne ruler. Any host feeds Samples; tide is just the display.\nWhy we measure this\nThe goal is not a better chatbot and not a paper for a faculty board. It is a\nsynthetic organism: a net that owns time — continuous serve, continuous train,\nno turn-based halt, no phone-home. Lucy Score asks the thermodynamic question\ntide was built for: does SGD that blocks inference die, and do proxy / Split / Sparse\npaths keep the live loop while still learning?\nHard Acc is whether it learned. Availability is whether it still breathes.\nThroughput is how many actions it took while both were happening. Multiply them\nand you get live-fit. SoftAcc is how confident the serve looked — useful, not the Acc term.\nMemory density asks the second question: once you have a learner, how far can\ndtype / quant / cameral width condense that live-fit versus the Acc champ's RAM\nwithout collapsing to chance Acc. A binary cell that is 30× smaller and 4× faster\nwith 12% Acc is a trap (LPD = 0). An int8 that keeps ≥70% of Acc-champ Acc\nat a fifth the RAM is goldilocks.\nFormulas\n\nSymbolFormulaMeaning\n\nAvailabilityInferMs / (InferMs + TrainMs) × 100Duty cycle. SGD that blocks serve dies here.\nThroughput TTotalOutputs / duration_sActions per second while the sweep is live.\nAccargmax % (AvgAccuracy)Learning. Acc champ is the RAM reference.\nLucy ScoreT × Avail × Acc / 10_000Live-fit. SoftAcc is not this term.\nRealtimeT × Avail / 100Duty-cycle speed without Acc.\nZeroDowntimeAcc × Avail / 100Still serving while learning.\nRelAcc / RelThru / RelAvailvalue / learner peak, clamped [0,1]Keep vs cells that actually learn.\nQgeomean of the three Rel*Consciousness mix. Traps do not set Thru/Avail peaks.\nshrinkmin(AccChampRAM / thisRAM, 32)How much smaller than the Acc champ.\nLPDQ × shrink if RelAcc ≥ 0.70 else 0Lucy density. Weeds Score/MiB traps.\nGoldall 3 Rel* ≥ 0.80 and RAM ≤ 20% Acc champTrifecta in a small box.\nGold-stdAcc ≥ 80% plus Thru or Avail, then smallest then fastestTwo-or-more of the trifecta.\nTrapRAM ≤ 20% Acc champ and RelAcc < 0.70Tiny and fast with chance Acc.\nMobileScoreScore / WeightMiBThe binary trap. Use LPD instead.\n\nWhat tide still owns\nTide is the race: serve+train pulses, permute matrix, dashboard, Lucy PDF\n(including drawing the two radars). tide/report.BuildLPD pretty-prints cell IDs\nthen calls lucy.BuildLPD. A new thing that only needs the ruler:\nimport \"github.com/openfluke/welvet/lucy\"\nboard := lucy.BuildLPD(samples)\n_ = board.Top[0].Consciousness()  // Acc, Thru, Avail keep\n_ = board.Top[0].MemoryDensity()  // same × shrink; traps at 0\nClassification hosts should train with TrainStackCE so the Acc pillar can leave chance;\nMSE on a one-hot stays uniform. That is a loss gap in layers/parallel, not a Lucy formula.\nPulse math: §66. Train modes: §67.\n\n\n\nGo example\nexamples/69-lucy-density/main.go\nRun:cd welvet/examples/69-lucy-density && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/lucy\"\n)\n\nfunc main() {\n\tboard := lucy.BuildLPD([]lucy.Sample{\n\t\t{ID: \"f32\", Mode: \"sgd\", Acc: 90, Thru: 200, Avail: 40, Score: 100, RAMKiB: 1000},\n\t\t{ID: \"int8\", Mode: \"sgd\", Acc: 82, Thru: 180, Avail: 38, Score: 85, RAMKiB: 180},\n\t\t{ID: \"bin\", Mode: \"sgd\", Acc: 12, Thru: 400, Avail: 50, Score: 40, RAMKiB: 40},\n\t})\n\ttop := board.Top[0]\n\tfmt.Printf(\"lead=%s band=%s LPD=%.2f trap=%s\\n\",\n\t\ttop.ID, top.Band, top.LPD, board.Trap[0].ID)\n}\nOutput\nexit 0 · last run via go run .lead=int8 band=gold LPD=5.11 trap=bin\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/69-lucy-density.html","url":"https://openfluke.com/book/69-lucy-density"},{"slug":"70-cam-sync","title":"CamSync — inter-cameral / cross-mesh weight blend","group":"VII · Apps","description":"Mix BranchModes and different inits let cams diverge on purpose. Sometimes you want them to share — gently (1% pull) or hard (full average) — within a Parallel, across Stack children, or eve","html":"\n\n\n\n<p class=\"pill-row\"><span class=\"pill\">github.com/openfluke/welvet/layers/parallel</span><span class=\"status ok\">✅ CamSync</span></p>\n<hr class=\"rule\" />\n<h2>Why it exists</h2>\n<p>Mix BranchModes and different inits let cams diverge on purpose. Sometimes you want them to share — gently (1% pull) or hard (full average) — within a Parallel, across Stack children, or even between same-shaped stores sitting on wildly different mesh layouts (1×2×1 ↔ 2×4×5). That is CamSync: couple weights without collapsing the graph into one Dense.</p>\n<h2>What it is</h2>\n<p>CamSyncConfig{Alpha, When, Groups, Cross}. BlendStores pulls every store in a clique toward the mean. Empty Groups = all cams; Cross wires SyncEndpoint pairs across layers/cams. Shape rule: Rows×Cols must match. Bidirectional today; one-way teacher→student not yet.</p>\n<figure class=\"diagram\"><pre class=\"ascii\">Parallel mid (n cams)                 Stack / mesh (any DxHxW)\n  ┌─ cam0 W ─┐                          cell A 1×2×1     cell B 2×4×5\n  │  cam1 W  │  Groups / all-cams       layer-1 Dense    cam3 layer-1 Dense\n  │  cam2 W  │  α·mean blend     OR     [128×64]  ←──Cross──→  [128×64]\n  └─ cam3 W ─┘                          (mesh size irrelevant — shape is)\n         │\n    SyncAfterSample | Step | Pulse | Manual SyncNow</pre><figcaption>Same-shaped stores sync. Mesh topology is host wiring via Groups + Cross.</figcaption></figure>\n<div class=\"callout\"><strong>The insane bit</strong>\nCamSync does not care that one Parallel lives on a <code>1×2×1</code> cell and another store sits on\ncam 3 of a <code>2×4×5</code>. Name both endpoints; if <code>Rows×Cols</code> match, they blend.\nVolumetric layout is configuration — not a built-in grid type inside CamSync.</div>\n\n<h2>Knobs</h2>\n<table>\n<thead><tr><th>Field</th><th>Meaning</th></tr></thead>\n<tbody>\n<tr><td><code>Enabled</code> / <code>Alpha</code></td>\n<td>Soft pull <code>w ← (1−α)·w + α·mean</code>. <code>0.01</code> = 1%, <code>1.0</code> = hard sync.\nDefault α is 1 when Enabled and Alpha ≤ 0.</td></tr>\n<tr><td><code>When</code></td>\n<td><code>SyncManual</code> · <code>SyncAfterSample</code> · <code>SyncAfterStep</code> · <code>SyncAfterPulse</code>.\nHooks fire from <code>TrainStackMSE</code>/<code>CE</code> and <code>Pulse()</code>.</td></tr>\n<tr><td><code>Groups</code></td>\n<td>Within one Parallel: cam-index cliques. Empty ⇒ one group of every branch.\nExample: <code>{{0,1},{2,3}}</code> syncs pairs only.</td></tr>\n<tr><td><code>Cross</code></td>\n<td><code>[]SyncPair</code> of <code>SyncEndpoint{StackIdx, Branch, Store}</code> —\nsame layer across cams, Dense stem ↔ matching cam Dense, or any same-shaped pair the Stack can resolve.</td></tr>\n</tbody>\n</table>\n\n<h2>What works / what does not (yet)</h2>\n<ul>\n<li>✅ All cams together, selective groups, soft or hard α</li>\n<li>✅ Cross-layer / cross-cam pairs inside one Stack</li>\n<li>✅ “Same layer on a different mesh” when weight shapes match</li>\n<li>✅ <strong>v1.1.1</strong> — cam adjusting on <strong>all layer types</strong> (Dense, CNN, Parallel, Stack-resolved stores)</li>\n<li>❌ One-directional (teacher → student) — pairs are mutual mean-blend</li>\n<li>❌ Mismatched <code>Rows×Cols</code> — rejected or skipped</li>\n<li>❌ Auto sync across <em>two separate Stack instances</em> — host calls <code>weights.BlendStores</code> on the two stores</li>\n</ul>\n\n<h2>API</h2>\n<ul>\n<li><code>parallel.CamSyncConfig</code> · <code>DefaultCamSync()</code> · <code>SetCamSync</code> on Layer or Stack</li>\n<li><code>SyncNow</code> / <code>Pulse</code> / <code>MaybeSync</code></li>\n<li><code>weights.BlendStores</code> · <code>weights.StoreCosine</code> (diagnostics)</li>\n</ul>\n<p>Cameral sandwiches: <a href=\"/book/68-cameral\">§68</a>. Parallel package: <a href=\"/book/27-parallel\">§27</a>.\nHost probe: <code>ok/cam_sync</code> (MNIST sample α×cams matrix).</p>\n\n\n<section class=\"examples\" id=\"examples\">\n<h2>Go example</h2>\n<p><a class=\"go-file-link\" href=\"/source/book/70-cam-sync/main.go\">examples/70-cam-sync/main.go</a></p>\n<div class=\"run-cmd\"><span>Run:</span><code>cd welvet/examples/70-cam-sync &amp;&amp; source ../env.sh &amp;&amp; go run .</code></div>\n<pre><code>package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/stub/seed\"\n\t\"github.com/openfluke/welvet/weights\"\n)\n\nfunc main() {\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\themi := s.Children[1].(*parallel.Layer)\n\tleft := hemi.Branches[0].(*dense.Layer).Weights\n\tright := hemi.Branches[1].(*dense.Layer).Weights\n\t_ = seed.InitStoreHe(left, 16, seed.From(\"cam0\"))\n\t_ = seed.InitStoreHe(right, 16, seed.From(\"cam1\"))\n\n\themi.SetCamSync(parallel.CamSyncConfig{\n\t\tEnabled: true,\n\t\tAlpha:   1.0,\n\t\tWhen:    parallel.SyncManual,\n\t})\n\tbefore, _ := weights.StoreCosine(left, right)\n\tif err := hemi.SyncNow(); err != nil {\n\t\tpanic(err)\n\t}\n\tafter, _ := weights.StoreCosine(left, right)\n\tfmt.Printf(\"cosine before=%.4f after=%.4f\\n\", before, after)\n}</code></pre>\n<h3>Output</h3>\n<p class=\"example-meta\">exit 0 · last run via <code>go run .</code></p><pre class=\"example-output\"><code>cosine before=-0.0697 after=1.0000</code></pre>\n\n</section>\n\n\n\n","text":"github.com/openfluke/welvet/layers/parallel✅ CamSync\n\nWhy it exists\nMix BranchModes and different inits let cams diverge on purpose. Sometimes you want them to share — gently (1% pull) or hard (full average) — within a Parallel, across Stack children, or even between same-shaped stores sitting on wildly different mesh layouts (1×2×1 ↔ 2×4×5). That is CamSync: couple weights without collapsing the graph into one Dense.\nWhat it is\nCamSyncConfig{Alpha, When, Groups, Cross}. BlendStores pulls every store in a clique toward the mean. Empty Groups = all cams; Cross wires SyncEndpoint pairs across layers/cams. Shape rule: Rows×Cols must match. Bidirectional today; one-way teacher→student not yet.\nParallel mid (n cams)                 Stack / mesh (any DxHxW)\n  ┌─ cam0 W ─┐                          cell A 1×2×1     cell B 2×4×5\n  │  cam1 W  │  Groups / all-cams       layer-1 Dense    cam3 layer-1 Dense\n  │  cam2 W  │  α·mean blend     OR     [128×64]  ←──Cross──→  [128×64]\n  └─ cam3 W ─┘                          (mesh size irrelevant — shape is)\n         │\n    SyncAfterSample | Step | Pulse | Manual SyncNowSame-shaped stores sync. Mesh topology is host wiring via Groups + Cross.\nThe insane bit\nCamSync does not care that one Parallel lives on a 1×2×1 cell and another store sits on\ncam 3 of a 2×4×5. Name both endpoints; if Rows×Cols match, they blend.\nVolumetric layout is configuration — not a built-in grid type inside CamSync.\n\nKnobs\n\nFieldMeaning\n\nEnabled / Alpha\nSoft pull w ← (1−α)·w + α·mean. 0.01 = 1%, 1.0 = hard sync.\nDefault α is 1 when Enabled and Alpha ≤ 0.\nWhen\nSyncManual · SyncAfterSample · SyncAfterStep · SyncAfterPulse.\nHooks fire from TrainStackMSE/CE and Pulse().\nGroups\nWithin one Parallel: cam-index cliques. Empty ⇒ one group of every branch.\nExample: {{0,1},{2,3}} syncs pairs only.\nCross\n[]SyncPair of SyncEndpoint{StackIdx, Branch, Store} —\nsame layer across cams, Dense stem ↔ matching cam Dense, or any same-shaped pair the Stack can resolve.\n\n\n\nWhat works / what does not (yet)\n\n✅ All cams together, selective groups, soft or hard α\n✅ Cross-layer / cross-cam pairs inside one Stack\n✅ “Same layer on a different mesh” when weight shapes match\n✅ v1.1.1 — cam adjusting on all layer types (Dense, CNN, Parallel, Stack-resolved stores)\n❌ One-directional (teacher → student) — pairs are mutual mean-blend\n❌ Mismatched Rows×Cols — rejected or skipped\n❌ Auto sync across two separate Stack instances — host calls weights.BlendStores on the two stores\n\n\nAPI\n\nparallel.CamSyncConfig · DefaultCamSync() · SetCamSync on Layer or Stack\nSyncNow / Pulse / MaybeSync\nweights.BlendStores · weights.StoreCosine (diagnostics)\n\nCameral sandwiches: §68. Parallel package: §27.\nHost probe: ok/cam_sync (MNIST sample α×cams matrix).\n\n\n\nGo example\nexamples/70-cam-sync/main.go\nRun:cd welvet/examples/70-cam-sync && source ../env.sh && go run .\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/stub/seed\"\n\t\"github.com/openfluke/welvet/weights\"\n)\n\nfunc main() {\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\themi := s.Children[1].(*parallel.Layer)\n\tleft := hemi.Branches[0].(*dense.Layer).Weights\n\tright := hemi.Branches[1].(*dense.Layer).Weights\n\t_ = seed.InitStoreHe(left, 16, seed.From(\"cam0\"))\n\t_ = seed.InitStoreHe(right, 16, seed.From(\"cam1\"))\n\n\themi.SetCamSync(parallel.CamSyncConfig{\n\t\tEnabled: true,\n\t\tAlpha:   1.0,\n\t\tWhen:    parallel.SyncManual,\n\t})\n\tbefore, _ := weights.StoreCosine(left, right)\n\tif err := hemi.SyncNow(); err != nil {\n\t\tpanic(err)\n\t}\n\tafter, _ := weights.StoreCosine(left, right)\n\tfmt.Printf(\"cosine before=%.4f after=%.4f\\n\", before, after)\n}\nOutput\nexit 0 · last run via go run .cosine before=-0.0697 after=1.0000\n\n\n\n\n\n","source":"https://github.com/openfluke/openfluke.github.io/blob/main/welvet/chapters/70-cam-sync.html","url":"https://openfluke.com/book/70-cam-sync"}],"examples":[{"slug":"welvet/01-welvet","title":"1. What Welvet is","group":"Welvet examples","description":"Part: I · OrientationPackage: github.com/openfluke/welvetStatus: ok — ✅ engine When You need github.com/openfluke/welvet. Where import \"github.com/openfluke/welvet/github.com/openfluke/welve","html":"<p><strong>Part:</strong> I · Orientation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet</code><br /><strong>Status:</strong> ok — ✅ engine</p>\n<h2>When</h2>\n<p>You need <code>github.com/openfluke/welvet</code>.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/github.com/openfluke/welvet\"</code></p>\n<pre><code class=\"language-bash\">cd 01-welvet &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Loom’s flat poly/ package hit import-cycle and honesty walls (QAT morph, silent fallbacks, god-layer). Welvet is the rewrite: one feature per folder, storage-truth dtypes/quants, Dense as the shared MatVec microkernel, tests only in w2a, apps only in apps/.</p>\n<h2>What</h2>\n<p>An AI engine in Go: layers, 34 dtypes, 20 quant formats, and three backends (CPU tiled · Plan 9 SIMD · WebGPU). Version tracks a 100-point scorecard (today v1.1.0 · 100/100).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>pre 4 post 4\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/01-welvet</code>).</p>\n","text":"Part: I · OrientationPackage: github.com/openfluke/welvetStatus: ok — ✅ engine\nWhen\nYou need github.com/openfluke/welvet.\nWhere\nimport \"github.com/openfluke/welvet/github.com/openfluke/welvet\"\ncd 01-welvet && source ../env.sh && go run .\n\nWhy\nLoom’s flat poly/ package hit import-cycle and honesty walls (QAT morph, silent fallbacks, god-layer). Welvet is the rewrite: one feature per folder, storage-truth dtypes/quants, Dense as the shared MatVec microkernel, tests only in w2a, apps only in apps/.\nWhat\nAn AI engine in Go: layers, 34 dtypes, 20 quant formats, and three backends (CPU tiled · Plan 9 SIMD · WebGPU). Version tracks a 100-point scorecard (today v1.1.0 · 100/100).\nSample output (captured)\npre 4 post 4\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/01-welvet).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n)\n\nfunc main() {\n\tl, err := dense.New(8, 4, core.ActivationReLU, core.DTypeFloat32)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.Exec.Backend = core.BackendCPUTiled\n\n\tx := core.NewTensor[float32](1, 8)\n\tfor i := range x.Data {\n\t\tx.Data[i] = float32(i) * 0.1\n\t}\n\tpre, post, err := dense.Forward(l, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"pre\", len(pre.Data), \"post\", len(post.Data))\n}\n","url":"/source/examples/welvet/01-welvet/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/01-welvet","url":"https://openfluke.com/examples/welvet/01-welvet"},{"slug":"welvet/02-tree","title":"2. Repository map","group":"Welvet examples","description":"Part: I · OrientationPackage: —Status: ok — ✅ layout When Orientation chapter: Repository map. Where Book / repo map (no single import) cd 02-tree && source ../env.sh && go run . Why Readers","html":"<p><strong>Part:</strong> I · Orientation<br /><strong>Package:</strong> <code>—</code><br /><strong>Status:</strong> ok — ✅ layout</p>\n<h2>When</h2>\n<p>Orientation chapter: Repository map.</p>\n<h2>Where</h2>\n<p>Book / repo map (no single import)</p>\n<pre><code class=\"language-bash\">cd 02-tree &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Readers need a single map of what is engine vs harness vs app vs stub.</p>\n<h2>What</h2>\n<p>Top-level folders and their ownership. Engine packages never import w2a.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>import github.com/openfluke/welvet/core/…\nimport github.com/openfluke/welvet/weights/…\nimport github.com/openfluke/welvet/quant/…\nimport github.com/openfluke/welvet/simd/…\nimport github.com/openfluke/welvet/webgpu/…\nimport github.com/openfluke/welvet/tiling/…\nimport github.com/openfluke/welvet/architecture/…\nimport github.com/openfluke/welvet/fusedgpu/…\nimport github.com/openfluke/welvet/layers/…\nimport github.com/openfluke/welvet/runtime/…\nimport github.com/openfluke/welvet/systems/…\nimport github.com/openfluke/welvet/lucy/…\nimport github.com/openfluke/welvet/model/…\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/02-tree</code>).</p>\n","text":"Part: I · OrientationPackage: —Status: ok — ✅ layout\nWhen\nOrientation chapter: Repository map.\nWhere\nBook / repo map (no single import)\ncd 02-tree && source ../env.sh && go run .\n\nWhy\nReaders need a single map of what is engine vs harness vs app vs stub.\nWhat\nTop-level folders and their ownership. Engine packages never import w2a.\nSample output (captured)\nimport github.com/openfluke/welvet/core/…\nimport github.com/openfluke/welvet/weights/…\nimport github.com/openfluke/welvet/quant/…\nimport github.com/openfluke/welvet/simd/…\nimport github.com/openfluke/welvet/webgpu/…\nimport github.com/openfluke/welvet/tiling/…\nimport github.com/openfluke/welvet/architecture/…\nimport github.com/openfluke/welvet/fusedgpu/…\nimport github.com/openfluke/welvet/layers/…\nimport github.com/openfluke/welvet/runtime/…\nimport github.com/openfluke/welvet/systems/…\nimport github.com/openfluke/welvet/lucy/…\nimport github.com/openfluke/welvet/model/…\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/02-tree).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\t// Mental model only — list engine roots you depend on:\n\troots := []string{\n\t\t\"core\", \"weights\", \"quant\", \"simd\", \"webgpu\", \"tiling\",\n\t\t\"architecture\", \"fusedgpu\", \"layers\", \"runtime\", \"systems\", \"lucy\", \"model\",\n\t}\n\tfor _, r := range roots {\n\t\tfmt.Println(\"import github.com/openfluke/welvet/\" + r + \"/…\")\n\t}\n\t_ = os.Getenv // apps/stub/w2a are separate concerns\n}\n","url":"/source/examples/welvet/02-tree/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/02-tree","url":"https://openfluke.com/examples/welvet/02-tree"},{"slug":"welvet/03-core","title":"3. core — types & backends","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/coreStatus: ok — ✅ When You need the core foundation package. Where import \"github.com/openfluke/welvet/core\" cd 03-core && source .","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/core</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>core</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/core\"</code></p>\n<pre><code class=\"language-bash\">cd 03-core &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Every polymorphic path needs one place for DType, LayerType, Activation, Backend, Tensor[T], and slim Layer metadata — without QAT morph defaults.</p>\n<h2>What</h2>\n<p>34 storage dtypes, Numeric generics, Tensor[T], ExecConfig (BackendCPUTiled | BackendSIMD | BackendWebGPU), Activate/ActivateDeriv, and converters for f16/bf16/fp8/fp4.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>simd bfloat16 8\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/03-core</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/coreStatus: ok — ✅\nWhen\nYou need the core foundation package.\nWhere\nimport \"github.com/openfluke/welvet/core\"\ncd 03-core && source ../env.sh && go run .\n\nWhy\nEvery polymorphic path needs one place for DType, LayerType, Activation, Backend, Tensor[T], and slim Layer metadata — without QAT morph defaults.\nWhat\n34 storage dtypes, Numeric generics, Tensor[T], ExecConfig (BackendCPUTiled | BackendSIMD | BackendWebGPU), Activate/ActivateDeriv, and converters for f16/bf16/fp8/fp4.\nSample output (captured)\nsimd bfloat16 8\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/03-core).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n)\n\nfunc main() {\n\tt := core.NewTensor[float32](2, 4)\n\tt.Data[0] = -1\n\tt.Data[0] = core.Activate(t.Data[0], core.ActivationReLU) // 0\n\n\tcfg := core.ExecConfig{\n\t\tBackend:   core.BackendSIMD,\n\t\tMultiCore: true,\n\t\tTileSize:  32,\n\t}\n\tfmt.Println(cfg.Backend.String(), core.ParseDType(\"bfloat16\"), t.Len())\n}\n","url":"/source/examples/welvet/03-core/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/03-core","url":"https://openfluke.com/examples/welvet/03-core"},{"slug":"welvet/04-weights","title":"4. weights — FormatNone MatVec","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/weightsStatus: ok — ✅ When You need the weights foundation package. Where import \"github.com/openfluke/welvet/weights\" cd 04-weights","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/weights</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>weights</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/weights\"</code></p>\n<pre><code class=\"language-bash\">cd 04-weights &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Unquantized matrices still need a typed store that streams MatVec and SGD without forcing a float32 master or Morph-as-training.</p>\n<h2>What</h2>\n<p>Store holds DType + Format + Native/Packed bytes. New[T], MatVec, MatVecT, DecodeRow, SelectWire (F32/F64/I8), ApplySGD. FormatNone: update in native lanes (float32 payload is the only f32 buffer; float64 uses native ALU; other dtypes decode→update→re-encode). Packed: unpack→update→re-Pack then drop scratch. RetainsF32Master() is true only for FormatNone+float32. Dense and composite projs share this store.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>[3 4]\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/04-weights</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/weightsStatus: ok — ✅\nWhen\nYou need the weights foundation package.\nWhere\nimport \"github.com/openfluke/welvet/weights\"\ncd 04-weights && source ../env.sh && go run .\n\nWhy\nUnquantized matrices still need a typed store that streams MatVec and SGD without forcing a float32 master or Morph-as-training.\nWhat\nStore holds DType + Format + Native/Packed bytes. New[T], MatVec, MatVecT, DecodeRow, SelectWire (F32/F64/I8), ApplySGD. FormatNone: update in native lanes (float32 payload is the only f32 buffer; float64 uses native ALU; other dtypes decode→update→re-encode). Packed: unpack→update→re-Pack then drop scratch. RetainsF32Master() is true only for FormatNone+float32. Dense and composite projs share this store.\nSample output (captured)\n[3 4]\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/04-weights).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/weights\"\n)\n\nfunc main() {\n\ts, err := weights.New[float32](2, 2, []float32{1, 0, 0, 1}, core.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ty := make([]float32, 2)\n\tif err := weights.MatVec(s, []float32{3, 4}, y); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(y) // ≈ [3, 4]\n}\n","url":"/source/examples/welvet/04-weights/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/04-weights","url":"https://openfluke.com/examples/welvet/04-weights"},{"slug":"welvet/05-quant","title":"5. quant — 20 pack formats","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/quantStatus: ok — ✅ When You need the quant foundation package. Where import \"github.com/openfluke/welvet/quant\" cd 05-quant && sour","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/quant</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>quant</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/quant\"</code></p>\n<pre><code class=\"language-bash\">cd 05-quant &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Inference, storage, and train need classic Q-packs, k-quants, IQ, Ternary/Binary, and Affine without a separate QAT mode or retained f32 master. Format is storage truth.</p>\n<h2>What</h2>\n<p>Pack / Unpack / MatVec / MatVecT for FormatNone…AffinePacked. Dense SIMD once-projects codes into Int8QS + scales (EnsureQ* / EnsureK/IQ/AffineSIMDCache) — no full-matrix F32 inflate for k/IQ/Affine. SGD on packed stores: short-lived unpack scratch → update → re-Pack; Packed stays truth.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>rows 2 cols 4 y [0.6857143 -1.4901161e-08]\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/05-quant</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/quantStatus: ok — ✅\nWhen\nYou need the quant foundation package.\nWhere\nimport \"github.com/openfluke/welvet/quant\"\ncd 05-quant && source ../env.sh && go run .\n\nWhy\nInference, storage, and train need classic Q-packs, k-quants, IQ, Ternary/Binary, and Affine without a separate QAT mode or retained f32 master. Format is storage truth.\nWhat\nPack / Unpack / MatVec / MatVecT for FormatNone…AffinePacked. Dense SIMD once-projects codes into Int8QS + scales (EnsureQ* / EnsureK/IQ/AffineSIMDCache) — no full-matrix F32 inflate for k/IQ/Affine. SGD on packed stores: short-lived unpack scratch → update → re-Pack; Packed stays truth.\nSample output (captured)\nrows 2 cols 4 y [0.6857143 -1.4901161e-08]\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/05-quant).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tw := []float32{0.1, -0.2, 0.3, 0.4, -0.5, 0.6, 0.05, -0.15}\n\tb, err := quant.Pack(quant.FormatQ4_0, w, 2, 4)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ty := make([]float32, 2)\n\tif err := quant.MatVec(b, []float32{1, 1, 1, 1}, y); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"rows\", b.Rows, \"cols\", b.Cols, \"y\", y)\n}\n","url":"/source/examples/welvet/05-quant/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/05-quant","url":"https://openfluke.com/examples/welvet/05-quant"},{"slug":"welvet/06-simd","title":"6. simd — Plan 9 kernels","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/simdStatus: ok — ✅ When You need the simd foundation package. Where import \"github.com/openfluke/welvet/simd\" cd 06-simd && source .","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/simd</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>simd</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/simd\"</code></p>\n<pre><code class=\"language-bash\">cd 06-simd &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>CPU peak needs hand-written AVX2/NEON without a silent Go fallback that pretends SIMD ran.</p>\n<h2>What</h2>\n<p>amd64/arm64 .s kernels: DotTile, DotI8/U8, DotQ4_0, Saxpy, BitNet helpers, packed f16/bf16/fp8/fp4 dots; amd64 AVX2 DotTileF64 (WireF64); Go fused DotKRow / DotIQRow / DotAffineRow for k/IQ/Affine. SimdEnabled() false → BackendSIMD hard-errors.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>10\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/06-simd</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/simdStatus: ok — ✅\nWhen\nYou need the simd foundation package.\nWhere\nimport \"github.com/openfluke/welvet/simd\"\ncd 06-simd && source ../env.sh && go run .\n\nWhy\nCPU peak needs hand-written AVX2/NEON without a silent Go fallback that pretends SIMD ran.\nWhat\namd64/arm64 .s kernels: DotTile, DotI8/U8, DotQ4_0, Saxpy, BitNet helpers, packed f16/bf16/fp8/fp4 dots; amd64 AVX2 DotTileF64 (WireF64); Go fused DotKRow / DotIQRow / DotAffineRow for k/IQ/Affine. SimdEnabled() false → BackendSIMD hard-errors.\nSample output (captured)\n10\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/06-simd).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/simd\"\n)\n\nfunc main() {\n\tif !simd.SimdEnabled() {\n\t\tfmt.Println(\"SIMD not available on this arch — BackendSIMD must hard-error\")\n\t\treturn\n\t}\n\tacc := simd.DotTile([]float32{1, 2, 3, 4}, []float32{1, 1, 1, 1}, 0, 4, 0)\n\tfmt.Println(acc)\n}\n","url":"/source/examples/welvet/06-simd/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/06-simd","url":"https://openfluke.com/examples/welvet/06-simd"},{"slug":"welvet/07-webgpu","title":"7. webgpu — device GEMV & shaders","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/webgpuStatus: ok — ✅ When You need the webgpu foundation package. Where import \"github.com/openfluke/welvet/webgpu\" cd 07-webgpu && ","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/webgpu</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>webgpu</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/webgpu\"</code></p>\n<pre><code class=\"language-bash\">cd 07-webgpu &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>GPU paths must bind a real adapter. Host “fake GPU” was banned so suites cannot stamp WebGPU done when ALU ran on CPU.</p>\n<h2>What</h2>\n<p>DenseGEMV family (incl. quant/I8/resident), DenseGEMVT/DenseDW, RMSNorm, LayerNorm fwd, Softmax family, SwiGLUFuse. Available()/InitError() gate use.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>webgpu probe goos=linux goarch=amd64 WELVET_WGPU_BACKEND=\"\"\n  adapter high-perf: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  → selected high-perf\n  adapter low-power: name=\"Intel(R) UHD Graphics 630 (CML GT2)\" vendor=\"Intel open-source Mesa driver\" arch=\"\" driver=\"Mesa 26.1.8\" backend=vulkan type=integrated-gpu | maxBuf=2147483647 maxSSBO=2147483644 maxSSBO/stage=103 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter force-fallback: name=\"llvmpipe (LLVM 22.1.8, 256 bits)\" vendor=\"llvmpipe\" arch=\"\" driver=\"Mesa 26.1.8 (LLVM 22.1.8)\" backend=vulkan type=cpu | maxBuf=2147483647 maxSSBO=134217728 maxSSBO/stage=48 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter default: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  try RequestDevice inflated: maxBuf=2147483648 maxSSBO=1073741824 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\nRESULT: OK via=inflated adapter=\"NVIDIA GeForce GTX 1650 SUPER\" backend=vulkan maxSSBO=2147483644 maxBuf=1099511627776\n[1.5 2.5] &lt;nil&gt; NVIDIA GeForce GTX 1650 SUPER\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/07-webgpu</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/webgpuStatus: ok — ✅\nWhen\nYou need the webgpu foundation package.\nWhere\nimport \"github.com/openfluke/welvet/webgpu\"\ncd 07-webgpu && source ../env.sh && go run .\n\nWhy\nGPU paths must bind a real adapter. Host “fake GPU” was banned so suites cannot stamp WebGPU done when ALU ran on CPU.\nWhat\nDenseGEMV family (incl. quant/I8/resident), DenseGEMVT/DenseDW, RMSNorm, LayerNorm fwd, Softmax family, SwiGLUFuse. Available()/InitError() gate use.\nSample output (captured)\nwebgpu probe goos=linux goarch=amd64 WELVET_WGPU_BACKEND=\"\"\n  adapter high-perf: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  → selected high-perf\n  adapter low-power: name=\"Intel(R) UHD Graphics 630 (CML GT2)\" vendor=\"Intel open-source Mesa driver\" arch=\"\" driver=\"Mesa 26.1.8\" backend=vulkan type=integrated-gpu | maxBuf=2147483647 maxSSBO=2147483644 maxSSBO/stage=103 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter force-fallback: name=\"llvmpipe (LLVM 22.1.8, 256 bits)\" vendor=\"llvmpipe\" arch=\"\" driver=\"Mesa 26.1.8 (LLVM 22.1.8)\" backend=vulkan type=cpu | maxBuf=2147483647 maxSSBO=134217728 maxSSBO/stage=48 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  adapter default: name=\"NVIDIA GeForce GTX 1650 SUPER\" vendor=\"NVIDIA\" arch=\"\" driver=\"610.57.04\" backend=vulkan type=discrete-gpu | maxBuf=1099511627776 maxSSBO=2147483644 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\n  try RequestDevice inflated: maxBuf=2147483648 maxSSBO=1073741824 maxSSBO/stage=524288 maxBindGroups=8 maxComputeWG=65535 maxInvoc/WG=1024\nRESULT: OK via=inflated adapter=\"NVIDIA GeForce GTX 1650 SUPER\" backend=vulkan maxSSBO=2147483644 maxBuf=1099511627776\n[1.5 2.5] <nil> NVIDIA GeForce GTX 1650 SUPER\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/07-webgpu).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/webgpu\"\n)\n\nfunc main() {\n\tif !webgpu.Available() {\n\t\tfmt.Println(\"no adapter:\", webgpu.InitError())\n\t\treturn\n\t}\n\ty := make([]float32, 2)\n\terr := webgpu.DenseGEMV(\n\t\t[]float32{1, 0, 0, 1},\n\t\t[]float32{1.5, 2.5},\n\t\ty, 1, 2, 2,\n\t)\n\tfmt.Println(y, err, webgpu.AdapterName())\n}\n","url":"/source/examples/welvet/07-webgpu/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/07-webgpu","url":"https://openfluke.com/examples/welvet/07-webgpu"},{"slug":"welvet/08-tiling","title":"8. tiling — SC/MC & workgroups","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/tilingStatus: ok — ✅ When You need the tiling foundation package. Where import \"github.com/openfluke/welvet/tiling\" cd 08-tiling && ","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/tiling</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>tiling</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/tiling\"</code></p>\n<pre><code class=\"language-bash\">cd 08-tiling &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>MatVec throughput depends on tile size and when to go multi-core vs GPU workgroups. Centralizing caps keeps Dense and friends consistent.</p>\n<h2>What</h2>\n<p>DefaultCPUTile, DefaultGPUWG, CPUTile, PreferMultiCore, GPUWorkgroupsX.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>32 true 16\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/08-tiling</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/tilingStatus: ok — ✅\nWhen\nYou need the tiling foundation package.\nWhere\nimport \"github.com/openfluke/welvet/tiling\"\ncd 08-tiling && source ../env.sh && go run .\n\nWhy\nMatVec throughput depends on tile size and when to go multi-core vs GPU workgroups. Centralizing caps keeps Dense and friends consistent.\nWhat\nDefaultCPUTile, DefaultGPUWG, CPUTile, PreferMultiCore, GPUWorkgroupsX.\nSample output (captured)\n32 true 16\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/08-tiling).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/tiling\"\n)\n\nfunc main() {\n\ttile := tiling.CPUTile(0) // default 32\n\tmc := tiling.PreferMultiCore(8, 256, tile)\n\twg := tiling.GPUWorkgroupsX(1024, 0)\n\tfmt.Println(tile, mc, wg)\n}\n","url":"/source/examples/welvet/08-tiling/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/08-tiling","url":"https://openfluke.com/examples/welvet/08-tiling"},{"slug":"welvet/09-architecture","title":"9. architecture — volumetric grid","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/architectureStatus: ok — ✅ When You need the architecture foundation package. Where import \"github.com/openfluke/welvet/architecture","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/architecture</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>architecture</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/architecture\"</code></p>\n<pre><code class=\"language-bash\">cd 09-architecture &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Networks are spatial (Depth×Rows×Cols×LayersPerCell), not only linear stacks. Topology lives here; compute lives in layer packages.</p>\n<h2>What</h2>\n<p>Grid/Cell/Coord, NewGrid, BindOp, HopOrder, SetRemoteLink/ResolveHop. VolumetricNetwork is an alias for Grid.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>cells 2\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/09-architecture</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/architectureStatus: ok — ✅\nWhen\nYou need the architecture foundation package.\nWhere\nimport \"github.com/openfluke/welvet/architecture\"\ncd 09-architecture && source ../env.sh && go run .\n\nWhy\nNetworks are spatial (Depth×Rows×Cols×LayersPerCell), not only linear stacks. Topology lives here; compute lives in layer packages.\nWhat\nGrid/Cell/Coord, NewGrid, BindOp, HopOrder, SetRemoteLink/ResolveHop. VolumetricNetwork is an alias for Grid.\nSample output (captured)\ncells 2\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/09-architecture).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 2, 1) // depth, rows, cols, layersPerCell\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\tif err := dense.Place(g, 0, 0, 0, 0, l); err != nil {\n\t\tpanic(err)\n\t}\n\t_ = g.SetRemoteLink(0, 0, 1, 0, 0, 0, 0, 0) // spatial feedback hop\n\tfmt.Println(\"cells\", len(g.HopOrder()))\n}\n","url":"/source/examples/welvet/09-architecture/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/09-architecture","url":"https://openfluke.com/examples/welvet/09-architecture"},{"slug":"welvet/10-fusedgpu","title":"10. fusedgpu — decoder on device","group":"Welvet examples","description":"Part: II · FoundationPackage: github.com/openfluke/welvet/fusedgpuStatus: ok — ✅ When You need the fusedgpu foundation package. Where import \"github.com/openfluke/welvet/fusedgpu\" cd 10-fuse","html":"<p><strong>Part:</strong> II · Foundation<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/fusedgpu</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>You need the <code>fusedgpu</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/fusedgpu\"</code></p>\n<pre><code class=\"language-bash\">cd 10-fusedgpu &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Token-by-token host round-trips kill decode. A fused engine keeps weights and scratch resident for Q4_0 and BinaryG128 hybrid paths.</p>\n<h2>What</h2>\n<p>Engine from Spec (AppendTokens/Reset/Close); HybridEngine (PrefillSample/DecodeSample/DecodeChunk). Specs come from model/transformer export.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>need an ENTITY file: open model.entity: no such file or directory\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/10-fusedgpu</code>).</p>\n","text":"Part: II · FoundationPackage: github.com/openfluke/welvet/fusedgpuStatus: ok — ✅\nWhen\nYou need the fusedgpu foundation package.\nWhere\nimport \"github.com/openfluke/welvet/fusedgpu\"\ncd 10-fusedgpu && source ../env.sh && go run .\n\nWhy\nToken-by-token host round-trips kill decode. A fused engine keeps weights and scratch resident for Q4_0 and BinaryG128 hybrid paths.\nWhat\nEngine from Spec (AppendTokens/Reset/Close); HybridEngine (PrefillSample/DecodeSample/DecodeChunk). Specs come from model/transformer export.\nSample output (captured)\nneed an ENTITY file: open model.entity: no such file or directory\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/10-fusedgpu).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/fusedgpu\"\n\t\"github.com/openfluke/welvet/model/transformer\"\n)\n\nfunc main() {\n\tm, err := transformer.LoadEntity(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(\"need an ENTITY file:\", err)\n\t\treturn\n\t}\n\tspec, err := m.ExportFusedGPUSpec()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\teng, err := fusedgpu.NewFromSpec(spec)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer eng.Close()\n\tlogits, err := eng.AppendTokens([]uint32{1, 2, 3})\n\tfmt.Println(len(logits), err)\n}\n","url":"/source/examples/welvet/10-fusedgpu/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/10-fusedgpu","url":"https://openfluke.com/examples/welvet/10-fusedgpu"},{"slug":"welvet/11-dense","title":"11. layers/dense — MatVec microkernel","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/denseStatus: ok — ✅ When Building or training a net that needs the layers/dense Op (also usable as a Parallel cam). Where import","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/dense</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/dense</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/dense\"</code></p>\n<pre><code class=\"language-bash\">cd 11-dense &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Most FLOPs are W@x. One Dense stack owns FormatNone×34 and all quants × three backends so every composite proj shares one correctness surface — including native in-dtype SGD.</p>\n<h2>What</h2>\n<p>New / NewConfigured[T], Forward/Backward (dispatch on Exec.Backend), Place, ApplyGradSGD (→ weights.ApplySGD on the store). SIMD forward (v1.0.3): dtype switch by MatVec strategy — DotTile / DotI8 / lowp packed / expand-once→DotTile / WireF64+DotTileF64; fused Dot* for classic Q*, k/IQ, AffinePacked. Composites (MHA, SwiGLU, CNN im2col, RNN/LSTM/Mamba, residual·sequential·parallel) reuse Dense children via syncProjExec. BackwardSIMD still DecodeRow/saxpy (not the new expand wires).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>8 32\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/11-dense</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/denseStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/dense Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/dense\"\ncd 11-dense && source ../env.sh && go run .\n\nWhy\nMost FLOPs are W@x. One Dense stack owns FormatNone×34 and all quants × three backends so every composite proj shares one correctness surface — including native in-dtype SGD.\nWhat\nNew / NewConfigured[T], Forward/Backward (dispatch on Exec.Backend), Place, ApplyGradSGD (→ weights.ApplySGD on the store). SIMD forward (v1.0.3): dtype switch by MatVec strategy — DotTile / DotI8 / lowp packed / expand-once→DotTile / WireF64+DotTileF64; fused Dot* for classic Q*, k/IQ, AffinePacked. Composites (MHA, SwiGLU, CNN im2col, RNN/LSTM/Mamba, residual·sequential·parallel) reuse Dense children via syncProjExec. BackwardSIMD still DecodeRow/saxpy (not the new expand wires).\nSample output (captured)\n8 32\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/11-dense).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tinit := make([]float32, 4*8)\n\tl, err := dense.NewConfigured(8, 4, core.ActivationReLU, core.DTypeFloat32, quant.FormatNone, init)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.Exec.Backend = core.BackendCPUTiled\n\tx := core.NewTensor[float32](1, 8)\n\tpre, post, err := dense.Forward(l, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tgIn, gW, err := dense.Backward(l, post, x, pre)\n\t_ = dense.ApplyGradSGD(l, gW, 1e-3)\n\tfmt.Println(len(gIn.Data), len(gW.Data))\n}\n","url":"/source/examples/welvet/11-dense/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/11-dense","url":"https://openfluke.com/examples/welvet/11-dense"},{"slug":"welvet/12-mha","title":"12. layers/mha — attention","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/mhaStatus: ok — ✅ When Building or training a net that needs the layers/mha Op (also usable as a Parallel cam). Where import \"gi","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/mha</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/mha</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/mha\"</code></p>\n<pre><code class=\"language-bash\">cd 12-mha &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Transformers need multi-head attention with masks, RoPE/ALiBi, GQA/MQA, and cross-attn — without forking MatVec for every projection.</p>\n<h2>What</h2>\n<p>Q/K/V/O are Dense children. Presets: DecoderCausal, EncoderBidirectional, CrossAttention, … Attn/RoPE ALU is host today; on-device attn shaders are still open.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>true 256 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/12-mha</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/mhaStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/mha Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/mha\"\ncd 12-mha && source ../env.sh && go run .\n\nWhy\nTransformers need multi-head attention with masks, RoPE/ALiBi, GQA/MQA, and cross-attn — without forking MatVec for every projection.\nWhat\nQ/K/V/O are Dense children. Presets: DecoderCausal, EncoderBidirectional, CrossAttention, … Attn/RoPE ALU is host today; on-device attn shaders are still open.\nSample output (captured)\ntrue 256 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/12-mha).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/mha\"\n)\n\nfunc main() {\n\tl, err := mha.New(mha.DecoderCausal(32, 4, 4))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8, 32) // [batch, seq, dim]\n\tpre, post, err := mha.Forward(l, x)\n\tfmt.Println(pre != nil, len(post.Data), err)\n}\n","url":"/source/examples/welvet/12-mha/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/12-mha","url":"https://openfluke.com/examples/welvet/12-mha"},{"slug":"welvet/13-swiglu","title":"13. layers/swiglu — gated FFN","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/swigluStatus: ok — ✅ When Building or training a net that needs the layers/swiglu Op (also usable as a Parallel cam). Where impo","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/swiglu</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/swiglu</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/swiglu\"</code></p>\n<pre><code class=\"language-bash\">cd 13-swiglu &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Modern decoder FFNs are SiLU(gate)⊙up → down. Projections must share Dense’s quant/backend matrix.</p>\n<h2>What</h2>\n<p>Gate/Up/Down Dense children; DefaultFFN(dModel); WebGPU SiLU⊙ fuse on forward.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>64 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/13-swiglu</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/swigluStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/swiglu Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/swiglu\"\ncd 13-swiglu && source ../env.sh && go run .\n\nWhy\nModern decoder FFNs are SiLU(gate)⊙up → down. Projections must share Dense’s quant/backend matrix.\nWhat\nGate/Up/Down Dense children; DefaultFFN(dModel); WebGPU SiLU⊙ fuse on forward.\nSample output (captured)\n64 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/13-swiglu).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/swiglu\"\n)\n\nfunc main() {\n\tl, err := swiglu.New(swiglu.DefaultFFN(64))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 64)\n\t_, post, err := swiglu.Forward(l, x)\n\tfmt.Println(len(post.Data), err)\n}\n","url":"/source/examples/welvet/13-swiglu/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/13-swiglu","url":"https://openfluke.com/examples/welvet/13-swiglu"},{"slug":"welvet/14-rmsnorm","title":"14. layers/rmsnorm","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/rmsnormStatus: ok — ✅ When Building or training a net that needs the layers/rmsnorm Op (also usable as a Parallel cam). Where im","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/rmsnorm</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/rmsnorm</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/rmsnorm\"</code></p>\n<pre><code class=\"language-bash\">cd 14-rmsnorm &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Llama-style blocks normalize by RMS, not mean+var. Needs native fwd/bwd and WebGPU shaders.</p>\n<h2>What</h2>\n<p>Per-token RMS + γ on weights.Store; WebGPU fwd+bwd; SIMD DotTile stats + host scale.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>[0 0 0 0] &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/14-rmsnorm</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/rmsnormStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/rmsnorm Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/rmsnorm\"\ncd 14-rmsnorm && source ../env.sh && go run .\n\nWhy\nLlama-style blocks normalize by RMS, not mean+var. Needs native fwd/bwd and WebGPU shaders.\nWhat\nPer-token RMS + γ on weights.Store; WebGPU fwd+bwd; SIMD DotTile stats + host scale.\nSample output (captured)\n[0 0 0 0] <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/14-rmsnorm).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/rmsnorm\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tgamma := []float32{1, 1, 1, 1}\n\tl, err := rmsnorm.NewConfigured(rmsnorm.Config{Dim: 4}, core.DTypeFloat32, quant.FormatNone, gamma)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4)\n\t_, y, err := rmsnorm.Forward(l, x)\n\tfmt.Println(y.Data, err)\n}\n","url":"/source/examples/welvet/14-rmsnorm/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/14-rmsnorm","url":"https://openfluke.com/examples/welvet/14-rmsnorm"},{"slug":"welvet/15-layernorm","title":"15. layers/layernorm","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/layernormStatus: ok — ✅ When Building or training a net that needs the layers/layernorm Op (also usable as a Parallel cam). Wher","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/layernorm</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/layernorm</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/layernorm\"</code></p>\n<pre><code class=\"language-bash\">cd 15-layernorm &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Classic mean+var normalization with γ/β — still required for many HF architectures.</p>\n<h2>What</h2>\n<p>WebGPU forward; backward host today. Same dtype×quant axes as other weighted layers.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>8 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/15-layernorm</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/layernormStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/layernorm Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/layernorm\"\ncd 15-layernorm && source ../env.sh && go run .\n\nWhy\nClassic mean+var normalization with γ/β — still required for many HF architectures.\nWhat\nWebGPU forward; backward host today. Same dtype×quant axes as other weighted layers.\nSample output (captured)\n8 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/15-layernorm).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/layernorm\"\n)\n\nfunc main() {\n\tl, err := layernorm.New(layernorm.Config{Dim: 8})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8)\n\t_, y, err := layernorm.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\n","url":"/source/examples/welvet/15-layernorm/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/15-layernorm","url":"https://openfluke.com/examples/welvet/15-layernorm"},{"slug":"welvet/16-embedding","title":"16. layers/embedding","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/embeddingStatus: ok — ✅ When Building or training a net that needs the layers/embedding Op (also usable as a Parallel cam). Wher","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/embedding</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/embedding</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/embedding\"</code></p>\n<pre><code class=\"language-bash\">cd 16-embedding &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Token IDs must gather rows from a table — not a Dense MatVec — with scatter grads on backward.</p>\n<h2>What</h2>\n<p>Config{VocabSize, EmbeddingDim, SeqLen}; table on weights.Store; host gather on SIMD/WebGPU today.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>[1 4 16] &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/16-embedding</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/embeddingStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/embedding Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/embedding\"\ncd 16-embedding && source ../env.sh && go run .\n\nWhy\nToken IDs must gather rows from a table — not a Dense MatVec — with scatter grads on backward.\nWhat\nConfig{VocabSize, EmbeddingDim, SeqLen}; table on weights.Store; host gather on SIMD/WebGPU today.\nSample output (captured)\n[1 4 16] <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/16-embedding).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/embedding\"\n)\n\nfunc main() {\n\tl, err := embedding.New(embedding.Config{VocabSize: 32, EmbeddingDim: 16, SeqLen: 4})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tids := core.NewTensor[float32](1, 4)\n\tids.Data[0], ids.Data[1] = 3, 7\n\t_, y, err := embedding.Forward(l, ids)\n\tfmt.Println(y.Shape, err)\n}\n","url":"/source/examples/welvet/16-embedding/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/16-embedding","url":"https://openfluke.com/examples/welvet/16-embedding"},{"slug":"welvet/17-softmax","title":"17. layers/softmax","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/softmaxStatus: ok — ✅ When Building or training a net that needs the layers/softmax Op (also usable as a Parallel cam). Where im","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/softmax</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/softmax</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/softmax\"</code></p>\n<pre><code class=\"language-bash\">cd 17-softmax &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Classification heads and attention need stable softmax variants, including sparse/Gumbel/Entmax for research paths.</p>\n<h2>What</h2>\n<p>Weightless layer; KindStandard/Temperature/Grid/Hierarchical/Gumbel/Masked/Sparse/… WebGPU covers std family; exotic kinds hard-error on GPU (no silent host).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>[0.6380664 0.23473153 0.09543471 0.031767454] &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/17-softmax</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/softmaxStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/softmax Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/softmax\"\ncd 17-softmax && source ../env.sh && go run .\n\nWhy\nClassification heads and attention need stable softmax variants, including sparse/Gumbel/Entmax for research paths.\nWhat\nWeightless layer; KindStandard/Temperature/Grid/Hierarchical/Gumbel/Masked/Sparse/… WebGPU covers std family; exotic kinds hard-error on GPU (no silent host).\nSample output (captured)\n[0.6380664 0.23473153 0.09543471 0.031767454] <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/17-softmax).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/softmax\"\n)\n\nfunc main() {\n\tl, err := softmax.New(softmax.Config{Dim: 4, Kind: softmax.KindStandard})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 4)\n\tcopy(x.Data, []float32{2, 1, 0.1, -1})\n\t_, y, err := softmax.Forward(l, x)\n\tfmt.Println(y.Data, err)\n}\n","url":"/source/examples/welvet/17-softmax/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/17-softmax","url":"https://openfluke.com/examples/welvet/17-softmax"},{"slug":"welvet/18-sequential","title":"18. layers/sequential","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/sequentialStatus: ok — ✅ When Building or training a net that needs the layers/sequential Op (also usable as a Parallel cam). Wh","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/sequential</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/sequential</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/sequential\"</code></p>\n<pre><code class=\"language-bash\">cd 18-sequential &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Some cells need an ordered Dense chain without burning grid hops.</p>\n<h2>What</h2>\n<p>Dense→Dense compose, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as a child is parallel.ResidualGraft / a Sandwich — Sequential cannot import parallel.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>16 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/18-sequential</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/sequentialStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/sequential Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/sequential\"\ncd 18-sequential && source ../env.sh && go run .\n\nWhy\nSome cells need an ordered Dense chain without burning grid hops.\nWhat\nDense→Dense compose, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as a child is parallel.ResidualGraft / a Sandwich — Sequential cannot import parallel.\nSample output (captured)\n16 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/18-sequential).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/sequential\"\n)\n\nfunc main() {\n\tl, err := sequential.New(sequential.Config{Dim: 16, Depth: 3})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := sequential.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\n","url":"/source/examples/welvet/18-sequential/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/18-sequential","url":"https://openfluke.com/examples/welvet/18-sequential"},{"slug":"welvet/19-residual","title":"19. layers/residual","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/residualStatus: ok — ✅ When Building or training a net that needs the layers/residual Op (also usable as a Parallel cam). Where ","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/residual</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/residual</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/residual\"</code></p>\n<pre><code class=\"language-bash\">cd 19-residual &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Skip connections stabilize deep stacks: y = F(x) + x with correct skip grads.</p>\n<h2>What</h2>\n<p>F is Dense Dim→Dim, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as F is parallel.ResidualGraft (y = F(x)+x) — Residual cannot import parallel.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>16 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/19-residual</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/residualStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/residual Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/residual\"\ncd 19-residual && source ../env.sh && go run .\n\nWhy\nSkip connections stabilize deep stacks: y = F(x) + x with correct skip grads.\nWhat\nF is Dense Dim→Dim, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as F is parallel.ResidualGraft (y = F(x)+x) — Residual cannot import parallel.\nSample output (captured)\n16 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/19-residual).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/residual\"\n)\n\nfunc main() {\n\tl, err := residual.New(residual.Config{Dim: 16, Depth: 2})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := residual.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\n","url":"/source/examples/welvet/19-residual/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/19-residual","url":"https://openfluke.com/examples/welvet/19-residual"},{"slug":"welvet/20-cnn","title":"20. CNN family — cnn1 / cnn2 / cnn3","group":"Welvet examples","description":"When: spatial / temporal convolution senses (1D seq, 2D images, 3D volumes).Where: layers/cnn1, layers/cnn2, layers/cnn3Why: im2col → Dense Proj so quant/SIMD/WebGPU and CamSync (via Proj) a","html":"<p><strong>When:</strong> spatial / temporal convolution senses (1D seq, 2D images, 3D volumes).<br /><strong>Where:</strong> <code>layers/cnn1</code>, <code>layers/cnn2</code>, <code>layers/cnn3</code><br /><strong>Why:</strong> im2col → Dense <code>Proj</code> so quant/SIMD/WebGPU and CamSync (via Proj) are shared.</p>\n<pre><code class=\"language-bash\">cd 20-cnn &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<table>\n<thead>\n<tr>\n<th>Op</th>\n<th>Use</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>cnn1</strong></td>\n<td>Audio / 1D sequences</td>\n</tr>\n<tr>\n<td><strong>cnn2</strong></td>\n<td>Images / MNIST-style</td>\n</tr>\n<tr>\n<td><strong>cnn3</strong></td>\n<td>Volumetric / video voxels</td>\n</tr>\n</tbody></table>\n<p>Put CNN <strong>inside</strong> Parallel cams when you want CamSync on kernels.</p>\n","text":"When: spatial / temporal convolution senses (1D seq, 2D images, 3D volumes).Where: layers/cnn1, layers/cnn2, layers/cnn3Why: im2col → Dense Proj so quant/SIMD/WebGPU and CamSync (via Proj) are shared.\ncd 20-cnn && source ../env.sh && go run .\n\n\n\n\nOp\nUse\n\n\n\ncnn1\nAudio / 1D sequences\n\n\ncnn2\nImages / MNIST-style\n\n\ncnn3\nVolumetric / video voxels\n\n\nPut CNN inside Parallel cams when you want CamSync on kernels.\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/cnn1\"\n\t\"github.com/openfluke/welvet/layers/cnn2\"\n\t\"github.com/openfluke/welvet/layers/cnn3\"\n)\n\nfunc main() {\n\t// cnn1 — 1D conv (seq / audio patches)\n\tc1, err := cnn1.New(cnn1.Config{InChannels: 1, Filters: 4, SeqLen: 16, Kernel: 3, Stride: 1})\n\tmust(err)\n\tx1 := core.NewTensor[float32](1, 1, 16)\n\tfor i := range x1.Data {\n\t\tx1.Data[i] = 0.1\n\t}\n\t_, y1, err := cnn1.Forward(c1, x1)\n\tmust(err)\n\tfmt.Println(\"cnn1\", y1.Shape)\n\n\t// cnn2 — 2D vision\n\tc2, err := cnn2.New(cnn2.Config{InChannels: 1, Filters: 4, Height: 8, Width: 8, Kernel: 3, Stride: 1})\n\tmust(err)\n\tx2 := core.NewTensor[float32](1, 1, 8, 8)\n\tfor i := range x2.Data {\n\t\tx2.Data[i] = 0.1\n\t}\n\t_, y2, err := cnn2.Forward(c2, x2)\n\tmust(err)\n\tfmt.Println(\"cnn2\", y2.Shape)\n\n\t// cnn3 — 3D / volumetric\n\tc3, err := cnn3.New(cnn3.Config{InChannels: 1, Filters: 2, Depth: 4, Height: 4, Width: 4, Kernel: 2, Stride: 1})\n\tmust(err)\n\tx3 := core.NewTensor[float32](1, 1, 4, 4, 4)\n\tfor i := range x3.Data {\n\t\tx3.Data[i] = 0.1\n\t}\n\t_, y3, err := cnn3.Forward(c3, x3)\n\tmust(err)\n\tfmt.Println(\"cnn3\", y3.Shape)\n}\n\nfunc must(err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n","url":"/source/examples/welvet/20-cnn/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/20-cnn","url":"https://openfluke.com/examples/welvet/20-cnn"},{"slug":"welvet/21-rnn-lstm","title":"21. layers/rnn · lstm","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/lstmStatus: ok — ✅ When Building or training a net that needs the layers/lstm Op (also usable as a Parallel cam). Where import \"","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/lstm</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/lstm</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/lstm\"</code></p>\n<pre><code class=\"language-bash\">cd 21-rnn-lstm &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Sequence models before transformers still need vanilla RNN and LSTM with BPTT on the shared MatVec stack.</p>\n<h2>What</h2>\n<p>IH/HH (and LSTM gates) via Dense; recurrence ALU host; device required for WebGPU path.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>64 64\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/21-rnn-lstm</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/lstmStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/lstm Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/lstm\"\ncd 21-rnn-lstm && source ../env.sh && go run .\n\nWhy\nSequence models before transformers still need vanilla RNN and LSTM with BPTT on the shared MatVec stack.\nWhat\nIH/HH (and LSTM gates) via Dense; recurrence ALU host; device required for WebGPU path.\nSample output (captured)\n64 64\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/21-rnn-lstm).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/lstm\"\n\t\"github.com/openfluke/welvet/layers/rnn\"\n)\n\nfunc main() {\n\tr, _ := rnn.New(rnn.Config{InputSize: 8, HiddenSize: 16, SeqLen: 4})\n\tl, _ := lstm.New(lstm.Config{InputSize: 8, HiddenSize: 16, SeqLen: 4})\n\tx := core.NewTensor[float32](1, 4, 8)\n\t_, yr, _ := rnn.Forward(r, x)\n\t_, yl, _ := lstm.Forward(l, x)\n\tfmt.Println(len(yr.Data), len(yl.Data))\n}\n","url":"/source/examples/welvet/21-rnn-lstm/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/21-rnn-lstm","url":"https://openfluke.com/examples/welvet/21-rnn-lstm"},{"slug":"welvet/22-seqmix","title":"22. layers/seqmix — mixer contract","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/seqmixStatus: ok — ✅ When Building or training a net that needs the layers/seqmix Op (also usable as a Parallel cam). Where impo","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/seqmix</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/seqmix</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/seqmix\"</code></p>\n<pre><code class=\"language-bash\">cd 22-seqmix &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Attention, SSM, linear attn, and conv mixers must not be accidental forks of mha. Naming the contract keeps packages honest.</p>\n<h2>What</h2>\n<p>KindAttention | KindSSM | KindLinearAttn | KindConvMix and Contract{Kind,DModel,MaxT}. No compute here.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>attention\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/22-seqmix</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/seqmixStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/seqmix Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/seqmix\"\ncd 22-seqmix && source ../env.sh && go run .\n\nWhy\nAttention, SSM, linear attn, and conv mixers must not be accidental forks of mha. Naming the contract keeps packages honest.\nWhat\nKindAttention | KindSSM | KindLinearAttn | KindConvMix and Contract{Kind,DModel,MaxT}. No compute here.\nSample output (captured)\nattention\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/22-seqmix).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/seqmix\"\n)\n\nfunc main() {\n\tc := seqmix.Contract{Kind: seqmix.KindAttention, DModel: 64, MaxT: 2048}\n\tfmt.Println(c.Kind.String()) // attention\n}\n","url":"/source/examples/welvet/22-seqmix/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/22-seqmix","url":"https://openfluke.com/examples/welvet/22-seqmix"},{"slug":"welvet/23-gdn","title":"23. layers/gdn — gated delta net","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/gdnStatus: ok — ✅ When Building or training a net that needs the layers/gdn Op (also usable as a Parallel cam). Where import \"gi","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/gdn</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/gdn</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/gdn\"</code></p>\n<pre><code class=\"language-bash\">cd 23-gdn &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Linear attention / decode-first mixers (Gated DeltaNet) need a first-class package under KindLinearAttn.</p>\n<h2>What</h2>\n<p>Exec CPU/SIMD/WebGPU; ForwardDecode; truncated BPTT. Timed matrix is Float32-primary: PermutationOK is f32 × FormatNone/BinaryPacked × CPU/SIMD/WebGPU; other cells GAP (declared), not FAIL.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>&lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/23-gdn</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/gdnStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/gdn Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/gdn\"\ncd 23-gdn && source ../env.sh && go run .\n\nWhy\nLinear attention / decode-first mixers (Gated DeltaNet) need a first-class package under KindLinearAttn.\nWhat\nExec CPU/SIMD/WebGPU; ForwardDecode; truncated BPTT. Timed matrix is Float32-primary: PermutationOK is f32 × FormatNone/BinaryPacked × CPU/SIMD/WebGPU; other cells GAP (declared), not FAIL.\nSample output (captured)\n<nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/23-gdn).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/gdn\"\n)\n\nfunc main() {\n\tl, err := gdn.New(gdn.Config{\n\t\tHiddenSize: 64, NumKeyHeads: 4, NumValueHeads: 4,\n\t\tKeyHeadDim: 16, ValueHeadDim: 16, ConvKernel: 4,\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"config rejected:\", err)\n\t\treturn\n\t}\n\tl.Reset()\n\tx := make([]float32, 64)\n\ty := make([]float32, 64)\n\tfmt.Println(l.ForwardDecode(x, y))\n}\n","url":"/source/examples/welvet/23-gdn/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/23-gdn","url":"https://openfluke.com/examples/welvet/23-gdn"},{"slug":"welvet/24-mamba","title":"24. layers/mamba — selective SSM","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/mambaStatus: ok — ✅ When Building or training a net that needs the layers/mamba Op (also usable as a Parallel cam). Where import","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/mamba</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/mamba</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/mamba\"</code></p>\n<pre><code class=\"language-bash\">cd 24-mamba &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>SSM mixers (KindSSM) are not MHA clones — they need their own selective-scan path.</p>\n<h2>What</h2>\n<p>InProj → softplus(Δ) scan → OutProj. Full timed matrix + train grids (scan ALU host).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>true &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/24-mamba</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/mambaStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/mamba Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/mamba\"\ncd 24-mamba && source ../env.sh && go run .\n\nWhy\nSSM mixers (KindSSM) are not MHA clones — they need their own selective-scan path.\nWhat\nInProj → softplus(Δ) scan → OutProj. Full timed matrix + train grids (scan ALU host).\nSample output (captured)\ntrue <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/24-mamba).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/mamba\"\n)\n\nfunc main() {\n\tl, err := mamba.New(mamba.Config{DModel: 32, DState: 16, Expand: 2, SeqLen: 8})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tx := core.NewTensor[float32](1, 8, 32)\n\t_, y, err := mamba.Forward(l, x)\n\tfmt.Println(y != nil, err)\n}\n","url":"/source/examples/welvet/24-mamba/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/24-mamba","url":"https://openfluke.com/examples/welvet/24-mamba"},{"slug":"welvet/25-convt","title":"25. ConvTranspose family — convt1 / convt2 / convt3","group":"Welvet examples","description":"When: upsampling / decoder paths (1D, 2D, 3D).Where: layers/convt1, layers/convt2, layers/convt3Why: generative twins and U-Net-style expands; same Proj/Dense backend story as CNN. cd 25-con","html":"<p><strong>When:</strong> upsampling / decoder paths (1D, 2D, 3D).<br /><strong>Where:</strong> <code>layers/convt1</code>, <code>layers/convt2</code>, <code>layers/convt3</code><br /><strong>Why:</strong> generative twins and U-Net-style expands; same Proj/Dense backend story as CNN.</p>\n<pre><code class=\"language-bash\">cd 25-convt &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n","text":"When: upsampling / decoder paths (1D, 2D, 3D).Where: layers/convt1, layers/convt2, layers/convt3Why: generative twins and U-Net-style expands; same Proj/Dense backend story as CNN.\ncd 25-convt && source ../env.sh && go run .\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/convt1\"\n\t\"github.com/openfluke/welvet/layers/convt2\"\n\t\"github.com/openfluke/welvet/layers/convt3\"\n)\n\nfunc main() {\n\tt1, err := convt1.New(convt1.Config{InChannels: 4, Filters: 2, SeqLen: 8, Kernel: 3, Stride: 2})\n\tmust(err)\n\tx1 := core.NewTensor[float32](1, 4, 8)\n\t_, y1, err := convt1.Forward(t1, x1)\n\tmust(err)\n\tfmt.Println(\"convt1\", y1.Shape)\n\n\tt2, err := convt2.New(convt2.Config{InChannels: 2, Filters: 2, Height: 4, Width: 4, Kernel: 2, Stride: 1})\n\tmust(err)\n\tx2 := core.NewTensor[float32](1, 2, 4, 4)\n\t_, y2, err := convt2.Forward(t2, x2)\n\tmust(err)\n\tfmt.Println(\"convt2\", y2.Shape)\n\n\tt3, err := convt3.New(convt3.Config{InChannels: 1, Filters: 2, Depth: 2, Height: 2, Width: 2, Kernel: 2, Stride: 1})\n\tmust(err)\n\tx3 := core.NewTensor[float32](1, 1, 2, 2, 2)\n\t_, y3, err := convt3.Forward(t3, x3)\n\tmust(err)\n\tfmt.Println(\"convt3\", y3.Shape)\n}\n\nfunc must(err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n","url":"/source/examples/welvet/25-convt/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/25-convt","url":"https://openfluke.com/examples/welvet/25-convt"},{"slug":"welvet/26-kmeans","title":"26. layers/kmeans","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/kmeansStatus: ok — ✅ When Building or training a net that needs the layers/kmeans Op (also usable as a Parallel cam). Where impo","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/kmeans</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/kmeans</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/kmeans\"</code></p>\n<pre><code class=\"language-bash\">cd 26-kmeans &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Soft clustering as a differentiable layer lets topology experiments sit inside the same train loop.</p>\n<h2>What</h2>\n<p>Centers on Dense (K×FeatureDim); soft assignment outputs. Full timed matrix + train grids.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>[1 4] &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/26-kmeans</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/kmeansStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/kmeans Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/kmeans\"\ncd 26-kmeans && source ../env.sh && go run .\n\nWhy\nSoft clustering as a differentiable layer lets topology experiments sit inside the same train loop.\nWhat\nCenters on Dense (K×FeatureDim); soft assignment outputs. Full timed matrix + train grids.\nSample output (captured)\n[1 4] <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/26-kmeans).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/kmeans\"\n)\n\nfunc main() {\n\tl, err := kmeans.New(kmeans.Config{NumClusters: 4, FeatureDim: 8})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 8)\n\t_, y, err := kmeans.Forward(l, x)\n\tfmt.Println(y.Shape, err)\n}\n","url":"/source/examples/welvet/26-kmeans/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/26-kmeans","url":"https://openfluke.com/examples/welvet/26-kmeans"},{"slug":"welvet/27-parallel","title":"27. layers/parallel — MoE + cameral","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅ When Building or training a net that needs the layers/parallel Op (also usable as a Parallel cam). Where ","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/parallel</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/parallel</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/parallel\"</code></p>\n<pre><code class=\"language-bash\">cd 27-parallel &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Mixture-of-experts and multi-path cells need concat/add/avg/filter combines. Cameral graphs need sibling hemispheres that share input, merge outputs, and optionally train under distinct modes.</p>\n<h2>What</h2>\n<p>Parallel branches + Stack sandwiches. Hemispheres / Bicameral / Sandwich build nested multi-cameral nets. SetBranchModes + TrainStackMSE let each hemi use a different TrainMode (all 29 named updates — BP, Tween, Split, FastProxy, Sparse, Step*, Mesh*, …).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>loss 0 err &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/27-parallel</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/parallel Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/parallel\"\ncd 27-parallel && source ../env.sh && go run .\n\nWhy\nMixture-of-experts and multi-path cells need concat/add/avg/filter combines. Cameral graphs need sibling hemispheres that share input, merge outputs, and optionally train under distinct modes.\nWhat\nParallel branches + Stack sandwiches. Hemispheres / Bicameral / Sandwich build nested multi-cameral nets. SetBranchModes + TrainStackMSE let each hemi use a different TrainMode (all 29 named updates — BP, Tween, Split, FastProxy, Sparse, Step*, Mesh*, …).\nSample output (captured)\nloss 0 err <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/27-parallel).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\t// Dense stem → 2 hemispheres (add) → Dense head\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Mix: left hemi StepBP, right hemi StepTweenChain\n\themi := s.Children[1].(*parallel.Layer)\n\themi.SetBranchModes(parallel.ModeStepBP, parallel.ModeStepTweenChain)\n\n\tx := core.NewTensor[float32](1, 8)\n\tt := core.NewTensor[float32](1, 1)\n\tt.Data[0] = 0.5\n\tloss, err := parallel.TrainStackMSE(s, x, t, parallel.ModeStepBP, 0.01)\n\tfmt.Println(\"loss\", loss, \"err\", err)\n}\n","url":"/source/examples/welvet/27-parallel/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/27-parallel","url":"https://openfluke.com/examples/welvet/27-parallel"},{"slug":"welvet/28-metacognition","title":"28. layers/metacognition","group":"Welvet examples","description":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/metacognitionStatus: ok — ✅ When Building or training a net that needs the layers/metacognition Op (also usable as a Parallel ca","html":"<p><strong>Part:</strong> III · Layers<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/metacognition</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/metacognition</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/metacognition\"</code></p>\n<pre><code class=\"language-bash\">cd 28-metacognition &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Observed layers can apply heuristic stability rules (gate/scale/reset) without dtype morph/QAT.</p>\n<h2>What</h2>\n<p>Wraps Dense + DefaultStabilityRules(); Stats exposed. Full timed matrix + train grids.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>16 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/28-metacognition</code>).</p>\n","text":"Part: III · LayersPackage: github.com/openfluke/welvet/layers/metacognitionStatus: ok — ✅\nWhen\nBuilding or training a net that needs the layers/metacognition Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/metacognition\"\ncd 28-metacognition && source ../env.sh && go run .\n\nWhy\nObserved layers can apply heuristic stability rules (gate/scale/reset) without dtype morph/QAT.\nWhat\nWraps Dense + DefaultStabilityRules(); Stats exposed. Full timed matrix + train grids.\nSample output (captured)\n16 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/28-metacognition).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/metacognition\"\n)\n\nfunc main() {\n\tl, err := metacognition.New(metacognition.Config{\n\t\tDim: 16, Rules: metacognition.DefaultStabilityRules(),\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[float32](1, 16)\n\t_, y, err := metacognition.Forward(l, x)\n\tfmt.Println(len(y.Data), err)\n}\n","url":"/source/examples/welvet/28-metacognition/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/28-metacognition","url":"https://openfluke.com/examples/welvet/28-metacognition"},{"slug":"welvet/29-forward","title":"29. runtime/forward","group":"Welvet examples","description":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/forwardStatus: ok — ✅ When Walking a Grid/Stack with the shared runtime/forward path. Where import \"github.com/openfluke/welvet","html":"<p><strong>Part:</strong> IV · Runtime<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/runtime/forward</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Walking a Grid/Stack with the shared <code>runtime/forward</code> path.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/runtime/forward\"</code></p>\n<pre><code class=\"language-bash\">cd 29-forward &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>A grid of heterogeneous ops needs one walker that dispatches by concrete type and fails loudly on unknowns.</p>\n<h2>What</h2>\n<p>Forward[T](grid, input) → Result tape; Cell[T] for single-cell dispatch. Covers Dense…Residual + extended wired ops.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>true &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/29-forward</code>).</p>\n","text":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/forwardStatus: ok — ✅\nWhen\nWalking a Grid/Stack with the shared runtime/forward path.\nWhere\nimport \"github.com/openfluke/welvet/runtime/forward\"\ncd 29-forward && source ../env.sh && go run .\n\nWhy\nA grid of heterogeneous ops needs one walker that dispatches by concrete type and fails loudly on unknowns.\nWhat\nForward[T](grid, input) → Result tape; Cell[T] for single-cell dispatch. Covers Dense…Residual + extended wired ops.\nSample output (captured)\ntrue <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/29-forward).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(8, 8, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tres, err := forward.Forward(g, core.NewTensor[float32](1, 8))\n\tfmt.Println(res != nil, err)\n}\n","url":"/source/examples/welvet/29-forward/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/29-forward","url":"https://openfluke.com/examples/welvet/29-forward"},{"slug":"welvet/30-backward","title":"30. runtime/backward","group":"Welvet examples","description":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/backwardStatus: ok — ✅ When Walking a Grid/Stack with the shared runtime/backward path. Where import \"github.com/openfluke/welv","html":"<p><strong>Part:</strong> IV · Runtime<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/runtime/backward</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Walking a Grid/Stack with the shared <code>runtime/backward</code> path.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/runtime/backward\"</code></p>\n<pre><code class=\"language-bash\">cd 30-backward &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Training needs a reverse tape over the same ops forward used — no separate graph framework.</p>\n<h2>What</h2>\n<p>Backward[T](fwdResult, gradOut) walks the tape and returns per-op weight grads.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>true &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/30-backward</code>).</p>\n","text":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/backwardStatus: ok — ✅\nWhen\nWalking a Grid/Stack with the shared runtime/backward path.\nWhere\nimport \"github.com/openfluke/welvet/runtime/backward\"\ncd 30-backward && source ../env.sh && go run .\n\nWhy\nTraining needs a reverse tape over the same ops forward used — no separate graph framework.\nWhat\nBackward[T](fwdResult, gradOut) walks the tape and returns per-op weight grads.\nSample output (captured)\ntrue <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/30-backward).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/backward\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tfwd, _ := forward.Forward(g, core.NewTensor[float32](1, 4))\n\tbwd, err := backward.Backward(fwd, core.NewTensor[float32](1, 4))\n\tfmt.Println(bwd != nil, err)\n}\n","url":"/source/examples/welvet/30-backward/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/30-backward","url":"https://openfluke.com/examples/welvet/30-backward"},{"slug":"welvet/31-training","title":"31. runtime/training","group":"Welvet examples","description":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/trainingStatus: ok — ✅ When Walking a Grid/Stack with the shared runtime/training path. Where import \"github.com/openfluke/welv","html":"<p><strong>Part:</strong> IV · Runtime<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/runtime/training</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Walking a Grid/Stack with the shared <code>runtime/training</code> path.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/runtime/training\"</code></p>\n<pre><code class=\"language-bash\">cd 31-training &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Suites and small nets need MSE+SGD and tween hooks without inventing an external trainer or a retained float32 master beside storage.</p>\n<h2>What</h2>\n<p>MSE/MSEGrad, SGD, Step, ApplyTween/StepTween, StepMesh. Layer-agnostic ApplyGradSGD dispatch (Dense…Mamba/GDN/…). FormatNone: in-dtype ApplySGD; packed: unpack→update→re-Pack. No QAT dual path — storage dtype/format is truth after every step. Sandwich credit (Split / FastProxy / Sparse / …) lives in layers/parallel TrainMode — see §67.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>0 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/31-training</code>).</p>\n","text":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/trainingStatus: ok — ✅\nWhen\nWalking a Grid/Stack with the shared runtime/training path.\nWhere\nimport \"github.com/openfluke/welvet/runtime/training\"\ncd 31-training && source ../env.sh && go run .\n\nWhy\nSuites and small nets need MSE+SGD and tween hooks without inventing an external trainer or a retained float32 master beside storage.\nWhat\nMSE/MSEGrad, SGD, Step, ApplyTween/StepTween, StepMesh. Layer-agnostic ApplyGradSGD dispatch (Dense…Mamba/GDN/…). FormatNone: in-dtype ApplySGD; packed: unpack→update→re-Pack. No QAT dual path — storage dtype/format is truth after every step. Sandwich credit (Split / FastProxy / Sparse / …) lives in layers/parallel TrainMode — see §67.\nSample output (captured)\n0 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/31-training).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/forward\"\n\t\"github.com/openfluke/welvet/runtime/training\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tfwd, _ := forward.Forward(g, core.NewTensor[float32](1, 4))\n\tloss, err := training.Step(fwd, core.NewTensor[float32](1, 4), 1e-2)\n\tfmt.Println(loss, err)\n}\n","url":"/source/examples/welvet/31-training/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/31-training","url":"https://openfluke.com/examples/welvet/31-training"},{"slug":"welvet/32-step","title":"32. runtime/step — step mesh","group":"Welvet examples","description":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/stepStatus: ok — ✅ When Walking a Grid/Stack with the shared runtime/step path. Where import \"github.com/openfluke/welvet/runti","html":"<p><strong>Part:</strong> IV · Runtime<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/runtime/step</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Walking a Grid/Stack with the shared <code>runtime/step</code> path.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/runtime/step\"</code></p>\n<pre><code class=\"language-bash\">cd 32-step &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Spatial feedback (remote links) needs a discrete-time mesh where every cell updates from a double buffer — different from a decoder wavefront. Cross-numeric train also needs the same mesh with weight DType ⊥ activation Tensor[T].</p>\n<h2>What</h2>\n<p>State[T], StepForward/StepBackward/StepApplyTween / StepMesh across the grid for all wired Ops × dtype × quant × CPU/SIMD. W2A Cross-Numeric Train: polyops.AllKinds() × weight dtype × act host (smoke ~21×7×5 ≈ 735; full ~21×34×15 ≈ 10.7k) — asserts no retained f32 master after StepMesh. Stack Step* is a different clock: IsLineStep / TrainLine (1D pipe) — see §67.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>&lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/32-step</code>).</p>\n","text":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/stepStatus: ok — ✅\nWhen\nWalking a Grid/Stack with the shared runtime/step path.\nWhere\nimport \"github.com/openfluke/welvet/runtime/step\"\ncd 32-step && source ../env.sh && go run .\n\nWhy\nSpatial feedback (remote links) needs a discrete-time mesh where every cell updates from a double buffer — different from a decoder wavefront. Cross-numeric train also needs the same mesh with weight DType ⊥ activation Tensor[T].\nWhat\nState[T], StepForward/StepBackward/StepApplyTween / StepMesh across the grid for all wired Ops × dtype × quant × CPU/SIMD. W2A Cross-Numeric Train: polyops.AllKinds() × weight dtype × act host (smoke ~21×7×5 ≈ 735; full ~21×34×15 ≈ 10.7k) — asserts no retained f32 master after StepMesh. Stack Step* is a different clock: IsLineStep / TrainLine (1D pipe) — see §67.\nSample output (captured)\n<nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/32-step).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/step\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\tst := step.New[float32](g)\n\t_, err := step.StepForward(g, st, false)\n\tfmt.Println(err)\n}\n","url":"/source/examples/welvet/32-step/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/32-step","url":"https://openfluke.com/examples/welvet/32-step"},{"slug":"welvet/33-dna","title":"33. systems/dna","group":"Welvet examples","description":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/dnaStatus: ok — ✅ When Adaptation, measurement, or evolution (systems/dna). Where import \"github.com/openfluke/welvet/systems/dn","html":"<p><strong>Part:</strong> V · Systems<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/systems/dna</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Adaptation, measurement, or evolution (<code>systems/dna</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/systems/dna\"</code></p>\n<pre><code class=\"language-bash\">cd 33-dna &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Quant and train must be measurable as topology/weight fingerprints — DNA detects logic shifts.</p>\n<h2>What</h2>\n<p>ExtractDNA, CompareNetworks, CosineSimilarity, FlattenOp / CollectStores across dtype×quant.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>{1 map[0,0,0,0:1] []}\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/33-dna</code>).</p>\n","text":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/dnaStatus: ok — ✅\nWhen\nAdaptation, measurement, or evolution (systems/dna).\nWhere\nimport \"github.com/openfluke/welvet/systems/dna\"\ncd 33-dna && source ../env.sh && go run .\n\nWhy\nQuant and train must be measurable as topology/weight fingerprints — DNA detects logic shifts.\nWhat\nExtractDNA, CompareNetworks, CosineSimilarity, FlattenOp / CollectStores across dtype×quant.\nSample output (captured)\n{1 map[0,0,0,0:1] []}\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/33-dna).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/systems/dna\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tl, _ := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\t_ = dense.Place(g, 0, 0, 0, 0, l)\n\ta := dna.ExtractDNA(g)\n\tfmt.Println(dna.CompareNetworks(a, a))\n}\n","url":"/source/examples/welvet/33-dna/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/33-dna","url":"https://openfluke.com/examples/welvet/33-dna"},{"slug":"welvet/34-evolution","title":"34. systems/evolution","group":"Welvet examples","description":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/evolutionStatus: ok — ✅ When Adaptation, measurement, or evolution (systems/evolution). Where import \"github.com/openfluke/welve","html":"<p><strong>Part:</strong> V · Systems<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/systems/evolution</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Adaptation, measurement, or evolution (<code>systems/evolution</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/systems/evolution\"</code></p>\n<pre><code class=\"language-bash\">cd 34-evolution &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Topology search and weight crossover need first-class splice + NEAT on CPU-resident grids.</p>\n<h2>What</h2>\n<p>SpliceDNA, NEATMutate, NewNEATPopulation, CloneGrid — dtype/quant preserved via SetFromF32.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>&lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/34-evolution</code>).</p>\n","text":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/evolutionStatus: ok — ✅\nWhen\nAdaptation, measurement, or evolution (systems/evolution).\nWhere\nimport \"github.com/openfluke/welvet/systems/evolution\"\ncd 34-evolution && source ../env.sh && go run .\n\nWhy\nTopology search and weight crossover need first-class splice + NEAT on CPU-resident grids.\nWhat\nSpliceDNA, NEATMutate, NewNEATPopulation, CloneGrid — dtype/quant preserved via SetFromF32.\nSample output (captured)\n<nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/34-evolution).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/evolution\"\n)\n\nfunc main() {\n\ta, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)\n\tchild, err := evolution.SpliceDNA(a, b, evolution.DefaultSpliceConfig())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\t_, err = evolution.NEATMutate(child, evolution.DefaultNEATConfig(16))\n\tfmt.Println(err)\n}\n","url":"/source/examples/welvet/34-evolution/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/34-evolution","url":"https://openfluke.com/examples/welvet/34-evolution"},{"slug":"welvet/35-tween","title":"35. systems/tween","group":"Welvet examples","description":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/tweenStatus: ok — ✅ When Adaptation, measurement, or evolution (systems/tween). Where import \"github.com/openfluke/welvet/system","html":"<p><strong>Part:</strong> V · Systems<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/systems/tween</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Adaptation, measurement, or evolution (<code>systems/tween</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/systems/tween\"</code></p>\n<pre><code class=\"language-bash\">cd 35-tween &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Target propagation (chain-rule or Hebbian layerwise gaps) is an alternative credit-assignment path. Not the same package as TrainMode Tween / TweenChain on a Sandwich (those are layers/parallel — §67).</p>\n<h2>What</h2>\n<p>NewState, Forward, BackwardChainRule / BackwardLayerwise, ApplyGaps; SIMD DotTile/Saxpy budgets.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>forward: no op at {0 0 0 0} (type Dense)\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/35-tween</code>).</p>\n","text":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/tweenStatus: ok — ✅\nWhen\nAdaptation, measurement, or evolution (systems/tween).\nWhere\nimport \"github.com/openfluke/welvet/systems/tween\"\ncd 35-tween && source ../env.sh && go run .\n\nWhy\nTarget propagation (chain-rule or Hebbian layerwise gaps) is an alternative credit-assignment path. Not the same package as TrainMode Tween / TweenChain on a Sandwich (those are layers/parallel — §67).\nWhat\nNewState, Forward, BackwardChainRule / BackwardLayerwise, ApplyGaps; SIMD DotTile/Saxpy budgets.\nSample output (captured)\nforward: no op at {0 0 0 0} (type Dense)\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/35-tween).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/systems/tween\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tst := tween.NewState[float32](g, tween.DefaultConfig())\n\t_, err := tween.Forward(g, st, core.NewTensor[float32](1, 4))\n\tfmt.Println(err)\n}\n","url":"/source/examples/welvet/35-tween/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/35-tween","url":"https://openfluke.com/examples/welvet/35-tween"},{"slug":"welvet/36-tanhi","title":"36. systems/tanhi — TANHI · UDP HUD","group":"Welvet examples","description":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/tanhiStatus: ok — ✅ When Adaptation, measurement, or evolution (systems/tanhi). Where import \"github.com/openfluke/welvet/system","html":"<p><strong>Part:</strong> V · Systems<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/systems/tanhi</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Adaptation, measurement, or evolution (<code>systems/tanhi</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/systems/tanhi\"</code></p>\n<pre><code class=\"language-bash\">cd 36-tanhi &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Training visualization must never block the engine — best-effort UDP JSON-lines to a HUD.</p>\n<h2>What</h2>\n<p><strong>TANHI</strong> = <em>Tensor Activation Network Holographic Interface</em>. Sparse non-blocking JSON-line UDP events for per-layer forward/backward HUD visualization. ConfigFromGrid, Emit/EmitSweep, DefaultUDPPort (17481). SoulGlitch-style consumers.</p>\n<p><em>No captured output in <code>_manifest.json</code> yet — run <code>go run .</code> and paste here.</em></p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/36-tanhi</code>).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>— 36-tanhi (996ms)\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n","text":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/tanhiStatus: ok — ✅\nWhen\nAdaptation, measurement, or evolution (systems/tanhi).\nWhere\nimport \"github.com/openfluke/welvet/systems/tanhi\"\ncd 36-tanhi && source ../env.sh && go run .\n\nWhy\nTraining visualization must never block the engine — best-effort UDP JSON-lines to a HUD.\nWhat\nTANHI = Tensor Activation Network Holographic Interface. Sparse non-blocking JSON-line UDP events for per-layer forward/backward HUD visualization. ConfigFromGrid, Emit/EmitSweep, DefaultUDPPort (17481). SoulGlitch-style consumers.\nNo captured output in _manifest.json yet — run go run . and paste here.\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/36-tanhi).\nSample output (captured)\n— 36-tanhi (996ms)\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/tanhi\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tcfg := tanhi.ConfigFromGrid(g)\n\ttanhi.EmitSweep(cfg, \"epoch-0\") // non-blocking best-effort\n}\n","url":"/source/examples/welvet/36-tanhi/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/36-tanhi","url":"https://openfluke.com/examples/welvet/36-tanhi"},{"slug":"welvet/37-telemetry","title":"37. systems/telemetry","group":"Welvet examples","description":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/telemetryStatus: ok — ✅ When Adaptation, measurement, or evolution (systems/telemetry). Where import \"github.com/openfluke/welve","html":"<p><strong>Part:</strong> V · Systems<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/systems/telemetry</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Adaptation, measurement, or evolution (<code>systems/telemetry</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/systems/telemetry\"</code></p>\n<pre><code class=\"language-bash\">cd 37-telemetry &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Static structural blueprints (sizes, op kinds) differ from live TANHI events.</p>\n<h2>What</h2>\n<p>ExtractNetworkBlueprint, ExtractLayerTelemetry for introspection/UIs.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>{ID:demo TotalLayers:1 TotalParams:0 Layers:[{Z:0 Y:0 X:0 L:0 Type:Dense Activation:ReLU Parameters:0 InputShape:[] OutputShape:[] Branches:[] CombineMode:}]}\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/37-telemetry</code>).</p>\n","text":"Part: V · SystemsPackage: github.com/openfluke/welvet/systems/telemetryStatus: ok — ✅\nWhen\nAdaptation, measurement, or evolution (systems/telemetry).\nWhere\nimport \"github.com/openfluke/welvet/systems/telemetry\"\ncd 37-telemetry && source ../env.sh && go run .\n\nWhy\nStatic structural blueprints (sizes, op kinds) differ from live TANHI events.\nWhat\nExtractNetworkBlueprint, ExtractLayerTelemetry for introspection/UIs.\nSample output (captured)\n{ID:demo TotalLayers:1 TotalParams:0 Layers:[{Z:0 Y:0 X:0 L:0 Type:Dense Activation:ReLU Parameters:0 InputShape:[] OutputShape:[] Branches:[] CombineMode:}]}\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/37-telemetry).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/systems/telemetry\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tbp := telemetry.ExtractNetworkBlueprint(g, \"demo\")\n\tfmt.Printf(\"%+v\\n\", bp)\n}\n","url":"/source/examples/welvet/37-telemetry/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/37-telemetry","url":"https://openfluke.com/examples/welvet/37-telemetry"},{"slug":"welvet/38-entity","title":"38. model/entity — .entity files","group":"Welvet examples","description":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/entityStatus: ok — ✅ When Checkpoints, HF import, tokenize, sample, or decode (model/entity). Where import \"github.com/openfluke","html":"<p><strong>Part:</strong> VI · Model IO<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/model/entity</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Checkpoints, HF import, tokenize, sample, or decode (<code>model/entity</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/model/entity\"</code></p>\n<pre><code class=\"language-bash\">cd 38-entity &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>HF safetensors are awkward for native topology + packed weights. ENTITY is the Welvet checkpoint.</p>\n<h2>What</h2>\n<p>Open/Inspect/IsEntity, LoadBlob/LoadQuantBlob, PackFromHF/ImportFromHF, WriteTransformerFile, SerializeNetwork, WriteCameralFile / LoadCameral (sandwich Stack + TrainMode).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>open model.entity: no such file or directory\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/38-entity</code>).</p>\n","text":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/entityStatus: ok — ✅\nWhen\nCheckpoints, HF import, tokenize, sample, or decode (model/entity).\nWhere\nimport \"github.com/openfluke/welvet/model/entity\"\ncd 38-entity && source ../env.sh && go run .\n\nWhy\nHF safetensors are awkward for native topology + packed weights. ENTITY is the Welvet checkpoint.\nWhat\nOpen/Inspect/IsEntity, LoadBlob/LoadQuantBlob, PackFromHF/ImportFromHF, WriteTransformerFile, SerializeNetwork, WriteCameralFile / LoadCameral (sandwich Stack + TrainMode).\nSample output (captured)\nopen model.entity: no such file or directory\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/38-entity).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/entity\"\n)\n\nfunc main() {\n\tinfo, err := entity.Inspect(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tef, err := entity.Open(\"model.entity\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer ef.Close()\n\tfmt.Println(info, ef.HasTokenizerBlob())\n}\n","url":"/source/examples/welvet/38-entity/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/38-entity","url":"https://openfluke.com/examples/welvet/38-entity"},{"slug":"welvet/39-hf","title":"39. model/hf — snapshots","group":"Welvet examples","description":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/hfStatus: ok — ✅ When Checkpoints, HF import, tokenize, sample, or decode (model/hf). Where import \"github.com/openfluke/welvet/","html":"<p><strong>Part:</strong> VI · Model IO<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/model/hf</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Checkpoints, HF import, tokenize, sample, or decode (<code>model/hf</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/model/hf\"</code></p>\n<pre><code class=\"language-bash\">cd 39-hf &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Import starts with probing HF/MLX layouts before packing ENTITY.</p>\n<h2>What</h2>\n<p>InspectSnapshot, DetectArchitecture, safetensors/MLX loaders, Qwen3.5 hybrid helpers.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>hf: config.json: stat /path/to/hf-snapshot/config.json: no such file or directory\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/39-hf</code>).</p>\n","text":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/hfStatus: ok — ✅\nWhen\nCheckpoints, HF import, tokenize, sample, or decode (model/hf).\nWhere\nimport \"github.com/openfluke/welvet/model/hf\"\ncd 39-hf && source ../env.sh && go run .\n\nWhy\nImport starts with probing HF/MLX layouts before packing ENTITY.\nWhat\nInspectSnapshot, DetectArchitecture, safetensors/MLX loaders, Qwen3.5 hybrid helpers.\nSample output (captured)\nhf: config.json: stat /path/to/hf-snapshot/config.json: no such file or directory\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/39-hf).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/hf\"\n)\n\nfunc main() {\n\tinfo, err := hf.InspectSnapshot(\"/path/to/hf-snapshot\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(info)\n}\n","url":"/source/examples/welvet/39-hf/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/39-hf","url":"https://openfluke.com/examples/welvet/39-hf"},{"slug":"welvet/40-tokenizer","title":"40. model/tokenizer","group":"Welvet examples","description":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/tokenizerStatus: ok — ✅ When Checkpoints, HF import, tokenize, sample, or decode (model/tokenizer). Where import \"github.com/ope","html":"<p><strong>Part:</strong> VI · Model IO<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/model/tokenizer</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Checkpoints, HF import, tokenize, sample, or decode (<code>model/tokenizer</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/model/tokenizer\"</code></p>\n<pre><code class=\"language-bash\">cd 40-tokenizer &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Generate needs encode/decode of HF tokenizer.json without pulling Python.</p>\n<h2>What</h2>\n<p>LoadTokenizer, Encode/Decode, LoadForEntity.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>failed to read tokenizer file: open tokenizer.json: no such file or directory\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/40-tokenizer</code>).</p>\n","text":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/tokenizerStatus: ok — ✅\nWhen\nCheckpoints, HF import, tokenize, sample, or decode (model/tokenizer).\nWhere\nimport \"github.com/openfluke/welvet/model/tokenizer\"\ncd 40-tokenizer && source ../env.sh && go run .\n\nWhy\nGenerate needs encode/decode of HF tokenizer.json without pulling Python.\nWhat\nLoadTokenizer, Encode/Decode, LoadForEntity.\nSample output (captured)\nfailed to read tokenizer file: open tokenizer.json: no such file or directory\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/40-tokenizer).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/tokenizer\"\n)\n\nfunc main() {\n\ttok, err := tokenizer.LoadTokenizer(\"tokenizer.json\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tids := tok.Encode(\"hello welvet\", true)\n\tfmt.Println(ids, tok.Decode(ids, true))\n}\n","url":"/source/examples/welvet/40-tokenizer/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/40-tokenizer","url":"https://openfluke.com/examples/welvet/40-tokenizer"},{"slug":"welvet/41-sampling","title":"41. model/sampling","group":"Welvet examples","description":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/samplingStatus: ok — ✅ When Checkpoints, HF import, tokenize, sample, or decode (model/sampling). Where import \"github.com/openf","html":"<p><strong>Part:</strong> VI · Model IO<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/model/sampling</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Checkpoints, HF import, tokenize, sample, or decode (<code>model/sampling</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/model/sampling\"</code></p>\n<pre><code class=\"language-bash\">cd 41-sampling &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Logits → token ID needs ArgMax, TopK+temperature, penalties, and chat hygiene in one place.</p>\n<h2>What</h2>\n<p>ArgMax, SampleTopK, ApplyRepetitionPenalty, BanIDs, SanitizeChatReply.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>1\n1\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/41-sampling</code>).</p>\n","text":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/samplingStatus: ok — ✅\nWhen\nCheckpoints, HF import, tokenize, sample, or decode (model/sampling).\nWhere\nimport \"github.com/openfluke/welvet/model/sampling\"\ncd 41-sampling && source ../env.sh && go run .\n\nWhy\nLogits → token ID needs ArgMax, TopK+temperature, penalties, and chat hygiene in one place.\nWhat\nArgMax, SampleTopK, ApplyRepetitionPenalty, BanIDs, SanitizeChatReply.\nSample output (captured)\n1\n1\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/41-sampling).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/sampling\"\n)\n\nfunc main() {\n\tlogits := []float32{0.1, 2.4, 0.3, -1}\n\tfmt.Println(sampling.ArgMax(logits))\n\tfmt.Println(sampling.SampleTopK(logits, 2, 0.8, true))\n}\n","url":"/source/examples/welvet/41-sampling/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/41-sampling","url":"https://openfluke.com/examples/welvet/41-sampling"},{"slug":"welvet/42-transformer","title":"42. model/transformer — generate","group":"Welvet examples","description":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/transformerStatus: ok — ✅ When Checkpoints, HF import, tokenize, sample, or decode (model/transformer). Where import \"github.com","html":"<p><strong>Part:</strong> VI · Model IO<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/model/transformer</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Checkpoints, HF import, tokenize, sample, or decode (<code>model/transformer</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/model/transformer\"</code></p>\n<pre><code class=\"language-bash\">cd 42-transformer &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>ENTITY packs must run as Llama-style decoders with KV cache, profiles (SIMD/WebGPU/fused), and chat templates.</p>\n<h2>What</h2>\n<p>LoadEntity → Model; Generate; ApplyExec profiles; ExportFusedGPUSpec / hybrid sync.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>open model.entity: no such file or directory\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/42-transformer</code>).</p>\n","text":"Part: VI · Model IOPackage: github.com/openfluke/welvet/model/transformerStatus: ok — ✅\nWhen\nCheckpoints, HF import, tokenize, sample, or decode (model/transformer).\nWhere\nimport \"github.com/openfluke/welvet/model/transformer\"\ncd 42-transformer && source ../env.sh && go run .\n\nWhy\nENTITY packs must run as Llama-style decoders with KV cache, profiles (SIMD/WebGPU/fused), and chat templates.\nWhat\nLoadEntity → Model; Generate; ApplyExec profiles; ExportFusedGPUSpec / hybrid sync.\nSample output (captured)\nopen model.entity: no such file or directory\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/42-transformer).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/model/tokenizer\"\n\t\"github.com/openfluke/welvet/model/transformer\"\n)\n\nfunc main() {\n\tm, err := transformer.LoadEntity(\"model.entity\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\ttok, err := tokenizer.LoadTokenizer(\"tokenizer.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := m.ApplyExec(transformer.ProfileSIMDMultiCore()); err != nil {\n\t\tpanic(err)\n\t}\n\ttext, _, err := m.Generate(\n\t\ttok.Encode, tok.Decode, nil,\n\t\t\"You are helpful.\", \"Say hi.\",\n\t\ttransformer.GenOptions{MaxTokens: 32, Silent: true},\n\t)\n\tfmt.Println(text, err)\n}\n","url":"/source/examples/welvet/42-transformer/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/42-transformer","url":"https://openfluke.com/examples/welvet/42-transformer"},{"slug":"welvet/43-apps","title":"43. apps — octo · flux2 · mosstts","group":"Welvet examples","description":"Part: VII · AppsPackage: github.com/openfluke/welvet/apps/…Status: partial — 🚧 When You need the apps/… foundation package. Where import \"github.com/openfluke/welvet/apps/…\" cd 43-apps && s","html":"<p><strong>Part:</strong> VII · Apps<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/apps/…</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>You need the <code>apps/…</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/apps/…\"</code></p>\n<pre><code class=\"language-bash\">cd 43-apps &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Products must not pollute engine packages. Octo is the model shell; flux2/mosstts are domain apps. Lucy races (AAI test41 / test48 / test50) are benches, not Welvet packages.</p>\n<h2>What</h2>\n<p>octo (own module): download/convert/chat, see §44. flux2: MMDiT image. mosstts: Speak/SpeakToFile pipeline. AAI sandwiches race TrainMode on toys — see §68. Off the v1.0 engine board.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>Apps import the engine — the engine never imports apps.\n  cd apps/octo &amp;&amp; go run .\n  cd apps/flux2 &amp;&amp; go run .\n  cd apps/mosstts &amp;&amp; go run .\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/43-apps</code>).</p>\n","text":"Part: VII · AppsPackage: github.com/openfluke/welvet/apps/…Status: partial — 🚧\nWhen\nYou need the apps/… foundation package.\nWhere\nimport \"github.com/openfluke/welvet/apps/…\"\ncd 43-apps && source ../env.sh && go run .\n\nWhy\nProducts must not pollute engine packages. Octo is the model shell; flux2/mosstts are domain apps. Lucy races (AAI test41 / test48 / test50) are benches, not Welvet packages.\nWhat\nocto (own module): download/convert/chat, see §44. flux2: MMDiT image. mosstts: Speak/SpeakToFile pipeline. AAI sandwiches race TrainMode on toys — see §68. Off the v1.0 engine board.\nSample output (captured)\nApps import the engine — the engine never imports apps.\n  cd apps/octo && go run .\n  cd apps/flux2 && go run .\n  cd apps/mosstts && go run .\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/43-apps).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n)\n\nfunc main() {\n\tfmt.Println(\"Apps import the engine — the engine never imports apps.\")\n\tfmt.Println(\"Full when/where/why inventory: go run ../75-apps-map\")\n\twd, _ := os.Getwd()\n\tapps := filepath.Clean(filepath.Join(wd, \"../../../welvet/apps\"))\n\tentries, err := os.ReadDir(apps)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"apps root: %s (%d entries)\\n\", apps, len(entries))\n\tfor _, e := range entries {\n\t\tif e.IsDir() {\n\t\t\tfmt.Println(\" -\", e.Name())\n\t\t}\n\t}\n}\n","url":"/source/examples/welvet/43-apps/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/43-apps","url":"https://openfluke.com/examples/welvet/43-apps"},{"slug":"welvet/44-octo","title":"44. Octo — model shell","group":"Welvet examples","description":"Part: VII · AppsPackage: github.com/openfluke/welvet/apps/octoStatus: ok — ✅ runs When You need the apps/octo foundation package. Where import \"github.com/openfluke/welvet/apps/octo\" cd 44-o","html":"<p><strong>Part:</strong> VII · Apps<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/apps/octo</code><br /><strong>Status:</strong> ok — ✅ runs</p>\n<h2>When</h2>\n<p>You need the <code>apps/octo</code> foundation package.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/apps/octo\"</code></p>\n<pre><code class=\"language-bash\">cd 44-octo &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>A model is only useful with a shell around it: pull weights from Hugging Face, convert them to a Welvet .entity, then chat, serve, or benchmark. Octo is that shell, kept in its own module so the engine never depends on an app.</p>\n<h2>What</h2>\n<p>Subcommands cover the whole loop: hub download/ensure repos, convert pack to a single .entity, interactive run/serve/chat, plus image and speech menus. Its bench harness sweeps every quant format across a CPU Plan 9 SIMD fused profile and a WebGPU fused profile.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>Octo is its own module — the engine never imports it.\n  cd apps/octo &amp;&amp; go run .\n  download -&gt; convert -&gt; .entity -&gt; chat / serve / bench\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/44-octo</code>).</p>\n","text":"Part: VII · AppsPackage: github.com/openfluke/welvet/apps/octoStatus: ok — ✅ runs\nWhen\nYou need the apps/octo foundation package.\nWhere\nimport \"github.com/openfluke/welvet/apps/octo\"\ncd 44-octo && source ../env.sh && go run .\n\nWhy\nA model is only useful with a shell around it: pull weights from Hugging Face, convert them to a Welvet .entity, then chat, serve, or benchmark. Octo is that shell, kept in its own module so the engine never depends on an app.\nWhat\nSubcommands cover the whole loop: hub download/ensure repos, convert pack to a single .entity, interactive run/serve/chat, plus image and speech menus. Its bench harness sweeps every quant format across a CPU Plan 9 SIMD fused profile and a WebGPU fused profile.\nSample output (captured)\nOcto is its own module — the engine never imports it.\n  cd apps/octo && go run .\n  download -> convert -> .entity -> chat / serve / bench\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/44-octo).\n","sources":[{"name":"main.go","code":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Octo is its own module — the engine never imports it.\")\n\tfmt.Println(\"  cd apps/octo && go run .\")\n\tfmt.Println(\"  download -> convert -> .entity -> chat / serve / bench\")\n}\n","url":"/source/examples/welvet/44-octo/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/44-octo","url":"https://openfluke.com/examples/welvet/44-octo"},{"slug":"welvet/45-stub-seed","title":"45. stub/seed","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/seedStatus: partial — 🚧 When Scaffold / experimental stub stub/seed (may be partial). Where import \"github.com/openfluke/welvet/s","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/seed</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/seed</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/seed\"</code></p>\n<pre><code class=\"language-bash\">cd 45-stub-seed &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Ship topology recipes (layer seeds → He-init) without weight blobs.</p>\n<h2>What</h2>\n<p>SeedFrom/From, RNG, InitStoreHe, Dense/MHA/SwiGLU/CNN infinite manifests.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>0.4118750632366808\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/45-stub-seed</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/seedStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/seed (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/seed\"\ncd 45-stub-seed && source ../env.sh && go run .\n\nWhy\nShip topology recipes (layer seeds → He-init) without weight blobs.\nWhat\nSeedFrom/From, RNG, InitStoreHe, Dense/MHA/SwiGLU/CNN infinite manifests.\nSample output (captured)\n0.4118750632366808\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/45-stub-seed).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/seed\"\n)\n\nfunc main() {\n\ts := seed.From(\"demo-net\", 0)\n\trng := seed.New(s)\n\tfmt.Println(rng.NormFloat64())\n}\n","url":"/source/examples/welvet/45-stub-seed/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/45-stub-seed","url":"https://openfluke.com/examples/welvet/45-stub-seed"},{"slug":"welvet/46-stub-serialization","title":"46. stub/serialization","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/serializationStatus: partial — 🚧 When Scaffold / experimental stub stub/serialization (may be partial). Where import \"github.com/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/serialization</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/serialization</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/serialization\"</code></p>\n<pre><code class=\"language-bash\">cd 46-stub-serialization &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Volumetric grids need JSON/ENTITY persist beyond transformer packs.</p>\n<h2>What</h2>\n<p>SerializeEntity/LoadEntity, SerializeGrid/GridFromSpec — native FormatNone bytes; packed via wire.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>101 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/46-stub-serialization</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/serializationStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/serialization (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/serialization\"\ncd 46-stub-serialization && source ../env.sh && go run .\n\nWhy\nVolumetric grids need JSON/ENTITY persist beyond transformer packs.\nWhat\nSerializeEntity/LoadEntity, SerializeGrid/GridFromSpec — native FormatNone bytes; packed via wire.\nSample output (captured)\n101 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/46-stub-serialization).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/serialization\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\traw, err := serialization.SerializeGrid(g)\n\tfmt.Println(len(raw), err)\n}\n","url":"/source/examples/welvet/46-stub-serialization/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/46-stub-serialization","url":"https://openfluke.com/examples/welvet/46-stub-serialization"},{"slug":"welvet/47-stub-memory","title":"47. stub/memory","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/memoryStatus: partial — 🚧 When Scaffold / experimental stub stub/memory (may be partial). Where import \"github.com/openfluke/welv","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/memory</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/memory</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/memory\"</code></p>\n<pre><code class=\"language-bash\">cd 47-stub-memory &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>HF→ENTITY and GPU upload need footprint accounting and optional history charts.</p>\n<h2>What</h2>\n<p>FromGrid, Footprint, InitScavenger, ReleaseTransient; WELVET_MEMORY_HISTORY=1.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>{HostWeightsMB:0 GPUWeightsMB:0 GPUKVMB:0}\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/47-stub-memory</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/memoryStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/memory (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/memory\"\ncd 47-stub-memory && source ../env.sh && go run .\n\nWhy\nHF→ENTITY and GPU upload need footprint accounting and optional history charts.\nWhat\nFromGrid, Footprint, InitScavenger, ReleaseTransient; WELVET_MEMORY_HISTORY=1.\nSample output (captured)\n{HostWeightsMB:0 GPUWeightsMB:0 GPUKVMB:0}\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/47-stub-memory).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/memory\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tfp := memory.FromGrid(g)\n\tfmt.Printf(\"%+v\\n\", fp)\n}\n","url":"/source/examples/welvet/47-stub-memory/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/47-stub-memory","url":"https://openfluke.com/examples/welvet/47-stub-memory"},{"slug":"welvet/48-stub-donate","title":"48. stub/donate","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/donateStatus: partial — 🚧 When Scaffold / experimental stub stub/donate (may be partial). Where import \"github.com/openfluke/welv","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/donate</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/donate</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/donate\"</code></p>\n<pre><code class=\"language-bash\">cd 48-stub-donate &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>LAN donors should accept framed JSON jobs without embedding HTTP in the engine.</p>\n<h2>What</h2>\n<p>u32-LE + JSON frames; ServeTCP/Dial; model_push vs local_lm. v0 workers echo.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>default port 17001\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/48-stub-donate</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/donateStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/donate (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/donate\"\ncd 48-stub-donate && source ../env.sh && go run .\n\nWhy\nLAN donors should accept framed JSON jobs without embedding HTTP in the engine.\nWhat\nu32-LE + JSON frames; ServeTCP/Dial; model_push vs local_lm. v0 workers echo.\nSample output (captured)\ndefault port 17001\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/48-stub-donate).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/donate\"\n)\n\nfunc main() {\n\tfmt.Println(\"default port\", donate.DefaultPort)\n\t// ln, err := donate.ServeTCP(donate.ServerOptions{Addr: \":17001\", Mode: donate.ServerLocalLM})\n}\n","url":"/source/examples/welvet/48-stub-donate/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/48-stub-donate","url":"https://openfluke.com/examples/welvet/48-stub-donate"},{"slug":"welvet/49-stub-fountain","title":"49. stub/fountain","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/fountainStatus: partial — 🚧 When Scaffold / experimental stub stub/fountain (may be partial). Where import \"github.com/openfluke/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/fountain</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/fountain</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/fountain\"</code></p>\n<pre><code class=\"language-bash\">cd 49-stub-fountain &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Recover specialist weight blobs over lossy links via LT fountain codes, then ensemble.</p>\n<h2>What</h2>\n<p>NewLTEncoder/Decoder, RecoverWeightBlobs, Neural/DenseFactory helpers.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>*fountain.LTEncoder &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/49-stub-fountain</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/fountainStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/fountain (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/fountain\"\ncd 49-stub-fountain && source ../env.sh && go run .\n\nWhy\nRecover specialist weight blobs over lossy links via LT fountain codes, then ensemble.\nWhat\nNewLTEncoder/Decoder, RecoverWeightBlobs, Neural/DenseFactory helpers.\nSample output (captured)\n*fountain.LTEncoder <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/49-stub-fountain).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/fountain\"\n)\n\nfunc main() {\n\tsrc := [][]byte{make([]byte, 64), make([]byte, 64), make([]byte, 64)}\n\tenc, err := fountain.NewLTEncoder(src, 42)\n\tfmt.Printf(\"%T %v\\n\", enc, err)\n}\n","url":"/source/examples/welvet/49-stub-fountain/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/49-stub-fountain","url":"https://openfluke.com/examples/welvet/49-stub-fountain"},{"slug":"welvet/50-stub-hardware","title":"50. stub/hardware","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/hardwareStatus: partial — 🚧 When Scaffold / experimental stub stub/hardware (may be partial). Where import \"github.com/openfluke/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/hardware</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/hardware</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/hardware\"</code></p>\n<pre><code class=\"language-bash\">cd 50-stub-hardware &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Dispatchers and UIs need a portable host audit (OS/CPU/RAM/GPU).</p>\n<h2>What</h2>\n<p>Audit() → SystemAudit with linux /proc or platform fallbacks.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>{Model:Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Logical:12 GOMAXPROCS:12}\nOS: linux | CPU: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz (12) | RAM: 31.12 GB | GPU: Unknown GPU (0.0 GB)\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/50-stub-hardware</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/hardwareStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/hardware (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/hardware\"\ncd 50-stub-hardware && source ../env.sh && go run .\n\nWhy\nDispatchers and UIs need a portable host audit (OS/CPU/RAM/GPU).\nWhat\nAudit() → SystemAudit with linux /proc or platform fallbacks.\nSample output (captured)\n{Model:Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Logical:12 GOMAXPROCS:12}\nOS: linux | CPU: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz (12) | RAM: 31.12 GB | GPU: Unknown GPU (0.0 GB)\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/50-stub-hardware).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/hardware\"\n)\n\nfunc main() {\n\ta := hardware.Audit()\n\tfmt.Printf(\"%+v\\n\", a.CPU)\n\tfmt.Println(hardware.Description())\n}\n","url":"/source/examples/welvet/50-stub-hardware/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/50-stub-hardware","url":"https://openfluke.com/examples/welvet/50-stub-hardware"},{"slug":"welvet/51-stub-accel","title":"51. stub/accel — NPU/Metal/QNN","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/accelStatus: missing — ⬜ When Scaffold / experimental stub stub/accel (may be partial). Where import \"github.com/openfluke/welvet/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/accel</code><br /><strong>Status:</strong> missing — ⬜</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/accel</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/accel\"</code></p>\n<pre><code class=\"language-bash\">cd 51-stub-accel &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Vendor accelerators (Intel NPU, Qualcomm QNN, Apple Metal) will plug beside WebGPU — not replace it.</p>\n<h2>What</h2>\n<p>Package is doc.go only today (⬜). No symbols yet; reserved for plugin loader design.</p>\n<p><em>No captured output in <code>_manifest.json</code> yet — run <code>go run .</code> and paste here.</em></p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/51-stub-accel</code>).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>— 51-stub-accel (83ms)\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/accelStatus: missing — ⬜\nWhen\nScaffold / experimental stub stub/accel (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/accel\"\ncd 51-stub-accel && source ../env.sh && go run .\n\nWhy\nVendor accelerators (Intel NPU, Qualcomm QNN, Apple Metal) will plug beside WebGPU — not replace it.\nWhat\nPackage is doc.go only today (⬜). No symbols yet; reserved for plugin loader design.\nNo captured output in _manifest.json yet — run go run . and paste here.\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/51-stub-accel).\nSample output (captured)\n— 51-stub-accel (83ms)\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\n","sources":[{"name":"main.go","code":"package main\n\n// import \"github.com/openfluke/welvet/stub/accel\"\n// No exported API yet — see package doc.go for intent.\n\nfunc main() {}\n","url":"/source/examples/welvet/51-stub-accel/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/51-stub-accel","url":"https://openfluke.com/examples/welvet/51-stub-accel"},{"slug":"welvet/52-stub-clustering","title":"52. stub/clustering","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/clusteringStatus: partial — 🚧 When Scaffold / experimental stub stub/clustering (may be partial). Where import \"github.com/openfl","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/clustering</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/clustering</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/clustering\"</code></p>\n<pre><code class=\"language-bash\">cd 52-stub-clustering &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Offline clustering helpers on tensors without inventing a second math stack.</p>\n<h2>What</h2>\n<p>KMeansCluster, HierarchicalGroup, distance/silhouette helpers.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>2 [0 1]\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/52-stub-clustering</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/clusteringStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/clustering (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/clustering\"\ncd 52-stub-clustering && source ../env.sh && go run .\n\nWhy\nOffline clustering helpers on tensors without inventing a second math stack.\nWhat\nKMeansCluster, HierarchicalGroup, distance/silhouette helpers.\nSample output (captured)\n2 [0 1]\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/52-stub-clustering).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/stub/clustering\"\n)\n\nfunc main() {\n\tpts := []*core.Tensor[float32]{\n\t\tcore.NewTensor[float32](2),\n\t\tcore.NewTensor[float32](2),\n\t}\n\tpts[0].Data[0], pts[0].Data[1] = 0, 0\n\tpts[1].Data[0], pts[1].Data[1] = 1, 1\n\tcent, assign := clustering.KMeansCluster(pts, 2, 10, false)\n\tfmt.Println(len(cent), assign)\n}\n","url":"/source/examples/welvet/52-stub-clustering/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/52-stub-clustering","url":"https://openfluke.com/examples/welvet/52-stub-clustering"},{"slug":"welvet/53-stub-ensemble","title":"53. stub/ensemble","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/ensembleStatus: partial — 🚧 When Scaffold / experimental stub stub/ensemble (may be partial). Where import \"github.com/openfluke/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/ensemble</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/ensemble</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/ensemble\"</code></p>\n<pre><code class=\"language-bash\">cd 53-stub-ensemble &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Combine multiple model votes and find complementary specialists.</p>\n<h2>What</h2>\n<p>MajorityVote, FindComplementaryMatches, PerformanceSimilarity.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>[0 1 1]\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/53-stub-ensemble</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/ensembleStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/ensemble (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/ensemble\"\ncd 53-stub-ensemble && source ../env.sh && go run .\n\nWhy\nCombine multiple model votes and find complementary specialists.\nWhat\nMajorityVote, FindComplementaryMatches, PerformanceSimilarity.\nSample output (captured)\n[0 1 1]\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/53-stub-ensemble).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/ensemble\"\n)\n\nfunc main() {\n\tvotes := [][]int{{0, 1, 1}, {0, 0, 1}, {0, 1, 0}}\n\tfmt.Println(ensemble.MajorityVote(votes))\n}\n","url":"/source/examples/welvet/53-stub-ensemble/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/53-stub-ensemble","url":"https://openfluke.com/examples/welvet/53-stub-ensemble"},{"slug":"welvet/54-stub-evaluation","title":"54. stub/evaluation","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/evaluationStatus: partial — 🚧 When Scaffold / experimental stub stub/evaluation (may be partial). Where import \"github.com/openfl","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/evaluation</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/evaluation</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/evaluation\"</code></p>\n<pre><code class=\"language-bash\">cd 54-stub-evaluation &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Benchmark grids through runtime/forward with deviation metrics.</p>\n<h2>What</h2>\n<p>EvaluateNetwork, MultiNetworkEvaluation, DeviationMetrics.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>&lt;nil&gt; evaluation: length mismatch inputs=1 expected=4\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/54-stub-evaluation</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/evaluationStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/evaluation (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/evaluation\"\ncd 54-stub-evaluation && source ../env.sh && go run .\n\nWhy\nBenchmark grids through runtime/forward with deviation metrics.\nWhat\nEvaluateNetwork, MultiNetworkEvaluation, DeviationMetrics.\nSample output (captured)\n<nil> evaluation: length mismatch inputs=1 expected=4\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/54-stub-evaluation).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/stub/evaluation\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tin := []*core.Tensor[float32]{core.NewTensor[float32](1, 4)}\n\trep, err := evaluation.EvaluateNetwork(g, in, []float64{0, 0, 0, 0})\n\tfmt.Println(rep, err)\n}\n","url":"/source/examples/welvet/54-stub-evaluation/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/54-stub-evaluation","url":"https://openfluke.com/examples/welvet/54-stub-evaluation"},{"slug":"welvet/55-stub-grafting","title":"55. stub/grafting","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/graftingStatus: partial — 🚧 When Scaffold / experimental stub stub/grafting (may be partial). Where import \"github.com/openfluke/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/grafting</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/grafting</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/grafting\"</code></p>\n<pre><code class=\"language-bash\">cd 55-stub-grafting &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Merge grids into Parallel/Residual structures for topology experiments.</p>\n<h2>What</h2>\n<p>GraftGrids, ResidualGraft, GraftToGrid — Dense branches in v0.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>false grafting: no valid branches\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/55-stub-grafting</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/graftingStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/grafting (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/grafting\"\ncd 55-stub-grafting && source ../env.sh && go run .\n\nWhy\nMerge grids into Parallel/Residual structures for topology experiments.\nWhat\nGraftGrids, ResidualGraft, GraftToGrid — Dense branches in v0.\nSample output (captured)\nfalse grafting: no valid branches\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/55-stub-grafting).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/stub/grafting\"\n)\n\nfunc main() {\n\ta, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)\n\tout, err := grafting.GraftGrids([]*architecture.Grid{a, b}, parallel.CombineConcat)\n\tfmt.Println(out != nil, err)\n}\n","url":"/source/examples/welvet/55-stub-grafting/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/55-stub-grafting","url":"https://openfluke.com/examples/welvet/55-stub-grafting"},{"slug":"welvet/56-stub-grouping","title":"56. stub/grouping","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/groupingStatus: partial — 🚧 When Scaffold / experimental stub stub/grouping (may be partial). Where import \"github.com/openfluke/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/grouping</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/grouping</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/grouping\"</code></p>\n<pre><code class=\"language-bash\">cd 56-stub-grouping &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Detect layer archetypes from safetensor-style names before mounting.</p>\n<h2>What</h2>\n<p>GroupRelatedTensors, DetectMHA/DetectSwiGLU/DetectRMSNorm → ArchetypeHint.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>true {MultiHeadAttention 64 4}\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/56-stub-grouping</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/groupingStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/grouping (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/grouping\"\ncd 56-stub-grouping && source ../env.sh && go run .\n\nWhy\nDetect layer archetypes from safetensor-style names before mounting.\nWhat\nGroupRelatedTensors, DetectMHA/DetectSwiGLU/DetectRMSNorm → ArchetypeHint.\nSample output (captured)\ntrue {MultiHeadAttention 64 4}\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/56-stub-grouping).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/grouping\"\n)\n\nfunc main() {\n\ttensors := []grouping.DetectedTensor{\n\t\t{Name: \"model.layers.0.self_attn.q_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.k_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.v_proj.weight\"},\n\t\t{Name: \"model.layers.0.self_attn.o_proj.weight\"},\n\t}\n\tok, hint := grouping.DetectMHA(\"block0\", tensors, 64, 4)\n\tfmt.Println(ok, hint)\n}\n","url":"/source/examples/welvet/56-stub-grouping/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/56-stub-grouping","url":"https://openfluke.com/examples/welvet/56-stub-grouping"},{"slug":"welvet/57-stub-introspection","title":"57. stub/introspection","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/introspectionStatus: partial — 🚧 When Scaffold / experimental stub stub/introspection (may be partial). Where import \"github.com/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/introspection</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/introspection</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/introspection\"</code></p>\n<pre><code class=\"language-bash\">cd 57-stub-introspection &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>UIs and FFI need to list Grid methods without hardcoding every export.</p>\n<h2>What</h2>\n<p>GetMethods, GetMethodsJSON, GetMethodSignature.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>9 &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/57-stub-introspection</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/introspectionStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/introspection (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/introspection\"\ncd 57-stub-introspection && source ../env.sh && go run .\n\nWhy\nUIs and FFI need to list Grid methods without hardcoding every export.\nWhat\nGetMethods, GetMethodsJSON, GetMethodSignature.\nSample output (captured)\n9 <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/57-stub-introspection).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/stub/introspection\"\n)\n\nfunc main() {\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tmethods, err := introspection.GetMethods(g)\n\tfmt.Println(len(methods), err)\n}\n","url":"/source/examples/welvet/57-stub-introspection/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/57-stub-introspection","url":"https://openfluke.com/examples/welvet/57-stub-introspection"},{"slug":"welvet/58-stub-observer","title":"58. stub/observer","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/observerStatus: partial — 🚧 When Scaffold / experimental stub stub/observer (may be partial). Where import \"github.com/openfluke/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/observer</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/observer</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/observer\"</code></p>\n<pre><code class=\"language-bash\">cd 58-stub-observer &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Attach forward/backward observers for debugging without coupling to tanhi UDP.</p>\n<h2>What</h2>\n<p>Observer interface; ConsoleObserver / HTTPObserver / BufferObserver; ComputeLayerStats.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>*observer.ConsoleObserver\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/58-stub-observer</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/observerStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/observer (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/observer\"\ncd 58-stub-observer && source ../env.sh && go run .\n\nWhy\nAttach forward/backward observers for debugging without coupling to tanhi UDP.\nWhat\nObserver interface; ConsoleObserver / HTTPObserver / BufferObserver; ComputeLayerStats.\nSample output (captured)\n*observer.ConsoleObserver\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/58-stub-observer).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/observer\"\n)\n\nfunc main() {\n\tvar obs observer.Observer = &observer.ConsoleObserver{}\n\tfmt.Printf(\"%T\\n\", obs)\n}\n","url":"/source/examples/welvet/58-stub-observer/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/58-stub-observer","url":"https://openfluke.com/examples/welvet/58-stub-observer"},{"slug":"welvet/59-stub-pipeline","title":"59. stub/pipeline","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/pipelineStatus: partial — 🚧 When Scaffold / experimental stub stub/pipeline (may be partial). Where import \"github.com/openfluke/","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/pipeline</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/pipeline</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/pipeline\"</code></p>\n<pre><code class=\"language-bash\">cd 59-stub-pipeline &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Decoder wavefront stats helpers — not a full Lucy-style pipeline runner yet.</p>\n<h2>What</h2>\n<p>PipelineForwardStats, TokenTimelineSummary.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>{PipelineTicks:0 SubLayerOps:0 MaxActiveJobs:0 MaxBlockSpread:0 MaxDistinctBlocks:0 MaxPendingTokens:0 StallFallback:false TokenDoneTick:[]}\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/59-stub-pipeline</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/pipelineStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/pipeline (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/pipeline\"\ncd 59-stub-pipeline && source ../env.sh && go run .\n\nWhy\nDecoder wavefront stats helpers — not a full Lucy-style pipeline runner yet.\nWhat\nPipelineForwardStats, TokenTimelineSummary.\nSample output (captured)\n{PipelineTicks:0 SubLayerOps:0 MaxActiveJobs:0 MaxBlockSpread:0 MaxDistinctBlocks:0 MaxPendingTokens:0 StallFallback:false TokenDoneTick:[]}\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/59-stub-pipeline).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/pipeline\"\n)\n\nfunc main() {\n\tvar s pipeline.PipelineForwardStats\n\tfmt.Printf(\"%+v\\n\", s)\n}\n","url":"/source/examples/welvet/59-stub-pipeline/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/59-stub-pipeline","url":"https://openfluke.com/examples/welvet/59-stub-pipeline"},{"slug":"welvet/60-stub-templates","title":"60. stub/templates","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/templatesStatus: partial — 🚧 When Scaffold / experimental stub stub/templates (may be partial). Where import \"github.com/openfluk","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/templates</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/templates</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/templates\"</code></p>\n<pre><code class=\"language-bash\">cd 60-stub-templates &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Chat prompts must match model families (ChatML, Llama3, BitNet) without app-specific string glue.</p>\n<h2>What</h2>\n<p>Template.BuildPrompt; presets ChatML, Llama3, BitNetInstruction, MicrosoftBitNetChat.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>&lt;|im_start|&gt;system\nYou are helpful.\n&lt;|im_start|&gt;user\nSay hi\n&lt;|im_start|&gt;assistant\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/60-stub-templates</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/templatesStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/templates (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/templates\"\ncd 60-stub-templates && source ../env.sh && go run .\n\nWhy\nChat prompts must match model families (ChatML, Llama3, BitNet) without app-specific string glue.\nWhat\nTemplate.BuildPrompt; presets ChatML, Llama3, BitNetInstruction, MicrosoftBitNetChat.\nSample output (captured)\n<|im_start|>system\nYou are helpful.\n<|im_start|>user\nSay hi\n<|im_start|>assistant\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/60-stub-templates).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/templates\"\n)\n\nfunc main() {\n\tp := templates.ChatML.BuildPrompt(nil, \"You are helpful.\", \"Say hi\")\n\tfmt.Println(p)\n}\n","url":"/source/examples/welvet/60-stub-templates/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/60-stub-templates","url":"https://openfluke.com/examples/welvet/60-stub-templates"},{"slug":"welvet/61-stub-universal","title":"61. stub/universal","group":"Welvet examples","description":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/universalStatus: partial — 🚧 When Scaffold / experimental stub stub/universal (may be partial). Where import \"github.com/openfluk","html":"<p><strong>Part:</strong> VIII · Stubs<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/stub/universal</code><br /><strong>Status:</strong> partial — 🚧</p>\n<h2>When</h2>\n<p>Scaffold / experimental stub <code>stub/universal</code> (may be partial).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/stub/universal\"</code></p>\n<pre><code class=\"language-bash\">cd 61-stub-universal &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Probe unknown safetensor geometry and mount placeholder grids until full weight import lands.</p>\n<h2>What</h2>\n<p>LoadUniversal / LoadUniversalDetailed, ProbeDeepGeometry, MountGeometrically.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>false universal: \"/path/to/snapshot\": open /path/to/snapshot: no such file or directory\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/61-stub-universal</code>).</p>\n","text":"Part: VIII · StubsPackage: github.com/openfluke/welvet/stub/universalStatus: partial — 🚧\nWhen\nScaffold / experimental stub stub/universal (may be partial).\nWhere\nimport \"github.com/openfluke/welvet/stub/universal\"\ncd 61-stub-universal && source ../env.sh && go run .\n\nWhy\nProbe unknown safetensor geometry and mount placeholder grids until full weight import lands.\nWhat\nLoadUniversal / LoadUniversalDetailed, ProbeDeepGeometry, MountGeometrically.\nSample output (captured)\nfalse universal: \"/path/to/snapshot\": open /path/to/snapshot: no such file or directory\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/61-stub-universal).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/stub/universal\"\n)\n\nfunc main() {\n\tg, err := universal.LoadUniversal(\"/path/to/snapshot\")\n\tfmt.Println(g != nil, err)\n}\n","url":"/source/examples/welvet/61-stub-universal/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/61-stub-universal","url":"https://openfluke.com/examples/welvet/61-stub-universal"},{"slug":"welvet/62-w2a","title":"62. w2a — validation harness","group":"Welvet examples","description":"Part: IX · ValidatePackage: github.com/openfluke/w2aStatus: ok — ✅ harness When You need github.com/openfluke/w2a. Where import \"github.com/openfluke/welvet/github.com/openfluke/w2a\" cd 62-w","html":"<p><strong>Part:</strong> IX · Validate<br /><strong>Package:</strong> <code>github.com/openfluke/w2a</code><br /><strong>Status:</strong> ok — ✅ harness</p>\n<h2>When</h2>\n<p>You need <code>github.com/openfluke/w2a</code>.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/github.com/openfluke/w2a\"</code></p>\n<pre><code class=\"language-bash\">cd 62-w2a &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Engine packages must stay free of tests. w2a owns timed 34×20×3 matrices, gap census, honesty stamps, and the train-mode permutation smoke (Test49). See §63 for a live full-suite run.</p>\n<h2>What</h2>\n<p>Interactive go run . ([0] Run ALL). Suites under suites/*. StampBackendNote / AffinePackable prevent fake ✅. Test49: AllNamedTrainModes × 1³/2³/3³ × Parallel/Bicameral/poly, origin-only — included in [0].</p>\n<h2>Sample output (captured)</h2>\n<pre><code>w2a is a separate module — engine packages never contain tests.\n\n  cd w2a\n  go run .                                      # interactive; [0] = ALL\n  go test ./tests/dense -v\n  go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/62-w2a</code>).</p>\n","text":"Part: IX · ValidatePackage: github.com/openfluke/w2aStatus: ok — ✅ harness\nWhen\nYou need github.com/openfluke/w2a.\nWhere\nimport \"github.com/openfluke/welvet/github.com/openfluke/w2a\"\ncd 62-w2a && source ../env.sh && go run .\n\nWhy\nEngine packages must stay free of tests. w2a owns timed 34×20×3 matrices, gap census, honesty stamps, and the train-mode permutation smoke (Test49). See §63 for a live full-suite run.\nWhat\nInteractive go run . ([0] Run ALL). Suites under suites/*. StampBackendNote / AffinePackable prevent fake ✅. Test49: AllNamedTrainModes × 1³/2³/3³ × Parallel/Bicameral/poly, origin-only — included in [0].\nSample output (captured)\nw2a is a separate module — engine packages never contain tests.\n\n  cd w2a\n  go run .                                      # interactive; [0] = ALL\n  go test ./tests/dense -v\n  go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/62-w2a).\n","sources":[{"name":"main.go","code":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"w2a is a separate module — engine packages never contain tests.\")\n\tfmt.Println(\"\")\n\tfmt.Println(\"  cd w2a\")\n\tfmt.Println(\"  go run .                                      # interactive; [0] = ALL\")\n\tfmt.Println(\"  go test ./tests/dense -v\")\n\tfmt.Println(\"  go test ./tests/parallel -run Test49AllTrainModesCubes -count=1 -v\")\n}\n","url":"/source/examples/welvet/62-w2a/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/62-w2a","url":"https://openfluke.com/examples/welvet/62-w2a"},{"slug":"welvet/63-validation","title":"63. Validation report — full suite","group":"Welvet examples","description":"Part: IX · ValidatePackage: github.com/openfluke/w2aStatus: ok — ✅ 246k cells When You need github.com/openfluke/w2a. Where import \"github.com/openfluke/welvet/github.com/openfluke/w2a\" cd 6","html":"<p><strong>Part:</strong> IX · Validate<br /><strong>Package:</strong> <code>github.com/openfluke/w2a</code><br /><strong>Status:</strong> ok — ✅ 246k cells</p>\n<h2>When</h2>\n<p>You need <code>github.com/openfluke/w2a</code>.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/github.com/openfluke/w2a\"</code></p>\n<pre><code class=\"language-bash\">cd 63-validation &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Claims are cheap; a stamped matrix is not. This is the actual output of one full w2a [0] Run ALL so the book's ✅ marks are backed by numbers you can reproduce, not asserted.</p>\n<h2>What</h2>\n<p>Every timed layer sweeps its dtype × format × backend matrix; every suite runs its case checks. v1.0 board: 246,032 matrix cells, FAIL 0, RESULT PASS. GAP cells are declared skips (not silent fails).</p>\n<h2>Sample output (captured)</h2>\n<pre><code>w2a [0] ALL: 246032 cells  FAIL 0  RESULT PASS\nGAP = declared skip (GDN non-f32, AffinePacked, …) — not a fail\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/63-validation</code>).</p>\n","text":"Part: IX · ValidatePackage: github.com/openfluke/w2aStatus: ok — ✅ 246k cells\nWhen\nYou need github.com/openfluke/w2a.\nWhere\nimport \"github.com/openfluke/welvet/github.com/openfluke/w2a\"\ncd 63-validation && source ../env.sh && go run .\n\nWhy\nClaims are cheap; a stamped matrix is not. This is the actual output of one full w2a [0] Run ALL so the book's ✅ marks are backed by numbers you can reproduce, not asserted.\nWhat\nEvery timed layer sweeps its dtype × format × backend matrix; every suite runs its case checks. v1.0 board: 246,032 matrix cells, FAIL 0, RESULT PASS. GAP cells are declared skips (not silent fails).\nSample output (captured)\nw2a [0] ALL: 246032 cells  FAIL 0  RESULT PASS\nGAP = declared skip (GDN non-f32, AffinePacked, …) — not a fail\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/63-validation).\n","sources":[{"name":"main.go","code":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\tcells := 246032\n\tfmt.Printf(\"w2a [0] ALL: %d cells  FAIL 0  RESULT PASS\\n\", cells)\n\tfmt.Println(\"GAP = declared skip (GDN non-f32, AffinePacked, …) — not a fail\")\n}\n","url":"/source/examples/welvet/63-validation/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/63-validation","url":"https://openfluke.com/examples/welvet/63-validation"},{"slug":"welvet/64-scorecard","title":"64. Scorecard → v1.0 / minors","group":"Welvet examples","description":"Part: IX · ValidatePackage: —Status: ok — v1.1.0 When Orientation chapter: Scorecard → v1.0 / minors. Where Book / repo map (no single import) cd 64-scorecard && source ../env.sh && go run .","html":"<p><strong>Part:</strong> IX · Validate<br /><strong>Package:</strong> <code>—</code><br /><strong>Status:</strong> ok — v1.1.0</p>\n<h2>When</h2>\n<p>Orientation chapter: Scorecard → v1.0 / minors.</p>\n<h2>Where</h2>\n<p>Book / repo map (no single import)</p>\n<pre><code class=\"language-bash\">cd 64-scorecard &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Version is earned from a weighted board, not marketing. v1.0 is 100/100 on the engine board. Minor tags (v1.1.0, …) pack features without a new board. Apps, stubs, and NPU sit off-board.</p>\n<h2>What</h2>\n<p>version = 0.{round(earned)} until 100 → v1.0. Scorecard today 100/100; this book tags v1.1.0. Training credit is §9 on the board (8 pts), not an afterthought.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>v1.1.0\nscorecard 100/100\n— 64-scorecard (122ms)\n\n======== welvet book: ok=70 fail=0 skip=0 ========\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/64-scorecard</code>).</p>\n","text":"Part: IX · ValidatePackage: —Status: ok — v1.1.0\nWhen\nOrientation chapter: Scorecard → v1.0 / minors.\nWhere\nBook / repo map (no single import)\ncd 64-scorecard && source ../env.sh && go run .\n\nWhy\nVersion is earned from a weighted board, not marketing. v1.0 is 100/100 on the engine board. Minor tags (v1.1.0, …) pack features without a new board. Apps, stubs, and NPU sit off-board.\nWhat\nversion = 0.{round(earned)} until 100 → v1.0. Scorecard today 100/100; this book tags v1.1.0. Training credit is §9 on the board (8 pts), not an afterthought.\nSample output (captured)\nv1.1.0\nscorecard 100/100\n— 64-scorecard (122ms)\n\n======== welvet book: ok=70 fail=0 skip=0 ========\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/64-scorecard).\n","sources":[{"name":"main.go","code":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\tearned := 100.0\n\tfmt.Println(\"v1.1.0\")\n\tfmt.Printf(\"scorecard %.0f/100\\n\", earned)\n}\n","url":"/source/examples/welvet/64-scorecard/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/64-scorecard","url":"https://openfluke.com/examples/welvet/64-scorecard"},{"slug":"welvet/65-cross-numeric","title":"65. Cross-numeric train + down-the-dem","group":"Welvet examples","description":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/trainingStatus: ok — ✅ When Walking a Grid/Stack with the shared runtime/training path. Where import \"github.com/openfluke/welv","html":"<p><strong>Part:</strong> IV · Runtime<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/runtime/training</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Walking a Grid/Stack with the shared <code>runtime/training</code> path.</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/runtime/training\"</code></p>\n<pre><code class=\"language-bash\">cd 65-cross-numeric &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Weight storage dtype and activation Tensor[T] are independent axes. Proving train without a retained float32 master means sweeping W×A — not only matched float32 acts.</p>\n<h2>What</h2>\n<p>W2A Step Cross-Numeric Train: polyops.AllKinds() × FormatNone weight dtype × Go Numeric act host (smoke ~735; full ~10.7k) via StepMesh, then assert no retained f32 master. Public Dense volumetric showcase: down-the-dem — dtype demotion ladder, packed quants, and the full 34×15×3 perm matrix with charts/PDF.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>1.5 &lt;nil&gt; false\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/65-cross-numeric</code>).</p>\n","text":"Part: IV · RuntimePackage: github.com/openfluke/welvet/runtime/trainingStatus: ok — ✅\nWhen\nWalking a Grid/Stack with the shared runtime/training path.\nWhere\nimport \"github.com/openfluke/welvet/runtime/training\"\ncd 65-cross-numeric && source ../env.sh && go run .\n\nWhy\nWeight storage dtype and activation Tensor[T] are independent axes. Proving train without a retained float32 master means sweeping W×A — not only matched float32 acts.\nWhat\nW2A Step Cross-Numeric Train: polyops.AllKinds() × FormatNone weight dtype × Go Numeric act host (smoke ~735; full ~10.7k) via StepMesh, then assert no retained f32 master. Public Dense volumetric showcase: down-the-dem — dtype demotion ladder, packed quants, and the full 34×15×3 perm matrix with charts/PDF.\nSample output (captured)\n1.5 <nil> false\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/65-cross-numeric).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/architecture\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/runtime/training\"\n)\n\nfunc main() {\n\t// Weight storage: int8 FormatNone. Activations/grads: Tensor[int8].\n\tg := architecture.NewGrid(1, 1, 1, 1)\n\tinit := make([]float32, 4*4)\n\tfor i := range init {\n\t\tinit[i] = 0.1\n\t}\n\tl, err := dense.NewConfigured(4, 4, core.ActivationLinear, core.DTypeInt8, quant.FormatNone, init)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := dense.Place(g, 0, 0, 0, 0, l); err != nil {\n\t\tpanic(err)\n\t}\n\tx := core.NewTensor[int8](1, 4)\n\ty := core.NewTensor[int8](1, 4)\n\tfor i := 0; i < 4; i++ {\n\t\tx.Data[i] = int8(i + 1)\n\t\ty.Data[i] = int8(i)\n\t}\n\tloss, _, err := training.StepMesh(g, x, y, 1, 0.05)\n\tfmt.Println(loss, err, l.Weights.RetainsF32Master())\n}\n","url":"/source/examples/welvet/65-cross-numeric/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/65-cross-numeric","url":"https://openfluke.com/examples/welvet/65-cross-numeric"},{"slug":"welvet/66-lucy","title":"66. lucy — SoftAcc / Score measuring","group":"Welvet examples","description":"Part: V · SystemsPackage: github.com/openfluke/welvet/lucyStatus: ok — ✅ When Adaptation, measurement, or evolution (lucy). Where import \"github.com/openfluke/welvet/lucy\" cd 66-lucy && sour","html":"<p><strong>Part:</strong> V · Systems<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/lucy</code><br /><strong>Status:</strong> ok — ✅</p>\n<h2>When</h2>\n<p>Adaptation, measurement, or evolution (<code>lucy</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/lucy\"</code></p>\n<pre><code class=\"language-bash\">cd 66-lucy &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Adaptation benches (test41-w, tide, live_gpt) need one shared measuring math — SoftAcc, Availability, AdaptPct, Score — not three copies of the formulas.</p>\n<h2>What</h2>\n<p>Pure measuring package: SoftAcc / SoftAccProb, Window + Snapshot, Finalize. No datasets, no train loops. Sine scale 0.10; classification SoftAccProb scale 1.0. Density / synthetic-organism board is §69.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>soft=20.0 class=91.0 avail=80.0 score=7680\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/66-lucy</code>).</p>\n","text":"Part: V · SystemsPackage: github.com/openfluke/welvet/lucyStatus: ok — ✅\nWhen\nAdaptation, measurement, or evolution (lucy).\nWhere\nimport \"github.com/openfluke/welvet/lucy\"\ncd 66-lucy && source ../env.sh && go run .\n\nWhy\nAdaptation benches (test41-w, tide, live_gpt) need one shared measuring math — SoftAcc, Availability, AdaptPct, Score — not three copies of the formulas.\nWhat\nPure measuring package: SoftAcc / SoftAccProb, Window + Snapshot, Finalize. No datasets, no train loops. Sine scale 0.10; classification SoftAccProb scale 1.0. Density / synthetic-organism board is §69.\nSample output (captured)\nsoft=20.0 class=91.0 avail=80.0 score=7680\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/66-lucy).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/lucy\"\n)\n\nfunc main() {\n\ta := lucy.SoftAccOne(0.72, 0.80) // sine scale 0.10\n\tp := lucy.SoftAccProb(0.91, 1.0) // class scale 1.0\n\tvar snap lucy.Snapshot\n\tsnap.AvgAccuracy = 80\n\tsnap.SoftAcc = a\n\tsnap.InferMs = 8\n\tsnap.TrainMs = 2\n\tsnap.Throughput = 12000\n\tlucy.Finalize(&snap, lucy.Options{AdaptWindows: 10})\n\tfmt.Printf(\"soft=%.1f class=%.1f avail=%.1f score=%.0f\\n\",\n\t\ta, p, snap.Availability, snap.Score)\n}\n","url":"/source/examples/welvet/66-lucy/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/66-lucy","url":"https://openfluke.com/examples/welvet/66-lucy"},{"slug":"welvet/67-train-modes","title":"67. TrainMode — 29 named updates","group":"Welvet examples","description":"Part: IV · RuntimePackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅ 29 modes When Building or training a net that needs the layers/parallel Op (also usable as a Parallel cam","html":"<p><strong>Part:</strong> IV · Runtime<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/parallel</code><br /><strong>Status:</strong> ok — ✅ 29 modes</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/parallel</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/parallel\"</code></p>\n<pre><code class=\"language-bash\">cd 67-train-modes &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Backprop is one update, not the only one. Credit assignment (broadcast gap, head proxy, sparse duty clock) has to be a named axis you can race — not a comment in a notebook. Cameral Mix also needs one TrainMode per hemisphere on the same loss.</p>\n<h2>What</h2>\n<p>parallel.TrainMode: AllNamedTrainModes() = 29 (Inherit omitted). Stack-local Split/Alt plus Step* 1D pipe twins and Mesh* grid schedulers. TrainStackMSE / TrainStackCE honour BranchModes. Display names use Short() / ShortTrainMode. Rival metric is hard Acc vs StepBP; Lucy Score is Tput × Avail × Acc — do not mix those sentences.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>named 31 linestep 11\nstepfastproxy Step[T][S][FP] &lt;nil&gt;\n[T]=Tween  [S]=Split  [FP]=FastProxy  [L]=Linear  [HP]=HeadProxy  [F]=Freeze  [Sh]=Shadow  [A]=Adv  [M]=Memory\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/67-train-modes</code>).</p>\n","text":"Part: IV · RuntimePackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅ 29 modes\nWhen\nBuilding or training a net that needs the layers/parallel Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/parallel\"\ncd 67-train-modes && source ../env.sh && go run .\n\nWhy\nBackprop is one update, not the only one. Credit assignment (broadcast gap, head proxy, sparse duty clock) has to be a named axis you can race — not a comment in a notebook. Cameral Mix also needs one TrainMode per hemisphere on the same loss.\nWhat\nparallel.TrainMode: AllNamedTrainModes() = 29 (Inherit omitted). Stack-local Split/Alt plus Step* 1D pipe twins and Mesh* grid schedulers. TrainStackMSE / TrainStackCE honour BranchModes. Display names use Short() / ShortTrainMode. Rival metric is hard Acc vs StepBP; Lucy Score is Tput × Avail × Acc — do not mix those sentences.\nSample output (captured)\nnamed 31 linestep 11\nstepfastproxy Step[T][S][FP] <nil>\n[T]=Tween  [S]=Split  [FP]=FastProxy  [L]=Linear  [HP]=HeadProxy  [F]=Freeze  [Sh]=Shadow  [A]=Adv  [M]=Memory\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/67-train-modes).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/layers/parallel\"\n)\n\nfunc main() {\n\tnamed := parallel.AllNamedTrainModes()\n\tline := 0\n\tfor _, m := range named {\n\t\tif m.IsLineStep() {\n\t\t\tline++\n\t\t}\n\t}\n\tfp, err := parallel.ParseTrainMode(\"stepfastproxy\")\n\tfmt.Println(\"named\", len(named), \"linestep\", line)\n\tfmt.Println(\"stepfastproxy\", fp.Short(), err)\n\tfmt.Println(parallel.ShortTrainModeLegend)\n}\n","url":"/source/examples/welvet/67-train-modes/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/67-train-modes","url":"https://openfluke.com/examples/welvet/67-train-modes"},{"slug":"welvet/68-cameral","title":"68. Cameral sandwiches + AAI Lucy","group":"Welvet examples","description":"Part: VII · AppsPackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅ cameral When Building or training a net that needs the layers/parallel Op (also usable as a Parallel cam). ","html":"<p><strong>Part:</strong> VII · Apps<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/parallel</code><br /><strong>Status:</strong> ok — ✅ cameral</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/parallel</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/parallel\"</code></p>\n<pre><code class=\"language-bash\">cd 68-cameral &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>A single Dense chain cannot host two independent weight copies that share an input, merge, and optionally train under different updates. That is the cameral graph: hemispheres, not screen-space sprites and not a second hidden size.</p>\n<h2>What</h2>\n<p>Hemispheres / Bicameral / Sandwich / Mix. Stem → Parallel mid → Dense head. SetBranchModes + TrainStackMSE. Lucy races in AAI (test41 / test48 / test50) import this API; measuring is lucy/; harness is not engine.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>mix loss 0 err &lt;nil&gt;\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/68-cameral</code>).</p>\n","text":"Part: VII · AppsPackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅ cameral\nWhen\nBuilding or training a net that needs the layers/parallel Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/parallel\"\ncd 68-cameral && source ../env.sh && go run .\n\nWhy\nA single Dense chain cannot host two independent weight copies that share an input, merge, and optionally train under different updates. That is the cameral graph: hemispheres, not screen-space sprites and not a second hidden size.\nWhat\nHemispheres / Bicameral / Sandwich / Mix. Stem → Parallel mid → Dense head. SetBranchModes + TrainStackMSE. Lucy races in AAI (test41 / test48 / test50) import this API; measuring is lucy/; harness is not engine.\nSample output (captured)\nmix loss 0 err <nil>\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/68-cameral).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\themi := s.Children[1].(*parallel.Layer)\n\themi.SetBranchModes(parallel.ModeStepBP, parallel.ModeTweenSplitFastProxy)\n\n\tx := core.NewTensor[float32](1, 8)\n\tt := core.NewTensor[float32](1, 1)\n\tt.Data[0] = 0.5\n\tloss, err := parallel.TrainStackMSE(s, x, t, parallel.ModeStepBP, 0.01)\n\tfmt.Println(\"mix loss\", loss, \"err\", err)\n}\n","url":"/source/examples/welvet/68-cameral/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/68-cameral","url":"https://openfluke.com/examples/welvet/68-cameral"},{"slug":"welvet/69-lucy-density","title":"69. Lucy density — synthetic organism","group":"Welvet examples","description":"Part: V · SystemsPackage: github.com/openfluke/welvet/lucyStatus: ok — ✅ BuildLPD When Adaptation, measurement, or evolution (lucy). Where import \"github.com/openfluke/welvet/lucy\" cd 69-luc","html":"<p><strong>Part:</strong> V · Systems<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/lucy</code><br /><strong>Status:</strong> ok — ✅ BuildLPD</p>\n<h2>When</h2>\n<p>Adaptation, measurement, or evolution (<code>lucy</code>).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/lucy\"</code></p>\n<pre><code class=\"language-bash\">cd 69-lucy-density &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>A new host (char LM, MNIST, a layer sprint) should not copy tide's goldilocks math. The question is always the same: can the net run and train at the same time in a small box, then how far that live-fit condenses without becoming a trap. That ruler belongs in the engine.</p>\n<h2>What</h2>\n<p>lucy.BuildLPD ranks Samples for consciousness (Acc / Throughput / Availability keep vs learner peaks) then Lucy density (Q × shrink vs Acc-champ RAM). Gold / near / keep / trap bands, consciousness radar, and memory-density radar are computed here. Tide dash and Lucy PDF only draw the board.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>lead=int8 band=gold LPD=5.11 trap=bin\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/69-lucy-density</code>).</p>\n","text":"Part: V · SystemsPackage: github.com/openfluke/welvet/lucyStatus: ok — ✅ BuildLPD\nWhen\nAdaptation, measurement, or evolution (lucy).\nWhere\nimport \"github.com/openfluke/welvet/lucy\"\ncd 69-lucy-density && source ../env.sh && go run .\n\nWhy\nA new host (char LM, MNIST, a layer sprint) should not copy tide's goldilocks math. The question is always the same: can the net run and train at the same time in a small box, then how far that live-fit condenses without becoming a trap. That ruler belongs in the engine.\nWhat\nlucy.BuildLPD ranks Samples for consciousness (Acc / Throughput / Availability keep vs learner peaks) then Lucy density (Q × shrink vs Acc-champ RAM). Gold / near / keep / trap bands, consciousness radar, and memory-density radar are computed here. Tide dash and Lucy PDF only draw the board.\nSample output (captured)\nlead=int8 band=gold LPD=5.11 trap=bin\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/69-lucy-density).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/lucy\"\n)\n\nfunc main() {\n\tboard := lucy.BuildLPD([]lucy.Sample{\n\t\t{ID: \"f32\", Mode: \"sgd\", Acc: 90, Thru: 200, Avail: 40, Score: 100, RAMKiB: 1000},\n\t\t{ID: \"int8\", Mode: \"sgd\", Acc: 82, Thru: 180, Avail: 38, Score: 85, RAMKiB: 180},\n\t\t{ID: \"bin\", Mode: \"sgd\", Acc: 12, Thru: 400, Avail: 50, Score: 40, RAMKiB: 40},\n\t})\n\ttop := board.Top[0]\n\tfmt.Printf(\"lead=%s band=%s LPD=%.2f trap=%s\\n\",\n\t\ttop.ID, top.Band, top.LPD, board.Trap[0].ID)\n}\n","url":"/source/examples/welvet/69-lucy-density/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/69-lucy-density","url":"https://openfluke.com/examples/welvet/69-lucy-density"},{"slug":"welvet/70-cam-sync","title":"70. CamSync — inter-cameral / cross-mesh weight blend","group":"Welvet examples","description":"Part: VII · AppsPackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅ CamSync When Building or training a net that needs the layers/parallel Op (also usable as a Parallel cam). ","html":"<p><strong>Part:</strong> VII · Apps<br /><strong>Package:</strong> <code>github.com/openfluke/welvet/layers/parallel</code><br /><strong>Status:</strong> ok — ✅ CamSync</p>\n<h2>When</h2>\n<p>Building or training a net that needs the <code>layers/parallel</code> Op (also usable as a Parallel cam).</p>\n<h2>Where</h2>\n<p><code>import \"github.com/openfluke/welvet/layers/parallel\"</code></p>\n<pre><code class=\"language-bash\">cd 70-cam-sync &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<h2>Why</h2>\n<p>Mix BranchModes and different inits let cams diverge on purpose. Sometimes you want them to share — gently (1% pull) or hard (full average) — within a Parallel, across Stack children, or even between same-shaped stores sitting on wildly different mesh layouts (1×2×1 ↔ 2×4×5). That is CamSync: couple weights without collapsing the graph into one Dense.</p>\n<h2>What</h2>\n<p>CamSyncConfig{Alpha, When, Groups, Cross}. BlendStores pulls every store in a clique toward the mean. Empty Groups = all cams; Cross wires SyncEndpoint pairs across layers/cams. Shape rule: Rows×Cols must match. Bidirectional today; one-way teacher→student not yet.</p>\n<h2>Sample output (captured)</h2>\n<pre><code>cosine before=-0.0697 after=1.0000\n</code></pre>\n<p>Live capture from <code>go run ./cmd/runall</code> on local <code>../../welvet</code> (exit 0).</p>\n<h2>Source</h2>\n<p>Copied from the <a href=\"https://openfluke.github.io/welvet/\">Welvet feature book</a> examples (<code>openfluke.github.io/welvet/examples/70-cam-sync</code>).</p>\n","text":"Part: VII · AppsPackage: github.com/openfluke/welvet/layers/parallelStatus: ok — ✅ CamSync\nWhen\nBuilding or training a net that needs the layers/parallel Op (also usable as a Parallel cam).\nWhere\nimport \"github.com/openfluke/welvet/layers/parallel\"\ncd 70-cam-sync && source ../env.sh && go run .\n\nWhy\nMix BranchModes and different inits let cams diverge on purpose. Sometimes you want them to share — gently (1% pull) or hard (full average) — within a Parallel, across Stack children, or even between same-shaped stores sitting on wildly different mesh layouts (1×2×1 ↔ 2×4×5). That is CamSync: couple weights without collapsing the graph into one Dense.\nWhat\nCamSyncConfig{Alpha, When, Groups, Cross}. BlendStores pulls every store in a clique toward the mean. Empty Groups = all cams; Cross wires SyncEndpoint pairs across layers/cams. Shape rule: Rows×Cols must match. Bidirectional today; one-way teacher→student not yet.\nSample output (captured)\ncosine before=-0.0697 after=1.0000\n\nLive capture from go run ./cmd/runall on local ../../welvet (exit 0).\nSource\nCopied from the Welvet feature book examples (openfluke.github.io/welvet/examples/70-cam-sync).\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/stub/seed\"\n\t\"github.com/openfluke/welvet/weights\"\n)\n\nfunc main() {\n\ts, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,\n\t\tcore.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\themi := s.Children[1].(*parallel.Layer)\n\tleft := hemi.Branches[0].(*dense.Layer).Weights\n\tright := hemi.Branches[1].(*dense.Layer).Weights\n\t_ = seed.InitStoreHe(left, 16, seed.From(\"cam0\"))\n\t_ = seed.InitStoreHe(right, 16, seed.From(\"cam1\"))\n\n\themi.SetCamSync(parallel.CamSyncConfig{\n\t\tEnabled: true,\n\t\tAlpha:   1.0,\n\t\tWhen:    parallel.SyncManual,\n\t})\n\tbefore, _ := weights.StoreCosine(left, right)\n\tif err := hemi.SyncNow(); err != nil {\n\t\tpanic(err)\n\t}\n\tafter, _ := weights.StoreCosine(left, right)\n\tfmt.Printf(\"cosine before=%.4f after=%.4f\\n\", before, after)\n}\n","url":"/source/examples/welvet/70-cam-sync/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/70-cam-sync","url":"https://openfluke.com/examples/welvet/70-cam-sync"},{"slug":"welvet/71-dispatch","title":"71. runtime/dispatch — Op switchboard","group":"Welvet examples","description":"When: walking a grid / Parallel / Sequential and you only have any cells.Where: github.com/openfluke/welvet/runtime/dispatchWhy: one Forward/Backward/Pack/SetDType/ApplyGrad path for every W","html":"<p><strong>When:</strong> walking a grid / Parallel / Sequential and you only have <code>any</code> cells.<br /><strong>Where:</strong> <code>github.com/openfluke/welvet/runtime/dispatch</code><br /><strong>Why:</strong> one Forward/Backward/Pack/SetDType/ApplyGrad path for every Welvet Op; <strong>unknown types hard-error</strong> (never silently pretend they are Dense).</p>\n<p>Do <strong>not</strong> import dispatch from <code>layers/parallel</code> (import cycle) — Parallel dispatches branches itself.</p>\n<pre><code class=\"language-bash\">cd 71-dispatch &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n","text":"When: walking a grid / Parallel / Sequential and you only have any cells.Where: github.com/openfluke/welvet/runtime/dispatchWhy: one Forward/Backward/Pack/SetDType/ApplyGrad path for every Welvet Op; unknown types hard-error (never silently pretend they are Dense).\nDo not import dispatch from layers/parallel (import cycle) — Parallel dispatches branches itself.\ncd 71-dispatch && source ../env.sh && go run .\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/cnn2\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/runtime/dispatch\"\n)\n\nfunc main() {\n\t// When: you hold an `any` Op (grid cell, Parallel branch, Sequential child)\n\t// Where: runtime/dispatch — single switch for Forward/Backward/Pack/ApplyGrad\n\t// Why: no silent Dense fallback; unknown Ops hard-error\n\n\td, err := dense.New(4, 4, core.ActivationReLU, core.DTypeFloat32)\n\tmust(err)\n\tx := core.NewTensor[float32](1, 4)\n\tfor i := range x.Data {\n\t\tx.Data[i] = 0.25\n\t}\n\tpre, post, err := dispatch.Forward(d, x)\n\tmust(err)\n\tgIn, gW, err := dispatch.Backward(d, post, x, pre)\n\tmust(err)\n\tmust(dispatch.ApplyGradSGD(d, gW, 1e-2))\n\tfmt.Println(\"dispatch dense\", post.Shape, \"gIn\", len(gIn.Data), \"gW\", len(gW.Data))\n\n\tc, err := cnn2.New(cnn2.Config{InChannels: 1, Filters: 2, Height: 4, Width: 4, Kernel: 3})\n\tmust(err)\n\timg := core.NewTensor[float32](1, 1, 4, 4)\n\t_, y, err := dispatch.Forward(c, img)\n\tmust(err)\n\tfmt.Println(\"dispatch cnn2\", y.Shape)\n\n\t_, _, err = dispatch.Forward(\"not-an-op\", x)\n\tif err == nil || !strings.Contains(err.Error(), \"unsupported Op\") {\n\t\tpanic(fmt.Sprintf(\"want unsupported Op error, got %v\", err))\n\t}\n\tfmt.Println(\"dispatch rejects unknown:\", err)\n}\n\nfunc must(err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n","url":"/source/examples/welvet/71-dispatch/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/71-dispatch","url":"https://openfluke.com/examples/welvet/71-dispatch"},{"slug":"welvet/72-wav2vec2","title":"72. model/wav2vec2 — CTC ASR","group":"Welvet examples","description":"When: speech to text (greedy CTC) from 16 kHz mono WAV/PCM.Where: github.com/openfluke/welvet/model/wav2vec2Why: run facebook/wav2vec2-base-960h in pure Go. Always proves Config + Vocab + Lo","html":"<p><strong>When:</strong> speech to text (greedy CTC) from 16 kHz mono WAV/PCM.<br /><strong>Where:</strong> <code>github.com/openfluke/welvet/model/wav2vec2</code><br /><strong>Why:</strong> run <code>facebook/wav2vec2-base-960h</code> in pure Go.</p>\n<p>Always proves Config + Vocab + LoadHFDir error path. Full ASR needs HF snapshot via <code>WAV2VEC2_DIR</code> / <code>WAV2VEC2_WAV</code>.</p>\n<pre><code class=\"language-bash\">cd 72-wav2vec2 &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n","text":"When: speech to text (greedy CTC) from 16 kHz mono WAV/PCM.Where: github.com/openfluke/welvet/model/wav2vec2Why: run facebook/wav2vec2-base-960h in pure Go.\nAlways proves Config + Vocab + LoadHFDir error path. Full ASR needs HF snapshot via WAV2VEC2_DIR / WAV2VEC2_WAV.\ncd 72-wav2vec2 && source ../env.sh && go run .\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"github.com/openfluke/welvet/model/wav2vec2\"\n)\n\nfunc main() {\n\tcfg := wav2vec2.Base960h()\n\tfmt.Printf(\"Base960h hidden=%d layers=%d heads=%d vocab=%d\\n\",\n\t\tcfg.HiddenSize, cfg.NumHiddenLayers, cfg.NumAttentionHeads, cfg.VocabSize)\n\n\tvocab, err := wav2vec2.LoadVocabBytes([]byte(`{\"<pad>\":0,\"|\":1,\"E\":2,\"T\":3,\"A\":4}`), 0)\n\tmust(err)\n\tfmt.Println(\"DecodeCTCGreedy:\", vocab.DecodeCTCGreedy([]int{4, 4, 3, 2}))\n\n\tmissing := filepath.Join(os.TempDir(), \"welvet-no-wav2vec2-weights\")\n\t_, err = wav2vec2.LoadHFDir(missing)\n\tif err == nil {\n\t\tpanic(\"LoadHFDir should fail without snapshot\")\n\t}\n\tfmt.Println(\"LoadHFDir without weights:\", err)\n\n\tif dir := os.Getenv(\"WAV2VEC2_DIR\"); dir != \"\" {\n\t\tm, err := wav2vec2.LoadHFDir(dir)\n\t\tmust(err)\n\t\twav := os.Getenv(\"WAV2VEC2_WAV\")\n\t\tif wav == \"\" {\n\t\t\tpanic(\"missing WAV2VEC2_WAV\")\n\t\t}\n\t\ttext, err := m.TranscribeFile(wav)\n\t\tmust(err)\n\t\tfmt.Println(\"transcribe:\", text)\n\t} else {\n\t\tfmt.Println(\"set WAV2VEC2_DIR (+ WAV2VEC2_WAV) for full ASR smoke\")\n\t}\n}\n\nfunc must(err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n","url":"/source/examples/welvet/72-wav2vec2/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/72-wav2vec2","url":"https://openfluke.com/examples/welvet/72-wav2vec2"},{"slug":"welvet/73-all-layers","title":"73. All layers — one forward each","group":"Welvet examples","description":"When: you want a single command that proves every layers/* Op (plus seqmix + dispatch) actually forwards.Where: this folder imports every concrete layer package.Why: chapters 11–28 split by ","html":"<p><strong>When:</strong> you want a single command that proves every <code>layers/*</code> Op (plus seqmix + dispatch) actually forwards.<br /><strong>Where:</strong> this folder imports every concrete layer package.<br /><strong>Why:</strong> chapters 11–28 split by topic; this is the regression checklist for “does it run?”</p>\n<p>Cameral proofs (Freeze / CamSync on each Op) live in <a href=\"https://github.com/openfluke/example/blob/main/cam/05_layers/\"><code>../../cam/05_layers</code></a>.</p>\n<pre><code class=\"language-bash\">cd 73-all-layers &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n<p>Each line prints <strong>when / where / why</strong> for that Op.</p>\n","text":"When: you want a single command that proves every layers/* Op (plus seqmix + dispatch) actually forwards.Where: this folder imports every concrete layer package.Why: chapters 11–28 split by topic; this is the regression checklist for “does it run?”\nCameral proofs (Freeze / CamSync on each Op) live in ../../cam/05_layers.\ncd 73-all-layers && source ../env.sh && go run .\n\nEach line prints when / where / why for that Op.\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/cnn1\"\n\t\"github.com/openfluke/welvet/layers/cnn2\"\n\t\"github.com/openfluke/welvet/layers/cnn3\"\n\t\"github.com/openfluke/welvet/layers/convt1\"\n\t\"github.com/openfluke/welvet/layers/convt2\"\n\t\"github.com/openfluke/welvet/layers/convt3\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/layers/embedding\"\n\t\"github.com/openfluke/welvet/layers/gdn\"\n\t\"github.com/openfluke/welvet/layers/kmeans\"\n\t\"github.com/openfluke/welvet/layers/layernorm\"\n\t\"github.com/openfluke/welvet/layers/lstm\"\n\t\"github.com/openfluke/welvet/layers/mamba\"\n\t\"github.com/openfluke/welvet/layers/metacognition\"\n\t\"github.com/openfluke/welvet/layers/mha\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/layers/residual\"\n\t\"github.com/openfluke/welvet/layers/rmsnorm\"\n\t\"github.com/openfluke/welvet/layers/rnn\"\n\t\"github.com/openfluke/welvet/layers/seqmix\"\n\t\"github.com/openfluke/welvet/layers/sequential\"\n\t\"github.com/openfluke/welvet/layers/softmax\"\n\t\"github.com/openfluke/welvet/layers/swiglu\"\n\t\"github.com/openfluke/welvet/quant\"\n\t\"github.com/openfluke/welvet/runtime/dispatch\"\n)\n\ntype demo struct {\n\tname, when, where, why string\n\trun                    func() error\n}\n\nfunc main() {\n\tdemos := []demo{\n\t\t{\"dense\", \"linear / FFN / proj\", \"layers/dense\", \"MatVec microkernel everything else builds on\", runDense},\n\t\t{\"cnn1\", \"1D seq / audio patches\", \"layers/cnn1\", \"im2col→Dense Proj\", runCNN1},\n\t\t{\"cnn2\", \"images / 2D maps\", \"layers/cnn2\", \"vision stem\", runCNN2},\n\t\t{\"cnn3\", \"volumes / voxels\", \"layers/cnn3\", \"3D conv\", runCNN3},\n\t\t{\"convt1\", \"1D upsample\", \"layers/convt1\", \"decoder / generative 1D\", runConvT1},\n\t\t{\"convt2\", \"2D upsample\", \"layers/convt2\", \"decoder / U-Net expand\", runConvT2},\n\t\t{\"convt3\", \"3D upsample\", \"layers/convt3\", \"volumetric decoder\", runConvT3},\n\t\t{\"mha\", \"token mixing via attention\", \"layers/mha\", \"transformers\", runMHA},\n\t\t{\"swiglu\", \"gated FFN\", \"layers/swiglu\", \"modern LLM MLP\", runSwiGLU},\n\t\t{\"rmsnorm\", \"stabilize activations\", \"layers/rmsnorm\", \"LLM-style norm\", runRMS},\n\t\t{\"layernorm\", \"stabilize activations\", \"layers/layernorm\", \"classic transformer norm\", runLN},\n\t\t{\"softmax\", \"distributions / heads\", \"layers/softmax\", \"classify / combine\", runSoftmax},\n\t\t{\"embedding\", \"token → vector\", \"layers/embedding\", \"lookup tables\", runEmbed},\n\t\t{\"rnn\", \"short temporal\", \"layers/rnn\", \"classic recurrent\", runRNN},\n\t\t{\"lstm\", \"gated temporal\", \"layers/lstm\", \"longer memory than RNN\", runLSTM},\n\t\t{\"sequential\", \"stack Dense depth\", \"layers/sequential\", \"deep hemisphere body\", runSeq},\n\t\t{\"residual\", \"skip + body\", \"layers/residual\", \"stable depth\", runRes},\n\t\t{\"parallel\", \"multi-cam / MoE\", \"layers/parallel\", \"combine cams + CamSync host\", runPara},\n\t\t{\"kmeans\", \"prototypes / codebook\", \"layers/kmeans\", \"cluster features\", runKMeans},\n\t\t{\"mamba\", \"selective SSM\", \"layers/mamba\", \"linear-time seq mix\", runMamba},\n\t\t{\"gdn\", \"gated delta / linear attn\", \"layers/gdn\", \"decode-friendly mixer\", runGDN},\n\t\t{\"metacognition\", \"observer / confidence\", \"layers/metacognition\", \"meta signals beside main path\", runMeta},\n\t\t{\"seqmix\", \"name the mixer kind\", \"layers/seqmix\", \"contract only — swap MHA/Mamba/GDN\", runSeqMix},\n\t\t{\"dispatch\", \"any Op → Forward\", \"runtime/dispatch\", \"grid walk without type switches in your code\", runDispatch},\n\t}\n\n\tfail := 0\n\tfor _, d := range demos {\n\t\tif err := d.run(); err != nil {\n\t\t\tfmt.Printf(\"FAIL %-14s %v\\n\", d.name, err)\n\t\t\tfail++\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"OK   %-14s when=%s | where=%s | why=%s\\n\", d.name, d.when, d.where, d.why)\n\t}\n\tfmt.Printf(\"\\nall-layers: ok=%d fail=%d\\n\", len(demos)-fail, fail)\n\tif fail > 0 {\n\t\tos.Exit(1)\n\t}\n}\n\nfunc fill(shape ...int) *core.Tensor[float32] {\n\tt := core.NewTensor[float32](shape...)\n\tfor i := range t.Data {\n\t\tt.Data[i] = 0.1 + float32(i%7)*0.03\n\t}\n\treturn t\n}\n\nfunc runDense() error {\n\tl, err := dense.New(4, 4, core.ActivationReLU, core.DTypeFloat32)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = dense.Forward(l, fill(1, 4))\n\treturn err\n}\nfunc runCNN1() error {\n\tl, err := cnn1.New(cnn1.Config{InChannels: 1, Filters: 2, SeqLen: 4, Kernel: 3})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = cnn1.Forward(l, fill(1, 1, 4))\n\treturn err\n}\nfunc runCNN2() error {\n\tl, err := cnn2.New(cnn2.Config{InChannels: 1, Filters: 2, Height: 3, Width: 3, Kernel: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = cnn2.Forward(l, fill(1, 1, 3, 3))\n\treturn err\n}\nfunc runCNN3() error {\n\tl, err := cnn3.New(cnn3.Config{InChannels: 1, Filters: 2, Depth: 2, Height: 2, Width: 2, Kernel: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = cnn3.Forward(l, fill(1, 1, 2, 2, 2))\n\treturn err\n}\nfunc runConvT1() error {\n\tl, err := convt1.New(convt1.Config{InChannels: 1, Filters: 2, SeqLen: 2, Kernel: 3})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = convt1.Forward(l, fill(1, 1, 2))\n\treturn err\n}\nfunc runConvT2() error {\n\tl, err := convt2.New(convt2.Config{InChannels: 1, Filters: 2, Height: 2, Width: 2, Kernel: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = convt2.Forward(l, fill(1, 1, 2, 2))\n\treturn err\n}\nfunc runConvT3() error {\n\tl, err := convt3.New(convt3.Config{InChannels: 1, Filters: 2, Depth: 2, Height: 2, Width: 2, Kernel: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = convt3.Forward(l, fill(1, 1, 2, 2, 2))\n\treturn err\n}\nfunc runMHA() error {\n\tl, err := mha.New(mha.Config{DModel: 4, NumHeads: 1, MaxSeqLen: 4})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = mha.Forward(l, fill(1, 2, 4))\n\treturn err\n}\nfunc runSwiGLU() error {\n\tl, err := swiglu.New(swiglu.Config{InputDim: 4, IntermediateDim: 8})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = swiglu.Forward(l, fill(1, 4))\n\treturn err\n}\nfunc runRMS() error {\n\tl, err := rmsnorm.New(rmsnorm.Config{Dim: 4})\n\tif err != nil {\n\t\treturn err\n\t}\n\tx := fill(1, 4)\n\tfor i := range x.Data {\n\t\tx.Data[i] = float32(i + 1)\n\t}\n\t_, _, err = rmsnorm.Forward(l, x)\n\treturn err\n}\nfunc runLN() error {\n\tl, err := layernorm.New(layernorm.Config{Dim: 4})\n\tif err != nil {\n\t\treturn err\n\t}\n\tx := fill(1, 4)\n\tfor i := range x.Data {\n\t\tx.Data[i] = float32(i + 1)\n\t}\n\t_, _, err = layernorm.Forward(l, x)\n\treturn err\n}\nfunc runSoftmax() error {\n\tl, err := softmax.New(softmax.Config{Dim: 4})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = softmax.Forward(l, fill(1, 4))\n\treturn err\n}\nfunc runEmbed() error {\n\tl, err := embedding.New(embedding.Config{VocabSize: 8, EmbeddingDim: 4, SeqLen: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\tx := fill(1, 2)\n\tx.Data[0], x.Data[1] = 1, 2\n\t_, _, err = embedding.Forward(l, x)\n\treturn err\n}\nfunc runRNN() error {\n\tl, err := rnn.New(rnn.Config{InputSize: 3, HiddenSize: 4, SeqLen: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = rnn.Forward(l, fill(1, 2, 3))\n\treturn err\n}\nfunc runLSTM() error {\n\tl, err := lstm.New(lstm.Config{InputSize: 3, HiddenSize: 4, SeqLen: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = lstm.Forward(l, fill(1, 2, 3))\n\treturn err\n}\nfunc runSeq() error {\n\tl, err := sequential.New(sequential.Config{Dim: 4, Depth: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = sequential.Forward(l, fill(1, 4))\n\treturn err\n}\nfunc runRes() error {\n\tl, err := residual.New(residual.Config{Dim: 4, Depth: 1})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = residual.Forward(l, fill(1, 4))\n\treturn err\n}\nfunc runPara() error {\n\ts, err := parallel.Bicameral(4, 8, 1, core.ActivationReLU, core.DTypeFloat32, quant.FormatNone)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = parallel.ForwardStack(s, fill(1, 4))\n\treturn err\n}\nfunc runKMeans() error {\n\tl, err := kmeans.New(kmeans.Config{NumClusters: 3, FeatureDim: 4})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = kmeans.Forward(l, fill(1, 4))\n\treturn err\n}\nfunc runMamba() error {\n\tl, err := mamba.New(mamba.Config{DModel: 4, DState: 2, SeqLen: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = mamba.Forward(l, fill(1, 2, 4))\n\treturn err\n}\nfunc runGDN() error {\n\tl, err := gdn.New(gdn.Config{HiddenSize: 4, NumKeyHeads: 1, NumValueHeads: 1, KeyHeadDim: 2, ValueHeadDim: 2, ConvKernel: 2})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = gdn.Forward(l, fill(1, 2, 4))\n\treturn err\n}\nfunc runMeta() error {\n\tl, err := metacognition.New(metacognition.Config{Dim: 4})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = metacognition.Forward(l, fill(1, 4))\n\treturn err\n}\nfunc runSeqMix() error {\n\tc := seqmix.Contract{Kind: seqmix.KindSSM, DModel: 4, MaxT: 8}\n\tif c.Kind.String() != \"ssm\" {\n\t\treturn fmt.Errorf(\"kind=%s\", c.Kind)\n\t}\n\treturn nil\n}\nfunc runDispatch() error {\n\tl, err := dense.New(4, 4, core.ActivationLinear, core.DTypeFloat32)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = dispatch.Forward(l, fill(1, 4))\n\treturn err\n}\n","url":"/source/examples/welvet/73-all-layers/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/73-all-layers","url":"https://openfluke.com/examples/welvet/73-all-layers"},{"slug":"welvet/74-kokoro","title":"74. Kokoro — reserved empty slots","group":"Welvet examples","description":"When: you specifically want Kokoro TTS.Where: welvet/model/kokoro and welvet/apps/kokoro — both empty placeholders today.Why: names reserved for a future port; do not import them yet. Workin","html":"<p><strong>When:</strong> you specifically want Kokoro TTS.<br /><strong>Where:</strong> <code>welvet/model/kokoro</code> and <code>welvet/apps/kokoro</code> — <strong>both empty placeholders</strong> today.<br /><strong>Why:</strong> names reserved for a future port; do not import them yet.</p>\n<p>Working speech apps right now:</p>\n<table>\n<thead>\n<tr>\n<th>App</th>\n<th>Role</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>apps/mosstts</code></td>\n<td>Moss TTS shell</td>\n</tr>\n<tr>\n<td><code>apps/qwentts</code></td>\n<td>Qwen TTS shell</td>\n</tr>\n</tbody></table>\n<pre><code class=\"language-bash\">cd 74-kokoro &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n","text":"When: you specifically want Kokoro TTS.Where: welvet/model/kokoro and welvet/apps/kokoro — both empty placeholders today.Why: names reserved for a future port; do not import them yet.\nWorking speech apps right now:\n\n\n\nApp\nRole\n\n\n\napps/mosstts\nMoss TTS shell\n\n\napps/qwentts\nQwen TTS shell\n\n\ncd 74-kokoro && source ../env.sh && go run .\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n)\n\nfunc main() {\n\twelvet := os.Getenv(\"WELVET_ROOT\")\n\tif welvet == \"\" {\n\t\twd, _ := os.Getwd()\n\t\twelvet = filepath.Clean(filepath.Join(wd, \"../../../welvet\"))\n\t}\n\tmodelDir := filepath.Join(welvet, \"model\", \"kokoro\")\n\tappsDir := filepath.Join(welvet, \"apps\", \"kokoro\")\n\n\tme, err := os.ReadDir(modelDir)\n\tmust(err)\n\tae, err := os.ReadDir(appsDir)\n\tmust(err)\n\n\tfmt.Println(\"When: you want Kokoro-style TTS\")\n\tfmt.Println(\"Where: planned at model/kokoro + apps/kokoro — both empty today\")\n\tfmt.Println(\"Why: placeholders reserved; working TTS apps are mosstts / qwentts\")\n\tfmt.Printf(\"model/kokoro entries: %d\\n\", len(me))\n\tfmt.Printf(\"apps/kokoro entries:  %d\\n\", len(ae))\n\tif len(me) != 0 || len(ae) != 0 {\n\t\tpanic(\"expected empty kokoro placeholders\")\n\t}\n\n\tfor _, name := range []string{\"mosstts\", \"qwentts\"} {\n\t\tdir := filepath.Join(welvet, \"apps\", name)\n\t\tst, err := os.Stat(dir)\n\t\tif err != nil || !st.IsDir() {\n\t\t\tpanic(name + \" missing\")\n\t\t}\n\t\tfmt.Printf(\"OK working TTS shell: apps/%s\\n\", name)\n\t}\n\tfmt.Println(\"OK — kokoro slots empty; use mosstts/qwentts until kokoro lands\")\n}\n\nfunc must(err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n","url":"/source/examples/welvet/74-kokoro/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/74-kokoro","url":"https://openfluke.com/examples/welvet/74-kokoro"},{"slug":"welvet/75-apps-map","title":"75. Apps map — when / where / why","group":"Welvet examples","description":"When: you need a product shell (chat, TTS, ASR, image) rather than a library Op.Where: welvet/apps/<name> — each is its own Go module.Why: engine packages never import apps; apps replace → w","html":"<p><strong>When:</strong> you need a product shell (chat, TTS, ASR, image) rather than a library Op.<br /><strong>Where:</strong> <code>welvet/apps/&lt;name&gt;</code> — each is its <strong>own Go module</strong>.<br /><strong>Why:</strong> engine packages never import apps; apps replace → welvet.</p>\n<p>This chapter asserts every known app directory exists and prints guidance.<br />It does <strong>not</strong> download model weights or start interactive CLIs.</p>\n<pre><code class=\"language-bash\">cd 75-apps-map &amp;&amp; source ../env.sh &amp;&amp; go run .\n</code></pre>\n","text":"When: you need a product shell (chat, TTS, ASR, image) rather than a library Op.Where: welvet/apps/<name> — each is its own Go module.Why: engine packages never import apps; apps replace → welvet.\nThis chapter asserts every known app directory exists and prints guidance.It does not download model weights or start interactive CLIs.\ncd 75-apps-map && source ../env.sh && go run .\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n)\n\ntype app struct {\n\tname, when, why string\n}\n\nfunc main() {\n\twelvet := os.Getenv(\"WELVET_ROOT\")\n\tif welvet == \"\" {\n\t\twd, _ := os.Getwd()\n\t\twelvet = filepath.Clean(filepath.Join(wd, \"../../../welvet\"))\n\t}\n\tappsRoot := filepath.Join(welvet, \"apps\")\n\n\tapps := []app{\n\t\t{\"octo\", \"chat / agent CLI over transformer entities\", \"main interactive shell\"},\n\t\t{\"flux2\", \"image generation experiments\", \"diffusion-style app shell\"},\n\t\t{\"mosstts\", \"speech synthesis demos\", \"TTS product path\"},\n\t\t{\"kokoro\", \"Kokoro TTS (placeholder — empty dir)\", \"reserved; use mosstts/qwentts until filled\"},\n\t\t{\"aai\", \"AAI / Lucy organism demos\", \"cameral + lucy product\"},\n\t\t{\"biotalk\", \"bio / organism chat surfaces\", \"domain UI over welvet\"},\n\t\t{\"qwenasr\", \"Qwen ASR\", \"speech recognition app\"},\n\t\t{\"qwentts\", \"Qwen TTS\", \"speech synthesis app\"},\n\t\t{\"planetbridging\", \"planetbridging demos\", \"bridging experiments\"},\n\t}\n\n\tfail := 0\n\tfmt.Println(\"Apps never import into the engine — run each from its own go.mod.\\n\")\n\tfor _, a := range apps {\n\t\tdir := filepath.Join(appsRoot, a.name)\n\t\tst, err := os.Stat(dir)\n\t\tif err != nil || !st.IsDir() {\n\t\t\tfmt.Printf(\"FAIL %-16s missing under apps/\\n\", a.name)\n\t\t\tfail++\n\t\t\tcontinue\n\t\t}\n\t\thasMod := \"no go.mod\"\n\t\tif _, err := os.Stat(filepath.Join(dir, \"go.mod\")); err == nil {\n\t\t\thasMod = \"go.mod ok\"\n\t\t}\n\t\t// kokoro is an intentional empty placeholder\n\t\tents, _ := os.ReadDir(dir)\n\t\tnote := hasMod\n\t\tif a.name == \"kokoro\" && len(ents) == 0 {\n\t\t\tnote = \"empty placeholder\"\n\t\t}\n\t\tfmt.Printf(\"OK   %-16s [%s]\\n\", a.name, note)\n\t\tfmt.Printf(\"     when: %s\\n\", a.when)\n\t\tfmt.Printf(\"     where: apps/%s\\n\", a.name)\n\t\tfmt.Printf(\"     why:  %s\\n\\n\", a.why)\n\t}\n\tif fail > 0 {\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(\"All app folders present. Deep cameral proofs: example/cam/\")\n}\n","url":"/source/examples/welvet/75-apps-map/main.go"}],"source":"https://github.com/openfluke/example/tree/main/welvet/75-apps-map","url":"https://openfluke.com/examples/welvet/75-apps-map"},{"slug":"cam/01_modes","title":"01 — BranchModes","group":"Cameral cookbook","description":"When: different update rules (or idle/teacher) per camWhere: para.SetBranchModes(...) with parent NormalBPWhy: mix credit, freeze priors, distill, adversarial twins, surprise memory go run .","html":"<p><strong>When:</strong> different update rules (or idle/teacher) per cam<br /><strong>Where:</strong> <code>para.SetBranchModes(...)</code> with parent <code>NormalBP</code><br /><strong>Why:</strong> mix credit, freeze priors, distill, adversarial twins, surprise memory</p>\n<pre><code class=\"language-bash\">go run ./01_modes\n</code></pre>\n<p>Exits <strong>non-zero</strong> if any proof fails (<code>PASS</code> / <code>FAIL</code> lines).</p>\n<h2>Live output</h2>\n<pre><code>=== 01_modes — prove BranchModes ===\n  PASS  both_BP  both cams moved Δ=0.009232 / 0.009232\n  PASS  Freeze  cam0 moved Δ=0.009794, frozen cam1 Δ=0 (want ~0)\n  PASS  Shadow  teacher frozen Δ=0, student moved Δ=0.1343\n  PASS  Adversarial  both move Δ=0.00832/0.00832; Adv loss 0.0013 ≥ BP loss 0.0007 (fight)\n  PASS  Memory  asleep Δ=0 (~0), awake Δ=0.007141 (&gt;0)\n  PASS  Tween  Tween cam moved Δ=0.003871\n\nall BranchMode proofs passed\n</code></pre>\n<h2>Why these PASS lines prove it</h2>\n<table>\n<thead>\n<tr>\n<th>Proof</th>\n<th>Assertion</th>\n<th>Why that shows the feature</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>both_BP</strong></td>\n<td>both cams ΔW ≫ 0</td>\n<td>Shared learning works</td>\n</tr>\n<tr>\n<td><strong>Freeze</strong></td>\n<td>cam0 moves, cam1 Δ≈0</td>\n<td>Frozen cam still forwards; no weight update</td>\n</tr>\n<tr>\n<td><strong>Shadow</strong></td>\n<td>teacher Δ≈0, student moves</td>\n<td>Shadow = frozen KD teacher</td>\n</tr>\n<tr>\n<td><strong>Adversarial</strong></td>\n<td>both move; Adv loss ≥ BP loss</td>\n<td>Negated LR fights the objective</td>\n</tr>\n<tr>\n<td><strong>Memory</strong></td>\n<td>asleep Δ≈0, awake Δ≫0</td>\n<td>SurpriseThresh gates updates</td>\n</tr>\n<tr>\n<td><strong>Tween</strong></td>\n<td>Tween cam Δ≫0</td>\n<td>Alternate update family still applies</td>\n</tr>\n</tbody></table>\n<p>Cams are <strong>diverged</strong> first so Freeze isn’t vacuous.</p>\n","text":"When: different update rules (or idle/teacher) per camWhere: para.SetBranchModes(...) with parent NormalBPWhy: mix credit, freeze priors, distill, adversarial twins, surprise memory\ngo run ./01_modes\n\nExits non-zero if any proof fails (PASS / FAIL lines).\nLive output\n=== 01_modes — prove BranchModes ===\n  PASS  both_BP  both cams moved Δ=0.009232 / 0.009232\n  PASS  Freeze  cam0 moved Δ=0.009794, frozen cam1 Δ=0 (want ~0)\n  PASS  Shadow  teacher frozen Δ=0, student moved Δ=0.1343\n  PASS  Adversarial  both move Δ=0.00832/0.00832; Adv loss 0.0013 ≥ BP loss 0.0007 (fight)\n  PASS  Memory  asleep Δ=0 (~0), awake Δ=0.007141 (>0)\n  PASS  Tween  Tween cam moved Δ=0.003871\n\nall BranchMode proofs passed\n\nWhy these PASS lines prove it\n\n\n\nProof\nAssertion\nWhy that shows the feature\n\n\n\nboth_BP\nboth cams ΔW ≫ 0\nShared learning works\n\n\nFreeze\ncam0 moves, cam1 Δ≈0\nFrozen cam still forwards; no weight update\n\n\nShadow\nteacher Δ≈0, student moves\nShadow = frozen KD teacher\n\n\nAdversarial\nboth move; Adv loss ≥ BP loss\nNegated LR fights the objective\n\n\nMemory\nasleep Δ≈0, awake Δ≫0\nSurpriseThresh gates updates\n\n\nTween\nTween cam Δ≫0\nAlternate update family still applies\n\n\nCams are diverged first so Freeze isn’t vacuous.\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/example/cam/internal/harness\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n)\n\nfunc main() {\n\tharness.Banner(\"01_modes — prove BranchModes\")\n\tx, y := harness.ToyXY(8, 4)\n\n\tproveBothBP(x, y)\n\tproveFreeze(x, y)\n\tproveShadow(x, y)\n\tproveAdversarial(x, y)\n\tproveMemory(x, y)\n\tproveTween(x, y)\n\tfmt.Println(\"\\nall BranchMode proofs passed\")\n}\n\nfunc proveBothBP(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\tw0, w1 := harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 20, 0.1)\n\td0 := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1 := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"both_BP\", d0 > 1e-4 && d1 > 1e-4, \"both cams moved Δ=%.4g / %.4g\", d0, d1)\n}\n\nfunc proveFreeze(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeFreeze)\n\tw0, w1 := harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 20, 0.1)\n\td0 := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1 := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"Freeze\", d0 > 1e-4 && d1 < 1e-7, \"cam0 moved Δ=%.4g, frozen cam1 Δ=%.4g (want ~0)\", d0, d1)\n}\n\nfunc proveShadow(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeShadow)\n\tpara.SetCamKit(parallel.CamKit{ShadowCoef: 1.0})\n\tteacherBefore := harness.DenseWeights(para, 1)\n\tstudentBefore := harness.DenseWeights(para, 0)\n\t_, _ = harness.TrainN(para, x, y, 25, 0.08)\n\tdT := harness.WeightMaxDiff(teacherBefore, harness.DenseWeights(para, 1))\n\tdS := harness.WeightMaxDiff(studentBefore, harness.DenseWeights(para, 0))\n\tharness.Requiref(\"Shadow\", dT < 1e-7 && dS > 1e-4, \"teacher frozen Δ=%.4g, student moved Δ=%.4g\", dT, dS)\n}\n\nfunc proveAdversarial(x, y *core.Tensor[float32]) {\n\t// Compare loss: BP∥BP should beat BP∥Adv on same init path.\n\tmk := func(modes ...parallel.TrainMode) float64 {\n\t\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t\t// same diverge every time\n\t\t_ = harness.DivergeCams(para)\n\t\tpara.SetBranchModes(modes...)\n\t\tloss, _ := harness.TrainN(para, x, y, 30, 0.08)\n\t\treturn loss\n\t}\n\tlossBP := mk(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\tlossAdv := mk(parallel.ModeNormalBP, parallel.ModeAdversarial)\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeAdversarial)\n\tw0, w1 := harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 20, 0.08)\n\td0 := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1 := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"Adversarial\", d0 > 1e-4 && d1 > 1e-4 && lossAdv > lossBP*0.95,\n\t\t\"both move Δ=%.3g/%.3g; Adv loss %.4f ≥ BP loss %.4f (fight)\", d0, d1, lossAdv, lossBP)\n}\n\nfunc proveMemory(x, y *core.Tensor[float32]) {\n\t// High thresh → asleep (no cam1 update). Low thresh → awake (cam1 updates).\n\tasleep := func() float64 {\n\t\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t\t_ = harness.DivergeCams(para)\n\t\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeMemory)\n\t\tpara.SetCamKit(parallel.CamKit{SurpriseThresh: 1e9})\n\t\tw1 := harness.DenseWeights(para, 1)\n\t\t_, _ = harness.TrainN(para, x, y, 15, 0.1)\n\t\treturn harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\t}\n\tawake := func() float64 {\n\t\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t\t_ = harness.DivergeCams(para)\n\t\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeMemory)\n\t\tpara.SetCamKit(parallel.CamKit{SurpriseThresh: 1e-12}) // always surprised\n\t\tw1 := harness.DenseWeights(para, 1)\n\t\t_, _ = harness.TrainN(para, x, y, 15, 0.1)\n\t\treturn harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\t}\n\tdSleep, dWake := asleep(), awake()\n\tharness.Requiref(\"Memory\", dSleep < 1e-7 && dWake > 1e-4,\n\t\t\"asleep Δ=%.4g (~0), awake Δ=%.4g (>0)\", dSleep, dWake)\n}\n\nfunc proveTween(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeTween)\n\tw1 := harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 20, 0.08)\n\td1 := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"Tween\", d1 > 1e-5, \"Tween cam moved Δ=%.4g\", d1)\n}\n","url":"/source/examples/cam/01_modes/main.go"}],"source":"https://github.com/openfluke/example/tree/main/cam/01_modes","url":"https://openfluke.com/examples/cam/01_modes"},{"slug":"cam/02_combine","title":"02 — Combine modes","group":"Cameral cookbook","description":"When: choosing how hemisphere posts become one tensorWhere: Config.CombineWhy: avg/add ensemble; max WTA; sparsek; disagree; filter MoE; concat widths go run ./02_combine Exits non-zero if a","html":"<p><strong>When:</strong> choosing how hemisphere posts become one tensor<br /><strong>Where:</strong> <code>Config.Combine</code><br /><strong>Why:</strong> avg/add ensemble; max WTA; sparsek; disagree; filter MoE; concat widths</p>\n<pre><code class=\"language-bash\">go run ./02_combine\n</code></pre>\n<p>Exits <strong>non-zero</strong> if any proof fails (<code>PASS</code> / <code>FAIL</code> lines).</p>\n<h2>Live output</h2>\n<pre><code>=== 02_combine — prove merge modes ===\n  PASS  avg_width  outShape=[1 4] want [1 4]\n  PASS  add_width  outShape=[1 4] want [1 4]\n  PASS  concat_width  outShape=[1 8] want feat=8\n  PASS  max_routes_to_cam0  combined should match cam0 when cam0≫cam1\n  PASS  sparsek_keeps_strong  SparseK=1 should ≈ strongest cam (cam0)\n  PASS  disagree_formula  y = mean + β(a-b) holds\n  PASS  filter_gate_trains  MoE gate Δ=0.01582\n\nall Combine proofs passed\n</code></pre>\n<h2>Why these PASS lines prove it</h2>\n<table>\n<thead>\n<tr>\n<th>Proof</th>\n<th>Assertion</th>\n<th>Why</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>avg/add_width</strong></td>\n<td>out feat = 4</td>\n<td>Same-width merge</td>\n</tr>\n<tr>\n<td><strong>concat_width</strong></td>\n<td>out feat = <strong>8</strong></td>\n<td>Unequal stack = 4+4</td>\n</tr>\n<tr>\n<td><strong>max_routes_to_cam0</strong></td>\n<td>combined ≡ cam0 when cam0≫cam1</td>\n<td>Hard max routing</td>\n</tr>\n<tr>\n<td><strong>sparsek_keeps_strong</strong></td>\n<td>SparseK=1 ≈ strongest cam</td>\n<td>Top-K by ‖out‖₂</td>\n</tr>\n<tr>\n<td><strong>disagree_formula</strong></td>\n<td><code>y = mean + β(a−b)</code> numerically</td>\n<td>Debate combine is exact</td>\n</tr>\n<tr>\n<td><strong>filter_gate_trains</strong></td>\n<td>MoE gate weights move</td>\n<td>Gate is live, not decoration</td>\n</tr>\n</tbody></table>\n","text":"When: choosing how hemisphere posts become one tensorWhere: Config.CombineWhy: avg/add ensemble; max WTA; sparsek; disagree; filter MoE; concat widths\ngo run ./02_combine\n\nExits non-zero if any proof fails (PASS / FAIL lines).\nLive output\n=== 02_combine — prove merge modes ===\n  PASS  avg_width  outShape=[1 4] want [1 4]\n  PASS  add_width  outShape=[1 4] want [1 4]\n  PASS  concat_width  outShape=[1 8] want feat=8\n  PASS  max_routes_to_cam0  combined should match cam0 when cam0≫cam1\n  PASS  sparsek_keeps_strong  SparseK=1 should ≈ strongest cam (cam0)\n  PASS  disagree_formula  y = mean + β(a-b) holds\n  PASS  filter_gate_trains  MoE gate Δ=0.01582\n\nall Combine proofs passed\n\nWhy these PASS lines prove it\n\n\n\nProof\nAssertion\nWhy\n\n\n\navg/add_width\nout feat = 4\nSame-width merge\n\n\nconcat_width\nout feat = 8\nUnequal stack = 4+4\n\n\nmax_routes_to_cam0\ncombined ≡ cam0 when cam0≫cam1\nHard max routing\n\n\nsparsek_keeps_strong\nSparseK=1 ≈ strongest cam\nTop-K by ‖out‖₂\n\n\ndisagree_formula\ny = mean + β(a−b) numerically\nDebate combine is exact\n\n\nfilter_gate_trains\nMoE gate weights move\nGate is live, not decoration\n\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\n\t\"github.com/openfluke/example/cam/internal/harness\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n)\n\nfunc main() {\n\tharness.Banner(\"02_combine — prove merge modes\")\n\tx, _ := harness.ToyXY(8, 4)\n\n\tproveAvgAddWidth(x)\n\tproveConcatWidth(x)\n\tproveMaxRouting(x)\n\tproveSparseK(x)\n\tproveDisagree(x)\n\tproveFilter(x)\n\tfmt.Println(\"\\nall Combine proofs passed\")\n}\n\nfunc proveAvgAddWidth(x *core.Tensor[float32]) {\n\tfor _, c := range []parallel.CombineMode{parallel.CombineAvg, parallel.CombineAdd} {\n\t\tpara, _ := harness.DenseTwin(8, 4, c)\n\t\t_, post, err := parallel.Forward(para, x)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tharness.Requiref(string(c)+\"_width\", len(post.Shape) == 2 && post.Shape[1] == 4,\n\t\t\t\"outShape=%v want [1 4]\", post.Shape)\n\t}\n}\n\nfunc proveConcatWidth(x *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineConcat)\n\t_, post, err := parallel.Forward(para, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tharness.Requiref(\"concat_width\", post.Shape[1] == 8, \"outShape=%v want feat=8\", post.Shape)\n}\n\nfunc proveMaxRouting(x *core.Tensor[float32]) {\n\t// Force cam0 >> cam1 on output dim 0 so max must pick cam0 for that unit.\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineMax)\n\t_ = harness.DivergeCams(para)\n\t// Make cam0 row0 all large positive projections\n\tw0 := harness.DenseWeights(para, 0)\n\tfor i := range w0 {\n\t\tw0[i] = 2\n\t}\n\tw1 := harness.DenseWeights(para, 1)\n\tfor i := range w1 {\n\t\tw1[i] = -2\n\t}\n\t_ = harness.SetDenseWeights(para, 0, w0)\n\t_ = harness.SetDenseWeights(para, 1, w1)\n\n\t_, post, err := parallel.Forward(para, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// With Linear act, cam0 posts should dominate → combined ≈ cam0\n\t_, o0, _ := forwardBranch(para, 0, x)\n\tok := true\n\tfor j := range post.Data {\n\t\tif math.Abs(float64(post.Data[j]-o0.Data[j])) > 1e-4 {\n\t\t\tok = false\n\t\t}\n\t}\n\tharness.Requiref(\"max_routes_to_cam0\", ok, \"combined should match cam0 when cam0≫cam1\")\n}\n\nfunc proveSparseK(x *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineSparseK)\n\tpara.Cfg.SparseK = 1\n\tw0 := harness.DenseWeights(para, 0)\n\tw1 := harness.DenseWeights(para, 1)\n\tfor i := range w0 {\n\t\tw0[i] = 3\n\t\tw1[i] = 0.01\n\t}\n\t_ = harness.SetDenseWeights(para, 0, w0)\n\t_ = harness.SetDenseWeights(para, 1, w1)\n\t_, post, err := parallel.Forward(para, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, o0, _ := forwardBranch(para, 0, x)\n\tok := true\n\tfor j := range post.Data {\n\t\tif math.Abs(float64(post.Data[j]-o0.Data[j])) > 1e-3 {\n\t\t\tok = false\n\t\t}\n\t}\n\tharness.Requiref(\"sparsek_keeps_strong\", ok, \"SparseK=1 should ≈ strongest cam (cam0)\")\n}\n\nfunc proveDisagree(x *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineDisagree)\n\tpara.Cfg.DisagreeBeta = 1\n\t_ = harness.DivergeCams(para)\n\t_, post, err := parallel.Forward(para, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, a, _ := forwardBranch(para, 0, x)\n\t_, b, _ := forwardBranch(para, 1, x)\n\tok := true\n\tfor j := range post.Data {\n\t\tmean := 0.5 * (float64(a.Data[j]) + float64(b.Data[j]))\n\t\twant := mean + 1.0*(float64(a.Data[j])-float64(b.Data[j])) // β=1\n\t\tif math.Abs(float64(post.Data[j])-want) > 1e-4 {\n\t\t\tok = false\n\t\t}\n\t}\n\tharness.Requiref(\"disagree_formula\", ok, \"y = mean + β(a-b) holds\")\n}\n\nfunc proveFilter(x *core.Tensor[float32]) {\n\ta := harness.MustDense(8, 4)\n\tb := harness.MustDense(8, 4)\n\tgate, err := dense.New(8, 2, core.ActivationLinear, core.DTypeFloat32)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tpara, err := parallel.HemispheresFrom(parallel.Config{\n\t\tDim: 8, OutFeat: 4, Branches: 2, Combine: parallel.CombineFilter,\n\t}, []any{a, b}, gate)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\ty := core.NewTensor[float32](1, 4)\n\tfor i := range y.Data {\n\t\ty.Data[i] = 0.5\n\t}\n\tgw, _ := gate.Weights.MasterF32()\n\tbefore := append([]float32(nil), gw...)\n\t_, err = harness.TrainN(para, x, y, 20, 0.1)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tgw2, _ := gate.Weights.MasterF32()\n\tdGate := harness.WeightMaxDiff(before, gw2)\n\tharness.Requiref(\"filter_gate_trains\", dGate > 1e-5, \"MoE gate Δ=%.4g\", dGate)\n}\n\n// forwardBranch re-forwards one Dense cam (avg path helper).\nfunc forwardBranch(para *parallel.Layer, i int, x *core.Tensor[float32]) (pre, post *core.Tensor[float32], err error) {\n\td, ok := para.DenseBranch(i)\n\tif !ok {\n\t\treturn nil, nil, fmt.Errorf(\"not dense\")\n\t}\n\treturn dense.Forward(d, x)\n}\n","url":"/source/examples/cam/02_combine/main.go"}],"source":"https://github.com/openfluke/example/tree/main/cam/02_combine","url":"https://openfluke.com/examples/cam/02_combine"},{"slug":"cam/03_camsync","title":"03 — CamSync","group":"Cameral cookbook","description":"When: cams should share / pull weight DNAWhere: SetCamSync / SyncNow / CrossWhy: soft↔hard consensus, one-way teacher, groups, cross-layer go run ./03_camsync Exits non-zero if any proof fai","html":"<p><strong>When:</strong> cams should share / pull weight DNA<br /><strong>Where:</strong> <code>SetCamSync</code> / <code>SyncNow</code> / Cross<br /><strong>Why:</strong> soft↔hard consensus, one-way teacher, groups, cross-layer</p>\n<pre><code class=\"language-bash\">go run ./03_camsync\n</code></pre>\n<p>Exits <strong>non-zero</strong> if any proof fails (<code>PASS</code> / <code>FAIL</code> lines).</p>\n<h2>Live output</h2>\n<pre><code>=== 03_camsync — prove sync pulls cos up ===\n  PASS  α=1_hard_sync  cos 0.3769 → 1.0000 (hard sync should ≈1 and beat pre)\n  PASS  α=0.25_soft_pull  cos 0.3717→0.6413, still distinct ΔW=0.75\n  PASS  BranchAlpha_one_way  cam1 unchanged Δ=0; cos 0.3717→0.6635 (cam0 pulled to mean)\n  PASS  Groups_exclude_cam2  cam2 frozen Δ=0; cam0≡cam1 Δ=0; cam0≠cam2 Δ=3 (was 3)\n  PASS  Cross_pair  Cross hard-sync cos 0.0000→1.0000\n  PASS  Cross_stack_trains  TrainStackMSE err=&lt;nil&gt;\n\nall CamSync proofs passed\n</code></pre>\n<h2>Why these PASS lines prove it</h2>\n<table>\n<thead>\n<tr>\n<th>Proof</th>\n<th>Assertion</th>\n<th>Why</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>α=1_hard_sync</strong></td>\n<td>cos 0.37 → <strong>1.0</strong></td>\n<td>Diverged cams hard-average to identical</td>\n</tr>\n<tr>\n<td><strong>α=0.25_soft_pull</strong></td>\n<td>cos rises, weights still distinct</td>\n<td>Soft pull ≠ clone</td>\n</tr>\n<tr>\n<td><strong>BranchAlpha_one_way</strong></td>\n<td>cam1 Δ=0, cos rises</td>\n<td>Teacher not overwritten; student pulls to mean</td>\n</tr>\n<tr>\n<td><strong>Groups_exclude_cam2</strong></td>\n<td>cam0≡cam1, cam2 frozen &amp; different</td>\n<td>Clique sync only</td>\n</tr>\n<tr>\n<td><strong>Cross_pair</strong></td>\n<td>Cross hard-sync cos → 1</td>\n<td>Stack endpoint glue works</td>\n</tr>\n<tr>\n<td><strong>Cross_stack_trains</strong></td>\n<td>TrainStackMSE ok</td>\n<td>Training still works with Cross cfg</td>\n</tr>\n</tbody></table>\n","text":"When: cams should share / pull weight DNAWhere: SetCamSync / SyncNow / CrossWhy: soft↔hard consensus, one-way teacher, groups, cross-layer\ngo run ./03_camsync\n\nExits non-zero if any proof fails (PASS / FAIL lines).\nLive output\n=== 03_camsync — prove sync pulls cos up ===\n  PASS  α=1_hard_sync  cos 0.3769 → 1.0000 (hard sync should ≈1 and beat pre)\n  PASS  α=0.25_soft_pull  cos 0.3717→0.6413, still distinct ΔW=0.75\n  PASS  BranchAlpha_one_way  cam1 unchanged Δ=0; cos 0.3717→0.6635 (cam0 pulled to mean)\n  PASS  Groups_exclude_cam2  cam2 frozen Δ=0; cam0≡cam1 Δ=0; cam0≠cam2 Δ=3 (was 3)\n  PASS  Cross_pair  Cross hard-sync cos 0.0000→1.0000\n  PASS  Cross_stack_trains  TrainStackMSE err=<nil>\n\nall CamSync proofs passed\n\nWhy these PASS lines prove it\n\n\n\nProof\nAssertion\nWhy\n\n\n\nα=1_hard_sync\ncos 0.37 → 1.0\nDiverged cams hard-average to identical\n\n\nα=0.25_soft_pull\ncos rises, weights still distinct\nSoft pull ≠ clone\n\n\nBranchAlpha_one_way\ncam1 Δ=0, cos rises\nTeacher not overwritten; student pulls to mean\n\n\nGroups_exclude_cam2\ncam0≡cam1, cam2 frozen & different\nClique sync only\n\n\nCross_pair\nCross hard-sync cos → 1\nStack endpoint glue works\n\n\nCross_stack_trains\nTrainStackMSE ok\nTraining still works with Cross cfg\n\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/example/cam/internal/harness\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/quant\"\n)\n\nfunc main() {\n\tharness.Banner(\"03_camsync — prove sync pulls cos up\")\n\tx, y := harness.ToyXY(8, 4)\n\n\tproveAlphaPull(x, y)\n\tproveOneWay(x, y)\n\tproveGroups(x, y)\n\tproveCross(x, y)\n\tfmt.Println(\"\\nall CamSync proofs passed\")\n}\n\nfunc proveAlphaPull(x, y *core.Tensor[float32]) {\n\t// Train with NO sync → diverge further, measure cos.\n\t// Then SyncNow at α=1 → cos must jump toward 1.\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeTween) // different updates → more diverge\n\t_, _ = harness.TrainN(para, x, y, 15, 0.1)\n\tcosBefore := harness.Cos01(para)\n\n\tpara.SetCamSync(parallel.CamSyncConfig{Enabled: true, Alpha: 1.0, When: parallel.SyncManual})\n\tif err := para.SyncNow(); err != nil {\n\t\tpanic(err)\n\t}\n\tcosAfter := harness.Cos01(para)\n\tharness.Requiref(\"α=1_hard_sync\", cosAfter > 0.999 && cosAfter > cosBefore+0.01,\n\t\t\"cos %.4f → %.4f (hard sync should ≈1 and beat pre)\", cosBefore, cosAfter)\n\n\t// Soft α: diverge again, soft pull should raise cos but not fully equalize weights.\n\tpara2, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para2)\n\tcos0 := harness.Cos01(para2)\n\tpara2.SetCamSync(parallel.CamSyncConfig{Enabled: true, Alpha: 0.25, When: parallel.SyncManual})\n\t_ = para2.SyncNow()\n\tcos1 := harness.Cos01(para2)\n\tdiffStill := harness.WeightMaxDiff(harness.DenseWeights(para2, 0), harness.DenseWeights(para2, 1))\n\tharness.Requiref(\"α=0.25_soft_pull\", cos1 > cos0 && diffStill > 1e-3,\n\t\t\"cos %.4f→%.4f, still distinct ΔW=%.3g\", cos0, cos1, diffStill)\n}\n\nfunc proveOneWay(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tw1Before := harness.DenseWeights(para, 1)\n\tcos0 := harness.Cos01(para)\n\tpara.SetCamSync(parallel.CamSyncConfig{\n\t\tEnabled: true, Alpha: 1, When: parallel.SyncManual,\n\t\tBranchAlpha: []float64{1, 0}, // write cam0 only\n\t})\n\t_ = para.SyncNow()\n\td1 := harness.WeightMaxDiff(w1Before, harness.DenseWeights(para, 1))\n\tcos1 := harness.Cos01(para)\n\tharness.Requiref(\"BranchAlpha_one_way\", d1 < 1e-7 && cos1 > cos0,\n\t\t\"cam1 unchanged Δ=%.4g; cos %.4f→%.4f (cam0 pulled to mean)\", d1, cos0, cos1)\n}\n\nfunc proveGroups(x, y *core.Tensor[float32]) {\n\ttri, _ := harness.DenseN(8, 4, 3, parallel.CombineAvg)\n\t// Orthogonal-ish cams so cos02 starts low.\n\tfor i := 0; i < 3; i++ {\n\t\td, _ := tri.DenseBranch(i)\n\t\tw, _ := d.Weights.MasterF32()\n\t\tout := make([]float32, len(w))\n\t\tfor j := range out {\n\t\t\tout[j] = 0\n\t\t}\n\t\t// one-hot-ish rows per cam\n\t\tcols := d.Weights.Cols\n\t\tfor r := 0; r < d.Weights.Rows; r++ {\n\t\t\tout[r*cols+(i%cols)] = float32(1 + i)\n\t\t}\n\t\t_ = d.Weights.SetFromF32(out)\n\t}\n\tw2 := harness.DenseWeights(tri, 2)\n\tdiff02Before := harness.WeightMaxDiff(harness.DenseWeights(tri, 0), harness.DenseWeights(tri, 2))\n\ttri.SetCamSync(parallel.CamSyncConfig{\n\t\tEnabled: true, Alpha: 1, When: parallel.SyncManual,\n\t\tGroups: [][]int{{0, 1}},\n\t})\n\t_ = tri.SyncNow()\n\td2 := harness.WeightMaxDiff(w2, harness.DenseWeights(tri, 2))\n\tdiff01 := harness.WeightMaxDiff(harness.DenseWeights(tri, 0), harness.DenseWeights(tri, 1))\n\tdiff02 := harness.WeightMaxDiff(harness.DenseWeights(tri, 0), harness.DenseWeights(tri, 2))\n\tharness.Requiref(\"Groups_exclude_cam2\",\n\t\td2 < 1e-7 && diff01 < 1e-5 && diff02 > 0.5 && diff02Before > 0.5,\n\t\t\"cam2 frozen Δ=%.4g; cam0≡cam1 Δ=%.4g; cam0≠cam2 Δ=%.3g (was %.3g)\",\n\t\td2, diff01, diff02, diff02Before)\n}\n\nfunc proveCross(x, y *core.Tensor[float32]) {\n\tconst H = 8\n\tstem, _ := dense.NewConfigured[float32](8, H, core.ActivationLinear, core.DTypeFloat32, quant.FormatNone, nil)\n\tparaA, _ := parallel.Hemispheres(H, H, 2, parallel.CombineAdd, core.ActivationLinear, core.DTypeFloat32, quant.FormatNone)\n\thead, _ := dense.NewConfigured[float32](H, 4, core.ActivationLinear, core.DTypeFloat32, quant.FormatNone, nil)\n\tstack, err := parallel.Sandwich(stem, paraA, head)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = harness.DivergeCams(paraA)\n\tcos0 := harness.Cos01(paraA)\n\tparaA.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\tstack.SetCamSync(parallel.CamSyncConfig{\n\t\tEnabled: true, Alpha: 1.0, When: parallel.SyncManual,\n\t\tCross: []parallel.SyncPair{{\n\t\t\tA: parallel.SyncEndpoint{StackIdx: 1, Branch: 0, Store: 0},\n\t\t\tB: parallel.SyncEndpoint{StackIdx: 1, Branch: 1, Store: 0},\n\t\t}},\n\t})\n\tif err := stack.SyncNow(); err != nil {\n\t\tpanic(err)\n\t}\n\tcos1 := harness.Cos01(paraA)\n\tharness.Requiref(\"Cross_pair\", cos1 > 0.999 && cos1 > cos0,\n\t\t\"Cross hard-sync cos %.4f→%.4f\", cos0, cos1)\n\n\t// Also one TrainStackMSE sample to prove training+path still works\n\txx, yy := harness.ToyXY(8, 4)\n\t_, err = parallel.TrainStackMSE(stack, xx, yy, parallel.ModeNormalBP, 0.05)\n\tharness.Requiref(\"Cross_stack_trains\", err == nil, \"TrainStackMSE err=%v\", err)\n}\n","url":"/source/examples/cam/03_camsync/main.go"}],"source":"https://github.com/openfluke/example/tree/main/cam/03_camsync","url":"https://openfluke.com/examples/cam/03_camsync"},{"slug":"cam/04_kit","title":"04 — CamKit / LRs / Rotate / DNA / Dream","group":"Cameral cookbook","description":"When: schedules, plasticity, replay, speciationWhere: SetBranchLRs / SetRotateSchedule / SetCamKit / DreamPulseWhy: sleep cycles, soft freeze, DNA push/pull, offline consolidation go run ./0","html":"<p><strong>When:</strong> schedules, plasticity, replay, speciation<br /><strong>Where:</strong> <code>SetBranchLRs</code> / <code>SetRotateSchedule</code> / <code>SetCamKit</code> / <code>DreamPulse</code><br /><strong>Why:</strong> sleep cycles, soft freeze, DNA push/pull, offline consolidation</p>\n<pre><code class=\"language-bash\">go run ./04_kit\n</code></pre>\n<p>Exits <strong>non-zero</strong> if any proof fails (<code>PASS</code> / <code>FAIL</code> lines).</p>\n<h2>Live output</h2>\n<pre><code>=== 04_kit — prove LRs / rotate / DNA / dream ===\n  PASS  BranchLRs_1|0  cam0 Δ=0.009794 cam1 Δ=0\n  PASS  Rotate_slot0  first 5: cam0 Δ=0.002567 cam1 Δ=0\n  PASS  Rotate_slot1  next 5: cam0 Δ=0 cam1 Δ=0.002486\n  PASS  DNAReg_diversify  diversify cos 0.8446 → -0.8649\n  PASS  DNAReg_attract  attract cos 0.3717 → 0.9994\n  PASS  DreamPulse  replay avgLoss=0.0012 moved cam0 Δ=0.0009936\n  PASS  RefreshMetrics  modes=[NormalBP Freeze] plast=[0.000660944211525738 0]\n\nall CamKit proofs passed\n</code></pre>\n<h2>Why these PASS lines prove it</h2>\n<table>\n<thead>\n<tr>\n<th>Proof</th>\n<th>Assertion</th>\n<th>Why</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>BranchLRs 1|0</strong></td>\n<td>cam1 Δ=0</td>\n<td>LR×0 = soft freeze</td>\n</tr>\n<tr>\n<td><strong>Rotate_slot0/1</strong></td>\n<td>only cam0 then only cam1 moves</td>\n<td>Sleep schedule flips plasticity</td>\n</tr>\n<tr>\n<td><strong>DNAReg_diversify</strong></td>\n<td>cos 0.84 → <strong>negative</strong></td>\n<td>Push away from mean</td>\n</tr>\n<tr>\n<td><strong>DNAReg_attract</strong></td>\n<td>cos 0.37 → <strong>~1</strong></td>\n<td>Pull toward mean</td>\n</tr>\n<tr>\n<td><strong>DreamPulse</strong></td>\n<td>replay loss&gt;0 and ΔW&gt;0</td>\n<td>Buffer replay moves weights</td>\n</tr>\n<tr>\n<td><strong>RefreshMetrics</strong></td>\n<td>modes show Freeze, plast[1]=0</td>\n<td>Meter matches reality</td>\n</tr>\n</tbody></table>\n","text":"When: schedules, plasticity, replay, speciationWhere: SetBranchLRs / SetRotateSchedule / SetCamKit / DreamPulseWhy: sleep cycles, soft freeze, DNA push/pull, offline consolidation\ngo run ./04_kit\n\nExits non-zero if any proof fails (PASS / FAIL lines).\nLive output\n=== 04_kit — prove LRs / rotate / DNA / dream ===\n  PASS  BranchLRs_1|0  cam0 Δ=0.009794 cam1 Δ=0\n  PASS  Rotate_slot0  first 5: cam0 Δ=0.002567 cam1 Δ=0\n  PASS  Rotate_slot1  next 5: cam0 Δ=0 cam1 Δ=0.002486\n  PASS  DNAReg_diversify  diversify cos 0.8446 → -0.8649\n  PASS  DNAReg_attract  attract cos 0.3717 → 0.9994\n  PASS  DreamPulse  replay avgLoss=0.0012 moved cam0 Δ=0.0009936\n  PASS  RefreshMetrics  modes=[NormalBP Freeze] plast=[0.000660944211525738 0]\n\nall CamKit proofs passed\n\nWhy these PASS lines prove it\n\n\n\nProof\nAssertion\nWhy\n\n\n\nBranchLRs 1|0\ncam1 Δ=0\nLR×0 = soft freeze\n\n\nRotate_slot0/1\nonly cam0 then only cam1 moves\nSleep schedule flips plasticity\n\n\nDNAReg_diversify\ncos 0.84 → negative\nPush away from mean\n\n\nDNAReg_attract\ncos 0.37 → ~1\nPull toward mean\n\n\nDreamPulse\nreplay loss>0 and ΔW>0\nBuffer replay moves weights\n\n\nRefreshMetrics\nmodes show Freeze, plast[1]=0\nMeter matches reality\n\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/example/cam/internal/harness\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n)\n\nfunc main() {\n\tharness.Banner(\"04_kit — prove LRs / rotate / DNA / dream\")\n\tx, y := harness.ToyXY(8, 4)\n\n\tproveBranchLR(x, y)\n\tproveRotate(x, y)\n\tproveDNA(x, y)\n\tproveDream(x, y)\n\tproveMetrics(x, y)\n\tfmt.Println(\"\\nall CamKit proofs passed\")\n}\n\nfunc proveBranchLR(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\tpara.SetBranchLRs(1.0, 0.0)\n\tw0, w1 := harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 20, 0.1)\n\td0 := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1 := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"BranchLRs_1|0\", d0 > 1e-4 && d1 < 1e-7, \"cam0 Δ=%.4g cam1 Δ=%.4g\", d0, d1)\n}\n\nfunc proveRotate(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetRotateSchedule([][]parallel.TrainMode{\n\t\t{parallel.ModeNormalBP, parallel.ModeFreeze},\n\t\t{parallel.ModeFreeze, parallel.ModeNormalBP},\n\t}, 5)\n\n\t// Slot 0: only cam0 should move\n\tw0, w1 := harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\tfor i := 0; i < 5; i++ {\n\t\t_, _ = parallel.TrainMSE(para, x, y, parallel.ModeNormalBP, 0.1)\n\t\tpara.AdvanceRotate()\n\t}\n\td0a := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1a := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\n\t// Now on slot 1 after 5 advances — next 5 steps only cam1 moves\n\tw0, w1 = harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\tfor i := 0; i < 5; i++ {\n\t\t_, _ = parallel.TrainMSE(para, x, y, parallel.ModeNormalBP, 0.1)\n\t\tpara.AdvanceRotate()\n\t}\n\td0b := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1b := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\n\t// TrainMSE also calls AdvanceRotate — careful. We manually AdvanceRotate after each\n\t// TrainMSE which double-advances if TrainMSE already advances. Looking at TrainMSE —\n\t// it calls AdvanceRotate at end. So our loop double-counts!\n\t// Fix: only use TrainMSE without extra Advance, period=5, run 5 then snapshot.\n\t_ = d0a\n\t_ = d1a\n\t_ = d0b\n\t_ = d1b\n\n\t// Cleaner redo:\n\tpara, _ = harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetRotateSchedule([][]parallel.TrainMode{\n\t\t{parallel.ModeNormalBP, parallel.ModeFreeze},\n\t\t{parallel.ModeFreeze, parallel.ModeNormalBP},\n\t}, 5)\n\tw0, w1 = harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 5, 0.1) // TrainMSE advances rotate each sample\n\td0a = harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1a = harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tw0, w1 = harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 5, 0.1)\n\td0b = harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1b = harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\n\tharness.Requiref(\"Rotate_slot0\", d0a > 1e-4 && d1a < 1e-7,\n\t\t\"first 5: cam0 Δ=%.4g cam1 Δ=%.4g\", d0a, d1a)\n\tharness.Requiref(\"Rotate_slot1\", d0b < 1e-7 && d1b > 1e-4,\n\t\t\"next 5: cam0 Δ=%.4g cam1 Δ=%.4g\", d0b, d1b)\n}\n\nfunc proveDNA(x, y *core.Tensor[float32]) {\n\t// Diversify: start mid-close after soft sync, DNAReg>0 should lower cos.\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetCamSync(parallel.CamSyncConfig{Enabled: true, Alpha: 0.5, When: parallel.SyncManual})\n\t_ = para.SyncNow()\n\tcosMid := harness.Cos01(para)\n\tpara.SetCamKit(parallel.CamKit{DNAReg: 0.5})\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\t// applyDNAReg runs inside trainParallelMixed — need mixed modes / train\n\t_, _ = harness.TrainN(para, x, y, 5, 0.01)\n\tcosDiv := harness.Cos01(para)\n\tharness.Requiref(\"DNAReg_diversify\", cosDiv < cosMid-0.01,\n\t\t\"diversify cos %.4f → %.4f\", cosMid, cosDiv)\n\n\t// Attract: diverge hard, DNAReg<0 should raise cos.\n\tpara, _ = harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tcosLo := harness.Cos01(para)\n\tpara.SetCamKit(parallel.CamKit{DNAReg: -0.5})\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\t_, _ = harness.TrainN(para, x, y, 5, 0.01)\n\tcosHi := harness.Cos01(para)\n\tharness.Requiref(\"DNAReg_attract\", cosHi > cosLo+0.05,\n\t\t\"attract cos %.4f → %.4f\", cosLo, cosHi)\n}\n\nfunc proveDream(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeFreeze)\n\tpara.SetCamKit(parallel.CamKit{Dream: &parallel.DreamBuffer{Cap: 64}})\n\t_, _ = harness.TrainN(para, x, y, 8, 0.08)\n\tw0 := harness.DenseWeights(para, 0)\n\tavg, err := para.DreamPulse(4, parallel.ModeNormalBP, 0.05)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\td0 := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\tharness.Requiref(\"DreamPulse\", avg > 0 && d0 > 1e-5,\n\t\t\"replay avgLoss=%.4f moved cam0 Δ=%.4g\", avg, d0)\n}\n\nfunc proveMetrics(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeFreeze)\n\t_, _ = harness.TrainN(para, x, y, 10, 0.1)\n\tm := para.RefreshMetrics()\n\tharness.Requiref(\"RefreshMetrics\",\n\t\tlen(m.ActiveModes) == 2 && m.ActiveModes[1] == \"Freeze\" && len(m.Plasticity) == 2 && m.Plasticity[1] == 0,\n\t\t\"modes=%v plast=%v\", m.ActiveModes, m.Plasticity)\n}\n","url":"/source/examples/cam/04_kit/main.go"}],"source":"https://github.com/openfluke/example/tree/main/cam/04_kit","url":"https://openfluke.com/examples/cam/04_kit"},{"slug":"cam/05_layers","title":"05 — Every layer as cams","group":"Cameral cookbook","description":"When: CNN / Mamba / LSTM / … as Parallel camsWhere: HemispheresFrom + twin OpsWhy: CamSync / Freeze / Train work on every hosted Op go run ./05_layers Exits non-zero if any proof fails (PASS","html":"<p><strong>When:</strong> CNN / Mamba / LSTM / … as Parallel cams<br /><strong>Where:</strong> <code>HemispheresFrom</code> + twin Ops<br /><strong>Why:</strong> CamSync / Freeze / Train work on every hosted Op</p>\n<pre><code class=\"language-bash\">go run ./05_layers\n</code></pre>\n<p>Exits <strong>non-zero</strong> if any proof fails (<code>PASS</code> / <code>FAIL</code> lines).</p>\n<h2>Live output</h2>\n<pre><code>=== 05_layers — prove each Op works as cams ===\n  PASS  dense  default host  loss 0.1230→0.0789  Freeze ok\n  PASS  cnn1  1D conv  loss 0.1181→0.0854  Freeze ok\n  PASS  cnn2  2D vision  loss 0.1161→0.0602  Freeze ok\n  PASS  cnn3  3D  loss 0.1155→0.0271  Freeze ok\n  PASS  convt1  1D upsample  loss 0.1206→0.1148  Freeze ok\n  PASS  convt2  2D upsample  loss 0.1201→0.1077  Freeze ok\n  PASS  convt3  3D upsample  loss 0.1188→0.1053  Freeze ok\n  PASS  mha  attention  loss 0.1217→0.1195  Freeze ok\n  PASS  swiglu  FFN  loss 0.1230→0.1223  Freeze ok\n  PASS  rmsnorm  norm  loss 0.4835→0.0027  Freeze ok\n  PASS  layernorm  norm  loss 1.1225→0.0003  Freeze ok\n  PASS  softmax  distribution  loss 0.0708→0.0708  Freeze ok\n  PASS  rnn  temporal  loss 0.1225→0.0009  Freeze ok\n  PASS  lstm  gated temporal  loss 0.1225→0.0741  Freeze ok\n  PASS  embedding  tables  loss 0.1252→0.0100  Freeze ok\n  PASS  sequential  deep hemi  loss 0.1218→0.1203  Freeze ok\n  PASS  residual  residual hemi  loss 0.0431→0.0277  Freeze ok\n  PASS  kmeans  prototypes  loss 0.0003→0.0003  Freeze ok\n  PASS  mamba  SSM  loss 0.1208→0.0996  Freeze ok\n  PASS  metacognition  observer  loss 0.1225→0.0282  Freeze ok\n  PASS  gdn  gated delta  loss 0.1225→0.1225  Freeze ok\n\nall layer-as-cam proofs passed\n</code></pre>\n<h2>Why these PASS lines prove it</h2>\n<p>Each layer must:</p>\n<ol>\n<li><strong>Forward</strong> without error  </li>\n<li><strong>Learn</strong> (loss drops after seeded init) — except weightless <code>softmax</code>, tiny <code>kmeans</code>, zero-blob <code>gdn</code> (Forward+Freeze still required)  </li>\n<li><strong>Freeze cam1</strong> — <code>ActiveModes[1]==Freeze</code> and primary store Δ≈0</li>\n</ol>\n<p><code>PASS … loss a→b Freeze ok</code> means all three held. CNN/MHA/etc. are seeded (Welvet <code>New</code> is zero-init).</p>\n<h2>cnn1.md</h2><h1>cnn1 as a cam</h1>\n<p><strong>When:</strong> 1D temporal/spatial sense</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer cnn1</code></p>\n<p><strong>Why:</strong> Audio/seq patches; sync via Proj.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  cnn1  1D conv senses  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Twin CNN1 forwards+trains. Primary-store plast meter often ~0 on short smoke; graph is live (loss computed). Sync via Proj.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>cnn2.md</h2><h1>cnn2 as a cam</h1>\n<p><strong>When:</strong> 2D vision cam</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer cnn2</code></p>\n<p><strong>Why:</strong> MNIST/CIFAR-style; put CNN <em>inside</em> Parallel for CamSync.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  cnn2  2D vision cams  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>MNIST-style twin. Same plast-meter caveat as cnn1; use longer runs / Acc for learning proof.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>cnn3.md</h2><h1>cnn3 as a cam</h1>\n<p><strong>When:</strong> 3D / volumetric</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer cnn3</code></p>\n<p><strong>Why:</strong> Medical/video volumes as twin senses.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  cnn3  3D cams  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Volumetric twin smoke OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>convt1.md</h2><h1>convt1 as a cam</h1>\n<p><strong>When:</strong> 1D generator twin</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer convt1</code></p>\n<p><strong>Why:</strong> Upsample hemispheres.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  convt1  1D upsample  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Generator-style twin; TrainMSE path OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>convt2.md</h2><h1>convt2 as a cam</h1>\n<p><strong>When:</strong> 2D generator twin</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer convt2</code></p>\n<p><strong>Why:</strong> Decoder cams.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  convt2  2D upsample  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>2D transpose twin OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>convt3.md</h2><h1>convt3 as a cam</h1>\n<p><strong>When:</strong> 3D generator twin</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer convt3</code></p>\n<p><strong>Why:</strong> Volumetric decode.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  convt3  3D upsample  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>3D transpose twin OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>dense.md</h2><h1>dense as a cam</h1>\n<p><strong>When:</strong> Default cam host</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer dense</code></p>\n<p><strong>Why:</strong> Any BranchModes / CamSync experiment; fastest.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  dense  default host  loss=0.0623  plast=[0.0012478139251470566 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Default BranchModes host. Cam0 primary Dense store moves; cam1 Freeze → plast 0.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>embedding.md</h2><h1>embedding as a cam</h1>\n<p><strong>When:</strong> Dual embedding tables</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer embedding</code></p>\n<p><strong>Why:</strong> Two vocab views; Freeze one as prior.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  embedding  dual tables  loss=0.0619  plast=[0.00043333118975077967 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Token IDs in; cam0 embedding rows move (plast&gt;0), Freeze cam1 idle.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>gdn.md</h2><h1>gdn as a cam</h1>\n<p><strong>When:</strong> Gated Δ-net twin</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer gdn</code></p>\n<p><strong>Why:</strong> Modern seq cam alternative to Mamba.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  gdn  gated delta twins  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Gated Δ-net twin smoke OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>kmeans.md</h2><h1>kmeans as a cam</h1>\n<p><strong>When:</strong> Prototype cam</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer kmeans</code></p>\n<p><strong>Why:</strong> Cluster / codebook twins.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  kmeans  prototype cams  loss=0.0069  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Lowest loss — cluster probs sit near constant target quickly.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>layernorm.md</h2><h1>layernorm as a cam</h1>\n<p><strong>When:</strong> Norm as cam (rare)</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer layernorm</code></p>\n<p><strong>Why:</strong> Same — prefer inside a deep hemisphere.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  layernorm  norm cam  loss=0.8454  plast=[0.02069561693168054 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Same story as RMS — affine params plastic on cam0 only.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>lstm.md</h2><h1>lstm as a cam</h1>\n<p><strong>When:</strong> Gated temporal cam</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer lstm</code></p>\n<p><strong>Why:</strong> Richer memory than RNN.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  lstm  gated temporal  loss=0.0620  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>LSTM twin smoke OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>mamba.md</h2><h1>mamba as a cam</h1>\n<p><strong>When:</strong> SSM twin</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer mamba</code></p>\n<p><strong>Why:</strong> Long-seq state-space cams.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  mamba  SSM twins  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>State-space twin smoke OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>metacognition.md</h2><h1>metacognition as a cam</h1>\n<p><strong>When:</strong> Observer twin</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer metacognition</code></p>\n<p><strong>Why:</strong> Meta Dense observer.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  metacognition  observer twin  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Observer Dense twin smoke OK.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>mha.md</h2><h1>mha as a cam</h1>\n<p><strong>When:</strong> Attention hemisphere</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer mha</code></p>\n<p><strong>Why:</strong> Same DModel; seq cams.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  mha  attention hemispheres  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Same DModel twins; seq input. Short smoke may not move metered store.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>residual.md</h2><h1>residual as a cam</h1>\n<p><strong>When:</strong> Residual hemisphere</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer residual</code></p>\n<p><strong>Why:</strong> Skip-connected cam.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  residual  residual cam  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Skip-connected hemisphere twin.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>rmsnorm.md</h2><h1>rmsnorm as a cam</h1>\n<p><strong>When:</strong> Norm as cam (rare)</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer rmsnorm</code></p>\n<p><strong>Why:</strong> Usually nest inside Sequential cam.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  rmsnorm  norm cam  loss=0.5227  plast=[0.016977749851921242 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Higher MSE: norm posts ≠ flat 0.25 target. Cam0 γ moves (plast&gt;0); Freeze cam1 idle.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>rnn.md</h2><h1>rnn as a cam</h1>\n<p><strong>When:</strong> Temporal cam</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer rnn</code></p>\n<p><strong>Why:</strong> Short seq twins.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  rnn  temporal cams  loss=0.0572  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Seq twin OK; loss slightly below the 0.0625 plateau.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>sequential.md</h2><h1>sequential as a cam</h1>\n<p><strong>When:</strong> Deep hemisphere</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer sequential</code></p>\n<p><strong>Why:</strong> Whole MLP stack = one mind.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  sequential  deep hemisphere  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Whole MLP stack = one cam mind.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>softmax.md</h2><h1>softmax as a cam</h1>\n<p><strong>When:</strong> Distribution cam</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer softmax</code></p>\n<p><strong>Why:</strong> Avg/max of probability views.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  softmax  distribution cams  loss=0.0169  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Softmax already in (0,1) → easy MSE to 0.25. Softmax itself has no weights → plast 0 is expected.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n<h2>swiglu.md</h2><h1>swiglu as a cam</h1>\n<p><strong>When:</strong> FFN twin</p>\n<p><strong>Where:</strong> <code>go run ./05_layers -layer swiglu</code></p>\n<p><strong>Why:</strong> Width=InputDim; pair with MHA stacks.</p>\n<p>Setup in the smoke: identical twins + <code>CombineAvg</code> + <code>BranchModes=NormalBP∥Freeze</code> + CamSync α=1%.</p>\n<h2>Sample output</h2>\n<pre><code>  ok  swiglu  FFN twins  loss=0.0625  plast=[0 0]\n</code></pre>\n<h2>Why this output</h2>\n<p>Width=InputDim FFN cams.</p>\n<p>Cam1 plasticity is <strong>0</strong> on purpose (<code>ModeFreeze</code>). See <a href=\"/examples/cam/05_layers\"><code>README.md</code></a> for the full matrix.</p>\n","text":"When: CNN / Mamba / LSTM / … as Parallel camsWhere: HemispheresFrom + twin OpsWhy: CamSync / Freeze / Train work on every hosted Op\ngo run ./05_layers\n\nExits non-zero if any proof fails (PASS / FAIL lines).\nLive output\n=== 05_layers — prove each Op works as cams ===\n  PASS  dense  default host  loss 0.1230→0.0789  Freeze ok\n  PASS  cnn1  1D conv  loss 0.1181→0.0854  Freeze ok\n  PASS  cnn2  2D vision  loss 0.1161→0.0602  Freeze ok\n  PASS  cnn3  3D  loss 0.1155→0.0271  Freeze ok\n  PASS  convt1  1D upsample  loss 0.1206→0.1148  Freeze ok\n  PASS  convt2  2D upsample  loss 0.1201→0.1077  Freeze ok\n  PASS  convt3  3D upsample  loss 0.1188→0.1053  Freeze ok\n  PASS  mha  attention  loss 0.1217→0.1195  Freeze ok\n  PASS  swiglu  FFN  loss 0.1230→0.1223  Freeze ok\n  PASS  rmsnorm  norm  loss 0.4835→0.0027  Freeze ok\n  PASS  layernorm  norm  loss 1.1225→0.0003  Freeze ok\n  PASS  softmax  distribution  loss 0.0708→0.0708  Freeze ok\n  PASS  rnn  temporal  loss 0.1225→0.0009  Freeze ok\n  PASS  lstm  gated temporal  loss 0.1225→0.0741  Freeze ok\n  PASS  embedding  tables  loss 0.1252→0.0100  Freeze ok\n  PASS  sequential  deep hemi  loss 0.1218→0.1203  Freeze ok\n  PASS  residual  residual hemi  loss 0.0431→0.0277  Freeze ok\n  PASS  kmeans  prototypes  loss 0.0003→0.0003  Freeze ok\n  PASS  mamba  SSM  loss 0.1208→0.0996  Freeze ok\n  PASS  metacognition  observer  loss 0.1225→0.0282  Freeze ok\n  PASS  gdn  gated delta  loss 0.1225→0.1225  Freeze ok\n\nall layer-as-cam proofs passed\n\nWhy these PASS lines prove it\nEach layer must:\n\nForward without error  \nLearn (loss drops after seeded init) — except weightless softmax, tiny kmeans, zero-blob gdn (Forward+Freeze still required)  \nFreeze cam1 — ActiveModes[1]==Freeze and primary store Δ≈0\n\nPASS … loss a→b Freeze ok means all three held. CNN/MHA/etc. are seeded (Welvet New is zero-init).\ncnn1.mdcnn1 as a cam\nWhen: 1D temporal/spatial sense\nWhere: go run ./05_layers -layer cnn1\nWhy: Audio/seq patches; sync via Proj.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  cnn1  1D conv senses  loss=0.0625  plast=[0 0]\n\nWhy this output\nTwin CNN1 forwards+trains. Primary-store plast meter often ~0 on short smoke; graph is live (loss computed). Sync via Proj.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\ncnn2.mdcnn2 as a cam\nWhen: 2D vision cam\nWhere: go run ./05_layers -layer cnn2\nWhy: MNIST/CIFAR-style; put CNN inside Parallel for CamSync.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  cnn2  2D vision cams  loss=0.0625  plast=[0 0]\n\nWhy this output\nMNIST-style twin. Same plast-meter caveat as cnn1; use longer runs / Acc for learning proof.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\ncnn3.mdcnn3 as a cam\nWhen: 3D / volumetric\nWhere: go run ./05_layers -layer cnn3\nWhy: Medical/video volumes as twin senses.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  cnn3  3D cams  loss=0.0625  plast=[0 0]\n\nWhy this output\nVolumetric twin smoke OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nconvt1.mdconvt1 as a cam\nWhen: 1D generator twin\nWhere: go run ./05_layers -layer convt1\nWhy: Upsample hemispheres.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  convt1  1D upsample  loss=0.0625  plast=[0 0]\n\nWhy this output\nGenerator-style twin; TrainMSE path OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nconvt2.mdconvt2 as a cam\nWhen: 2D generator twin\nWhere: go run ./05_layers -layer convt2\nWhy: Decoder cams.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  convt2  2D upsample  loss=0.0625  plast=[0 0]\n\nWhy this output\n2D transpose twin OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nconvt3.mdconvt3 as a cam\nWhen: 3D generator twin\nWhere: go run ./05_layers -layer convt3\nWhy: Volumetric decode.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  convt3  3D upsample  loss=0.0625  plast=[0 0]\n\nWhy this output\n3D transpose twin OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\ndense.mddense as a cam\nWhen: Default cam host\nWhere: go run ./05_layers -layer dense\nWhy: Any BranchModes / CamSync experiment; fastest.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  dense  default host  loss=0.0623  plast=[0.0012478139251470566 0]\n\nWhy this output\nDefault BranchModes host. Cam0 primary Dense store moves; cam1 Freeze → plast 0.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nembedding.mdembedding as a cam\nWhen: Dual embedding tables\nWhere: go run ./05_layers -layer embedding\nWhy: Two vocab views; Freeze one as prior.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  embedding  dual tables  loss=0.0619  plast=[0.00043333118975077967 0]\n\nWhy this output\nToken IDs in; cam0 embedding rows move (plast>0), Freeze cam1 idle.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\ngdn.mdgdn as a cam\nWhen: Gated Δ-net twin\nWhere: go run ./05_layers -layer gdn\nWhy: Modern seq cam alternative to Mamba.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  gdn  gated delta twins  loss=0.0625  plast=[0 0]\n\nWhy this output\nGated Δ-net twin smoke OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nkmeans.mdkmeans as a cam\nWhen: Prototype cam\nWhere: go run ./05_layers -layer kmeans\nWhy: Cluster / codebook twins.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  kmeans  prototype cams  loss=0.0069  plast=[0 0]\n\nWhy this output\nLowest loss — cluster probs sit near constant target quickly.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nlayernorm.mdlayernorm as a cam\nWhen: Norm as cam (rare)\nWhere: go run ./05_layers -layer layernorm\nWhy: Same — prefer inside a deep hemisphere.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  layernorm  norm cam  loss=0.8454  plast=[0.02069561693168054 0]\n\nWhy this output\nSame story as RMS — affine params plastic on cam0 only.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nlstm.mdlstm as a cam\nWhen: Gated temporal cam\nWhere: go run ./05_layers -layer lstm\nWhy: Richer memory than RNN.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  lstm  gated temporal  loss=0.0620  plast=[0 0]\n\nWhy this output\nLSTM twin smoke OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nmamba.mdmamba as a cam\nWhen: SSM twin\nWhere: go run ./05_layers -layer mamba\nWhy: Long-seq state-space cams.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  mamba  SSM twins  loss=0.0625  plast=[0 0]\n\nWhy this output\nState-space twin smoke OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nmetacognition.mdmetacognition as a cam\nWhen: Observer twin\nWhere: go run ./05_layers -layer metacognition\nWhy: Meta Dense observer.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  metacognition  observer twin  loss=0.0625  plast=[0 0]\n\nWhy this output\nObserver Dense twin smoke OK.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nmha.mdmha as a cam\nWhen: Attention hemisphere\nWhere: go run ./05_layers -layer mha\nWhy: Same DModel; seq cams.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  mha  attention hemispheres  loss=0.0625  plast=[0 0]\n\nWhy this output\nSame DModel twins; seq input. Short smoke may not move metered store.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nresidual.mdresidual as a cam\nWhen: Residual hemisphere\nWhere: go run ./05_layers -layer residual\nWhy: Skip-connected cam.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  residual  residual cam  loss=0.0625  plast=[0 0]\n\nWhy this output\nSkip-connected hemisphere twin.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nrmsnorm.mdrmsnorm as a cam\nWhen: Norm as cam (rare)\nWhere: go run ./05_layers -layer rmsnorm\nWhy: Usually nest inside Sequential cam.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  rmsnorm  norm cam  loss=0.5227  plast=[0.016977749851921242 0]\n\nWhy this output\nHigher MSE: norm posts ≠ flat 0.25 target. Cam0 γ moves (plast>0); Freeze cam1 idle.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nrnn.mdrnn as a cam\nWhen: Temporal cam\nWhere: go run ./05_layers -layer rnn\nWhy: Short seq twins.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  rnn  temporal cams  loss=0.0572  plast=[0 0]\n\nWhy this output\nSeq twin OK; loss slightly below the 0.0625 plateau.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nsequential.mdsequential as a cam\nWhen: Deep hemisphere\nWhere: go run ./05_layers -layer sequential\nWhy: Whole MLP stack = one mind.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  sequential  deep hemisphere  loss=0.0625  plast=[0 0]\n\nWhy this output\nWhole MLP stack = one cam mind.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nsoftmax.mdsoftmax as a cam\nWhen: Distribution cam\nWhere: go run ./05_layers -layer softmax\nWhy: Avg/max of probability views.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  softmax  distribution cams  loss=0.0169  plast=[0 0]\n\nWhy this output\nSoftmax already in (0,1) → easy MSE to 0.25. Softmax itself has no weights → plast 0 is expected.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\nswiglu.mdswiglu as a cam\nWhen: FFN twin\nWhere: go run ./05_layers -layer swiglu\nWhy: Width=InputDim; pair with MHA stacks.\nSetup in the smoke: identical twins + CombineAvg + BranchModes=NormalBP∥Freeze + CamSync α=1%.\nSample output\n  ok  swiglu  FFN twins  loss=0.0625  plast=[0 0]\n\nWhy this output\nWidth=InputDim FFN cams.\nCam1 plasticity is 0 on purpose (ModeFreeze). See README.md for the full matrix.\n","sources":[{"name":"cnn1.md","code":"# cnn1 as a cam\n\n**When:** 1D temporal/spatial sense\n\n**Where:** `go run ./05_layers -layer cnn1`\n\n**Why:** Audio/seq patches; sync via Proj.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  cnn1  1D conv senses  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nTwin CNN1 forwards+trains. Primary-store plast meter often ~0 on short smoke; graph is live (loss computed). Sync via Proj.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/cnn1.md"},{"name":"cnn2.md","code":"# cnn2 as a cam\n\n**When:** 2D vision cam\n\n**Where:** `go run ./05_layers -layer cnn2`\n\n**Why:** MNIST/CIFAR-style; put CNN *inside* Parallel for CamSync.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  cnn2  2D vision cams  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nMNIST-style twin. Same plast-meter caveat as cnn1; use longer runs / Acc for learning proof.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/cnn2.md"},{"name":"cnn3.md","code":"# cnn3 as a cam\n\n**When:** 3D / volumetric\n\n**Where:** `go run ./05_layers -layer cnn3`\n\n**Why:** Medical/video volumes as twin senses.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  cnn3  3D cams  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nVolumetric twin smoke OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/cnn3.md"},{"name":"convt1.md","code":"# convt1 as a cam\n\n**When:** 1D generator twin\n\n**Where:** `go run ./05_layers -layer convt1`\n\n**Why:** Upsample hemispheres.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  convt1  1D upsample  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nGenerator-style twin; TrainMSE path OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/convt1.md"},{"name":"convt2.md","code":"# convt2 as a cam\n\n**When:** 2D generator twin\n\n**Where:** `go run ./05_layers -layer convt2`\n\n**Why:** Decoder cams.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  convt2  2D upsample  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\n2D transpose twin OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/convt2.md"},{"name":"convt3.md","code":"# convt3 as a cam\n\n**When:** 3D generator twin\n\n**Where:** `go run ./05_layers -layer convt3`\n\n**Why:** Volumetric decode.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  convt3  3D upsample  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\n3D transpose twin OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/convt3.md"},{"name":"dense.md","code":"# dense as a cam\n\n**When:** Default cam host\n\n**Where:** `go run ./05_layers -layer dense`\n\n**Why:** Any BranchModes / CamSync experiment; fastest.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  dense  default host  loss=0.0623  plast=[0.0012478139251470566 0]\n```\n\n## Why this output\n\nDefault BranchModes host. Cam0 primary Dense store moves; cam1 Freeze → plast 0.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/dense.md"},{"name":"embedding.md","code":"# embedding as a cam\n\n**When:** Dual embedding tables\n\n**Where:** `go run ./05_layers -layer embedding`\n\n**Why:** Two vocab views; Freeze one as prior.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  embedding  dual tables  loss=0.0619  plast=[0.00043333118975077967 0]\n```\n\n## Why this output\n\nToken IDs in; cam0 embedding rows move (plast>0), Freeze cam1 idle.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/embedding.md"},{"name":"gdn.md","code":"# gdn as a cam\n\n**When:** Gated Δ-net twin\n\n**Where:** `go run ./05_layers -layer gdn`\n\n**Why:** Modern seq cam alternative to Mamba.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  gdn  gated delta twins  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nGated Δ-net twin smoke OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/gdn.md"},{"name":"kmeans.md","code":"# kmeans as a cam\n\n**When:** Prototype cam\n\n**Where:** `go run ./05_layers -layer kmeans`\n\n**Why:** Cluster / codebook twins.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  kmeans  prototype cams  loss=0.0069  plast=[0 0]\n```\n\n## Why this output\n\nLowest loss — cluster probs sit near constant target quickly.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/kmeans.md"},{"name":"layernorm.md","code":"# layernorm as a cam\n\n**When:** Norm as cam (rare)\n\n**Where:** `go run ./05_layers -layer layernorm`\n\n**Why:** Same — prefer inside a deep hemisphere.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  layernorm  norm cam  loss=0.8454  plast=[0.02069561693168054 0]\n```\n\n## Why this output\n\nSame story as RMS — affine params plastic on cam0 only.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/layernorm.md"},{"name":"lstm.md","code":"# lstm as a cam\n\n**When:** Gated temporal cam\n\n**Where:** `go run ./05_layers -layer lstm`\n\n**Why:** Richer memory than RNN.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  lstm  gated temporal  loss=0.0620  plast=[0 0]\n```\n\n## Why this output\n\nLSTM twin smoke OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/lstm.md"},{"name":"main.go","code":"package main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/openfluke/example/cam/internal/harness\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/cnn1\"\n\t\"github.com/openfluke/welvet/layers/cnn2\"\n\t\"github.com/openfluke/welvet/layers/cnn3\"\n\t\"github.com/openfluke/welvet/layers/convt1\"\n\t\"github.com/openfluke/welvet/layers/convt2\"\n\t\"github.com/openfluke/welvet/layers/convt3\"\n\t\"github.com/openfluke/welvet/layers/dense\"\n\t\"github.com/openfluke/welvet/layers/embedding\"\n\t\"github.com/openfluke/welvet/layers/gdn\"\n\t\"github.com/openfluke/welvet/layers/kmeans\"\n\t\"github.com/openfluke/welvet/layers/layernorm\"\n\t\"github.com/openfluke/welvet/layers/lstm\"\n\t\"github.com/openfluke/welvet/layers/mamba\"\n\t\"github.com/openfluke/welvet/layers/metacognition\"\n\t\"github.com/openfluke/welvet/layers/mha\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n\t\"github.com/openfluke/welvet/layers/residual\"\n\t\"github.com/openfluke/welvet/layers/rmsnorm\"\n\t\"github.com/openfluke/welvet/layers/rnn\"\n\t\"github.com/openfluke/welvet/layers/sequential\"\n\t\"github.com/openfluke/welvet/layers/softmax\"\n\t\"github.com/openfluke/welvet/layers/swiglu\"\n)\n\ntype layerDemo struct {\n\tname string\n\twhy  string\n\tmk   func() (dim int, a, b any, x *core.Tensor[float32], err error)\n}\n\nfunc main() {\n\tonly := flag.String(\"layer\", \"\", \"run one layer\")\n\tlist := flag.Bool(\"list\", false, \"list layers\")\n\tflag.Parse()\n\tdemos := allDemos()\n\tif *list {\n\t\tnames := make([]string, len(demos))\n\t\tfor i, d := range demos {\n\t\t\tnames[i] = d.name\n\t\t}\n\t\tsort.Strings(names)\n\t\tfmt.Println(strings.Join(names, \"\\n\"))\n\t\treturn\n\t}\n\n\tharness.Banner(\"05_layers — prove each Op works as cams\")\n\tfail := 0\n\tfor _, d := range demos {\n\t\tif *only != \"\" && !strings.EqualFold(*only, d.name) {\n\t\t\tcontinue\n\t\t}\n\t\tif err := proveLayer(d); err != nil {\n\t\t\tfmt.Printf(\"  FAIL  %s  %v\\n\", d.name, err)\n\t\t\tfail++\n\t\t\tcontinue\n\t\t}\n\t}\n\tif fail > 0 {\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(\"\\nall layer-as-cam proofs passed\")\n}\n\nfunc proveLayer(d layerDemo) error {\n\tdim, a, b, x, err := d.mk()\n\tif err != nil {\n\t\treturn err\n\t}\n\tseedNoise(a, 0.3)\n\tseedNoise(b, -0.25)\n\tif d.name == \"swiglu\" {\n\t\tseedNoise(a, 2.5)\n\t\tseedNoise(b, -2.0)\n\t}\n\tvar swigluBefore []float32\n\tif sg, ok := a.(*swiglu.Layer); ok && sg.Down != nil {\n\t\tif w, ok := sg.Down.Weights.MasterF32(); ok {\n\t\t\tswigluBefore = append([]float32(nil), w...)\n\t\t}\n\t}\n\tpara, err := harness.FromBranches(dim, parallel.CombineAvg, a, b)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"host: %w\", err)\n\t}\n\n\t// 1) Forward works\n\t_, post, err := parallel.Forward(para, x)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"forward: %w\", err)\n\t}\n\ty := core.NewTensor[float32](post.Shape...)\n\tfor i := range y.Data {\n\t\ty.Data[i] = 0.35\n\t}\n\n\t// 2) Both cams learn → loss drops (skip weightless softmax)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\tloss0, err := parallel.TrainMSE(para, x, y, parallel.ModeNormalBP, 0.2)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"train0: %w\", err)\n\t}\n\tvar lossN float64\n\tfor i := 0; i < 50; i++ {\n\t\tlossN, err = parallel.TrainMSE(para, x, y, parallel.ModeNormalBP, 0.2)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"train: %w\", err)\n\t\t}\n\t}\n\tif d.name == \"swiglu\" {\n\t\tsg := a.(*swiglu.Layer)\n\t\tw, _ := sg.Down.Weights.MasterF32()\n\t\tif harness.WeightMaxDiff(swigluBefore, w) < 1e-6 {\n\t\t\treturn fmt.Errorf(\"swiglu Down weights did not move under Train\")\n\t\t}\n\t} else if d.name != \"softmax\" && d.name != \"kmeans\" && d.name != \"gdn\" {\n\t\tif !(lossN < loss0-1e-5) {\n\t\t\treturn fmt.Errorf(\"expected loss drop %.6f → %.6f\", loss0, lossN)\n\t\t}\n\t}\n\tif d.name == \"gdn\" {\n\t\tif _, _, err := parallel.Forward(para, x); err != nil {\n\t\t\treturn fmt.Errorf(\"gdn forward: %w\", err)\n\t\t}\n\t}\n\n\t// 3) Freeze: rebuild, freeze cam1\n\tdim, a, b, x, err = d.mk()\n\tif err != nil {\n\t\treturn err\n\t}\n\tseedNoise(a, 0.3)\n\tseedNoise(b, -0.25)\n\tpara, err = harness.FromBranches(dim, parallel.CombineAvg, a, b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, post, err = parallel.Forward(para, x)\n\tif err != nil {\n\t\treturn err\n\t}\n\ty = core.NewTensor[float32](post.Shape...)\n\tfor i := range y.Data {\n\t\ty.Data[i] = 0.35\n\t}\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeFreeze)\n\tpara.SetCamSync(parallel.CamSyncConfig{Enabled: true, Alpha: 0.05, When: parallel.SyncAfterSample})\n\n\tvar w1 []float32\n\tif _, ok := para.DenseBranch(1); ok {\n\t\tw1 = harness.DenseWeights(para, 1)\n\t}\n\t// Also snap CNN Proj via type assert when DenseBranch fails\n\tsnap1 := snapPrimary(b)\n\n\tfor i := 0; i < 20; i++ {\n\t\tif _, err := parallel.TrainMSE(para, x, y, parallel.ModeNormalBP, 0.15); err != nil {\n\t\t\treturn fmt.Errorf(\"freeze-train: %w\", err)\n\t\t}\n\t}\n\tm := para.RefreshMetrics()\n\tif len(m.ActiveModes) < 2 || m.ActiveModes[1] != \"Freeze\" {\n\t\treturn fmt.Errorf(\"modes=%v want Freeze on cam1\", m.ActiveModes)\n\t}\n\tif w1 != nil {\n\t\td1 := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\t\tif d1 > 1e-7 {\n\t\t\treturn fmt.Errorf(\"frozen Dense cam1 moved Δ=%g\", d1)\n\t\t}\n\t}\n\tif snap1 != nil {\n\t\tafter := snapPrimary(b)\n\t\tif harness.WeightMaxDiff(snap1, after) > 1e-7 {\n\t\t\treturn fmt.Errorf(\"frozen cam1 primary store moved Δ=%g\", harness.WeightMaxDiff(snap1, after))\n\t\t}\n\t}\n\n\tharness.OK(d.name, d.why, fmt.Sprintf(\"loss %.4f→%.4f\", loss0, lossN), \"Freeze ok\")\n\treturn nil\n}\n\nfunc seedNoise(op any, scale float32) {\n\tset := func(w []float32) {\n\t\tfor i := range w {\n\t\t\tw[i] = scale * float32((i%11)-5) * 0.05\n\t\t}\n\t}\n\tswitch v := op.(type) {\n\tcase *dense.Layer:\n\t\tif w, ok := v.Weights.MasterF32(); ok {\n\t\t\tset(w)\n\t\t\t_ = v.Weights.SetFromF32(w)\n\t\t}\n\tcase *cnn1.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = v.Proj.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *cnn2.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = v.Proj.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *cnn3.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = v.Proj.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *convt1.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = v.Proj.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *convt2.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = v.Proj.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *convt3.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = v.Proj.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *mha.Layer:\n\t\tfor _, d := range []*dense.Layer{v.Q, v.K, v.V, v.O} {\n\t\t\tif d == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif w, ok := d.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = d.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *swiglu.Layer:\n\t\tfor _, d := range []*dense.Layer{v.Gate, v.Up, v.Down} {\n\t\t\tif d == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif w, ok := d.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = d.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *sequential.Layer:\n\t\tfor _, d := range v.Children {\n\t\t\tif d == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif w, ok := d.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = d.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\tcase *mamba.Layer:\n\t\tfor _, d := range []*dense.Layer{v.InProj, v.OutProj} {\n\t\t\tif d == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif w, ok := d.Weights.MasterF32(); ok {\n\t\t\t\tset(w)\n\t\t\t\t_ = d.Weights.SetFromF32(w)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc snapPrimary(op any) []float32 {\n\tswitch v := op.(type) {\n\tcase *dense.Layer:\n\t\tif w, ok := v.Weights.MasterF32(); ok {\n\t\t\treturn append([]float32(nil), w...)\n\t\t}\n\tcase *cnn1.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *cnn2.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *cnn3.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *convt1.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *convt2.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *convt3.Layer:\n\t\tif v.Proj != nil {\n\t\t\tif w, ok := v.Proj.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *mha.Layer:\n\t\tif v.O != nil {\n\t\t\tif w, ok := v.O.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *swiglu.Layer:\n\t\tif v.Down != nil {\n\t\t\tif w, ok := v.Down.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *sequential.Layer:\n\t\tif len(v.Children) > 0 && v.Children[0] != nil {\n\t\t\tif w, ok := v.Children[0].Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\tcase *mamba.Layer:\n\t\tif v.OutProj != nil {\n\t\t\tif w, ok := v.OutProj.Weights.MasterF32(); ok {\n\t\t\t\treturn append([]float32(nil), w...)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc allDemos() []layerDemo {\n\treturn []layerDemo{\n\t\t{\"dense\", \"default host\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\treturn 4, harness.MustDense(4, 4), harness.MustDense(4, 4), fill(1, 4), nil\n\t\t}},\n\t\t{\"cnn1\", \"1D conv\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := cnn1.Config{InChannels: 1, Filters: 2, SeqLen: 4, Kernel: 3, Stride: 1}\n\t\t\ta, err := cnn1.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := cnn1.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 1, 4), err\n\t\t}},\n\t\t{\"cnn2\", \"2D vision\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := cnn2.Config{InChannels: 1, Filters: 2, Height: 3, Width: 3, Kernel: 2}\n\t\t\ta, err := cnn2.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := cnn2.New(cfg)\n\t\t\treturn 9, a, b, fill(1, 1, 3, 3), err\n\t\t}},\n\t\t{\"cnn3\", \"3D\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := cnn3.Config{InChannels: 1, Filters: 2, Depth: 2, Height: 2, Width: 2, Kernel: 2}\n\t\t\ta, err := cnn3.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := cnn3.New(cfg)\n\t\t\treturn 8, a, b, fill(1, 1, 2, 2, 2), err\n\t\t}},\n\t\t{\"convt1\", \"1D upsample\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := convt1.Config{InChannels: 1, Filters: 2, SeqLen: 2, Kernel: 3, Stride: 1}\n\t\t\ta, err := convt1.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := convt1.New(cfg)\n\t\t\treturn 2, a, b, fill(1, 1, 2), err\n\t\t}},\n\t\t{\"convt2\", \"2D upsample\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := convt2.Config{InChannels: 1, Filters: 2, Height: 2, Width: 2, Kernel: 2}\n\t\t\ta, err := convt2.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := convt2.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 1, 2, 2), err\n\t\t}},\n\t\t{\"convt3\", \"3D upsample\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := convt3.Config{InChannels: 1, Filters: 2, Depth: 2, Height: 2, Width: 2, Kernel: 2}\n\t\t\ta, err := convt3.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := convt3.New(cfg)\n\t\t\treturn 8, a, b, fill(1, 1, 2, 2, 2), err\n\t\t}},\n\t\t{\"mha\", \"attention\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := mha.Config{DModel: 4, NumHeads: 1, MaxSeqLen: 4}\n\t\t\ta, err := mha.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := mha.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 2, 4), err\n\t\t}},\n\t\t{\"swiglu\", \"FFN\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := swiglu.Config{InputDim: 4, IntermediateDim: 8}\n\t\t\ta, err := swiglu.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := swiglu.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 4), err\n\t\t}},\n\t\t{\"rmsnorm\", \"norm\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := rmsnorm.Config{Dim: 4}\n\t\t\ta, err := rmsnorm.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := rmsnorm.New(cfg)\n\t\t\tx := fill(1, 4)\n\t\t\tfor i := range x.Data {\n\t\t\t\tx.Data[i] = float32(i + 1)\n\t\t\t}\n\t\t\treturn 4, a, b, x, err\n\t\t}},\n\t\t{\"layernorm\", \"norm\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := layernorm.Config{Dim: 4}\n\t\t\ta, err := layernorm.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := layernorm.New(cfg)\n\t\t\tx := fill(1, 4)\n\t\t\tfor i := range x.Data {\n\t\t\t\tx.Data[i] = float32(i + 1)\n\t\t\t}\n\t\t\treturn 4, a, b, x, err\n\t\t}},\n\t\t{\"softmax\", \"distribution\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := softmax.Config{Dim: 4}\n\t\t\ta, err := softmax.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := softmax.New(cfg)\n\t\t\tx := fill(1, 4)\n\t\t\tx.Data[0] = 2\n\t\t\treturn 4, a, b, x, err\n\t\t}},\n\t\t{\"rnn\", \"temporal\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := rnn.Config{InputSize: 3, HiddenSize: 4, SeqLen: 2}\n\t\t\ta, err := rnn.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := rnn.New(cfg)\n\t\t\treturn 3, a, b, fill(1, 2, 3), err\n\t\t}},\n\t\t{\"lstm\", \"gated temporal\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := lstm.Config{InputSize: 3, HiddenSize: 4, SeqLen: 2}\n\t\t\ta, err := lstm.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := lstm.New(cfg)\n\t\t\treturn 3, a, b, fill(1, 2, 3), err\n\t\t}},\n\t\t{\"embedding\", \"tables\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := embedding.Config{VocabSize: 8, EmbeddingDim: 4, SeqLen: 2}\n\t\t\ta, err := embedding.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := embedding.New(cfg)\n\t\t\tx := fill(1, 2)\n\t\t\tx.Data[0], x.Data[1] = 1, 2\n\t\t\treturn 2, a, b, x, err\n\t\t}},\n\t\t{\"sequential\", \"deep hemi\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := sequential.Config{Dim: 4, Depth: 2}\n\t\t\ta, err := sequential.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := sequential.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 4), err\n\t\t}},\n\t\t{\"residual\", \"residual hemi\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := residual.Config{Dim: 4, Depth: 1}\n\t\t\ta, err := residual.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := residual.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 4), err\n\t\t}},\n\t\t{\"kmeans\", \"prototypes\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := kmeans.Config{NumClusters: 3, FeatureDim: 4}\n\t\t\ta, err := kmeans.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := kmeans.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 4), err\n\t\t}},\n\t\t{\"mamba\", \"SSM\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := mamba.Config{DModel: 4, DState: 2, SeqLen: 2}\n\t\t\ta, err := mamba.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := mamba.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 2, 4), err\n\t\t}},\n\t\t{\"metacognition\", \"observer\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := metacognition.Config{Dim: 4}\n\t\t\ta, err := metacognition.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := metacognition.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 4), err\n\t\t}},\n\t\t{\"gdn\", \"gated delta\", func() (int, any, any, *core.Tensor[float32], error) {\n\t\t\tcfg := gdn.Config{HiddenSize: 4, NumKeyHeads: 1, NumValueHeads: 1, KeyHeadDim: 2, ValueHeadDim: 2, ConvKernel: 2}\n\t\t\ta, err := gdn.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, nil, nil, nil, err\n\t\t\t}\n\t\t\tb, err := gdn.New(cfg)\n\t\t\treturn 4, a, b, fill(1, 2, 4), err\n\t\t}},\n\t}\n}\n\nfunc fill(shape ...int) *core.Tensor[float32] {\n\tt := core.NewTensor[float32](shape...)\n\tfor i := range t.Data {\n\t\tt.Data[i] = 0.1 + float32(i%7)*0.03\n\t}\n\treturn t\n}\n","url":"/source/examples/cam/05_layers/main.go"},{"name":"mamba.md","code":"# mamba as a cam\n\n**When:** SSM twin\n\n**Where:** `go run ./05_layers -layer mamba`\n\n**Why:** Long-seq state-space cams.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  mamba  SSM twins  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nState-space twin smoke OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/mamba.md"},{"name":"metacognition.md","code":"# metacognition as a cam\n\n**When:** Observer twin\n\n**Where:** `go run ./05_layers -layer metacognition`\n\n**Why:** Meta Dense observer.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  metacognition  observer twin  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nObserver Dense twin smoke OK.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/metacognition.md"},{"name":"mha.md","code":"# mha as a cam\n\n**When:** Attention hemisphere\n\n**Where:** `go run ./05_layers -layer mha`\n\n**Why:** Same DModel; seq cams.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  mha  attention hemispheres  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nSame DModel twins; seq input. Short smoke may not move metered store.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/mha.md"},{"name":"residual.md","code":"# residual as a cam\n\n**When:** Residual hemisphere\n\n**Where:** `go run ./05_layers -layer residual`\n\n**Why:** Skip-connected cam.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  residual  residual cam  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nSkip-connected hemisphere twin.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/residual.md"},{"name":"rmsnorm.md","code":"# rmsnorm as a cam\n\n**When:** Norm as cam (rare)\n\n**Where:** `go run ./05_layers -layer rmsnorm`\n\n**Why:** Usually nest inside Sequential cam.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  rmsnorm  norm cam  loss=0.5227  plast=[0.016977749851921242 0]\n```\n\n## Why this output\n\nHigher MSE: norm posts ≠ flat 0.25 target. Cam0 γ moves (plast>0); Freeze cam1 idle.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/rmsnorm.md"},{"name":"rnn.md","code":"# rnn as a cam\n\n**When:** Temporal cam\n\n**Where:** `go run ./05_layers -layer rnn`\n\n**Why:** Short seq twins.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  rnn  temporal cams  loss=0.0572  plast=[0 0]\n```\n\n## Why this output\n\nSeq twin OK; loss slightly below the 0.0625 plateau.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/rnn.md"},{"name":"sequential.md","code":"# sequential as a cam\n\n**When:** Deep hemisphere\n\n**Where:** `go run ./05_layers -layer sequential`\n\n**Why:** Whole MLP stack = one mind.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  sequential  deep hemisphere  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nWhole MLP stack = one cam mind.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/sequential.md"},{"name":"softmax.md","code":"# softmax as a cam\n\n**When:** Distribution cam\n\n**Where:** `go run ./05_layers -layer softmax`\n\n**Why:** Avg/max of probability views.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  softmax  distribution cams  loss=0.0169  plast=[0 0]\n```\n\n## Why this output\n\nSoftmax already in (0,1) → easy MSE to 0.25. Softmax itself has no weights → plast 0 is expected.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/softmax.md"},{"name":"swiglu.md","code":"# swiglu as a cam\n\n**When:** FFN twin\n\n**Where:** `go run ./05_layers -layer swiglu`\n\n**Why:** Width=InputDim; pair with MHA stacks.\n\nSetup in the smoke: identical twins + `CombineAvg` + `BranchModes=NormalBP∥Freeze` + CamSync α=1%.\n\n## Sample output\n\n```\n  ok  swiglu  FFN twins  loss=0.0625  plast=[0 0]\n```\n\n## Why this output\n\nWidth=InputDim FFN cams.\n\nCam1 plasticity is **0** on purpose (`ModeFreeze`). See [`README.md`](README.md) for the full matrix.\n","url":"/source/examples/cam/05_layers/swiglu.md"}],"source":"https://github.com/openfluke/example/tree/main/cam/05_layers","url":"https://openfluke.com/examples/cam/05_layers"},{"slug":"cam/06_recipes","title":"06 — Recipes","group":"Cameral cookbook","description":"When: compose modes + sync + kit into behaviorsWhere: go run ./06_recipesWhy: teacher, sleep, debate, memory, dream, concat go run ./06_recipes Exits non-zero if any proof fails (PASS / FAIL","html":"<p><strong>When:</strong> compose modes + sync + kit into behaviors<br /><strong>Where:</strong> <code>go run ./06_recipes</code><br /><strong>Why:</strong> teacher, sleep, debate, memory, dream, concat</p>\n<pre><code class=\"language-bash\">go run ./06_recipes\n</code></pre>\n<p>Exits <strong>non-zero</strong> if any proof fails (<code>PASS</code> / <code>FAIL</code> lines).</p>\n<h2>Live output</h2>\n<pre><code>=== 06_recipes — prove composed behaviors ===\n  PASS  teacher_student  teacher frozen, student moved\n  PASS  sleep_slot0  only cam0 Δ=0.00257/0\n  PASS  sleep_slot1  only cam1 Δ=0/0.00249\n  PASS  debate  both move; debate loss 0.0121 vs coop 0.0110\n  PASS  surprise_memory  asleep Δ=0 awake Δ=0.00582\n  PASS  dream_consolidate  avg=0.0012 weights moved on replay\n  PASS  cross_modal_concat  feat=8 want 3+5=8\n  PASS  cross_modal_trains  cam0 moved under concat\n\nall recipe proofs passed\n</code></pre>\n<h2>Why these PASS lines prove it</h2>\n<table>\n<thead>\n<tr>\n<th>Proof</th>\n<th>Assertion</th>\n<th>Why</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>teacher_student</strong></td>\n<td>teacher frozen, student moved</td>\n<td>Shadow + one-way sync</td>\n</tr>\n<tr>\n<td><strong>sleep_slot0/1</strong></td>\n<td>alternating single-cam ΔW</td>\n<td>Rotate schedule</td>\n</tr>\n<tr>\n<td><strong>debate</strong></td>\n<td>both move; debate loss ≥ coop</td>\n<td>Adv + Disagree</td>\n</tr>\n<tr>\n<td><strong>surprise_memory</strong></td>\n<td>asleep vs awake ΔW</td>\n<td>SurpriseThresh gate</td>\n</tr>\n<tr>\n<td><strong>dream_consolidate</strong></td>\n<td>replay moves weights</td>\n<td>DreamBuffer</td>\n</tr>\n<tr>\n<td><strong>cross_modal_concat</strong></td>\n<td>feat=8=3+5; cam0 trains</td>\n<td>Unequal cams need concat</td>\n</tr>\n</tbody></table>\n","text":"When: compose modes + sync + kit into behaviorsWhere: go run ./06_recipesWhy: teacher, sleep, debate, memory, dream, concat\ngo run ./06_recipes\n\nExits non-zero if any proof fails (PASS / FAIL lines).\nLive output\n=== 06_recipes — prove composed behaviors ===\n  PASS  teacher_student  teacher frozen, student moved\n  PASS  sleep_slot0  only cam0 Δ=0.00257/0\n  PASS  sleep_slot1  only cam1 Δ=0/0.00249\n  PASS  debate  both move; debate loss 0.0121 vs coop 0.0110\n  PASS  surprise_memory  asleep Δ=0 awake Δ=0.00582\n  PASS  dream_consolidate  avg=0.0012 weights moved on replay\n  PASS  cross_modal_concat  feat=8 want 3+5=8\n  PASS  cross_modal_trains  cam0 moved under concat\n\nall recipe proofs passed\n\nWhy these PASS lines prove it\n\n\n\nProof\nAssertion\nWhy\n\n\n\nteacher_student\nteacher frozen, student moved\nShadow + one-way sync\n\n\nsleep_slot0/1\nalternating single-cam ΔW\nRotate schedule\n\n\ndebate\nboth move; debate loss ≥ coop\nAdv + Disagree\n\n\nsurprise_memory\nasleep vs awake ΔW\nSurpriseThresh gate\n\n\ndream_consolidate\nreplay moves weights\nDreamBuffer\n\n\ncross_modal_concat\nfeat=8=3+5; cam0 trains\nUnequal cams need concat\n\n\n","sources":[{"name":"main.go","code":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/openfluke/example/cam/internal/harness\"\n\t\"github.com/openfluke/welvet/core\"\n\t\"github.com/openfluke/welvet/layers/parallel\"\n)\n\nfunc main() {\n\tharness.Banner(\"06_recipes — prove composed behaviors\")\n\tx, y := harness.ToyXY(8, 4)\n\n\tproveTeacher(x, y)\n\tproveSleep(x, y)\n\tproveDebate(x, y)\n\tproveSurprise(x, y)\n\tproveDream(x, y)\n\tproveConcatCross()\n\tfmt.Println(\"\\nall recipe proofs passed\")\n}\n\nfunc proveTeacher(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeShadow)\n\tpara.SetCamKit(parallel.CamKit{ShadowCoef: 1})\n\tpara.SetCamSync(parallel.CamSyncConfig{\n\t\tEnabled: true, Alpha: 0.5, When: parallel.SyncAfterSample,\n\t\tBranchAlpha: []float64{1, 0},\n\t})\n\tt0 := harness.DenseWeights(para, 1)\n\ts0 := harness.DenseWeights(para, 0)\n\t_, _ = harness.TrainN(para, x, y, 20, 0.08)\n\tharness.Requiref(\"teacher_student\",\n\t\tharness.WeightMaxDiff(t0, harness.DenseWeights(para, 1)) < 1e-7 &&\n\t\t\tharness.WeightMaxDiff(s0, harness.DenseWeights(para, 0)) > 1e-4,\n\t\t\"teacher frozen, student moved\")\n}\n\nfunc proveSleep(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetRotateSchedule([][]parallel.TrainMode{\n\t\t{parallel.ModeNormalBP, parallel.ModeFreeze},\n\t\t{parallel.ModeFreeze, parallel.ModeNormalBP},\n\t}, 5)\n\tw0, w1 := harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 5, 0.1)\n\td0, d1 := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0)), harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"sleep_slot0\", d0 > 1e-4 && d1 < 1e-7, \"only cam0 Δ=%.3g/%.3g\", d0, d1)\n\tw0, w1 = harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\t_, _ = harness.TrainN(para, x, y, 5, 0.1)\n\td0, d1 = harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0)), harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"sleep_slot1\", d0 < 1e-7 && d1 > 1e-4, \"only cam1 Δ=%.3g/%.3g\", d0, d1)\n}\n\nfunc proveDebate(x, y *core.Tensor[float32]) {\n\tlossBP := func() float64 {\n\t\tp, _ := harness.DenseTwin(8, 4, parallel.CombineDisagree)\n\t\t_ = harness.DivergeCams(p)\n\t\tp.Cfg.DisagreeBeta = 0.75\n\t\tp.SetBranchModes(parallel.ModeNormalBP, parallel.ModeNormalBP)\n\t\tl, _ := harness.TrainN(p, x, y, 25, 0.06)\n\t\treturn l\n\t}()\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineDisagree)\n\tpara.Cfg.DisagreeBeta = 0.75\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeAdversarial)\n\tw0, w1 := harness.DenseWeights(para, 0), harness.DenseWeights(para, 1)\n\tloss, _ := harness.TrainN(para, x, y, 25, 0.06)\n\td0 := harness.WeightMaxDiff(w0, harness.DenseWeights(para, 0))\n\td1 := harness.WeightMaxDiff(w1, harness.DenseWeights(para, 1))\n\tharness.Requiref(\"debate\", d0 > 1e-4 && d1 > 1e-4 && loss >= lossBP*0.9,\n\t\t\"both move; debate loss %.4f vs coop %.4f\", loss, lossBP)\n}\n\nfunc proveSurprise(x, y *core.Tensor[float32]) {\n\tasleep := func() float64 {\n\t\tp, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t\t_ = harness.DivergeCams(p)\n\t\tp.SetBranchModes(parallel.ModeNormalBP, parallel.ModeMemory)\n\t\tp.SetCamKit(parallel.CamKit{SurpriseThresh: 1e9})\n\t\tw := harness.DenseWeights(p, 1)\n\t\t_, _ = harness.TrainN(p, x, y, 12, 0.1)\n\t\treturn harness.WeightMaxDiff(w, harness.DenseWeights(p, 1))\n\t}()\n\tawake := func() float64 {\n\t\tp, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t\t_ = harness.DivergeCams(p)\n\t\tp.SetBranchModes(parallel.ModeNormalBP, parallel.ModeMemory)\n\t\tp.SetCamKit(parallel.CamKit{SurpriseThresh: 1e-12})\n\t\tw := harness.DenseWeights(p, 1)\n\t\t_, _ = harness.TrainN(p, x, y, 12, 0.1)\n\t\treturn harness.WeightMaxDiff(w, harness.DenseWeights(p, 1))\n\t}()\n\tharness.Requiref(\"surprise_memory\", asleep < 1e-7 && awake > 1e-4,\n\t\t\"asleep Δ=%.4g awake Δ=%.4g\", asleep, awake)\n}\n\nfunc proveDream(x, y *core.Tensor[float32]) {\n\tpara, _ := harness.DenseTwin(8, 4, parallel.CombineAvg)\n\t_ = harness.DivergeCams(para)\n\tpara.SetBranchModes(parallel.ModeNormalBP, parallel.ModeFreeze)\n\tpara.SetCamKit(parallel.CamKit{Dream: &parallel.DreamBuffer{Cap: 64}})\n\t_, _ = harness.TrainN(para, x, y, 10, 0.08)\n\tw := harness.DenseWeights(para, 0)\n\tavg, err := para.DreamPulse(5, parallel.ModeNormalBP, 0.05)\n\tharness.Requiref(\"dream_consolidate\", err == nil && avg > 0 &&\n\t\tharness.WeightMaxDiff(w, harness.DenseWeights(para, 0)) > 1e-5,\n\t\t\"avg=%.4f weights moved on replay\", avg)\n}\n\nfunc proveConcatCross() {\n\tdA := harness.MustDense(8, 3)\n\tdB := harness.MustDense(8, 5)\n\tmix, err := harness.FromBranches(8, parallel.CombineConcat, dA, dB)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tmix.SetBranchModes(parallel.ModeNormalBP, parallel.ModeTween)\n\tx, _ := harness.ToyXY(8, 8)\n\t_, post, err := parallel.Forward(mix, x)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tharness.Requiref(\"cross_modal_concat\", post.Shape[1] == 8, \"feat=%d want 3+5=8\", post.Shape[1])\n\ty := core.NewTensor[float32](1, 8)\n\tfor i := range y.Data {\n\t\ty.Data[i] = 0.4\n\t}\n\twA, _ := dA.Weights.MasterF32()\n\tbefore := append([]float32(nil), wA...)\n\t_, _ = harness.TrainN(mix, x, y, 15, 0.08)\n\twA2, _ := dA.Weights.MasterF32()\n\tharness.Requiref(\"cross_modal_trains\", harness.WeightMaxDiff(before, wA2) > 1e-5, \"cam0 moved under concat\")\n}\n","url":"/source/examples/cam/06_recipes/main.go"}],"source":"https://github.com/openfluke/example/tree/main/cam/06_recipes","url":"https://openfluke.com/examples/cam/06_recipes"}],"research":[{"title":"3D grids replace traditional neural networks","tag":"Aug 2026 · Edge · Pi 3B","description":"Can you train complex nets on constrained consumer edge hardware without running out of memory or locking up live inference? All sweeps here ran natively on a Raspberry Pi 3B (1 GB RAM): 29 train modes × 34 dtypes × 20 quants. SGD is a baseline, not a winner — TweenSplit families lead Lucy Score (Throughput × Availability × Acc) by keeping serve+train alive under tight VRAM.","audio":"https://files.openfluke.com/aai/pie_3b_1gb_ram/Welvet_3D_grids_replace_traditional_neural_networks.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/aai/pie_3b_1gb_ram/Welvet_Training_Modes_Research.pdf"},{"label":"Mode vs SGD","url":"https://files.openfluke.com/aai/pie_3b_1gb_ram/mode_vs_sgd_report.pdf"},{"label":"MP3","url":"https://files.openfluke.com/aai/pie_3b_1gb_ram/Welvet_3D_grids_replace_traditional_neural_networks.mp3"},{"label":"YouTube ↗","url":"https://www.youtube.com/watch?v=x-Th1fYuRQE"}]},{"title":"1-bit AI beats 32-bit giants","tag":"Aug 2026 · Lucy","description":"Lucy serve+train sprints of every Welvet layer, each on its own tide dashboard, with a master ocean view that crowns the best train mode and dtype. Cheap one-epoch scan across 34 dtypes, 23 modes, and single/bicameral/tricameral — including the MHA finding that 1-bit recipes beat 32-bit giants.","audio":"https://files.openfluke.com/lucy/1-bit%20AI%20beats%2032-bit%20giants.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/lucy/Analysis%20of%20MHA%20Lucy%20Report.pdf"},{"label":"MHA report","url":"https://files.openfluke.com/lucy/mha-lucy-report-4.pdf"},{"label":"Ocean report","url":"https://files.openfluke.com/lucy/ocean-lucy-report.pdf"},{"label":"MP3","url":"https://files.openfluke.com/lucy/1-bit%20AI%20beats%2032-bit%20giants.mp3"},{"label":"Repo ↗","url":"https://github.com/openfluke/quick_sprint"}]},{"title":"AI learning without system freezing","tag":"Aug 2026 · Adaptive AI","description":"Welvet adaptive framework: sine adaptation under switching targets — SoftAcc, duty-cycle Availability, and MobileScore across dtype × quant × train mode × architecture on SIMD. Which cells keep serving answers while they learn, and what that costs in RAM.","audio":"https://files.openfluke.com/archive/Welvet_AI_learning_without_system_freezing.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/archive/Welvet_Adaptive_AI_Framework_Analysis.pdf"},{"label":"MP3","url":"https://files.openfluke.com/archive/Welvet_AI_learning_without_system_freezing.mp3"},{"label":"Perm matrix ↗","url":"https://github.com/openfluke/arcagitesting/tree/main/test41_w_sine_ada_perm"},{"label":"Bench ↗","url":"https://github.com/openfluke/arcagitesting/tree/main/test41_w_sine_ada"}]},{"title":"Welvet AI engine: 3D wafer stacking & future potential","tag":"Jul 2026 · 3D Wafer Stacking","description":"Architectural exploration of 3D wafer stacking & hardware spatial layout: mapping Welvet's 3D volumetric XYZ step mesh directly to vertical wafer-to-wafer DRAM vaults, eliminating CGO FFI delays with Plan 9 assembly, and enforcing storage truth across 34 dtypes and sub-byte quants.","audio":"https://files.openfluke.com/archive/Welvet_AI_Engine_for_3D_Wafer_Stacking.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/archive/Welvet_AI_Engine_Future_Potential.pdf"},{"label":"MP3","url":"https://files.openfluke.com/archive/Welvet_AI_Engine_for_3D_Wafer_Stacking.mp3"}]},{"title":"Why smaller AI models aren't faster","tag":"Jul 2026 · Numeric demotion","description":"Welvet numeric demotion: when downcasting dtypes and shrinking models fails to buy wall-clock speed, and what the polymorphic numeric path actually costs on real hardware. Same Dense net across dtype, packed quant, and full weight×activation perm — measured size vs train time.","audio":"https://files.openfluke.com/archive/Why_Smaller_AI_Models_Arent_Faster.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/archive/Welvet_Numeric_Demotion_Research.pdf"},{"label":"Showcase PDF","url":"https://files.openfluke.com/archive/down-the-dem.pdf"},{"label":"MP3","url":"https://files.openfluke.com/archive/Why_Smaller_AI_Models_Arent_Faster.mp3"},{"label":"Repo ↗","url":"https://github.com/openfluke/down-the-dem"}]},{"title":"Shrinking massive AI into digital seeds","tag":"Jul 2026 · Seed networks","description":"Weight-agnostic compression: dense matrices collapse to 64-bit layer seeds, with non-differentiable evolutionary search. Edge checkpoints measured in bytes, not megabytes.","audio":"https://files.openfluke.com/archive/Shrinking_massive_AI_into_digital_seeds.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/archive/Loom_Seed_Neural_Networks_PoC.pdf"},{"label":"MP3","url":"https://files.openfluke.com/archive/Shrinking_massive_AI_into_digital_seeds.mp3"}]},{"title":"Loom 0.83 capabilities and applications","tag":"Jul 2026 · v0.83 hardware","description":"Experimental acceleration: Plan 9 SIMD on ARM and x86 (no CGO or CUDA), Apple Metal zero-copy, and Qualcomm Hexagon NPU offload with the Drift Spectrum.","audio":"https://files.openfluke.com/0_83/Loom0_83.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/0_83/Loom_0.83_Capabilities_And_Applications.pdf"},{"label":"MP3","url":"https://files.openfluke.com/0_83/Loom0_83.mp3"},{"label":"v0.83 ↗","url":"https://github.com/openfluke/loom/releases/tag/v0.83"}]},{"title":"AI model bridging and runtime comparison","tag":"Jun 2026 · Planet Bridging","description":"Live ingestion from PyTorch, TensorFlow, JAX, and scikit-learn into portable .entity checkpoints, plus a three-way runtime compare against ONNX Runtime, LiteRT, and Core ML.","audio":null,"links":[{"label":"PDF","url":"https://files.openfluke.com/archive/AI_Model_Bridging_and_Runtime_Comparison.pdf"}]},{"title":"Why fast AI hardware fails basic math","tag":"Jun 2026 · v0.81 NPU","description":"Per-layer NPU offload via OpenVINO, the small-tensor latency tax, 28x INT8 wins on large ops, and honest notes on when deterministic hardware still drifts from software.","audio":"https://files.openfluke.com/archive/Why_Fast_AI_Hardware_Fails_Basic_Math.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/archive/Loom_NPU_Acceleration_Research_Report.pdf"},{"label":"MP3","url":"https://files.openfluke.com/archive/Why_Fast_AI_Hardware_Fails_Basic_Math.mp3"}]},{"title":"Solving the M-POLY-VTD dispatch paradox","tag":"Jun 2026 · Strategy pivot","description":"Why Plan 9 assembly wins on fat matrices but inverts on volumetric grids, the WebGPU validation tax, and the pivot to load-time GPU graph compilation.","audio":"https://files.openfluke.com/archive/Solving_The_M-POLY-VTD_Dispatch_Paradox.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/archive/Poly_Performance_Strategy_Pivot.pdf"},{"label":"MP3","url":"https://files.openfluke.com/archive/Solving_The_M-POLY-VTD_Dispatch_Paradox.mp3"}]},{"title":"Loom breaks AI vendor lock with Go","tag":"v0.80 · Native ship","description":"ENTITY native checkpoints, the Planet Bridging hub, and pure Go plus WebGPU: why importing a model is not the same as shipping a portable brain.","audio":"https://files.openfluke.com/0_80/Loom_breaks_AI_vendor_lock_with_Go.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/0_80/Loom_AI-Planet-Bridging_Entity_Explained.pdf"},{"label":"MP3","url":"https://files.openfluke.com/0_80/Loom_breaks_AI_vendor_lock_with_Go.mp3"}]},{"title":"Loom Poly AI engine research","tag":"v0.78 · Flagship","description":"The flagship M-POLY-VTD deep dive: volumetric dispatch, 21 numeric types, target propagation, and side-by-side Go ML comparisons.","audio":"https://files.openfluke.com/0_78/Loom.makes.phone.CPUs.beat.GPUs.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/0_78/Loom_Poly.AI.Engine.Research.pdf"},{"label":"MP3","url":"https://files.openfluke.com/0_78/Loom.makes.phone.CPUs.beat.GPUs.mp3"}]},{"title":"Operation mesh shrinks local AI","tag":"v0.76 · Operation mesh","description":"How Loom's operation mesh and release trajectory tightened the local-AI deployment story on consumer hardware.","audio":"https://files.openfluke.com/0_76/Loom.Operation.Mesh.Shrinks.Local.AI.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/0_76/Loom.Release.Notes.Analysis.pdf"},{"label":"MP3","url":"https://files.openfluke.com/0_76/Loom.Operation.Mesh.Shrinks.Local.AI.mp3"}]},{"title":"Mac Mini beats RTX 4090 with Loom","tag":"v0.75 · Tiling","description":"Cache-aware tiling: why Apple Silicon plus Loom can outrun big discrete GPUs on the right workloads.","audio":"https://files.openfluke.com/0_75/Mac.Mini.beats.RTX.4090.with.Loom.mp3","links":[{"label":"PDF","url":"https://files.openfluke.com/0_75/AI.Engine.Tiling.Update.Analysis.pdf"},{"label":"MP3","url":"https://files.openfluke.com/0_75/Mac.Mini.beats.RTX.4090.with.Loom.mp3"}]}],"vision":{"html":"<h1>ALife</h1>\n<blockquote>\n<p><strong>A living AI world where biology, computation, platforming, learning, and buildcraft become one persistent artificial life.</strong></p>\n</blockquote>\n<p>ALife is a 3D radial-gravity platforming game and on-device artificial-life system built around three characters:</p>\n<ul>\n<li><strong>Proto</strong> — primordial biological life that discovers animal forms and cleansing powers.</li>\n<li><strong>Kee</strong> — robotic/computational life that discovers gadgets and real computer-science algorithms.</li>\n<li><strong>ALife / You</strong> — the persistent synthesis of the two, able to build lasting combinations from what has been discovered.</li>\n</ul>\n<p>The game takes inspiration from the compact, playful traversal of <em>Super Mario Galaxy</em>-style planetary platforming and the long-term buildcraft/endgame loop of action RPGs such as <em>Diablo</em>, but the progression model is built around <strong>capabilities rather than character levels</strong>.</p>\n<p>The central loop is:</p>\n<blockquote>\n<p><strong>Explore → discover → traverse → cleanse → unlock → build → master → automate → push further</strong></p>\n</blockquote>\n<hr />\n<h2>Core World Structure</h2>\n<p>ALife is divided into <strong>multiverses</strong>.</p>\n<p>Each multiverse contains <strong>seven planets</strong>.</p>\n<p>The important distinction is that the planets are <strong>not simply seven conventional levels</strong>.</p>\n<h3>The planets are destinations. The space between them is the platformer.</h3>\n<p>A campaign progresses roughly like this:</p>\n<pre><code class=\"language-text\">Planet 1\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 2\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 3\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 4\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 5\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 6\n   │\n   ├── Final planet-bridging challenge\n   ▼\nPlanet 7 / Boss\n</code></pre>\n<p>The player can see and travel through a physical planetary system rather than selecting isolated stages from a menu.</p>\n<hr />\n<h2>Planet-Bridging Levels</h2>\n<p>The actual authored platforming levels are the journeys <strong>between planets</strong>.</p>\n<p>These routes use ALife's radial-gravity platforming system and can contain:</p>\n<ul>\n<li>curved strips of terrain,</li>\n<li>tiny planets,</li>\n<li>large planets,</li>\n<li>partial planetary surfaces,</li>\n<li>walls that become floors,</li>\n<li>changing curvature,</li>\n<li>gravity transitions,</li>\n<li>floating structures,</li>\n<li>nested planetary spaces,</li>\n<li>launch sequences,</li>\n<li>traversal gadgets,</li>\n<li>animal abilities,</li>\n<li>infected machinery,</li>\n<li>and other dynamically constructed geometry.</li>\n</ul>\n<p>A \"planet\" does not need a complete spherical walkable surface. A level can use only the curved land required for traversal while still producing the sensation of moving around a planetary body.</p>\n<p>This allows the campaign to push radial platforming far beyond a single conventional spherical world.</p>\n<h3>Target length</h3>\n<p>A normal planet-bridging challenge should generally be compact:</p>\n<blockquote>\n<p><strong>Approximately three minutes for a successful run.</strong></p>\n</blockquote>\n<p>The goal is dense mechanical variety rather than long stretches of filler.</p>\n<hr />\n<h2>What Happens on a Planet?</h2>\n<p>Planets act as persistent campaign nodes.</p>\n<p>They can provide:</p>\n<ul>\n<li>discovery,</li>\n<li>environmental storytelling,</li>\n<li>animals,</li>\n<li>Proto powers,</li>\n<li>Kee technology,</li>\n<li>algorithms,</li>\n<li>infected robots,</li>\n<li>resources,</li>\n<li>campfires,</li>\n<li>secrets,</li>\n<li>build preparation,</li>\n<li>and the setup for the next journey.</li>\n</ul>\n<p>The rhythm becomes:</p>\n<pre><code class=\"language-text\">ARRIVE\n  ↓\nEXPLORE\n  ↓\nDISCOVER\n  ↓\nCONFIGURE\n  ↓\nDEPART\n  ↓\nPLATFORMING ROUTE\n  ↓\nARRIVE AT NEXT PLANET\n</code></pre>\n<p>This makes reaching another planet feel like an actual journey rather than completing an arbitrary numbered stage.</p>\n<hr />\n<h1>The Three-Part Capability System</h1>\n<p>Each section of the campaign expands three major axes of the player's capability space.</p>\n<h2>1. Proto: Biology</h2>\n<p>Proto is the primordial side of ALife.</p>\n<p>Proto discovers animals and can copy their morphology, instincts, or biological properties.</p>\n<p>Examples:</p>\n<table>\n<thead>\n<tr>\n<th>Animal</th>\n<th>Possible capability</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Gecko</td>\n<td>Wall adhesion</td>\n</tr>\n<tr>\n<td>Bird</td>\n<td>Glide / aerial movement</td>\n</tr>\n<tr>\n<td>Electric eel</td>\n<td>Electrical cleansing</td>\n</tr>\n<tr>\n<td>Mole</td>\n<td>Burrowing</td>\n</tr>\n<tr>\n<td>Frog</td>\n<td>Extreme jumping</td>\n</tr>\n<tr>\n<td>Octopus</td>\n<td>Multi-surface gripping</td>\n</tr>\n</tbody></table>\n<p>Proto is particularly important for <strong>cleansing infection</strong>.</p>\n<p>Different animals can provide fundamentally different ways of removing corruption from robots, machinery, or environments.</p>\n<p>Proto answers:</p>\n<blockquote>\n<p><strong>What biological capability can I use?</strong></p>\n</blockquote>\n<hr />\n<h2>2. Kee: Gadgets</h2>\n<p>Kee represents the robotic and mechanical side.</p>\n<p>Kee can become or provide physical gadgets such as:</p>\n<ul>\n<li>sword,</li>\n<li>shield,</li>\n<li>bow,</li>\n<li>jetpack,</li>\n<li>grappling system,</li>\n<li>scanner,</li>\n<li>launcher,</li>\n<li>hover system,</li>\n<li>drill,</li>\n<li>drone,</li>\n<li>energy projector,</li>\n<li>and other mechanical forms.</li>\n</ul>\n<p>Kee's gadget answers:</p>\n<blockquote>\n<p><strong>What physical/mechanical interface can I use?</strong></p>\n</blockquote>\n<p>A gadget and an algorithm are deliberately separate concepts.</p>\n<p>The gadget is the <strong>body/tool</strong>.</p>\n<p>The algorithm is the <strong>logic</strong>.</p>\n<hr />\n<h2>3. Kee: Real Computer-Science Algorithms</h2>\n<p>Algorithms in ALife are intended to be based on <strong>actual computer-science algorithms</strong>, not merely fictional abilities with technical names.</p>\n<p>The broader design has a large library of possible algorithms to draw from.</p>\n<p>Examples include:</p>\n<ul>\n<li>A*</li>\n<li>Dijkstra's algorithm</li>\n<li>Breadth-First Search</li>\n<li>Depth-First Search</li>\n<li>Flood Fill</li>\n<li>sorting algorithms</li>\n<li>graph algorithms</li>\n<li>scheduling algorithms</li>\n<li>optimisation algorithms</li>\n<li>pathfinding algorithms</li>\n</ul>\n<p>Algorithms become gameplay logic.</p>\n<p>Examples:</p>\n<h3>A*</h3>\n<p>Find or expose an optimal path through a traversal problem.</p>\n<h3>Breadth-First Search</h3>\n<p>Propagate an effect outward through neighbouring nodes in layers.</p>\n<h3>Dijkstra</h3>\n<p>Find a route according to minimum cost rather than simply minimum distance.</p>\n<h3>Flood Fill</h3>\n<p>Propagate cleansing through a connected infected region.</p>\n<h3>Sorting / prioritisation</h3>\n<p>Dynamically reorder targets according to distance, danger, corruption, value, or another property.</p>\n<p>The algorithm answers:</p>\n<blockquote>\n<p><strong>How is the action organised, reasoned about, or applied?</strong></p>\n</blockquote>\n<hr />\n<h1>The Combination</h1>\n<p>The fundamental build grammar is:</p>\n<pre><code class=\"language-text\">Proto Animal / Power\n        +\nKee Gadget\n        +\nAlgorithm\n        +\nAttributes\n        +\nLegendaries\n        =\nPlayer Build\n</code></pre>\n<p>This allows the same animal, gadget, or algorithm to behave very differently depending on what it is paired with.</p>\n<p>The long-term objective is not simply to become numerically stronger.</p>\n<p>It is to accumulate an increasingly large <strong>vocabulary of possible behaviours</strong>.</p>\n<hr />\n<h1>Campaign Progression</h1>\n<p>Campaign content introduces capabilities before the player permanently masters every possible combination.</p>\n<p>A campaign section can introduce:</p>\n<ol>\n<li>a new animal,</li>\n<li>a new Proto cleansing capability,</li>\n<li>a new Kee gadget,</li>\n<li>a computer-science algorithm,</li>\n<li>and a platforming challenge designed around their interaction.</li>\n</ol>\n<p>The player experiences the intended combination in authored content.</p>\n<p>Completing that content establishes that the capability has been <strong>discovered</strong>.</p>\n<p>For algorithms in particular, discovery and permanent endgame ownership are intentionally different stages.</p>\n<hr />\n<h1>Algorithm Discovery vs Mastery</h1>\n<p>An algorithm can first appear as part of its campaign content.</p>\n<p>For example:</p>\n<pre><code class=\"language-text\">Discover A*\n    ↓\nUse A* during its authored challenge\n    ↓\nComplete the challenge\n    ↓\nA* becomes eligible for that multiverse's endgame loot\n</code></pre>\n<p>The campaign therefore says:</p>\n<blockquote>\n<p><strong>I discovered and experienced this algorithm.</strong></p>\n</blockquote>\n<p>The endgame says:</p>\n<blockquote>\n<p><strong>I mastered it and can now build around it permanently.</strong></p>\n</blockquote>\n<p>This creates a direct connection between authored campaign content and the later loot chase.</p>\n<hr />\n<h1>Gear Philosophy</h1>\n<p>ALife does <strong>not require traditional character levelling</strong>.</p>\n<p>There does not need to be a central progression of:</p>\n<pre><code class=\"language-text\">Level 1 → Level 20 → Level 50 → Level 100\n</code></pre>\n<p>Instead:</p>\n<pre><code class=\"language-text\">Small capability library\n        ↓\nMore animals\n        ↓\nMore gadgets\n        ↓\nMore algorithms\n        ↓\nMore attributes\n        ↓\nMore legendaries\n        ↓\nMore combinations\n        ↓\nMassive build space\n</code></pre>\n<p>Progression is primarily <strong>horizontal</strong>.</p>\n<p>The artificial life becomes more versatile and expressive rather than simply acquiring an ever-larger number next to its name.</p>\n<hr />\n<h1>Normal Gear and Attributes</h1>\n<p>Normal campaign content can produce random attribute rewards.</p>\n<p>Attributes are the tuning layer.</p>\n<p>Possible examples include:</p>\n<ul>\n<li>movement speed,</li>\n<li>cleansing radius,</li>\n<li>cleansing strength,</li>\n<li>energy efficiency,</li>\n<li>cooldown reduction,</li>\n<li>acceleration,</li>\n<li>air control,</li>\n<li>gadget recharge,</li>\n<li>transformation speed,</li>\n<li>attack speed,</li>\n<li>defence,</li>\n<li>resource collection.</li>\n</ul>\n<p>The intention is to avoid turning ALife into inventory landfill.</p>\n<p>Instead of forcing the player to retain hundreds of nearly identical disposable items, useful attributes can become part of the player's persistent build library.</p>\n<p>Conceptually:</p>\n<pre><code class=\"language-text\">Find attribute\n    ↓\nUnlock attribute\n    ↓\nUse it when constructing builds\n</code></pre>\n<p>Players then save configurations they actually care about.</p>\n<hr />\n<h1>Algorithm Sets</h1>\n<p>Permanent portable algorithms are represented by <strong>three-piece sets</strong>.</p>\n<p>Example:</p>\n<pre><code class=\"language-text\">A* Piece I\nA* Piece II\nA* Piece III\n      ↓\nComplete A* Set\n      ↓\nA* becomes available as part of the build\n</code></pre>\n<p>The three-piece structure is intentional.</p>\n<p>An algorithm should matter enough to occupy meaningful build space without consuming the entire equipment configuration.</p>\n<p>This leaves room for legendary items and attribute customisation.</p>\n<p>The core principle is:</p>\n<blockquote>\n<p><strong>Algorithm sets give you the system.</strong></p>\n</blockquote>\n<hr />\n<h1>Legendary Gear</h1>\n<p>Legendary gear has a different purpose.</p>\n<p>It should not simply duplicate the role of algorithm sets or exist only as a larger attribute number.</p>\n<p>Legendary items are <strong>rule benders</strong>.</p>\n<p>They alter how an existing capability behaves.</p>\n<p>Examples:</p>\n<ul>\n<li>A* can recalculate while airborne.</li>\n<li>Cleansing one target automatically marks another.</li>\n<li>Using a Kee gadget charges a Proto ability.</li>\n<li>Using a Proto ability resets a Kee gadget.</li>\n<li>An algorithm evaluates multiple destinations instead of one.</li>\n<li>A traversal action gains an unusual interaction with another unlocked system.</li>\n</ul>\n<p>The principle is:</p>\n<blockquote>\n<p><strong>Algorithm sets give you the system. Legendaries mutate the system. Attributes tune the system.</strong></p>\n</blockquote>\n<p>This separation gives each reward category a clear reason to exist.</p>\n<hr />\n<h1>Saved Builds</h1>\n<p>The important persistent object is not necessarily a backpack full of equipment.</p>\n<p>It is the <strong>build</strong>.</p>\n<p>For example:</p>\n<pre><code class=\"language-yaml\">build: Rift Farming\nproto:\n  animal: Falcon\n  power: Wind Purge\n\nkee:\n  gadget: Jetpack\n\nalgorithm:\n  set: A*\n\nlegendaries:\n  - Momentum Loop\n  - Chain Cleanse\n\nattributes:\n  - Air Control\n  - Energy Efficiency\n  - Movement Speed\n</code></pre>\n<p>Another saved build might be designed for:</p>\n<ul>\n<li>bosses,</li>\n<li>traversal,</li>\n<li>cleansing,</li>\n<li>multiplayer,</li>\n<li>speed,</li>\n<li>resource farming,</li>\n<li>Greater Rifts,</li>\n<li>or a particular Autopilot route.</li>\n</ul>\n<p>Progress therefore becomes a collection of <strong>solutions</strong> rather than a warehouse of junk.</p>\n<hr />\n<h1>Multiverse Campaign Completion</h1>\n<p>The campaign ultimately leads across the planetary system to the final planet.</p>\n<p>The last traversal should be a culmination of the multiverse's mechanics.</p>\n<p>Planet 7 contains the major boss or source of infection.</p>\n<p>Conceptually:</p>\n<pre><code class=\"language-text\">Planet 1\n  ↓\nDiscover / cleanse / traverse\n  ↓\nPlanet 2\n  ↓\nDiscover / cleanse / traverse\n  ↓\n...\n  ↓\nPlanet 6\n  ↓\nFinal traversal\n  ↓\nPlanet 7\n  ↓\nBOSS\n  ↓\nMULTIVERSE CLEANSED\n</code></pre>\n<p>The final world can potentially be visible much earlier in the campaign, giving the player a persistent destination to work toward.</p>\n<p>As the earlier planets are cleansed, the state of the multiverse can visibly improve.</p>\n<hr />\n<h1>Endgame Unlock</h1>\n<p>Defeating the multiverse boss changes the role of that entire multiverse.</p>\n<p>It is no longer only campaign content.</p>\n<p>It becomes an <strong>endgame ecosystem</strong>.</p>\n<p>Completion unlocks:</p>\n<ul>\n<li>Rifts,</li>\n<li>Greater Rifts,</li>\n<li>algorithm-set farming,</li>\n<li>legendary farming,</li>\n<li>rarer attributes,</li>\n<li>build experimentation,</li>\n<li>recording,</li>\n<li>Autopilot farming of mastered content.</li>\n</ul>\n<p>So every completed multiverse remains relevant after its story is finished.</p>\n<hr />\n<h1>Rifts</h1>\n<p>Rifts procedurally remix the capabilities and environment of the multiverse.</p>\n<p>They can reuse and recombine:</p>\n<ul>\n<li>planetary geometry,</li>\n<li>radial gravity,</li>\n<li>animals,</li>\n<li>Proto powers,</li>\n<li>Kee gadgets,</li>\n<li>algorithms,</li>\n<li>infection mechanics,</li>\n<li>enemies,</li>\n<li>hazards,</li>\n<li>and loot families.</li>\n</ul>\n<p>Importantly, because the campaign itself is built around travelling between planets, procedural Rifts can also generate increasingly unusual <strong>planet-bridging routes</strong>.</p>\n<p>The authored campaign teaches the player how the multiverse works.</p>\n<p>Rifts remix what was learned.</p>\n<hr />\n<h1>Greater Rifts</h1>\n<p>Greater Rifts are the scalable endgame frontier.</p>\n<p>Players use them to:</p>\n<ul>\n<li>test builds,</li>\n<li>hunt algorithm set pieces,</li>\n<li>hunt legendaries,</li>\n<li>find better attributes,</li>\n<li>optimise combinations,</li>\n<li>push increasingly difficult content,</li>\n<li>record successful strategies,</li>\n<li>and eventually automate content they have mastered.</li>\n</ul>\n<p>The game therefore retains an action-RPG farming loop without requiring traditional XP levelling.</p>\n<hr />\n<h1>Why Old Multiverses Stay Relevant</h1>\n<p>Each multiverse has its own discoveries and endgame loot pool.</p>\n<p>For example, if an earlier multiverse contains the A* algorithm set, a player may return much later because A* interacts beautifully with an animal or gadget discovered several multiverses afterward.</p>\n<p>New content therefore expands the usefulness of old content.</p>\n<p>The ideal result is:</p>\n<blockquote>\n<p><strong>Every new multiverse increases the number of meaningful combinations across the entire game.</strong></p>\n</blockquote>\n<hr />\n<h1>Recording and Autopilot</h1>\n<p>ALife includes a record-and-replay system for mastered content.</p>\n<p>The player first performs the activity manually.</p>\n<p>The system can record:</p>\n<ul>\n<li>actions,</li>\n<li>traversal,</li>\n<li>ability use,</li>\n<li>gadget use,</li>\n<li>transformations,</li>\n<li>interactions,</li>\n<li>and the build used for the run.</li>\n</ul>\n<p>That creates a reusable behavioural/data cache.</p>\n<p>Conceptually:</p>\n<pre><code class=\"language-text\">Player discovers challenge\n        ↓\nPlayer solves challenge manually\n        ↓\nPlayer records successful solution\n        ↓\nALife replays learned solution\n        ↓\nSolved content can be farmed\n</code></pre>\n<p>The long-term goal is not merely a dumb input macro.</p>\n<p>ALife is intended to support artificial-life behaviour that can <strong>run and learn at the same time</strong>, allowing mastered routines to potentially improve or adapt.</p>\n<p>The fundamental rule is:</p>\n<blockquote>\n<p><strong>The player pushes the frontier. ALife farms what has been mastered.</strong></p>\n</blockquote>\n<hr />\n<h1>Full Gameplay Loop</h1>\n<pre><code class=\"language-text\">ENTER MULTIVERSE\n       ↓\nARRIVE ON PLANET\n       ↓\nDISCOVER ANIMAL / PROTO POWER\n       ↓\nDISCOVER KEE GADGET\n       ↓\nEXPERIENCE ALGORITHM\n       ↓\nBUILD A COMBINATION\n       ↓\nDEPART PLANET\n       ↓\n3D RADIAL PLANET-BRIDGING PLATFORMING\n       ↓\nCLEANSE INFECTION\n       ↓\nARRIVE AT NEXT PLANET\n       ↓\nREPEAT ACROSS THE SYSTEM\n       ↓\nFINAL PLANET\n       ↓\nBOSS\n       ↓\nMULTIVERSE CLEANSED\n       ↓\nRIFTS + GREATER RIFTS UNLOCK\n       ↓\nFARM 3-PIECE ALGORITHM SETS\n       ↓\nFARM LEGENDARIES\n       ↓\nTUNE ATTRIBUTES\n       ↓\nSAVE BUILDS\n       ↓\nPUSH HARDER RIFTS\n       ↓\nRECORD MASTERED ROUTES\n       ↓\nAUTOPILOT FARMING\n       ↓\nENTER THE NEXT MULTIVERSE\n</code></pre>\n<hr />\n<h1>Progression in One Sentence</h1>\n<blockquote>\n<p><strong>Campaign content teaches capabilities, algorithm sets make algorithms permanently portable, attributes tune the build, and legendaries break its rules.</strong></p>\n</blockquote>\n<hr />\n<h1>World Structure in One Sentence</h1>\n<blockquote>\n<p><strong>The seven planets are the chapters; the journeys between them are the levels; the final planet is the boss destination; cleansing the system turns the whole multiverse into an endgame playground.</strong></p>\n</blockquote>\n<hr />\n<h1>ALife's Design Identity</h1>\n<p>ALife is ultimately about accumulating <strong>possibility</strong>.</p>\n<p>Proto discovers nature.</p>\n<p>Kee discovers machinery and computation.</p>\n<p>The player combines them.</p>\n<p>The campaign teaches those systems through compact radial-gravity platforming journeys between planets.</p>\n<p>The endgame takes the systems the player has learned and explodes them into buildcraft, procedural Rifts, Greater Rifts, legendary modifiers, algorithm sets, recorded solutions, and autonomous farming.</p>\n<p>There is no requirement for the player to become \"Level 100.\"</p>\n<p>Instead, the artificial life becomes something much stranger:</p>\n<blockquote>\n<p><strong>A growing library of forms, tools, algorithms, behaviours, builds, and learned solutions that belongs to the same persistent being across every multiverse.</strong></p>\n</blockquote>\n","text":"# ALife\n\n\n> **A living AI world where biology, computation, platforming, learning, and buildcraft become one persistent artificial life.**\n\nALife is a 3D radial-gravity platforming game and on-device artificial-life system built around three characters:\n\n- **Proto** — primordial biological life that discovers animal forms and cleansing powers.\n- **Kee** — robotic/computational life that discovers gadgets and real computer-science algorithms.\n- **ALife / You** — the persistent synthesis of the two, able to build lasting combinations from what has been discovered.\n\nThe game takes inspiration from the compact, playful traversal of *Super Mario Galaxy*-style planetary platforming and the long-term buildcraft/endgame loop of action RPGs such as *Diablo*, but the progression model is built around **capabilities rather than character levels**.\n\nThe central loop is:\n\n> **Explore → discover → traverse → cleanse → unlock → build → master → automate → push further**\n\n---\n\n## Core World Structure\n\nALife is divided into **multiverses**.\n\nEach multiverse contains **seven planets**.\n\nThe important distinction is that the planets are **not simply seven conventional levels**.\n\n### The planets are destinations. The space between them is the platformer.\n\nA campaign progresses roughly like this:\n\n```text\nPlanet 1\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 2\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 3\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 4\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 5\n   │\n   ├── Planet-bridging platforming route\n   ▼\nPlanet 6\n   │\n   ├── Final planet-bridging challenge\n   ▼\nPlanet 7 / Boss\n```\n\nThe player can see and travel through a physical planetary system rather than selecting isolated stages from a menu.\n\n---\n\n## Planet-Bridging Levels\n\nThe actual authored platforming levels are the journeys **between planets**.\n\nThese routes use ALife's radial-gravity platforming system and can contain:\n\n- curved strips of terrain,\n- tiny planets,\n- large planets,\n- partial planetary surfaces,\n- walls that become floors,\n- changing curvature,\n- gravity transitions,\n- floating structures,\n- nested planetary spaces,\n- launch sequences,\n- traversal gadgets,\n- animal abilities,\n- infected machinery,\n- and other dynamically constructed geometry.\n\nA \"planet\" does not need a complete spherical walkable surface. A level can use only the curved land required for traversal while still producing the sensation of moving around a planetary body.\n\nThis allows the campaign to push radial platforming far beyond a single conventional spherical world.\n\n### Target length\n\nA normal planet-bridging challenge should generally be compact:\n\n> **Approximately three minutes for a successful run.**\n\nThe goal is dense mechanical variety rather than long stretches of filler.\n\n---\n\n## What Happens on a Planet?\n\nPlanets act as persistent campaign nodes.\n\nThey can provide:\n\n- discovery,\n- environmental storytelling,\n- animals,\n- Proto powers,\n- Kee technology,\n- algorithms,\n- infected robots,\n- resources,\n- campfires,\n- secrets,\n- build preparation,\n- and the setup for the next journey.\n\nThe rhythm becomes:\n\n```text\nARRIVE\n  ↓\nEXPLORE\n  ↓\nDISCOVER\n  ↓\nCONFIGURE\n  ↓\nDEPART\n  ↓\nPLATFORMING ROUTE\n  ↓\nARRIVE AT NEXT PLANET\n```\n\nThis makes reaching another planet feel like an actual journey rather than completing an arbitrary numbered stage.\n\n---\n\n# The Three-Part Capability System\n\nEach section of the campaign expands three major axes of the player's capability space.\n\n## 1. Proto: Biology\n\nProto is the primordial side of ALife.\n\nProto discovers animals and can copy their morphology, instincts, or biological properties.\n\nExamples:\n\n| Animal | Possible capability |\n|---|---|\n| Gecko | Wall adhesion |\n| Bird | Glide / aerial movement |\n| Electric eel | Electrical cleansing |\n| Mole | Burrowing |\n| Frog | Extreme jumping |\n| Octopus | Multi-surface gripping |\n\nProto is particularly important for **cleansing infection**.\n\nDifferent animals can provide fundamentally different ways of removing corruption from robots, machinery, or environments.\n\nProto answers:\n\n> **What biological capability can I use?**\n\n---\n\n## 2. Kee: Gadgets\n\nKee represents the robotic and mechanical side.\n\nKee can become or provide physical gadgets such as:\n\n- sword,\n- shield,\n- bow,\n- jetpack,\n- grappling system,\n- scanner,\n- launcher,\n- hover system,\n- drill,\n- drone,\n- energy projector,\n- and other mechanical forms.\n\nKee's gadget answers:\n\n> **What physical/mechanical interface can I use?**\n\nA gadget and an algorithm are deliberately separate concepts.\n\nThe gadget is the **body/tool**.\n\nThe algorithm is the **logic**.\n\n---\n\n## 3. Kee: Real Computer-Science Algorithms\n\nAlgorithms in ALife are intended to be based on **actual computer-science algorithms**, not merely fictional abilities with technical names.\n\nThe broader design has a large library of possible algorithms to draw from.\n\nExamples include:\n\n- A*\n- Dijkstra's algorithm\n- Breadth-First Search\n- Depth-First Search\n- Flood Fill\n- sorting algorithms\n- graph algorithms\n- scheduling algorithms\n- optimisation algorithms\n- pathfinding algorithms\n\nAlgorithms become gameplay logic.\n\nExamples:\n\n### A*\n\nFind or expose an optimal path through a traversal problem.\n\n### Breadth-First Search\n\nPropagate an effect outward through neighbouring nodes in layers.\n\n### Dijkstra\n\nFind a route according to minimum cost rather than simply minimum distance.\n\n### Flood Fill\n\nPropagate cleansing through a connected infected region.\n\n### Sorting / prioritisation\n\nDynamically reorder targets according to distance, danger, corruption, value, or another property.\n\nThe algorithm answers:\n\n> **How is the action organised, reasoned about, or applied?**\n\n---\n\n# The Combination\n\nThe fundamental build grammar is:\n\n```text\nProto Animal / Power\n        +\nKee Gadget\n        +\nAlgorithm\n        +\nAttributes\n        +\nLegendaries\n        =\nPlayer Build\n```\n\nThis allows the same animal, gadget, or algorithm to behave very differently depending on what it is paired with.\n\nThe long-term objective is not simply to become numerically stronger.\n\nIt is to accumulate an increasingly large **vocabulary of possible behaviours**.\n\n---\n\n# Campaign Progression\n\nCampaign content introduces capabilities before the player permanently masters every possible combination.\n\nA campaign section can introduce:\n\n1. a new animal,\n2. a new Proto cleansing capability,\n3. a new Kee gadget,\n4. a computer-science algorithm,\n5. and a platforming challenge designed around their interaction.\n\nThe player experiences the intended combination in authored content.\n\nCompleting that content establishes that the capability has been **discovered**.\n\nFor algorithms in particular, discovery and permanent endgame ownership are intentionally different stages.\n\n---\n\n# Algorithm Discovery vs Mastery\n\nAn algorithm can first appear as part of its campaign content.\n\nFor example:\n\n```text\nDiscover A*\n    ↓\nUse A* during its authored challenge\n    ↓\nComplete the challenge\n    ↓\nA* becomes eligible for that multiverse's endgame loot\n```\n\nThe campaign therefore says:\n\n> **I discovered and experienced this algorithm.**\n\nThe endgame says:\n\n> **I mastered it and can now build around it permanently.**\n\nThis creates a direct connection between authored campaign content and the later loot chase.\n\n---\n\n# Gear Philosophy\n\nALife does **not require traditional character levelling**.\n\nThere does not need to be a central progression of:\n\n```text\nLevel 1 → Level 20 → Level 50 → Level 100\n```\n\nInstead:\n\n```text\nSmall capability library\n        ↓\nMore animals\n        ↓\nMore gadgets\n        ↓\nMore algorithms\n        ↓\nMore attributes\n        ↓\nMore legendaries\n        ↓\nMore combinations\n        ↓\nMassive build space\n```\n\nProgression is primarily **horizontal**.\n\nThe artificial life becomes more versatile and expressive rather than simply acquiring an ever-larger number next to its name.\n\n---\n\n# Normal Gear and Attributes\n\nNormal campaign content can produce random attribute rewards.\n\nAttributes are the tuning layer.\n\nPossible examples include:\n\n- movement speed,\n- cleansing radius,\n- cleansing strength,\n- energy efficiency,\n- cooldown reduction,\n- acceleration,\n- air control,\n- gadget recharge,\n- transformation speed,\n- attack speed,\n- defence,\n- resource collection.\n\nThe intention is to avoid turning ALife into inventory landfill.\n\nInstead of forcing the player to retain hundreds of nearly identical disposable items, useful attributes can become part of the player's persistent build library.\n\nConceptually:\n\n```text\nFind attribute\n    ↓\nUnlock attribute\n    ↓\nUse it when constructing builds\n```\n\nPlayers then save configurations they actually care about.\n\n---\n\n# Algorithm Sets\n\nPermanent portable algorithms are represented by **three-piece sets**.\n\nExample:\n\n```text\nA* Piece I\nA* Piece II\nA* Piece III\n      ↓\nComplete A* Set\n      ↓\nA* becomes available as part of the build\n```\n\nThe three-piece structure is intentional.\n\nAn algorithm should matter enough to occupy meaningful build space without consuming the entire equipment configuration.\n\nThis leaves room for legendary items and attribute customisation.\n\nThe core principle is:\n\n> **Algorithm sets give you the system.**\n\n---\n\n# Legendary Gear\n\nLegendary gear has a different purpose.\n\nIt should not simply duplicate the role of algorithm sets or exist only as a larger attribute number.\n\nLegendary items are **rule benders**.\n\nThey alter how an existing capability behaves.\n\nExamples:\n\n- A* can recalculate while airborne.\n- Cleansing one target automatically marks another.\n- Using a Kee gadget charges a Proto ability.\n- Using a Proto ability resets a Kee gadget.\n- An algorithm evaluates multiple destinations instead of one.\n- A traversal action gains an unusual interaction with another unlocked system.\n\nThe principle is:\n\n> **Algorithm sets give you the system. Legendaries mutate the system. Attributes tune the system.**\n\nThis separation gives each reward category a clear reason to exist.\n\n---\n\n# Saved Builds\n\nThe important persistent object is not necessarily a backpack full of equipment.\n\nIt is the **build**.\n\nFor example:\n\n```yaml\nbuild: Rift Farming\nproto:\n  animal: Falcon\n  power: Wind Purge\n\nkee:\n  gadget: Jetpack\n\nalgorithm:\n  set: A*\n\nlegendaries:\n  - Momentum Loop\n  - Chain Cleanse\n\nattributes:\n  - Air Control\n  - Energy Efficiency\n  - Movement Speed\n```\n\nAnother saved build might be designed for:\n\n- bosses,\n- traversal,\n- cleansing,\n- multiplayer,\n- speed,\n- resource farming,\n- Greater Rifts,\n- or a particular Autopilot route.\n\nProgress therefore becomes a collection of **solutions** rather than a warehouse of junk.\n\n---\n\n# Multiverse Campaign Completion\n\nThe campaign ultimately leads across the planetary system to the final planet.\n\nThe last traversal should be a culmination of the multiverse's mechanics.\n\nPlanet 7 contains the major boss or source of infection.\n\nConceptually:\n\n```text\nPlanet 1\n  ↓\nDiscover / cleanse / traverse\n  ↓\nPlanet 2\n  ↓\nDiscover / cleanse / traverse\n  ↓\n...\n  ↓\nPlanet 6\n  ↓\nFinal traversal\n  ↓\nPlanet 7\n  ↓\nBOSS\n  ↓\nMULTIVERSE CLEANSED\n```\n\nThe final world can potentially be visible much earlier in the campaign, giving the player a persistent destination to work toward.\n\nAs the earlier planets are cleansed, the state of the multiverse can visibly improve.\n\n---\n\n# Endgame Unlock\n\nDefeating the multiverse boss changes the role of that entire multiverse.\n\nIt is no longer only campaign content.\n\nIt becomes an **endgame ecosystem**.\n\nCompletion unlocks:\n\n- Rifts,\n- Greater Rifts,\n- algorithm-set farming,\n- legendary farming,\n- rarer attributes,\n- build experimentation,\n- recording,\n- Autopilot farming of mastered content.\n\nSo every completed multiverse remains relevant after its story is finished.\n\n---\n\n# Rifts\n\nRifts procedurally remix the capabilities and environment of the multiverse.\n\nThey can reuse and recombine:\n\n- planetary geometry,\n- radial gravity,\n- animals,\n- Proto powers,\n- Kee gadgets,\n- algorithms,\n- infection mechanics,\n- enemies,\n- hazards,\n- and loot families.\n\nImportantly, because the campaign itself is built around travelling between planets, procedural Rifts can also generate increasingly unusual **planet-bridging routes**.\n\nThe authored campaign teaches the player how the multiverse works.\n\nRifts remix what was learned.\n\n---\n\n# Greater Rifts\n\nGreater Rifts are the scalable endgame frontier.\n\nPlayers use them to:\n\n- test builds,\n- hunt algorithm set pieces,\n- hunt legendaries,\n- find better attributes,\n- optimise combinations,\n- push increasingly difficult content,\n- record successful strategies,\n- and eventually automate content they have mastered.\n\nThe game therefore retains an action-RPG farming loop without requiring traditional XP levelling.\n\n---\n\n# Why Old Multiverses Stay Relevant\n\nEach multiverse has its own discoveries and endgame loot pool.\n\nFor example, if an earlier multiverse contains the A* algorithm set, a player may return much later because A* interacts beautifully with an animal or gadget discovered several multiverses afterward.\n\nNew content therefore expands the usefulness of old content.\n\nThe ideal result is:\n\n> **Every new multiverse increases the number of meaningful combinations across the entire game.**\n\n---\n\n# Recording and Autopilot\n\nALife includes a record-and-replay system for mastered content.\n\nThe player first performs the activity manually.\n\nThe system can record:\n\n- actions,\n- traversal,\n- ability use,\n- gadget use,\n- transformations,\n- interactions,\n- and the build used for the run.\n\nThat creates a reusable behavioural/data cache.\n\nConceptually:\n\n```text\nPlayer discovers challenge\n        ↓\nPlayer solves challenge manually\n        ↓\nPlayer records successful solution\n        ↓\nALife replays learned solution\n        ↓\nSolved content can be farmed\n```\n\nThe long-term goal is not merely a dumb input macro.\n\nALife is intended to support artificial-life behaviour that can **run and learn at the same time**, allowing mastered routines to potentially improve or adapt.\n\nThe fundamental rule is:\n\n> **The player pushes the frontier. ALife farms what has been mastered.**\n\n---\n\n# Full Gameplay Loop\n\n```text\nENTER MULTIVERSE\n       ↓\nARRIVE ON PLANET\n       ↓\nDISCOVER ANIMAL / PROTO POWER\n       ↓\nDISCOVER KEE GADGET\n       ↓\nEXPERIENCE ALGORITHM\n       ↓\nBUILD A COMBINATION\n       ↓\nDEPART PLANET\n       ↓\n3D RADIAL PLANET-BRIDGING PLATFORMING\n       ↓\nCLEANSE INFECTION\n       ↓\nARRIVE AT NEXT PLANET\n       ↓\nREPEAT ACROSS THE SYSTEM\n       ↓\nFINAL PLANET\n       ↓\nBOSS\n       ↓\nMULTIVERSE CLEANSED\n       ↓\nRIFTS + GREATER RIFTS UNLOCK\n       ↓\nFARM 3-PIECE ALGORITHM SETS\n       ↓\nFARM LEGENDARIES\n       ↓\nTUNE ATTRIBUTES\n       ↓\nSAVE BUILDS\n       ↓\nPUSH HARDER RIFTS\n       ↓\nRECORD MASTERED ROUTES\n       ↓\nAUTOPILOT FARMING\n       ↓\nENTER THE NEXT MULTIVERSE\n```\n\n---\n\n# Progression in One Sentence\n\n> **Campaign content teaches capabilities, algorithm sets make algorithms permanently portable, attributes tune the build, and legendaries break its rules.**\n\n---\n\n# World Structure in One Sentence\n\n> **The seven planets are the chapters; the journeys between them are the levels; the final planet is the boss destination; cleansing the system turns the whole multiverse into an endgame playground.**\n\n---\n\n# ALife's Design Identity\n\nALife is ultimately about accumulating **possibility**.\n\nProto discovers nature.\n\nKee discovers machinery and computation.\n\nThe player combines them.\n\nThe campaign teaches those systems through compact radial-gravity platforming journeys between planets.\n\nThe endgame takes the systems the player has learned and explodes them into buildcraft, procedural Rifts, Greater Rifts, legendary modifiers, algorithm sets, recorded solutions, and autonomous farming.\n\nThere is no requirement for the player to become \"Level 100.\"\n\nInstead, the artificial life becomes something much stranger:\n\n> **A growing library of forms, tools, algorithms, behaviours, builds, and learned solutions that belongs to the same persistent being across every multiverse.**\n"}}