Self-Play in
Multi Snakes Environment
Jeewoo Kim
Mentor: Shounan An
Yum!
Intro
About Me - Jeewoo Kim
Education
1st year Computing AI (UG) at Imperial College London
Interests
Reinforcement Learning, Music Generation
Motivation
RL Newbie, but want to do multi agents!
Try simple multi agents environment
Apply well-known algorithms into simple env
Do lots of experiments to understand what’s � happening in the small grid world
Motivation
Requests for Research 2.0 (https://blog.openai.com/requests-for-research-2/)
Slitherin: Multi Snakes Environment
Why Snake Game?
Simple in the beginning, but more complicated� and diverse by adding more rules to the env!
Best multi agents env to do experiments
Hands-on experiments in this camp!
What are pros and cons of self-play?
What is self-play instability?
Goals of this Project
Theory
Reinforcement Learning
Policy Gradients
PPO - Solve both (1), (2)
Self-Play
Use a single network to train both sides of game
(AlphaGo - One network plays both black and white)
Tends to easily overfits to its fighting opponent
1. Randomly samples from older version of opponents
or
2. Generate opponents from an ensemble of policies (Competitive Self-Play)
Development
Algorithms Implementation
DQN
Implemented DQN based on the paper and tutorials
Too SLOW to train agent in my environment! (10 steps / s)
OpenAI Baselines
Decided to use baselines code from OpenAI
Was much faster than my code, especially PPO
Algorithms Implementation
DQN - Single Snake
Didn’t converge. Reward: -1 ~ 0 after 5 million steps
Problems
Solution
Self-Play Set up
Based on Competitive Self-play by OpenAI
Past opponents
Past opponents
Main Model
Opponent
Agent 1
Agent 2
a1
a2
Copy (update interval)
Environment
Past opponents
Past opponents
Append
Past opponents
Past opponents
Past opponents
Randomly select
Self-Play for n > 2
For n(agents) > 2, How should I update opponent networks?
Main Model
Opponent 1
Opponent 2
Main Model
Opponent 1
Opponent 2
Results
Single Snake using PPO
Reward over timesteps (10 X 10)
Two Snakes using Self-Play
Self-Play method (10 X 10)
Two Snakes using Self-Play
Self-Play method
Fight against past models -> generalised
Past opponents
Past opponents
Main Model
Opponent
Agent 1
Agent 2
a1
a2
Copy (update interval)
Environment
Past opponents
Past opponents
Append
Past opponents
Past opponents
Past opponents
Randomly select
Single Snake using PPO
Reward over timesteps (19 X 19)
Two Snakes using Self-Play
Self-Play method (19 X 19)
Two Snakes using Self-Play
Intuitions from the Observation
1. Can see they try to avoid each other (focus more on surviving)
2. Surviving Longer > Eat Fruits with risk
3. Learns ‘if opponent eats fruits, �fruits will be generated somewhere�else, so change the direction’
4. Agents trained on bigger environment are more unstable (wobbling)
Comparison
Vanilla PPO didn’t learn because of sparse reward (there’s only 1 reward out of 361 grid space)
Can infer that self-play performs better exploration
Three Snakes using Self-Play
Used the first method
Extended: Adversarial Environment
Long-term reward > short-term reward
Wanted to see ‘they fight each other after growing into certain lengths’
Error in the code (Fruits keep generating in the same positions)
Conclusions
Future Plans
Acknowledgements
Thanks to my mentor Shounan An�and other mentors Sourabh and Eric, �and all the camp organisers and sponsors
To participants, thank you so much for�good memories! Best memory in my life
Thank you!
https://github.com/jdubkim/dlcampjeju2018
jeewoo1998@gmail.com
References