A PPO Implementation You Can Read in One Sitting
A minimal PyTorch implementation of clipped-objective PPO that prioritizes readability over state-of-the-art performance for OpenAI Gym environments.

What it does
This is a stripped-back, single-threaded implementation of Proximal Policy Optimization (PPO) with clipped objective, written in PyTorch for OpenAI Gym environments. It handles both discrete and continuous action spaces across a few plain Python files and a bundled Jupyter notebook, treating the algorithm as a teaching aid rather than a production framework.
The interesting bit
The author openly omits the usual performance tricks—no Generalized Advantage Estimation, no parallel workers, and a fixed-but-decaying action standard deviation—to keep the code legible. That honesty is the project’s best feature: it is explicitly pitched as a learning tool that can still solve CartPole, LunarLander, and Roboschool tasks if you respect its hyperparameters.
Key highlights
- Merged discrete and continuous algorithms into one codebase.
- Ships with a Google Colab notebook (
PPO_colab.ipynb) that bundles training, testing, plotting, and GIF generation. - Logs episodes and rewards to CSV and includes utilities to visualize pre-trained policies.
- Documents hyperparameters for every pre-trained policy in a dedicated directory.
- Notes that CPU-bound environments like Box-2d and Roboschool can train faster on CPU than GPU because of data-transfer overhead.
Caveats
- Single-threaded experience collection only; a community fork adds parallel workers, but it is not merged here.
- Uses simple Monte-Carlo advantage estimates, which are less sample-efficient than GAE.
- The README warns that complex environments will likely need hyperparameter tuning or code changes.
Verdict
Grab this if you are a student or developer who wants to read a complete PPO implementation in an afternoon and watch it flail a cheetah across your screen. Skip it if you need parallel workers, Generalized Advantage Estimation, or a turnkey solution for complex environments without tuning.
Frequently asked
- What is nikhilbarhate99/PPO-PyTorch?
- A minimal PyTorch implementation of clipped-objective PPO that prioritizes readability over state-of-the-art performance for OpenAI Gym environments.
- Is PPO-PyTorch open source?
- Yes — nikhilbarhate99/PPO-PyTorch is open source, released under the MIT license.
- What language is PPO-PyTorch written in?
- nikhilbarhate99/PPO-PyTorch is primarily written in Python.
- How popular is PPO-PyTorch?
- nikhilbarhate99/PPO-PyTorch has 2.4k stars on GitHub.
- Where can I find PPO-PyTorch?
- nikhilbarhate99/PPO-PyTorch is on GitHub at https://github.com/nikhilbarhate99/PPO-PyTorch.