TLDR: NiceWebRL is a Python library that enables researchers to conduct online human subject experiments using Jax-based reinforcement learning (RL) environments. It simplifies the process of integrating Python-based ML models with web interfaces by leveraging Jax for low-latency environment dynamics and NiceGUI for Python-only web development. The library supports research in Human-like, Human-compatible, and Human-assistive AI, demonstrated through case studies involving cognitive models, multi-agent collaboration, and LLM assistance in virtual environments.
Researchers at Harvard University and the University of Washington have introduced NiceWebRL, a new Python library designed to simplify the integration of machine reinforcement learning (RL) environments into online human subject experiments. This tool addresses a significant challenge in AI research: the difficulty of combining Python-based machine learning models with JavaScript-based web interfaces required for large-scale human studies.
NiceWebRL acts as a bridge, allowing any Jax-based RL environment to be transformed into an online interface. This means that AI researchers can now easily compare their algorithms against human performance, cognitive scientists can test machine learning algorithms as theories for human cognition, and multi-agent researchers can develop algorithms for human-AI collaboration.
The library’s core innovation lies in its use of Jax, a high-performance numerical computing library. NiceWebRL leverages Jax to precompute and cache environment dynamics, significantly reducing latency often encountered when a remote Python server interacts with a local JavaScript client. This precomputation ensures immediate visual feedback for participants, making online experiments smoother and more responsive. Furthermore, NiceWebRL integrates with NiceGUI, enabling researchers to program entire experiments, including advanced graphical user interface (GUI) components, purely in Python, eliminating the need for JavaScript knowledge.
Also Read:
- Unlocking Desktop Intelligence with Reinforcement Learning
- Boosting Active Inference Performance on Hardware for Edge AI
Supporting Diverse AI Research
NiceWebRL is showcased through three compelling case studies, demonstrating its potential to advance research in Human-like AI, Human-compatible AI, and Human-assistive AI.
For **Human-like AI**, NiceWebRL facilitated the development of a novel Deep RL cognitive model. Researchers used the library to compare human behavior with advanced Deep RL algorithms in complex environments like a maze gridworld and Craftax, a 2D Minecraft domain. The ability to measure precise response times was crucial in understanding how humans and AI reuse prior behaviors for new tasks.
In the realm of **Human-compatible AI**, NiceWebRL enabled the creation of a new Multi-agent Reinforcement Learning (MARL) algorithm called Cross-Environment Cooperation (CEC). This algorithm was designed to generalize to human partners without requiring human training data, tested in the Overcooked domain. The library allowed for the comparison of multiple MARL algorithms, collection of subjective feedback from participants, and detailed analysis of interaction trajectories, revealing why certain AI agents were perceived as better collaborators.
Finally, for **Human-assistive AI**, NiceWebRL provided a proof-of-concept for how Large Language Models (LLMs) can assist humans with complex sequential decision-making tasks in the XLand-Minigrid environment. Participants received help from various LLM assistants (Claude 3 Opus, GPT 3.5 Turbo, or Gemini 2.0 Flash), and the library facilitated collecting feedback on the LLMs’ helpfulness and human-likeness. This highlights NiceWebRL’s capability to study human-LLM collaboration in virtual settings.
The library also features robust data management, asynchronously saving participant states and environment interactions to a SQL database, ensuring persistence even across connection issues. This allows for detailed post-hoc analysis of experimental data.
NiceWebRL is an open-source project, with its codebase available on GitHub. It represents a significant step forward for researchers looking to conduct human subject experiments with modern machine learning models and environments, all within a unified Python framework. For more details, you can read the full research paper: NiceWebRL: a Python library for human subject experiments with reinforcement learning environments.


