karpathy / karpathy/micrograd

Adjusting parameters by sign and magnitude of gradient

Open
#65 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
17.6k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/karpathy/micrograd/blame/c911406e5ace8742e5841a7e0df113ecb5d54685/demo.ipynb#L271C13-L271C45

I really appreciate your videos! Such a gift to all of us.

When adjusting parameters after computing the loss, the example multiplies the step size by the sign _and magnitude_ of the gradient. In cases of a steep gradients near local minimum values, a large value will jump the parameter far from the desired solution. In the case of shallow gradients, the parameter will struggle to reach its local minimum in the given number of iterations.

Thus, I think the adjustment should be a step size times the sign of the gradient.

What are your thoughts?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.