2048: Reinforcement Learning in a Delayed Reward Environment

Tanvir BhathalarXiv 2025 · DOI

TL;DR

This paper tackles the challenge of reinforcement learning (RL) agents learning in environments with sparse and delayed rewards, using the popular game 2048 as a testbed. They introduce Horizon-DQN (H-DQN), a novel architecture that significantly improves performance by combining distributional learning, multi-step targets, and recurrent neural networks, demonstrating that these architectural choices are crucial for long-horizon credit assignment.

What Problem Does This Paper Address?

Reinforcement learning agents excel in environments with immediate and clear reward signals, like many video games. However, real-world applications such as medical treatment planning, financial trading, or autonomous driving often involve decisions whose consequences only become apparent much later. This "long-horizon credit assignment problem" is a fundamental obstacle for RL, as agents struggle to attribute success or failure to the correct actions taken far in the past. The game 2048, with its simple mechanics but complex strategic depth, serves as an excellent microcosm for this challenge: local merges provide immediate feedback, but can easily lead agents into suboptimal strategies that prevent them from reaching high-value tiles.

Methods

The authors propose and evaluate several RL agents, building upon existing state-of-the-art techniques:

  • Baselines: They use standard Deep Q-Network (DQN) and Proximal Policy Optimization (PPO) as foundational baselines, adapted for the 2048 environment.
  • Quantile Regression DQN (QR-DQN): This agent models the entire distribution of future returns, not just the expected value. This provides a more robust estimate of value, especially in stochastic environments. They adapt QR-DQN with a convolutional encoder for better spatial feature extraction.
  • Horizon-DQN (H-DQN): This is their novel, composite architecture. It extends the "Rainbow" DQN framework by incorporating:
  • Recurrent LSTM Encoder: To capture long-term dependencies and context from sequences of moves.
  • Multi-Step Returns: To propagate rewards over several steps, directly addressing delayed rewards.
  • Distributional Learning (C51): To model the full return distribution.
  • Dueling Architectures, NoisyNets, Prioritized Replay: These are existing techniques that improve learning stability, exploration, and sample efficiency.
  • Sequence-Level Prioritized Replay: To focus learning on more informative subsequences of gameplay.

Datasets

The primary dataset used is generated from gameplay within the gymnasium-2048 environment. This is not a new benchmark but rather an existing, well-defined environment that serves as the testbed for their experiments.

Key Insights and Ideas

  • Distributional and Multi-Step Learning are Crucial: The paper strongly suggests that simply using single-step returns and point estimates of value is insufficient for long-horizon, sparse-reward tasks. Modeling the full return distribution and using multi-step targets provides a powerful inductive bias.
  • Architectural Choices Matter: H-DQN's success highlights that combining several advanced RL components (LSTM, distributional heads, prioritized replay) into a cohesive architecture is key to unlocking performance in complex environments.
  • 2048 as a Revealing Testbed: The game's deceptive reward structure makes it an excellent environment for evaluating RL agents' ability to learn long-term strategies beyond greedy local optimization.
  • Corner-Locking Emerges Naturally: Stronger agents, particularly H-DQN, develop a bias towards anchoring the largest tile in a corner, which appears to be a stable and effective strategy for managing board fragmentation.

Key Results

  • H-DQN Significantly Outperforms Baselines:
    • H-DQN achieved a maximum score of 18,210 and reached the 2048 tile after 5,000 training episodes.
  • Scaling H-DQN to 9,000 episodes further boosted performance to a max score of 41,828 and reaching the 4096 tile.
  • In contrast, standard DQN and PPO plateaued at much lower scores (around 1,443 and 1,831 respectively).
  • QR-DQN also showed improvement, reaching the 1024 tile.
  • Move Distribution Analysis: Stronger models exhibit a more biased move distribution (e.g., favoring "Right" or "Up"), indicating learned strategic preferences, unlike vanilla DQN's near-uniform distribution.
  • Max Tile Distribution: Better models not only increase the maximum achievable tile but also the minimum tile achieved, suggesting more consistent performance.

Limitations and Future Work

  • Hyperparameter Sensitivity: The authors note that H-DQN's complex architecture leads to a tightly coupled hyperparameter space, requiring extensive tuning (e.g., using Optuna sweeps) and potentially impacting reproducibility.
  • Compute Cost: Achieving these results requires significant computational resources, with a trade-off between architectural complexity, performance gains, and training time/memory usage.
  • Future Work:
    • Integrating model-based planning engines (like Dyna) to improve sample efficiency.
  • Exploring curriculum learning and meta-gradient hyperparameter adaptation for faster convergence.
  • Utilizing distributed architectures and PopArt value normalization to manage memory and compute demands.
  • Investigating hierarchical transfer learning for broader applicability.
  • Developing more efficient training protocols and scaling compute resources.

Summary updated

BibTeX
@misc{bhathal2025reinforcement,
  author = {Tanvir Bhathal},
  title = {{2048: Reinforcement Learning in a Delayed Reward Environment}},
  year = {2025},
  eprint = {2507.05465},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.05465},
}
Figure