Reported KL divergence negative in PPO [rllib]
What is the problem?
Is it possible for reported KL values in PPO to be negative?
I thought that the reported number was supposed to be the expectation over states of the KL-divergences of the action probabilities at each state. So it shouldn't be negative, right?
Ray version and other system information (Python version, TensorFlow version, OS):
Ray 0.8.5
Reproduction (REQUIRED)
Please provide a script that can be run to reproduce the issue. The script should have no external library dependencies (i.e., use fake or mock data / environments):
Unsure what causes such low KL divergences, since this is supposed to mean that the strategy is changing very little between iterations; other environments I've tried within PPO examples don't seem to have this issue.
However, reported relative frequency (e.g. # of times agent chose this action divided by the total # of steps) of a particular action being chosen isn't staying constant despite the KL divergence staying low.

If it helps, you can clone the repo I've been using here https://github.com/wuwuz/SquirRL/tree/master/MultiAgent
And you can run it with python3 bitcoin_game.py --alphas .3875 --OSM 1 --workers (your workers setting) --players 2 --save_path none
Edit: Is there perhaps something funky going on with np.inf's? I implemented a parametric action space, following the example https://github.com/ray-project/ray/blob/e0d8b58969728054d1800abc925aa5352882baa8/rllib/examples/models/parametric_actions_model.py#L16
Continuous distribution can provide negative entropy.
cc @ericl
(1) Sorry, I should've mentioned that the action space I used is discrete, so that shouldn't be a concern. (2) Differential entropy can be negative, but differential KL divergence cannot be negative. Check out the proof (under the "alternative proofs" section). This proof is also valid for continuous distributions.
Hi, I'm a bot from the Ray team :)
To help human contributors to focus on more relevant issues, I will automatically add the stale label to issues that have had no activity for more than 4 months.
If there is no further activity in the 14 days, the issue will be closed!
- If you'd like to keep the issue open, just leave any comment, and the stale label will be removed!
- If you'd like to get more attention to the issue, please tag one of Ray's contributors.
You can always ask for help on our discussion forum or Ray's public slack channel.
Hi again! The issue will be closed because there has been no more activity in the 14 days since the last message.
Please feel free to reopen or open a new issue if you'd still like it to be addressed.
Again, you can always ask for help on our discussion forum or Ray's public slack channel.
Thanks again for opening the issue!