Kina.ai

Specification

ADR: StoryLM-0 functional SGD

Context

AGENTS.md step 4 asks for functional SGD before AdamW. Section 10 can build NLL cotangents but cannot return them from @main. A training loop still needs a specified parameter update.

A new sgd primitive would invent fusion and mutability that the numbered specs do not define.

Decision

Specify SGD as the existing composition in 11-functional-sgd.md:

w' = w - lr.broadcast(shape(w)) * g

No new surface form, IR constructor, or FFI. Examples take w and g as explicit tensors. Do not compose this slice with reverseMode returns. Do not add AdamW.

Consequences