feat: layer freezing PR2 — backward truncation at deepest trainable layer + dx wire elision (#380)#393
Open
LeoBuron wants to merge 3 commits into
Open
feat: layer freezing PR2 — backward truncation at deepest trainable layer + dx wire elision (#380)#393LeoBuron wants to merge 3 commits into
LeoBuron wants to merge 3 commits into
Conversation
…or param layers
…e layer + wire elision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #380 (PR2 of 3 — do not auto-close the epic). Builds directly on #392 (PR1).
What
Backward dx-chain truncation — the TTE-class memory/compute win PR1's freezing enables:
propLoss == NULLgrads-only contract on the five parameter-layer backwards: compute weight/bias (gamma/beta) grads exactly as normal, touch no dx memory. LN/GN SYM paths skip pass B entirely when NULL (dx requant,plQC->scalerefresh, entry validations, empty-geometry writes).calculateGradsImpl):deepestTrainableIndexfinds the closest-to-input layer whose params still train; the loop runsbackwardIndex → Donly, passesNULLpropLoss at D (its dx wire is never allocated), and nothing below D executes. A model with no trainable params skips the entire backward (loss value still computed).lossgrad/agradonly for the executed range; nothing below D; no backward events at all for all-frozen models.Behavior change disclosure (deliberate, epic-spec'd)
The cut is at the deepest parameter layer. Consequences beyond frozen models:
agradevents vanish from traces. Concretely: kws_raw'spool0.agradparity probe disappears;trace_compare.pydoes not flag one-sided files (follow-up below).Testing
deepestTrainableIndexcorruption — all killed by named tests).propLoss->audit; gradNext ownership re-derived across all three model shapes (no leak/double-free); 208 tests across touched binaries re-run clean.trace_c_kws_raw).Known minors (deliberate)
detect_leaks=0, LSan tracked under Enable LeakSanitizer in CI after establishing cleanup convention #82).Follow-up candidates (not filed yet)
[trainable, frozen, trainable]composition) and LN/GN-at-deepest loop coverage.trace_compare.py: report one-sided (missing-pair) files instead of silently skipping.🤖 Generated with Claude Code