Learning to Solve a Rubik's Cube with a Dexterous Hand

Tingguang Li, Weitao Xi, Meng Fang, Jia Xu, Max Q.-h. Meng

Introduction

Dexterous in-hand manipulation—the ability of a multi-fingered robotic hand to reposition and reorient objects—remains a significant challenge in robotics. While specialized machines can solve a Rubik's Cube in seconds, performing the same task with a human-like hand involves navigating a massive state space and complex contact physics. This paper presents a hierarchical deep reinforcement learning (DRL) framework that enables a 24-degree-of-freedom (DoF) Shadow Dexterous Hand to solve a 2x2x2 Rubik’s Cube with high reliability.

The 24-DoF Shadow Dexterous Hand and the 2x2x2 Rubik's Cube in the MuJoCo simulation environment.

The Challenge of Dexterity

The difficulty of solving a Rubik's Cube with a dexterous hand stems from two primary factors:

  1. High-Dimensional Action Space: Controlling 24 DoF requires a computationally expensive search for precise finger movements.
  2. Sparse Rewards: A 2x2x2 Rubik’s Cube has over 3.6 million configurations but only one solved state. Standard RL agents often fail to find the solution because they rarely receive a positive reward signal during random exploration.

Methodology: A Hierarchical Approach

To overcome these hurdles, the researchers decoupled high-level planning from low-level execution.

1. Model-Based Planning

Instead of learning the puzzle logic, the system uses the classical IDA (Iterative Deepening A) search algorithm. This provides an optimal sequence of moves, allowing the RL agent to focus solely on physical manipulation.

2. Model-Free Manipulation (The Operator)

The "Operator" is a DRL agent trained using Deep Deterministic Policy Gradient (DDPG) and Hindsight Experience Replay (HER). HER allows the agent to learn from failed attempts by treating the resulting state as a "virtual goal," effectively densifying the reward signal.

3. Execution Strategy

Manipulation is divided into two distinct stages:

  • Cube Rotation: Re-posing the entire cube to bring the target layer to the top.
  • Layer-wise Operation: Executing the specific twist.

Interestingly, the researchers found that the Shadow Hand is most proficient at a counter-clockwise top-layer twist ($U'$). By rotating the entire cube appropriately, every required move can be executed as this "Golden Move," simplifying the action space.

Sequence of in-hand manipulation steps for solving the 2x2x2 Rubik's Cube.

4. The Rollback Mechanism

Physical execution in simulation is prone to errors. The system incorporates a closed-loop feedback mechanism: if a move fails, the system detects the error, randomizes the hand pose to "reset" the physics, and attempts the step again. This "rollback" capability is critical for long-horizon tasks.

Results and Discussion

The system was evaluated on 1,400 randomly scrambled cubes in the MuJoCo physics engine. It achieved an overall success rate of 90.3%. Notably, even for the most complex scrambles requiring 11–14 moves, the success rate remained above 80%.

The inclusion of the rollback mechanism proved vital; without it, the success rate for 14-move solutions dropped from 88% to approximately 46%. This underscores that for complex manipulation, error recovery is often more important than perfect initial execution.

Conclusion and Future Work

This research demonstrates that a hierarchical framework combining classical planning with DRL can master complex dexterous tasks. While currently limited to simulation, future work aims to bridge the "sim-to-real" gap and scale the approach to the even more complex 3x3x3 Rubik's Cube, which involves more intricate contact points and coordination.

Summary updated

BibTeX
@inproceedings{li2019learning,
  author = {Tingguang Li and Weitao Xi and Meng Fang and Jia Xu and Max Q.-H. Meng},
  title = {{Learning to Solve a Rubik's Cube with a Dexterous Hand}},
  booktitle = {ROBIO},
  year = {2019},
  doi = {10.1109/robio49542.2019.8961560},
}
Figure