Answers.Body: <p>Yes Q-learning benefits from decaying epsilon in at least two ways:</p>
  <ul>
  <li><p>Early exploration. It makes little sense to follow whatever policy is implied by the initialised network closely, and more will be learned about variation in the environment by starting with a random policy. It is fairly common in DQN to initially fill the experience replay table whilst using <span class="math-container">$\epsilon = 1.0$</span> or otherwise an effectively random policy.</p>
  </li>
  <li><p>Later refinement. Q-learning can only learn from experiences it has. A behaviour policy that is too random may not experience enough states close to optimal in order to gain enough statistics on them to overcome variance. In more difficult cases, it may never experience the whole of an optimal trajectory even when combining all the different transitions that it ever observes.</p>
  </li>
  </ul>
  <p>In addition, when using a function approximator such as a neural network, predictions of the target policy will be influenced by the distribution of states and actions in the experience replay memory. If that is is biased towards the distribution of states of a very different behaviour policy, then basic Q-learning has no good way to adjust for that - it adjusts for differences in expected return between behaviour and target policies, but not in distribution of observed states. In fact this is still a somewhat open problem, you want the agent to learn from mistakes and imperfect behaviour so as to avoid it, but you don't want those mistakes to skew predictions of what should happen under an optimal policy. Function approximation such as neural networks is influenced by the distribution of input data, so it typically performs better in Q learning when the behaviour policy and target policy are close e.g. <span class="math-container">$\epsilon$</span> should be relatively low if using <span class="math-container">$\epsilon$</span>-greedy.</p>
  <p>A typical implementation might start with <span class="math-container">$\epsilon=1.0$</span>, set a decay factor per time step or per episode e.g. <span class="math-container">$0.999$</span> per episode, and a minimum <span class="math-container">$\epsilon = 0.01$</span>. These are all hyper-parameters that you can adjust depending on the problem.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-27T18:57:08.707Z
Answers.LastActivityDate: 2022-01-23T11:04:32.360Z
Answers.LastEditDate: 2022-01-23T11:04:32.360Z
Answers.UserDisplayName: Neil Slater
Body: <p>If the agent is following an <span class="math-container">$\epsilon$</span>-greedy policy derived from Q, is there any advantage to decaying <span class="math-container">$\epsilon$</span> even though <span class="math-container">$\epsilon$</span> decay is not required for convergence?</p>
  
Tags: <reinforcement-learning><q-learning><convergence><epsilon-greedy-policy><exploration-strategies>
Title: Is there an advantage in decaying $\epsilon$ during Q-Learning?
UserDisplayName: KaneM
ThreadText: # Is there an advantage in decaying $\epsilon$ during Q-Learning?
  
  (Asked by: username_0 on 2020-02-27)
  
  If the agent is following an $\epsilon$-greedy policy derived from Q, is there any advantage to decaying $\epsilon$ even though $\epsilon$ decay is not required for convergence?
  
  **Tags:** reinforcement-learning, q-learning, convergence, epsilon-greedy-policy, exploration-strategies
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-02-27. Score: 4 | Accepted answer
  
  Yes Q-learning benefits from decaying epsilon in at least two ways:
  
  * Early exploration. It makes little sense to follow whatever policy is implied by the initialised network closely, and more will be learned about variation in the environment by starting with a random policy. It is fairly common in DQN to initially fill the experience replay table whilst using $\epsilon = 1.0$ or otherwise an effectively random policy.
  * Later refinement. Q-learning can only learn from experiences it has. A behaviour policy that is too random may not experience enough states close to optimal in order to gain enough statistics on them to overcome variance. In more difficult cases, it may never experience the whole of an optimal trajectory even when combining all the different transitions that it ever observes.
  
  In addition, when using a function approximator such as a neural network, predictions of the target policy will be influenced by the distribution of states and actions in the experience replay memory. If that is is biased towards the distribution of states of a very different behaviour policy, then basic Q-learning has no good way to adjust for that - it adjusts for differences in expected return between behaviour and target policies, but not in distribution of observed states. In fact this is still a somewhat open problem, you want the agent to learn from mistakes and imperfect behaviour so as to avoid it, but you don't want those mistakes to skew predictions of what should happen under an optimal policy. Function approximation such as neural networks is influenced by the distribution of input data, so it typically performs better in Q learning when the behaviour policy and target policy are close e.g. $\epsilon$ should be relatively low if using $\epsilon$-greedy.
  
  A typical implementation might start with $\epsilon=1.0$, set a decay factor per time step or per episode e.g. $0.999$ per episode, and a minimum $\epsilon = 0.01$. These are all hyper-parameters that you can adjust depending on the problem.
  
  
  ---
  
  