# Interpretation of this learning rate finder plot

**URL:** <https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337>\
**Category:** AI Discussions\
**Tags:** ai-discussions\
**Created:** [April 23, 2024, 5:23pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337 "2024-04-23T17:23:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 5:23pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/1 "2024-04-23T17:23:17Z")

</div>

I have the following plot relating to learning rate finder results (following the principles of [Smith (2015)](https://arxiv.org/abs/1506.01186)), made according to this [code example](https://github.com/beringresearch/lrfinder/blob/master/examples/example.ipynb) and found the loss drop section to be very narrow, what does that mean? The optimal learning rate found is 1.5655376e-05 and the batch size wrt code that was executed is 512.

![NEW-PLOT-1](https://global.discourse-cdn.com/dlai/original/3X/7/e/7e1b48fe81d701a0a8d25966a223d24df7b1b136.png)

Now I made the same plot using Plotly to see it better, as follows, I zoomed in on the section of interest, and I verified that the optimal learning rate is not even in the section with an abrupt drop, it is located much earlier (trying to understand why the optimal learning rate chosen is far from the abrupt drop).

 ![NEW-PLOT-2](https://global.discourse-cdn.com/dlai/original/3X/0/4/041e2fd2b212f46e2644230d6e73defad860f51d.png)

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 5:50pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/2 "2024-04-23T17:50:25Z")

</div>

I can’t really see your images clearly, and you’re uploaded them to a 3rd party site that my browser is blocking.

Please just paste your images into the thread directly.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 5:51pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/3 "2024-04-23T17:51:25Z")

</div>

Also, please update your plot format to include markers for each data point.

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 6:17pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/4 "2024-04-23T18:17:52Z")

</div>

@TMosh Hi, ok, I made the adjustments you requested by updating my post. Thanks!

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 6:33pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/5 "2024-04-23T18:33:46Z")

</div>

Thanks.

First I doubt that testing the learning rate with such fine increments is really necessary. It’s not that critical to have an exact optimum value. Just getting close is good enough.

Typically you’d use an approximate log range of values using ratios of 1:3:10.  
So maybe use 0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 1.0. If the data set is normalized, that should cover all the likely values.

Regarding your plots and why the best learning rate doesn’t line up with the step function in the cost plot, I suspect there’s an error in your code.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 6:36pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/6 "2024-04-23T18:36:00Z")

</div>

Note that normalizing the dataset is a critical first step. Doing this will make it a lot easier to find the best learning rate.

And remember, you’re looking for “good enough”. There should be a big range of learning rate values that give just about identical performance.

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 6:45pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/7 "2024-04-23T18:45:45Z")

</div>

