HN
Today

Show HN: Watch a neural net learn to play Snake

This 'Show HN' project demonstrates a neural network learning to play the classic Snake game directly within your web browser. Leveraging tinygrad for the machine learning framework and WebGPU for efficient computation, it provides an interactive peek into reinforcement learning. It's popular for showcasing cutting-edge browser capabilities and an accessible, engaging AI training demo.

16
Score
2
Comments
#8
Highest Rank
6h
on Front Page
First Seen
May 15, 4:00 PM
Last Seen
May 15, 9:00 PM
Rank Over Time
12111181223

The Lowdown

This 'Show HN' entry presents 'tinyppo-snake', an in-browser demonstration of a neural network being trained to play Snake using Proximal Policy Optimization (PPO). The project highlights the capabilities of modern web technologies by enabling real-time machine learning inference and training directly in the browser, without requiring server-side processing.

Key aspects of the demo include:

  • In-Browser PPO Training: The core functionality involves training a reinforcement learning agent (neural network) using the PPO algorithm directly within the user's web browser.
  • tinygrad Integration: The machine learning computations are powered by tinygrad, a minimalist neural network framework known for its efficiency.
  • WebGPU Acceleration: WebGPU kernels are utilized for accelerating the intensive computations required for neural network training and inference, enabling performance previously uncommon for browser-based ML.
  • Interactive Learning Visualization: Users can observe the neural net's learning process through 'trained-policy roll-outs' and monitor parameter updates for its fc1_pi.weight and fc1_v.weight layers.
  • Technical Requirements: The demo explicitly requires a WebGPU-compatible browser to function correctly.

Overall, 'tinyppo-snake' serves as an impressive technical showcase, pushing the boundaries of what's possible with in-browser machine learning and providing an engaging, live demonstration of AI learning in action.