Skip to content

Scalar reverse-mode autograd engine + SGD#1

Merged
ThomasHartDev merged 2 commits into
mainfrom
thomas/feat/gradient-descent
Jul 18, 2026
Merged

Scalar reverse-mode autograd engine + SGD#1
ThomasHartDev merged 2 commits into
mainfrom
thomas/feat/gradient-descent

Conversation

@ThomasHartDev

Copy link
Copy Markdown
Owner

adds a little scalar autograd engine, basically a Value type that records each op as it happens and then replays the graph backward to fill in gradients via the chain rule. built the usual ops (+, *, **, div) plus relu/tanh/exp/log/sigmoid, and an SGD optimizer with optional momentum plus a minimize loop on top. this is the gradient descent + backprop foundation everything else in the repo will lean on. tests check the grads against numeric finite differences, verify a softmax cross-entropy grad against numpy, and actually train a tiny linear regression through the engine to make sure the whole loop works. also covers the annoying edge cases like a node reused twice needing its grads accumulated. numpy only, no ml libs.

@ThomasHartDev
ThomasHartDev merged commit 7201147 into main Jul 18, 2026
2 checks passed
@ThomasHartDev
ThomasHartDev deleted the thomas/feat/gradient-descent branch July 18, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant