Open
Description
The current AtariWrapper by default has terminate_on_life_loss
set to True. This goes against the recommendations of Revisiting the Arcade Learning Environment (https://arxiv.org/pdf/1709.06009.pdf). I believe this should be set to False by default. They also recommend using sticky actions instead of noop resets, but I think that problem is outside the scope of this wrapper.
Activity
Miffyli commentedon Oct 27, 2021
That is set to True by default to follow the original implementation of baselines which had
terminate_on_life_loss
enabled here. While I agree it would be better to not have used it (to reflect the "real" end of the game as originally intended by the game developers, and also pick the easier option of two), it would cause major hidden changes in results if it were changed at this point. @araffin ?RyanNavillus commentedon Oct 27, 2021
I just realized that I should have put this issue in the actual stable baselines 3 repo, but I guess it's relevant here as well. I definitely understand the trade-off between using newer recommendations and preserving fair comparisons to previous work.
jkterry1 commentedon Oct 27, 2021
My concern, and I'm sure @JesseFarebro (the maintainer of the ALE) would agree, is that the settings in Gym environments for Atari was never really done to begin with and that for people doing future work with then should use what have been the recommended practices with then for years. This actually caused an issue with us working with Atari games for an ICML paper, which is why Ryan created the issue.
Miffyli commentedon Oct 27, 2021
Right, I totally agree with the point :). We could consider changing the default setting in zoo and SB3, and leave a big warning there to indicate of this change. It would be bad if a popular library would hinder the progression just by sticking to "old stuff" for the weak reason of "that's what has been done before".
araffin commentedon Oct 28, 2021
Hello,
Yes, I'm aware of that.
We kept it to be able to compare results against SB2.
Looking at the actual paragraph (see below) and my personal experience, this does not affect much results (your experience is probably different, otherwise there would not be an issue).
But we should at least update the doc and put a warning there with the recommended settings (this could be a flag in the
make_atari_env
deactivated at first but with a warning and then activated in a future version of SB3)araffin commentedon May 1, 2022
I did quick experiments on Breakout with PPO, with and without terminal on life loss activated, and the current default seems to have a good impact on performance:
https://wandb.ai/openrlbenchmark/openrlbenchmark/reports/Atari-defaults-PPO---VmlldzoxOTA4NjUz
Results are not significant at all yet, only 3 runs, but it should be investigated further.
qgallouedec commentedon Jan 1, 2023
What about sticky actions?
araffin commentedon Jan 2, 2023
you mean its influence on performance?
I don't know, I think the main issue is that the changes were made without benchmark (in the paper, comparison is only partial) and it looks like it's still missing.
@RyanNavillus @JesseFarebro @pseudo-rnd-thoughts am I wrong?
qgallouedec commentedon Jan 3, 2023
I meant, is it implemented? After digging in the code, I realize that sticky actions are enabled by default directly by ALE, but only for v0 and v5 (not for v4, which is used by sb3), see the gym documentation and the ALE source code. It seems to me that sticky actions is used by most of the works, so shouldn't we provide a
StickyActionWrapper
for v4?EDIT: Or just add default
repeat_action_probability=0.25
toenv_kwargs
incommon.env_util.make_atari_env
function.Somehow related: DLR-RM/rl-baselines3-zoo#133 (comment)
pseudo-rnd-thoughts commentedon Jan 3, 2023
I believe the primary difference between
v0
andv4
is if sticky actions is enabled. This is a confusing change that ale madehttps://gymnasium.farama.org/environments/atari/#version-history-and-naming-schemes
RyanNavillus commentedon Jan 8, 2023
@araffin I think the goal of sticky actions was not to improve performance w.r.t reward but to produce a robust policy instead of a deterministic action sequence. They show that it training with sticky actions causes DQN to have roughly the same performance when you evaluate with sticky actions on and off, while methods designed to exploit determinism in the environment perform much worse when evaluated with stick actions on. They argue that sticky actions are better than other methods for various reasons in section 5.3.
TL;DR, sticky actions are the recommended way to prevent agents from abusing determinism, not a way to improve rewards.
RyanNavillus commentedon Jan 8, 2023
There is a much weaker argument in the paper that we should not
terminate_on_life_loss
because that's environment-specific knowledge, so algorithms evaluated with that setting will overfit more to Atari. They also argue thatterminate_on_life_loss
has a debatable effect on performance, but it seems like your experiments show that it can help.16 remaining items