Skip to content

spec(ml): adamw.t27 heap-free rewrite so it compiles and its tests can fail (Refs #10024) #10091

Closed as not planned

Description

@gHashTag

Goal

Make specs/ml/optimizer/adamw.t27 compile and pass t27c test-report with every test passing and zero vacuous tests. Part of epic #10024 (cell 23, "ML specs that compile": 6 of 17 compile today). The spec is blocked on allocate_array, a heap call t27c does not lower, and its function bodies were comments, so no test could run.

Boundary

  • In: specs/ml/optimizer/adamw.t27 only. Heap-free rewrite in the style of adam.t27 and lamb.t27: the caller owns the buffers (params, grads, m, v, v_max) and passes them in.
  • Out: seals under .trinity/seals/ (refreshed by the reseal workflows), any other optimizer spec, any non-t27 file.
  • Out: the BPB ablation itself. The four hyper-parameter arms (phi canonical, phi damped, tuned standard, random rational) stay as named constants, labelled [Open conjecture].

Scenarios

  • One AdamW step on a hand-computed 2-element case gives the expected parameters and moments.
  • With weight decay 0 the update equals adam.t27's over several steps with changing gradients.
  • With a zero gradient AdamW still shrinks theta by lr * wd * theta, while Adam with L2 in the gradient does not (decoupled decay).
  • Bias correction at step 1 recovers m_hat = g.
  • AMSGrad keeps the largest v and takes a smaller step than plain AdamW afterwards.
  • NaN and infinite gradients are refused and change nothing.
  • A few steps on f(x) = x^2 reduce |x|.

Requirements

  1. t27c test-report specs/ml/optimizer/adamw.t27 shows 0 FAIL, 0 BLOCKED, 0 vacuous.
  2. Each test asserts something a wrong implementation would fail; a mutation check (flip the update sign, flip the decay sign, drop bias correction, ignore v_max) fails at least one test each.
  3. Tests that were placeholders, called undefined helpers, or asserted nothing are dropped, and the PR lists what was dropped and why.
  4. .t27 only, ASCII only, English only.

Close criteria

Activity

  1. gHashTag commented on Oct 17, 2026

    @gHashTag
    OwnerAuthor

    Superseded by #10077 / PR #10088, which rewrites adamw.t27 heap-free on the arena.

  2. added
    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions