Abstract
NiceWebRL is a new Python library that facilitates the creation of web-based interfaces for human subject experiments using high-performance, Jax-based reinforcement learning (RL) environments. By utilizing Jax to precompute environment states and NiceGUI to provide a Python-native frontend, the library eliminates the need for complex JavaScript integration and minimizes network latency. This paper details the architecture of NiceWebRL and demonstrates its effectiveness through case studies in human-like AI modeling, human-compatible agent evaluation, and human-assistive AI.
Introduction
In AI research, a significant "language barrier" exists between the Python-dominated machine learning ecosystem and the JavaScript-based web infrastructure used for human experiments. Researchers often struggle to bridge this gap when comparing AI performance to human baselines or developing collaborative AI. Existing tools frequently suffer from high latency or require cumbersome server-client configurations, hindering real-time interaction in complex virtual environments. NiceWebRL addresses these challenges by providing a unified Python framework for "human-in-the-loop" research.
Methodology: The NiceWebRL Architecture
NiceWebRL is built on two primary pillars:
- Jax Integration: Leveraging Jax’s functional programming and speed, the library precomputes and caches potential next states. This "look-ahead" mechanism ensures that when a human participant acts, the subsequent frame is immediately available, significantly reducing perceived latency.
- NiceGUI Frontend: Researchers can define experimental flows—including instructions, game interfaces, and feedback forms—entirely in Python. The library uses a "Stage" architecture, where the
EnvStagemanages interactions between humans, Jax environments, and AI agents.
Additionally, built-in SQL support ensures data persistence, allowing participants to resume experiments seamlessly after browser refreshes.
Supported Environments
NiceWebRL is environment-agnostic for Jax-based systems. It supports a wide array of modern benchmarks, ranging from simple gridworlds to complex 3D robotics simulations.
Key benchmarks include XLand-Minigrid for hierarchical tasks, Craftax for 2D exploration, and JaxMARL for multi-agent coordination. The library's ability to handle diverse domains allows researchers to test if cognitive models generalize across varying levels of complexity.
Case Studies and Key Results
The library's utility is validated through three distinct research paradigms:
- Human-like AI: Testing cognitive models against human performance. Results showed that specific RL models (e.g., "Multitask Preplay") better mimic human planning behaviors, such as pausing to "think" when faced with new goals.
- Human-compatible AI: Evaluating multi-agent algorithms. Participants rated agents that prioritized "human-like" behavior (e.g., avoiding collisions) as more adaptive, even if they were less efficient than state-of-the-art baselines.
- Human-assistive AI: Integrating LLMs (Claude, GPT, Gemini) as assistants. The study found that LLM effectiveness as a human aid depends heavily on the model's inherent reasoning capabilities.
Discussion and Future Work
While NiceWebRL streamlines human-AI experimentation, several areas for improvement remain. Currently, the library is optimized for two-agent scenarios and discrete action spaces; scaling to n-agents or continuous actions presents computational challenges for the precomputation strategy. Furthermore, while environment latency is minimized, external LLM API calls still introduce delays. Future work will explore differentiable environments for automated task design and broader multi-agent support.
Summary updated