https://github.com/bolt-research/popgym-arcade

Atari-style POMDPs

https://github.com/bolt-research/popgym-arcade

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Atari-style POMDPs

Basic Info
  • Host: GitHub
  • Owner: bolt-research
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 9.12 MB
Statistics
  • Stars: 14
  • Watchers: 0
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Created over 1 year ago · Last pushed 10 months ago
Metadata Files
Readme License

README.md

POPGym Arcade - GPU-Accelerated POMDPs

Tests

GIF 1 GIF 1 GIF 2 GIF 2 GIF 3 GIF 3 GIF 4 GIF 4 GIF 5 GIF 5 GIF 6 GIF 6 GIF 7 GIF 7 GIF 8 GIF 8 GIF 9 GIF 9 GIF 10 GIF 10

POPGym Arcade contains 10 pixel-based tasks in the style of the Arcade Learning Environment. Each environment provides: - 3 Difficulty settings - Common observation and action space shared across all envs - Fully observable and partially observable configurations - Fast and easy GPU vectorization using jax.vmap and jax.jit

Gradient Visualization

We also provide tools to visualize how policies use memory.

See below for further instructions.

Throughput

You can expect millions of frames per second on a consumer-grade GPU. With obs_size=128, most policies converge within 30-60 minutes of training.


Getting Started

Installation

To install the environments, run

bash pip install popgym-arcade If you plan to use our training scripts, install the baselines as well

bash pip install 'popgym-arcade[baselines]'

Human Play

To best understand the environments, you should try and play them yourself. The play script lets you play the games yourself using the arrow keys and spacebar.

bash popgym-arcade-play NoisyCartPoleEasy # play MDP 256 pixel version popgym-arcade-play BattleShipEasy -p -o 128 # play POMDP 128 pixel version

Creating and Stepping Environments

Our envs are gymnax envs, so you can use your wrappers and code designed to work with gymnax. The following example demonstrates how to integrate POPGym Arcade into your code.

```python import popgym_arcade import jax

Create both POMDP and MDP env variants

pomdp, pomdpparams = popgymarcade.make("BattleShipEasy", partialobs=True) mdp, mdpparams = popgymarcade.make("BattleShipEasy", partialobs=False)

Let's vectorize and compile the envs

Note when you are training a policy, it is better to compile your policyupdate rather than the envstep

pomdpreset = jax.jit(jax.vmap(pomdp.reset, inaxes=(0, None))) pomdpstep = jax.jit(jax.vmap(pomdp.step, inaxes=(0, 0, 0, None))) mdpreset = jax.jit(jax.vmap(mdp.reset, inaxes=(0, None))) mdpstep = jax.jit(jax.vmap(mdp.step, inaxes=(0, 0, 0, None)))

Initialize four vectorized environments

n_envs = 4

Initialize PRNG keys

key = jax.random.key(0) resetkeys = jax.random.split(key, nenvs)

Reset environments

observation, envstate = pomdpreset(resetkeys, pomdpparams)

Step the POMDPs

for t in range(10): # Propagate some randomness actionkey, stepkey = jax.random.split(jax.random.key(t)) actionkeys = jax.random.split(actionkey, nenvs) stepkeys = jax.random.split(stepkey, nenvs) # Pick actions at random actions = jax.vmap(pomdp.actionspace(pomdpparams).sample)(actionkeys) # Step the env to the next state # No need to reset, gymnax automatically resets when done observation, envstate, reward, done, info = pomdpstep(stepkeys, envstate, actions, pomdpparams)

POMDP and MDP variants share states

We can plug the POMDP states into the MDP and continue playing

actionkeys = jax.random.split(jax.random.key(t + 1), nenvs) stepkeys = jax.random.split(jax.random.key(t + 2), nenvs) markovstate, envstate, reward, done, info = mdpstep(stepkeys, envstate, actions, mdpparams) ```

Memory Introspection Tools

We implement visualization tools to probe which pixels persist in agent memory, and their impact on Q value predictions. Try code below or vis example to visualize the memory your agent uses

```python from popgymarcade.baselines.model.builder import QNetworkRNN from popgymarcade.baselines.utils import getsaliencymaps, vis_fn import equinox as eqx import jax

config = { # Env string "ENVNAME": "NavigatorEasy", # Whether to use full or partial observability "PARTIAL": True, # Memory model type (see models directory) "MEMORYTYPE": "lru", # Evaluation episode seed "SEED": 0, # Observation size in pixels (128 or 256) "OBS_SIZE": 128, }

Initialize the random key

rng = jax.random.PRNGKey(config["SEED"])

Initialize the model

network = QNetworkRNN(rng, rnntype=config["MEMORYTYPE"], obssize=config["OBSSIZE"])

Load the model

model = eqx.treedeserialiseleaves("PATHTOYOURMODELWEIGHTS.pkl", network)

Compute the saliency maps

grads, obsseq, gradaccumulator = getsaliencymaps(rng, model, config)

Visualize the saliency maps

If you have latex installed, set use_latex=True

visfn(grads, obsseq, config, use_latex=False) ```

Other Useful Libraries

  • gymnax - The (deprecated) jax-capable gymnasium API
  • stable-gymnax - A maintained and patched version of gymnax
  • popgym - The original collection of POMDPs, implemented in numpy
  • popjaxrl - A jax version of popgym
  • popjym - A more readable version of popjaxrl environments that served as a basis for our work

Citation

@article{wang2025popgym, title={POPGym Arcade: Parallel Pixelated POMDPs}, author={Wang, Zekang and He, Zhe and Zhang, Borong and Toledo, Edan and Morad, Steven}, journal={arXiv preprint arXiv:2503.01450}, year={2025} }

Owner

  • Name: bolt-research
  • Login: bolt-research
  • Kind: organization

GitHub Events

Total
  • Release event: 1
  • Watch event: 3
  • Delete event: 6
  • Issue comment event: 7
  • Member event: 1
  • Push event: 44
  • Pull request event: 16
  • Create event: 16
Last Year
  • Release event: 1
  • Watch event: 3
  • Delete event: 6
  • Issue comment event: 7
  • Member event: 1
  • Push event: 44
  • Pull request event: 16
  • Create event: 16

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 12
  • Average time to close issues: N/A
  • Average time to close pull requests: 9 minutes
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 6.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 12
  • Average time to close issues: N/A
  • Average time to close pull requests: 9 minutes
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 6.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • marvin-oh (1)
Pull Request Authors
  • smorad (12)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 26 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
pypi.org: popgym-arcade

POMDP Arcade Environments on the GPU

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 26 Last month
Rankings
Dependent packages count: 9.0%
Average: 29.9%
Dependent repos count: 50.7%
Maintainers (1)
Last synced: 10 months ago