Cs234 lecture 6 deep q learning and nn

Nonlinear function approximations for RL:

History of NN approaches to RL:

Deep Q Learning and Improvements

IMG_0353.PNG

IMG_0354.PNGIn 2014 Atari Paper, DQN Used Q-learning with CNN as Value Function Approximator. They used two tricks to make it work:** Experience Replay** and Fixed Q Targets.

Experience Replay

Keep a store of prior experience and sample from that store with replacement as the training dataset.

Benefits - allows us to use a lot more data - experience is not just thrown away after being used.

Note that each sampled action (s,a,r,s’) will update the weights a different amount even if the same action (s,a,r,s’) was sampled before - because the Q function was different from before, so the update is now different.

Expereince replay was super super important for success (Appendix 1)!

IMG_0356.PNG

Fixed Q Targets

Basically, instead of updating the target weights evert step, when calculating the bootstrap value use the same weights for every couple of steps (freeze its value) and then reset the frozen value to the new learned value every n steps. This is no longer precise gradient descent but improves stability in the training with little loss.

IMG_0361.PNG** **

Some Improvements over Original DeepQL Paper.

IMG_0365.PNG

Double DQN

Improvement over Original Deep QL Paper.

Basically Double Q-learning applied to DQN.

Easy to Implement, impressive Results (Apendix 1)

IMG_0368.PNG

Prioritized Replay: In TD Learning, the order of sampling from the replay experience affects the speed of learning, becuase it determines whether or not some updates will propagate to other states.

The authors proposed sampling updates with probability proportional to their DQN error. So tuples (s,a,r,s’) for which the DQN update is more accurate is sampled more often.

This seems to have a very high impact also! (Appendix 1) (See Appendix 2 for example)

IMG_0370.PNG

IMG_0371.PNG** **

If we knew the optimal order in which to sample, the above paper proved that the time to convergence can be reduced by an exponential factor! Of course it is computationally infeasible to know the exact optimal order, but we can estimate it with heuristics.

IMG_0372.PNG

(note: alpha is a temperature setting which, if 0 gives requal prob for all actions and if large gives the max action every time).

Dueling QN:

Also very good effects! (Appendix 1)

Intuition: The features that you might need to write down the values of the state might be different from the features you need to specify the relative benefit of differnet actions (advantage functions) in that state.

Idea: Instead of estimating the Q value function, estimate the advantage function.

IMG_0377.PNG** **

IMG_0378.PNG

However, the advantage function is unidedentifiable (there is not a unique V and A you can decompose Q into - you can add a constant to one and subtract the same from the other and get the same Q. So we add an additional constraint to force out a particular V, A.

IMG_0379.PNG

Practical Tips for training DQNs:

IMG_0381.PNG** **

IMG_0382.PNG** **

** **

Appendix 1: DQN for Atari, Summary and Results

** **

IMG_0363.PNG** **

IMG_0364.PNG

IMG_0369.PNG

IMG_0373.PNGIMG_0380.PNG

Appendix 2: Mars Rover example for different values of estimate for differnet orders sampling.

Screenshot 2020-03-30 at 10.37.10 PM.png

Tip: Build and debug your Q-learning implementation first before you test on Atari, Atari could take several hours.