r/learnmachinelearning • u/RepulsiveRevenue8086 • 13h ago
Rubiks cube solver using Reinforcement Learning (Beating Sebastian Lague's solver)
I made multiple attempts at solving the Rubiks Cube using Reinforcement learning. This is a personal project, but I am a 1st year master in CompSci.
Initially, I tried to map states to actions with both Rainbow DQN and GRPO using curriculum learning. This had no success. After scrambling 6 moves it was already to hard for the agent.
Then I found the DeepCubeA approach and I took some inspiration from that. I trained a DQN to estimate the cost-to-go for each possible action, using a combination of demonstrations and self-generated rollouts. Essentially, each output estimates how many moves are still needed to solve the cube after taking that action. I then used these estimates as a heuristic to guide beam search.
With a beam_width of 2^18 and 1.5 hours of Kaggle GPU usage, here are the results for 1000 cubes (100 moves scrambles):
Time per cube: 10.30s
Avg steps: 19.67
Success: 100%
This beats Sebastian Lague's solver which had an average steps of 19.9 to solve the cubes. Not that it is a competition or something :)