Repository navigation
[WIP] Depth-recurrent QAT: 3x4 loops, 768d, 15.6MB artifact - #51
hacksurvivor wants to merge 3 commits into
Conversation
Depth recurrence (3 shared blocks x 4 loops = 12 effective layers), QAT via STE fake-quantize, per-loop LoRA adapters, LAWA weight averaging, fp16 tied embedding export. Validated on A10G. H100 multi-seed results pending. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c5e06c38e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| lawa_state = {k: v.detach().cpu().clone().float() for k, v in base_model.state_dict().items()} | ||
| lawa_count = 1 | ||
| else: | ||
| lawa_count += 1 | ||
| for k, v in base_model.state_dict().items(): | ||
| lawa_state[k] += (v.detach().cpu().float() - lawa_state[k]) / lawa_count |
There was a problem hiding this comment.
Keep LAWA averaging off the CPU hot path
Once warmdown starts, this code copies the entire state_dict() from GPU to CPU and casts it to float on every step. For the default 13M-parameter model that is tens of MB of host transfer per step, and over a 400-step warmdown it turns into many GB of extra PCIe traffic and Python-side work on every rank. In the challenge’s 10-minute setting, that overhead can easily consume the remaining wallclock budget and force an earlier stop or a worse final score.
Useful? React with 👍 / 👎.
| if os.environ.get("SKIP_COMPILE", "0") == "1": | ||
| compiled_model = base_model | ||
| else: | ||
| compiled_model = torch.compile(base_model, dynamic=False, fullgraph=True) |
There was a problem hiding this comment.
Make
SKIP_COMPILE disable all torch.compile calls
This branch suggests SKIP_COMPILE=1 is enough to bypass Inductor, but main() still unconditionally runs torch.compile(zeropower_via_newtonschulz5) earlier at line 789. On the smoke-test machines where people set SKIP_COMPILE because compile is slow or unsupported, the script can still fail or spend a long time compiling before it ever reaches this branch, so the escape hatch is incomplete.
Useful? React with 👍 / 👎.
INT8_KEEP_FLOAT_MAX_NUMEL=1M accidentally kept attention weights (589K params) in fp16 instead of int8, inflating artifact to 17.6MB. Fix: name-based pattern keeps only tok_emb in fp16, threshold back to 65K. Reduces raw payload from 19.5MB to 14.2MB. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- LAWA averaging now stays on GPU using lerp_() instead of copying to CPU every step. Eliminates PCIe overhead during warmdown. - SKIP_COMPILE=1 now also skips torch.compile(zeropower_via_newtonschulz5) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ode sync Post-production review of the three preceding commits (iter163 promotion + cleanup openai#47 + cleanup openai#50) using coderabbit, pr-review-toolkit, and four exploration agents found ~25 drift items that the prior cleanups missed. iter163 correctness fixes: - bf16 invariant: _consistency_extend_no_grad cast Parcae coefficients to z.dtype so the no-grad extension target follows the same bf16 trajectory as the actual training-time DEQ solve (was silently fp32 because _parcae_a_bar/_parcae_b_bar return fp32). Without this, the consistency target was biased relative to what the model produces. - Split _consistency_*_loss_raw (with-grad, used in assembly) from _consistency_*_loss_t (detached log copy) to match the convention used by every other loss component. iter163 P0 sibling-fanout DRY fix: - The iter163 promotion commit emitted consistency_anchor_loss / consistency_ext_loss to run.log but had no entries in plot_metrics.py parse_log, tests/test_training_contracts.py required_fields, or any plot fixture. Added a CONSISTENCY_LOSS_FIELDS registry in plot_metrics.py driving both the out-dict initializer and the parser loop; added the fields to the contract-test required_fields. opg_doc.tex doc-code sync: - Parameter table: dropped stale router_load_cv_coef / mos_load_cv_coef rows (cleanup openai#50 removed the fields but left the rows with arithmetically wrong values); replaced with the new multi_k_consistency_anchor_coef / extension_coef / extension_delta rows (loss-form-triple-touch compliance). - Loss equation block: dropped the λ_rcv·CV² and λ_mcv·CV² terms that the cleanup commit removed from code but left in equations, while the prose two paragraphs later claimed they were "gone" — internally inconsistent. - Feature table: flipped deq_prefix_anchors from false to true to match CLAUDE.md (default-on since iter152 promotion, 2026-05-13). - Local Stability Guarantee section: rewrote the lip_ub_F-as-gate paragraphs to point at rho_F (necessary AND sufficient by Hartman-Grobman); annotated the historical narrative paragraphs with 'removed 2026-05-15'. - Bumped document date 2026-05-06 -> 2026-05-15. train_gpt.py docstring sweep: - Annotated or rewrote ~10 stale lip_ub_F / fp_bound / power_jvp_F references in _collect_routing_losses, _prescribe_failure_fix, _parcae_cycle_F, _joint_F_residual_at_saved_fp, the Hyperparameters Lyapunov section, and the Lyapunov FD branch comments. - Removed the redundant docstring bullet listing mos_load_cv_coef as a prescription lever (the prescription itself correctly notes the removal). New audit-checklist row (the user's explicit ask for a prevention principle): 'Removal-symmetry sweep' in CLAUDE.md. When removing a Hyperparameter / loss term / diagnostic, the same commit MUST drop the field from Hyperparameters + CLI + opg_doc.tex (equation AND parameter table), annotate every train_gpt.py docstring that names the field, and preserve intentional backward-compat parsing with a co-located comment. The worst failure mode is removing the implementation but leaving the equation in opg_doc.tex and a paragraph two pages later saying 'removed' — that produces an internally contradictory paper. Enforced by NEW tests/test_removal_symmetry.py (5 tests, all passing): - Greps opg_doc.tex, train_gpt.py, CLAUDE.md for an explicit ledger of removed names (REMOVED_NAMES tuple); asserts each occurrence is in an annotated 3-line context window (REMOVAL_ANNOTATIONS markers). - Asserts removed Hyperparameters fields are absent from the dataclass body. - Asserts iter163 log fields are in plot_metrics.py + contract test (the addition-direction analogue of the same DRY rule). EXPERIENCE.md gains #removal-symmetry-sweep section with the full incident write-up and index row. Verification: - 158 tests pass across tests/ + experiments/test_*.py. - LaTeX compiles cleanly (pdflatex exit 0). - grep verification: all remaining lip_ub_* / fp_bound mentions in opg_doc.tex and train_gpt.py are in annotated context windows. Simplify pass (post-review): consolidated cv_sum/mos_cv detach to single site at assignment (removed redundant aggregation-side detach); condensed verbose iter163 anchor-loss comment (cross-references opg_doc.tex Section 7 instead of restating the math); merged required/optional loss-tensor assertion loops in test_loss_component_logging.py; replaced O(N*M) line+name scan in test_removal_symmetry.py with a single compiled combined regex. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Depth-recurrent transformer with quantization-aware training.
Key optimizations
A10G validation (200 iterations, 1 shard)
Full 8xH100 multi-seed results pending compute grant.
Test plan