# Gradient descent decreasing loss [duplicate]

Is the following statement true: Gradient descent is guaranteed to always decrease a loss function.

I know that if the loss function is convex, then each iteration of gradient descent will result in a smaller loss, but does this statement hold for all loss functions? Could we design a loss function in such a way that performing gradient descent was not optimal?

• Imagine the loss function $f(x) = 0$ Oct 4 '18 at 21:59
• How is the step size ascertained? Oct 4 '18 at 22:17
• @MatthewGunn The question does not speak to the value of the step size, so I'm assuming it could be anything. Oct 4 '18 at 22:31
• I think you're asking two separate things. The first is essentially if GD works for all loss functions, i.e. is there a loss function where GD wouldn't work? In the second question you ask if there is a loss function where GD isn't optimal? The second is quite easy, in any non-convex loss function GD is dependent of its staring point. Imaging if that were true and GD was the optimal way to decrease any loss function imaginable. The first question is more interesting, but in my opinion you should give a bit more details (e.g. can the loss function be non-differentiable?) Oct 4 '18 at 23:14

$$\theta_t = \theta_{t-1} -\eta\nabla_\theta\mathcal{L}$$
where $$t$$ indexes the training iteration, $$\theta$$ is the parameter, $$\eta$$ is the step size, and $$\mathcal{L}$$ is the loss. When you perform gradient descent, you are essentially linearizing your loss function around $$\theta$$. If $$\eta$$ is too large, then $$\mathcal{L}(\theta_{t-1} -\eta\nabla_\theta\mathcal{L})$$ may be greater than $$\mathcal{L}(\theta_{t-1}) -\eta\nabla_\theta\mathcal{L}$$, indicating that you overshot the local minimum and increased the loss (see illustration below). Note that it is also possible to overshoot the minimum and still have a decrease in loss (not shown). • What did you use for plotting? To display TeX in R put it into expression and in matplotlib in .
{"ft_lang_label":"__label__en","ft_lang_prob":0.8519661,"math_prob":0.99292624,"size":848,"snap":"2021-43-2021-49","text_gpt3_token_len":227,"char_repetition_ratio":0.1492891,"word_repetition_ratio":0.0,"special_character_ratio":0.25707546,"punctuation_ratio":0.08387097,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9997009,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-11-30T18:26:43Z\",\"WARC-Record-ID\":\"<urn:uuid:ea8e8502-d655-4d6b-af9b-e5463d6e0670>\",\"Content-Length\":\"120655\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6458c6cc-702f-45ed-8d8d-b91d3ccbed5c>\",\"WARC-Concurrent-To\":\"<urn:uuid:f18254d6-1075-4934-bc14-d2f7d8ffdd0c>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://stats.stackexchange.com/questions/370196/gradient-descent-decreasing-loss?noredirect=1\",\"WARC-Payload-Digest\":\"sha1:DVM3W3SWNAYN5GUBFAKFHPOPSS3DKM3E\",\"WARC-Block-Digest\":\"sha1:DP7UWMU6SQJ5OF247TLM44QMZX3TCHCF\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-49/CC-MAIN-2021-49_segments_1637964359065.88_warc_CC-MAIN-20211130171559-20211130201559-00080.warc.gz\"}"}