NetHack is Hard to Hack

Ulyana Piterbarg, Lerrel Pinto, Rob Fergus · DOI

Introduction

While neural networks have mastered games like Go and Chess, the classic 1980s dungeon-crawler NetHack remains a formidable "final boss" for modern AI. Characterized by procedural generation, a massive state space, and multi-modal observations (ASCII symbols and text), NetHack requires long-horizon reasoning and complex strategy. In the 2021 NeurIPS NetHack Challenge, symbolic agents—essentially sophisticated rule-based systems—outperformed neural approaches by a factor of four. This paper investigates this performance gap and introduces HiHack, a massive dataset designed to push neural agents toward symbolic-level performance.

The HiHack Dataset

To address the limitations of existing neural models, the researchers developed HiHack, the largest dataset of its kind for NetHack. It consists of 3 billion transitions (approximately $10^9$ actions) collected across 100,000 games.

The defining feature of HiHack is its hierarchical strategy labels. By modifying AutoAscend, a world-class symbolic bot, the authors logged not just the raw actions but the high-level "intentions" behind them. Every transition is mapped to one of 13 strategies, such as "fight," "explore," or "eat." This provides a roadmap for neural agents to learn the underlying logic of the game rather than just mimicking surface-level movements.

Methodology: Hierarchy and Hybrid Architectures

The authors proposed several innovations to leverage the HiHack dataset:

  1. Hierarchical Behavioral Cloning (HBC): Instead of a monolithic network, they implemented a bi-level decoder. A high-level Multi-Layer Perceptron (MLP) predicts the strategy, which then activates a specific low-level MLP to execute the corresponding action.
  2. Transformer-LSTM Architecture: Recognizing that NetHack requires both immediate tactical awareness and long-term memory, the researchers combined a frozen, pre-trained LSTM with a causal Transformer. The LSTM provides a "recurrent memory" of the game's history, while the Transformer processes local observations.
  3. Hybrid Training (APPO + BC): The agents were trained using a combination of offline Imitation Learning (learning from the symbolic bot's data) and online Reinforcement Learning (Asynchronous Proximal Policy Optimization, or APPO). This allows the agent to learn from expert demonstrations while refining its policy through trial and error.

Key Insights

The study revealed several critical aspects of AI performance in complex environments:

  • The Role of Hierarchy: Hierarchical labels significantly improved the performance of LSTMs, which often struggle with underfitting in complex tasks. However, the same labels occasionally hindered Transformer-based models, which were prone to overfitting the training data.
  • The Scaling Limit: The researchers observed a "sub-log-linear" relationship between data volume and agent performance. This suggests that simply increasing the amount of data or the number of parameters is insufficient to reach human-level play; NetHack demands a fundamental shift in reasoning capabilities.
  • The Necessity of Memory: "Flat" Transformers without recurrent components performed poorly. In a game where an item discovered thousands of steps ago might be essential for survival later, the recurrent state provided by an LSTM remains indispensable.

Results and the Symbolic Gap

The researchers successfully established a new state-of-the-art (SOTA) for neural agents in NetHack. Their best model—a hybrid APPO + BC + Hierarchical LSTM—achieved a median score of 1551, representing a 25% improvement over previous neural benchmarks. In purely offline settings, the Transformer-LSTM model outperformed existing baselines by 127%.

Despite these advancements, a significant "neural-symbolic gap" remains. The symbolic AutoAscend bot maintains a median score of approximately 8500. While neural models are improving, they still lack the rigorous error-correction and long-term planning inherent in symbolic systems.

Conclusion

NetHack continues to serve as a rigorous benchmark for AI. While the HiHack dataset and hierarchical training methods have narrowed the gap, the "messy" logic of dungeon crawling remains a hurdle. Future work will likely focus on better context management for Transformers, deeper multi-modal integration of text and visuals, and distributional learning techniques to handle the diverse strategies required for survival in the Dungeons of Doom.

Summary updated

BibTeX
@inproceedings{piterbarg2023nethack,
  author = {Ulyana Piterbarg and Lerrel Pinto and Rob Fergus},
  title = {{NetHack is Hard to Hack}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=tp2nEZ5zfP},
}
Figure