Repository navigation
Conversation
…loses #10091) The old spec called allocate_array (not lowered by t27c), left every function body as a comment and carried two copies of the optimizer. Rewritten in the adam.t27 / lamb.t27 style: caller-owned buffers, real AdamW update with bias correction and optional AMSGrad, tests that fail under a sign flip. Refs #10024 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Closing as a duplicate: #10088 rewrites the same file (specs/ml/optimizer/adamw.t27) without allocate_array, carving m, v and v_max from specs/ml/arena_heap.t27, with resealed seals and the map count update. Two rewrites of one spec would conflict on whichever lands second. This PR's extra tests (wd=0 equals Adam, decoupled decay differs from L2, bias correction at step 1) can be folded into the #10088 version in a follow-up. Part of #10024. |
Contributor
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.
Closes #10091
Refs #10024 (cell 23)
What
Heap-free rewrite of
specs/ml/optimizer/adamw.t27. The old file calledallocate_array(not lowered by t27c), had comment-only function bodies, and carried two copies of the optimizer (pre-B1 and Phase B1). The new file is one module in theadam.t27/lamb.t27style: the caller ownsparams,grads,m,v,v_max;adamw_stepis the real update:with bias correction, optional AMSGrad (v_max tracks raw v, bias-corrected afterwards, as in PyTorch), and refusal of NaN/inf gradients. beta1, beta2 and epsilon defaults and
powi/is_finiteare taken fromadam.t27throughuse, not copied.Measured (Railway lab, t27c test-report, zig 0.16.0)
Each test executes 1 runtime assert (a chained
and). Before: BLOCKED,allocate_array.Mutation check (applied to a copy on the lab, then deleted)
theta + lr * ...)- wd * theta)m / 1.0)v_used = v)amsgrad_keeps_the_largest_second_moment)All four mutants are killed.
Tests that can fail
adam.t27over five steps with changing gradients (and the parameter must have moved).Dropped from the old spec, and why
gf16storage types,PHI_BETA1/PHI_BETA2and the_V1/_v2twin copies: duplicates; f32 matches the passing siblings.PhiVariantenum and tuple-returningget_effective_betas(its body returned a single value, so the 4+4 variant tests could never pass): replaced byvariant_beta1(which)/variant_weight_decay(which)with real tests.PHI_DAMPED_BETA2andPHI_CANONICAL_LR: unused by any arm.OptimizerStepResultrecord (step_norm never computed).benchblocks: they timed undefined helpers (random_input,steps_per_second,any_adamw_config), so none could run.b1_control_ablation_produces_distinct_bpb: called an undefinedrun_adamw; the BPB ablation is a training experiment, not a unit test.b1_phi_anchors_labeled_open_conjecture:assert trueplaceholder. The [Open conjecture] label stays in comments.Not in this PR
.trinity/seals/AdamW.jsonandoptimizer_AdamW.jsonstill hold the oldspec_hashand theallocate_arrayblocked note; the reseal workflows refresh them (sibling spec PRs do not touch seals).🤖 Generated with Claude Code