Repository navigation
Living Weights as a core module: the learner, pocket and fits in zig/src/living, a family described as data (Nemotron only) - #878
Conversation
…unchanged The learner, its whole-lesson and routed paths, the pocket and its fits and helpers move from families/nemotron to a `living` module that both builds import, as 19 renames with no change to their contents. The family-neutral half of learn_shape.zig (block sizes, Adam settings, direction lengths) moves with them; Nemotron's learn_shape.zig keeps where its blocks sit and names the shared constants from the module. Nemotron's files import the moved ones through the module. The learner's tests now also run on Linux, as `zig build test-living` and under test-cuda-host. No behaviour change.
… layout, neuron kind and shard format A family now describes itself once, as data (living/families.zig): where its shared experts sit and their tensor names, the neuron's activation (relu^2, or SwiGLU with an optional per-row gate), the quantization, the config keys and the object they live in, and its MTP head's expert. Its host gives the learner a layout and the pocket hooks (living/family.zig). Nemotron is the one family listed, and its lessons, routed blocks, edits and probes are unchanged. - The pocket reads its layers and width from the family's layout, not from Nemotron's config, and the learner offers routed blocks, edits and probes only to a trainer with `sites` (Nemotron's). - living/shards.zig widens any family's experts at its group and width; Nemotron's writer is now a wrapper over it. shard_edit sets and reads nested config keys (text_config). - A SwiGLU neuron fitted as u is written as gate row 16u and up row u/16: relu(u x)^2 on its fact's rows, at most 8e-5 of it at a 0.5 margin; a gated family's outputs fit gate * act(x). No listed family uses it yet; the tests use a stand-in family shaped as Qwen3.8 Flash Next's shared expert. - The server's view reads layers, pockets and shards through the family its config's model_type names, and native/nemotron_slide.zig is native/slide_adapter.zig. - pocket.zig's quiet refit and its loading move to pocket_quiet.zig and pocket_load.zig, for the 600-line rule. - Tests: the generic writer equals affine4_host at 4 bits in groups of 64, Nemotron's save test over the wrapper, a SwiGLU neuron fitted and stored at 4 bits in groups of 32, and a whole pocket lesson over a stand-in host for each activation (test-living, also under test-cuda-host).
|
Thank you, @ZackSample. Living Weights as a core module, with each family described as data, is the direction we want. Your receipt makes the move easy to trust: through ten lessons the shard hashes, the graph and every reply matched main. It lands after #876 and #877, which land right after 1.0.12. Its second commit reworks the learner files that #872, #876 and #877 all change, so we will rebase #878 onto them ourselves and run its gates then. There is nothing for you to redo. The list of what a host and a trainer give the learner would make a good recipe page beside Posted by Ash's AI Assistant Synthena |
…w-c-fnback (ashhart#869 and the backward kernels) Flash Next's trainer needs both open PRs: the CUDA family (ashhart#869) and the learner in zig/src/living (ashhart#878). The two touched zig/build/cuda.zig and native/cuda.zig: the build keeps both the flashnext and living modules, and the native host keeps @hasDecl(F, "slide") because Flash Next does not declare one until the next commits.
|
Just dropping a note as I saw this feature today. I worked on an orthogonal approach, hidden state injection. Generate hidden state for something like a prompt, inject the hidden state at the beginning of decode. No weight changes or decode logic changes. Needle recall is pretty good, 95-99%, so it can better be regarded as approximate memory. It doesn't, however, elicit any different behavior that a prompt wouldn't. It does save context length, and the injected hidden states are never exposed to the user or logs. Might compose well with this expert sidecar approach. |
|
Thank you, @ZackSample, for describing each family as data and moving the learner and pocket into one shared module. This work moves with Living Weights to 1.1.1, the next patch release. Our reviewed follow-ups reject invalid code widths and unsafe SwiGLU sharp values before arithmetic, and count occupied neurons from the up rows. The extraction and each CUDA or Metal family port must retain lesson, reload, delete and full-pocket restore results on the combined build before release. Thanks too, @pierre427, for the hidden-state note. It trades weight changes for approximate memory, which makes it a different feature; it would fit best as its own proposal. Posted by Ash's AI Assistant Synthena |
…sked cold @ZackSample's #891 (head 4a63c4b): a lesson also learns a fact's questions after scripted conversations (talk, task, long, and a chain of the latest learned facts' questions) and checks its two held-out questions after two conversations no lesson learns in. The model writes each conversation once; the fact graph keeps it. On CUDA a prompt in a conversation is read at any length through the trainer's taps; Metal leaves out what its passes cannot hold. Reconciled with what landed after its base: - the quiet refit holds both #876's rows (other prompts') and #891's (inside a conversation, where a chain carries an earlier fact's question and answer), above refit_above; - #877's rounds, recheck, repair and take-out kept; the conversation checks join each round's verdict; - #872's graph format kept, talks and chain beside it; checks asked in conversation stay out of its answer records here (the next commits give them their conversation); - after #878's move: the tap path in living/pocket_read.zig, the example checks in lesson_examples.readable, cuda_train_tap.zig's lesson_route from living; - askIn takes `shipped`, so a delete's checks can ask the model as shipped after a conversation; json as a module.
fitLayer takes the family's margin since #878; the check tool still called it with eight arguments, so a plain `zig build` on a Mac failed to compile it. It passes relu^2's margin, Nemotron's, as the fit used before.
…ollow-ups named as ours After review of the fourteen lines that overstated: #710's fresh-quantization gain is one measured case; #902's stop and group cleanup hold where the watch lines are open and through the shared helper; #887 says its chunks change the attention bits below 8,192, on M5 too, with no larger error against float64; #899 records the ring start and the wider refusal; #802 keeps the author's B70 receipts apart from our host-checked lifetime fixes; #836's equalities are the GB10's and its Windows build the author's; #888 says a failed restore's pinned memory is kept, never freed; #734's tree rounds are checked against the host's, not float64; the Living Weights lines (#876, #877, #878, #891) say which runs their numbers come from, the ten-fact costs, and the M3 Ultra's four-fact result; #946 and #910 read plainer.
… in conversation (#876, #877, #878, #891) This reverts the merge bafca587d (its first parent kept): the learner moves back from zig/src/living to the Nemotron family as 1.0.12 ships it, and the server, the build and the families lose the shared module. 1.1.1 takes the series again. Kept from the commits that came after it: the lean moves (shard_edit_link_test.zig, the kernel list in cuda_kernels.zig), the KV pages, which now read the lesson route from the Nemotron family, the required-tools lanes import in the server build, and Drama's and Qwen-VL's build wiring.
…Next on CUDA's lines say what was measured The six Living Weights rows (#876, #877, #878, #891, #905 and #992) leave Unreleased with the series. The EXL3 operators' line names GLM-5.3-Flash's two-rank engine as the family that serves them; #995's and #979's launches have their records on nvcc 13.0 and 13.2; and Flash Next on CUDA states what a GB10 served from the MLX 4-bit checkpoint, text and PNG images.
|
Thank you, @ZackSample, for describing each family as data and moving the learner and pocket into one shared module. This work moves with Living Weights to the next patch release that passes its gates, 1.1.1 if they pass in time. Our reviewed follow-ups reject invalid code widths and unsafe SwiGLU sharp values before arithmetic, and count occupied neurons from the up rows. The extraction and each CUDA or Metal family port must retain lesson, reload, delete and full-pocket restore results on the combined build before release. Nemotron on Apple M3 Ultra kept 3 of 4 facts and Apple M5 Ultra kept 2 of 4, both failing at the same rounding check, so Living Weights stays held for a repaired 4/4 rerun plus the NVIDIA GB10 27B and persistence/retention gates. Posted by Ash's AI Assistant Synthena |
… data @ZackSample's ashhart#878 (head 0bf1178): the learner, pocket and fits move to zig/src/living as a module, then a family is described as data (layout, neuron kind, shard format), Nemotron the one registered. Reconciled with what landed after its base: - ashhart#876 and the refit_above threshold: living/pocket_quiet.zig carries both (the extraction held the refit from before ashhart#876); - ashhart#872 and ashhart#877: the delete (pocket_forget.zig), the lesson's mark (pocket_mark.zig) and their tests move into living; their snapshots and put-backs hold a SwiGLU pocket's gate rows; the round a save writes is shards.roundSlot over living's affine (the codes affine4_host writes, tested), so the hosts' pocketRound hooks go; - the delete's tests now run in the living module, on Linux hosts too; - the HIP, XPU and fuzz builds' servers get the living module (server.zig), which the server's model view now imports; - 1.0.12's json module, heat, radio and GLM build wiring kept beside living's.
… only asked cold @ZackSample's ashhart#891 (head a203094): a lesson also learns a fact's questions after scripted conversations (talk, task, long, and a chain of the latest learned facts' questions) and checks its two held-out questions after two conversations no lesson learns in. The model writes each conversation once; the fact graph keeps it. On CUDA a prompt in a conversation is read at any length through the trainer's taps; Metal leaves out what its passes cannot hold. Reconciled with what landed after its base: - the quiet refit holds both ashhart#876's rows (other prompts') and ashhart#891's (inside a conversation, where a chain carries an earlier fact's question and answer), above refit_above; - ashhart#877's rounds, recheck, repair and take-out kept; the conversation checks join each round's verdict; - ashhart#872's graph format kept, talks and chain beside it; checks asked in conversation stay out of its answer records here (the next commits give them their conversation); - after ashhart#878's move: the tap path in living/pocket_read.zig, the example checks in lesson_examples.readable, cuda_train_tap.zig's lesson_route from living; - askIn takes `shipped`, so a delete's checks can ask the model as shipped after a conversation; json as a module.
…rt#877, ashhart#878, ashhart#891) One line each, with the GB10 measurements; the M3 Ultra numbers follow its gate.
…added fitLayer takes the family's margin since ashhart#878; the check tool still called it with eight arguments, so a plain `zig build` on a Mac failed to compile it. It passes relu^2's margin, Nemotron's, as the fit used before.
…ollow-ups named as ours After review of the fourteen lines that overstated: ashhart#710's fresh-quantization gain is one measured case; ashhart#902's stop and group cleanup hold where the watch lines are open and through the shared helper; ashhart#887 says its chunks change the attention bits below 8,192, on M5 too, with no larger error against float64; ashhart#899 records the ring start and the wider refusal; ashhart#802 keeps the author's B70 receipts apart from our host-checked lifetime fixes; ashhart#836's equalities are the GB10's and its Windows build the author's; ashhart#888 says a failed restore's pinned memory is kept, never freed; ashhart#734's tree rounds are checked against the host's, not float64; the Living Weights lines (ashhart#876, ashhart#877, ashhart#878, ashhart#891) say which runs their numbers come from, the ten-fact costs, and the M3 Ultra's four-fact result; ashhart#946 and ashhart#910 read plainer.
… in conversation (ashhart#876, ashhart#877, ashhart#878, ashhart#891) This reverts the merge bafca587d (its first parent kept): the learner moves back from zig/src/living to the Nemotron family as 1.0.12 ships it, and the server, the build and the families lose the shared module. 1.1.1 takes the series again. Kept from the commits that came after it: the lean moves (shard_edit_link_test.zig, the kernel list in cuda_kernels.zig), the KV pages, which now read the lesson route from the Nemotron family, the required-tools lanes import in the server build, and Drama's and Qwen-VL's build wiring.
…Next on CUDA's lines say what was measured The six Living Weights rows (ashhart#876, ashhart#877, ashhart#878, ashhart#891, ashhart#905 and ashhart#992) leave Unreleased with the series. The EXL3 operators' line names GLM-5.3-Flash's two-rank engine as the family that serves them; ashhart#995's and ashhart#979's launches have their records on nvcc 13.0 and 13.2; and Flash Next on CUDA states what a GB10 served from the MLX 4-bit checkpoint, text and PNG images.
What this changes
Following your note on #472 (the core builds each step once and a family plugs in), this moves Living Weights out of
families/nemotroninto alivingmodule that both builds import. A family then describes itself as data and hands thelearner a few hooks. Nemotron is the only family listed, and nothing it does changes.
5a4987b7). The learner, its whole-lesson and routed paths, the pocket and itsfits and helpers (19 files) are
git mv'd tozig/src/living/, and GitHub shows each as a 100% rename. Thefamily-neutral half of
learn_shape.zig(block sizes, Adam settings, direction lengths) moves with them. Nemotron'slearn_shape.zigkeeps where its blocks sit and names the shared constants from the module. Nemotron's files importthe moved ones as
@import("living").x.build.zigandzig/build/cuda.zigadd the module, and its tests run onLinux as
zig build test-livingand undertest-cuda-host.75978a1c).living/families.zig: a family as data. That means its shared experts' tensor names and where they sit, theneuron's activation (relu^2, or SwiGLU with an optional per-row gate), its affine format (bits, group), its config
keys and the object they sit in, and its MTP head's expert. Only
nemotron_his listed.living/family.zig:Family,Layout(the layers a pocket widens and learns at) and the hooks a host gives(below).
layout(), not from Nemotron's config. The learner offersrouted blocks, edits and probes only to a trainer with
sites, which only Nemotron's has.living/shards.zigwidens any family's experts at its own group and width, throughliving/affine.zig(MLXaffine at any bits and group). A test shows it writes exactly
affine4_host's codes, scales and biases at 4 bitsin groups of 64. Nemotron's
pocket_shards.zigis now a wrapper over it, and its existing save test passesunchanged.
shard_editreads and sets config keys inside a nested object (text_config).living/neuron.zig: a SwiGLU neuron fitted asuis written as gate row16uand up rowu/16, so it adds(u x)^2 sigmoid(16 u x). That is relu(u x)^2 within 1e-7 on its fact's rows, and at most 8e-5 of it at a 0.5margin. A gated family's outputs are fitted as
gate * act(x). No listed family uses SwiGLU yet. Its tests use astand-in family shaped as Qwen3.8 Flash Next's shared expert (
living/test_families.zig), and Flash Next itselfcomes in a later PR.
model_typenames.native/nemotron_slide.zigis nownative/slide_adapter.zig.pocket.zig's quiet refit and its loading move topocket_quiet.zigandpocket_load.zig.What a host gives the learner (this was a block comment in
family.zig, which the one-line rule does not allow):host:
Trainer,max_rows,Ctx,family,layout(ctx),trainer(gpa, io, ctx),free(t, gpa),seconds(io). For the pocket:pocket(ctx, layer, up, down, used),pocketRead(ctx, layer, up, down) usizeandpocketSave(ctx, gpa, io, layers, neurons, up, down) usize;gatebesideup.upandgateare each neuron's input rows as the forward multiplies them ([neurons, D]f32), anddownis itsoutput. A save hands the rows back as written. Optional:
attach,writeandlayers(routed blocks), andcodes,commitandfold4(weight edits).trainer:
normed(layer, row),pass(seqs, mode, turn, out),step(ids, start, mode, turn),spans,packs(),pack,count,prefixes,prefixSlots(n),pushAt(i, key, layer),deltaAt(i, key, layer),residual(layer, row),nudgeandfrom. A gated family also needsgateAt(layer, row). Nemotron's routedblocks, edits and probes additionally use
sites,sketched,score(),projected(),key()andconfig().It could go in a recipe page beside
adding-a-zig-family.mdif you want it written down.Receipt
lw-b-core75978a1 onmainc7137bb (v1.0.11 + 19), Zig 0.17.0; NVIDIA GB10 (DGX Spark, sm_121),driver 580.178.04, CUDA 13.0.88, Ubuntu 24.04.5; checkpoint
TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bitrevision d9d758fb, a freshcp -RLcopy for each run.peanuts.") one learn request at a time, with
mainand with this branch, each on a fresh copy, and probed after everylesson. Every probe was two fixed wordings per fact (20 questions) and every learned fact's stored held-out
questions, at
"temperature": 0..safetensorsfile and ofconfig.jsonwas the same on both,including the first save, which widens the shared experts.
--sliderestart gave the same replies as after lesson 10.
what the learner writes.
zig build teston Linux: 781/786 pass, 5 skipped (main: 743/748, 5 skipped; the 38 more are the learner's,the pocket's and the shard writer's tests, which no Linux test binary reached before). Both commits build and pass.
zig fmt --check build.zig zigis clean, andpython3 tools/zig/lean_check.pygives 527 problems against 527 onmain(0 new).zig build test-native -Dtarget=aarch64-macosandzig build native -Dtarget=aarch64-macos, with a stubxcrunthat writes empty metallibs, compile every Zig module and stop only atlinking Apple's frameworks, the same as on
main. So the Metal side type-checks, but a Maczig build testand aMac lesson (same neurons, same shard hashes as
main) are still needed.Checklist
change.)
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Nottouched.)
shard bytes, receipt above.)
type-checked only.)
the generic writer against
affine4_host, the SwiGLU rows, a whole lesson over a stand-in host.)Questions
zig/src/living/as here, or underzig/src/core/?Familyvalue live in its own folder (for examplefamilies/nemotron/pocket_layout.zig), withno central
families.zig? The server's view would then need a family registry elsewhere.trainer, leaving this one relu^2 only?
Order with the other Living Weights PRs
This moves the files that the refit fix (#876) and the recheck and take-out fix (#877) change. If those
land first, I will rebase this onto them: A1 already splits
quiet()intopocket_quiet.zig, as this does, and A2'spocket_mark.zigand its writerround()move intoliving/andliving/shards.zig.