Sliding Puzzles Gym: A Scalable Benchmark for State Representation in Visual Reinforcement Learning
Abstract
Visual reinforcement learning (RL) requires agents to simultaneously learn world representations and decision-making policies. The Sliding Puzzles Gym (SPGym) isolates these components by skinning classic sliding puzzles with image patches. Our evaluation of state-of-the-art RL agents reveals a significant reliance on visual memorization over spatial reasoning, leading to poor generalization on out-of-distribution images.
Introduction
In visual RL, an agent faces a dual challenge: perceiving the environment (representation) and determining optimal actions (policy). Existing benchmarks like Atari or ProcGen often entangle these challenges, making it difficult to diagnose whether an agent's failure stems from poor perception or flawed logic. Furthermore, many environments use irrelevant "distractors" that do not scale with task complexity.
The Sliding Puzzles Gym (SPGym) addresses these issues by transforming the classic 8-tile puzzle into a visual challenge. By keeping the underlying game logic constant while scaling visual complexity through a "diversity knob," SPGym allows researchers to isolate and study representation learning in isolation.
The SPGym Framework
SPGym adapts the 8-tile puzzle by replacing numbers with patches of an image. To solve the puzzle, an agent must rearrange these patches to reconstruct the original picture. This design ensures that the visuals are entirely task-relevant while allowing for adjustable visual diversity ($p$), representing the number of unique images the agent encounters during training.
The benchmark utilizes high-diversity datasets such as ImageNet-1k and DiffusionDB to provide a wide array of visual stimuli. Researchers can test various algorithmic families, including Policy Gradient (PPO), Off-policy Actor-Critic (SAC) with auxiliary representation losses, and World Model-based RL (DreamerV3).
Representational Challenges and Insights
A core finding of this research is the "Memorization Trap." As the image pool size ($p$) increases, agent performance drops significantly. Rather than learning the abstract concept of tile positions (e.g., "this is the top-left corner"), agents tend to memorize specific visual patterns associated with individual training images.
This lack of generalization is most evident in "Hard OOD" tests. When presented with completely new images, success rates for most agents plummeted to near zero. Even agents trained on 100 different images failed to generalize to a 101st image, suggesting that current visual RL methods struggle to capture generalizable spatial concepts.
Key Results
- Algorithm Performance: DreamerV3 emerged as the most robust algorithm. Its internal requirement to reconstruct the environment via a decoder forces it to learn more compressed and useful representations compared to agents relying solely on reward signals.
- Linear Probing: The authors used linear probing—freezing the encoder and training a simple classifier to identify the puzzle state—to measure representation quality. They found a strong negative correlation ($r = -0.81$) between probe accuracy and the steps required to solve the task.
- Complexity Scaling: Moving from a $3 \times 3$ to a $4 \times 4$ grid increases the state space from $1.8 \times 10^5$ to $10^{13}$ states, drastically increasing sample requirements for standard algorithms like PPO.
Conclusion
SPGym highlights a sobering reality: state-of-the-art RL agents are primarily visual memorizers. While world models like DreamerV3 show promise, there remains a massive gap in achieving true spatial generalization. Future work will explore the use of foundation models (e.g., CLIP) as frozen encoders and the use of procedural generation to force agents away from memorization toward genuine reasoning.
Summary updated