Local Feature Swapping for Generalization in Reinforcement Learning

David Bertoin, Emmanuel Rachelson

TL;DR

Deep reinforcement learning agents often overfit to visual backgrounds and irrelevant decorations instead of learning generalizable skills. This paper introduces Channel-consistent LOcal Permutations (CLOP), a simple yet highly effective regularization layer that stochastically swaps nearby features in the deepest latent space during training. CLOP significantly reduces observational overfitting and improves zero-shot generalization across both reinforcement learning and supervised learning benchmarks with negligible computational overhead.

What Problem Does This Paper Address?

Deep reinforcement learning (RL) agents trained directly from pixels are notoriously prone to observational overfitting. Because deep neural networks are inherently designed to minimize empirical risk, they excel at memorizing training trajectories. In visual environments, this means an agent might mistakenly correlate a reward with a specific background texture, a cloud pattern, or a decorative asset rather than the actual game mechanics (e.g., avoiding an enemy).

When these agents are tested on new levels with different layouts or visual styles, their performance plummets. While standard regularization techniques from supervised learning (like dropout, batch normalization, or input data augmentation) mitigate this, they don't fully solve the generalization challenge in RL. The authors aim to design a regularization method tailored to decision-making architectures that prevents the memorization of spurious spatial correlations.

Methods

The authors introduce the Channel-consistent LOcal Permutations (CLOP) layer. Instead of modifying the raw input image (input-space data augmentation), CLOP acts as an intermediate regularization layer placed immediately after the deepest convolutional layer (latent space).

Three core principles guide its design:

  1. Latent Space Augmentation: Perturbing features at the highest level of abstraction (where a feature represents an object or concept like "an enemy") is more effective for decision-making than modifying independent, raw pixels.
  2. Locality: If an action is optimal in a given state, it remains optimal if objects move slightly. CLOP stochastically swaps feature pixels only with their direct neighbors, ensuring the synthetic feature maps retain a human-interpretable, coherent structure.
  3. Channel Consistency: A feature descriptor is formed by the combination of values across all channels at a specific spatial coordinate. CLOP applies the exact same spatial permutation across all channels simultaneously, preserving the integrity of the feature descriptors while altering their positions.

During training, the layer iterates through the feature map coordinates in a random order and swaps adjacent features with a probability $\alpha$. At evaluation time, CLOP is deactivated and behaves as an identity function.

Figure 1: Channel-consistent LOcal Permutation Layer (CLOP)

Datasets

The method was rigorously evaluated across both reinforcement learning and supervised learning benchmarks:

  • OpenAI Procgen Benchmark: A suite of 16 procedurally generated visual games (e.g., Coinrun, Bigfish, Dodgeball) specifically designed to benchmark generalization in RL. Testing was conducted on both "Easy" (25M steps) and "Hard" (200M steps) settings.
  • MNIST & USPS: Used to evaluate cross-dataset domain generalization in digit classification.
  • Imagenette, Imagewoof, and STL-10: Scarce-data supervised learning datasets used to verify CLOP's utility as a general deep learning regularizer.

Key Insights and Ideas

  • The "Oracle" Critic: In actor-critic setups like PPO, the authors found that applying CLOP only to the actor yields the best results. Because the critic's sole purpose is to evaluate states already encountered in the training buffer, letting the critic overfit actually provides a cleaner, "oracle-like" supervision signal to the actor.
  • Why Global Shuffling Fails: Through ablation studies, the authors showed that removing the locality constraint (allowing features to swap anywhere in the map) or removing channel consistency destroys the semantic meaning of the latent space, severely degrading performance.
  • Hyperparameter Robustness: The permutation rate $\alpha$ is highly robust. Any non-zero value permits generalization, meaning practitioners do not need to waste heavy computational resources fine-tuning it.

Key Results

Reinforcement Learning

On the Procgen benchmark, PPO agents trained with CLOP outperformed state-of-the-art RL regularization methods (including mixreg, RAD, UCB-DraC, and IDAAC) on 7 out of 16 games, often by substantial margins.

  • On average, CLOP reduced the generalization gap by 30% across all games, reaching up to a 50% reduction in StarPilot.
  • In hard-mode testing, CLOP dominated its closest competitor, mixreg, in 10 out of 16 games.

Supervised Learning

CLOP proved to be an excellent general-purpose regularizer for image classification when data is scarce.

  • In the MNIST $\rightarrow$ USPS transfer task, a plain network achieved 81.6% test accuracy. Adding CLOP boosted this to 91.2%, significantly beating Dropout (77.7%) and Batch Normalization (65.6%).

Computational Cost

Because CLOP operates on low-dimensional deep feature maps rather than high-dimensional input images, its computational complexity is bounded by $O(H'W')$ (where $H'$ and $W'$ are the height and width of the latent feature map). Its overhead is virtually zero, making it much faster than input-space augmentations like random convolutions or rotations.

Limitations and Future Work

While CLOP delivers impressive gains, it exhibits game-dependent performance and underperformed on 3 out of the 16 Procgen games (CaveFlyer, Ninja, and Plunder), where baseline PPO or IDAAC remained superior.

Additionally, CLOP is inherently an image-based method that exploits the spatial grid structure of convolutional layers. It cannot be directly applied to non-image-based RL environments (e.g., environments utilizing vector states or robotics control based purely on joint angles). The authors suggest that future work should investigate how to translate this concept of "positional fuzzying" into non-visual latent spaces.

Summary updated

BibTeX
@inproceedings{bertoin2022local,
  author = {David Bertoin and Emmanuel Rachelson},
  title = {{Local Feature Swapping for Generalization in Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=Sq0-tgDyHe4},
}
Figure