> [@TMosh](#):
>
> First I doubt that testing the learning rate with such fine increments is really necessary. It’s not that critical to have an exact optimum value. Just getting close is good enough.

What do you mean exactly by testing the LR with such fine increments? Would it be possible for you to reference what you are saying in relation to the code I provided?

> [@TMosh](#):
>
> Typically you’d use an approximate log range of values using ratios of 1:3:10.  
> So maybe use 0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 1.0. If the data set is normalized, that should cover all the likely values.

Do you mean to adjust these log scales in relation to simply viewing the values on the plot? And yes, I am normalizing my data set.

> [@TMosh](#):
>
> Regarding your plots and why the best learning rate doesn’t line up with the step function in the cost plot, I suspect there’s an error in your code.

Are you referring to a possible problem in the code only in relation to the red line that denotes the optimal learning rate?

> [@TMosh](#):
>
> Note that normalizing the dataset is a critical first step. Doing this will make it a lot easier to find the best learning rate.
> 
> And remember, you’re looking for “good enough”. There should be a big range of learning rate values that give just about identical performance.

Ok, I’m normalizing the data set. Yes, being good enough would be enough, of course.

Thanks!

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 8:56pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/8 "2024-04-23T20:56:58Z")

</div>

Your plot shows that you’re testing with learning rates that are spaced at approximately 0.00000003 units.

 ![image](https://global.discourse-cdn.com/dlai/original/3X/5/7/5770ccf45e385b4bf819638f59008c9448993119.png)

Interval: 15.61e-6 - 15.58e-6 = 3.0e-8

I think that is not necessary or useful.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 8:57pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/9 "2024-04-23T20:57:44Z")

</div>

> [@marcocintra](#):
>
> Do you mean to adjust these log scales

Yes. Start by only using these learning rates:  
0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 1.0

Once you identify the interval where the minimum lies, you might then test again using a few points within that interval.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 9:00pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/10 "2024-04-23T21:00:02Z")

</div>

> [@marcocintra](#):
>
> Are you referring to a possible problem in the code only in relation to the red line that denotes the optimal learning rate?

Could be either.

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 9:40pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/11 "2024-04-23T21:40:28Z")

</div>

> [@TMosh](#):
>
> I think that is not necessary or useful.

Ok, I understand now.

> [@TMosh](#):
>
> Yes. Start by only using these learning rates:  
> 0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 1.0

Right, and how do I adjust this in the code? Could you help me, please?

> [@TMosh](#):
>
> Could be either.

Ok. Could you please help me check this problem in the code?

Thanks!

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 10:08pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/12 "2024-04-23T22:08:34Z")

</div>

Updating your code is best done by yourself. I’m not familiar with your project code, and as a volunteer, I’m not inclined to do it for you.

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 10:14pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/13 "2024-04-23T22:14:12Z")

</div>

> [@TMosh](#):
>
> Updating your code is best done by yourself.

Well, I thought this was a help forum, and I didn’t ask you to update my code, just to help me. I didn’t understand the sentence about the code update is better if it is done by myself. If I don’t understand, I should seek help, right? How am I going to solve something If I don’t know what to do?

> [@TMosh](#):
>
> I’m not familiar with your project code, and as a volunteer, I’m not inclined to do it for you.

It’s ok if you’re not familiar with the code and that you’re not willing to help, thanks!

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [April 23, 2024, 11:00pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/14 "2024-04-23T23:00:17Z")

</div>

This is a forum for questions. I’m not available to work on your code.

Perhaps someone else from the community will be able to help.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [April 23, 2024, 11:16pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/15 "2024-04-23T23:16:23Z")

</div>

> [@marcocintra](#):
>
> Well, I thought this was a help forum, and I didn’t ask you to update my code, just to help me. I didn’t understand the sentence about the code update is better if it is done by myself. If I don’t understand, I should seek help, right? How am I going to solve something If I don’t know what to do?

We don’t know that code either: it’s something new you just presented to us. And I guess what you are saying is that you don’t understand that code and you’d like us to do the work to understand it and then explain it to you or perhaps even debug it for you. You may get lucky and there is someone listening here who is sufficiently curious about the topic that they are willing to do that work for you. Please realize that the mentors are just volunteers here. We don’t get paid to answer questions. So when you ask a question about something that is beyond the scope of any of the courses here, we have a choice of whether we want to spend our time in that way.

You gave a link to the paper on which this work is based. Have you read the paper?

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 11:19pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/16 "2024-04-23T23:19:54Z")

</div>

> [@TMosh](#):
>
> This is a forum for questions. I’m not available to work on your code.
> 
> Perhaps someone else from the community will be able to help.

Yes, I know it’s for questions, and automatically, it’s a help forum. And again I say that there is no problem with you not being available to help me, I just found it strange the way you talked about how updating the code is better if done by myself, especially because if I knew how to update the code I wouldn’t be asking for help. Thanks.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [April 23, 2024, 11:26pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/17 "2024-04-23T23:26:34Z")

</div>

> [@paulinpaloalto](#):
>
> You gave a link to the paper on which this work is based. Have you read the paper?

I took a quick look at the paper. I didn’t read every line, but my take is that what they are saying is not that there is an optimal learning rate, but that they got better training results in fewer iterations by varying the LR in a range in a triangular pattern. Meaning that they raise it and lower it alternately. So it’s unclear to me what they mean by that code implementing something from the paper to find an optimal learning rate.

But this was with less than 10 minutes of effort, so I’m very likely missing the point …

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 11:28pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/18 "2024-04-23T23:28:10Z")

</div>

> [@paulinpaloalto](#):
>
> and you’d like us to do the work to understand it and then explain it to you or perhaps even debug it for you.

“to do the work”? Look, I’m trying to get help, I’m not saying you have to help me. So does this mean that in your opinion, a person who wants help wants someone to do the work for them? I know that no one is paid here, and no one is obligated to help, I’m not complaining that they’re not helping me, I’m just commenting on the way I’m being answered to.

> [@paulinpaloalto](#):
>
> So when you ask a question about something that is beyond the scope of any of the courses here, we have a choice of whether we want to spend our time in that way.

Of course, at some point did I say that someone is obligated to help me?

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 11:28pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/19 "2024-04-23T23:28:42Z")

</div>

> [@paulinpaloalto](#):
>
> I took a quick look at the paper. I didn’t read every line, but my take is that what they are saying is not that there is an optimal learning rate, but that they got better training results in fewer iterations by varying the LR in a range in a triangular pattern. Meaning that they raise it and lower it alternately. So it’s unclear to me what they mean by that code implementing something from the paper to find an optimal learning rate.
> 
> But this was with less than 10 minutes of effort, so I’m very likely missing the point …

Ok, thanks. Check this link for example for more info about learning rate finder: [Learning Rate Finder — PyTorch Lightning 1.4.9 documentation](https://pytorch-lightning.readthedocs.io/en/1.4.9/advanced/lr_finder.html).

---

<div class="post-metadata">

**Author:** ![marcocintra](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@marcocintra](https://community.deeplearning.ai/u/marcocintra)\
**Post date:** [April 23, 2024, 11:29pm UTC](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337/20 "2024-04-23T23:29:29Z")

</div>

> [@paulinpaloalto](#):
>
> You gave a link to the paper on which this work is based. Have you read the paper?

Yes, the problem is not understand the paper, but the code that is based on the paper.

[Next page](https://community.deeplearning.ai/t/interpretation-of-this-learning-rate-finder-plot/615337.md?page=2)
