Abstract
Intracortical motor brain-computer interfaces (BCIs) are expensive and time-consuming to design because accurate evaluation traditionally requires real-time experiments. In a BCI system, a user interacts with an imperfect decoder and continuously changes motor commands in response to unexpected decoded movements. This “closed-loop” nature of BCI leads to emergent interactions between the user and decoder that are challenging to model. The gold standard for BCI evaluation is therefore real-time experiments, which significantly limits the speed and community of BCI research. We present a new BCI simulator that enables researchers to accurately and quickly design BCIs for cursor control entirely in software. Our simulator replaces the BCI user with a deep reinforcement learning (RL) agent that interacts with a simulated BCI system and learns to optimally control it. We demonstrate that our simulator is accurate and versatile, reproducing the published results of three distinct types of BCI decoders: (1) a state-of-the-art linear decoder (FIT-KF), (2) a “two-stage” BCI decoder requiring closed-loop decoder adaptation (ReFIT-KF), and (3) a nonlinear recurrent neural network decoder (FORCE).
Introduction: The Closed-Loop Challenge
The primary bottleneck in developing motor brain-computer interfaces (BCIs) is the "user-in-the-loop" problem. Unlike many machine learning tasks where models can be validated on static, offline datasets, BCIs are inherently closed-loop systems. When a user observes a cursor move in an unintended direction due to decoder error, they immediately adjust their neural activity to compensate. This creates a dynamic control policy that is specific to the decoder being used.
Because of this emergent interaction, testing a new decoder architecture traditionally requires neurosurgically implanted subjects (typically non-human primates or clinical trial participants) to perform real-time tasks. This "gold standard" makes BCI research prohibitively expensive and slow, limiting the field's ability to iterate on complex, nonlinear decoding algorithms.
Methods: A High-Fidelity Software Simulator
To overcome these limitations, we developed a purely software-based simulator that replaces the biological subject with two sophisticated AI components:
- RNN Neural Encoder (The "Brain"): We utilize a Recurrent Neural Network (RNN) to map intended hand kinematics to synthetic neural signals (spikes). By training on a small amount of existing hand-control data, the RNN captures the complex, low-dimensional population dynamics characteristic of the motor cortex.
- Deep RL Agent (The "User"): We model the user's adaptive behavior using a Deep Reinforcement Learning agent trained via Proximal Policy Optimization (PPO). To ensure the agent behaves like a biological subject rather than an unconstrained optimizer, we implemented biophysical constraints, including smoothness and energy-efficiency regularizations.
As shown in the comparison above, our simulator is the first to provide a purely software-based solution that maintains both an accurate control policy and accurate neural signals while generalizing across different decoder types.
Key Results and Validation
The simulator was validated by reproducing the performance hierarchies and kinematic characteristics of three landmark BCI decoders:
- FIT-KF: A high-performance linear decoder.
- ReFIT-KF: An adaptive, two-stage decoder. The simulator correctly predicted the smoother trajectories and improved efficiency (shorter path lengths) seen in real-world ReFIT-KF trials compared to standard Kalman filters.
- FORCE: A modern, nonlinear recurrent neural network decoder. The simulator successfully modeled the high-performance characteristics of this complex architecture.
Our results matched experimental "gold standard" data across critical metrics, including Dial-In Time (DIT) and First Touch Time (FTT), proving that the RL agent's behavior mirrors the specific kinematic "quirks" of biological users.
Discussion and Future Work
This simulator allows researchers to validate and iterate on BCI designs entirely in code before moving to expensive animal or clinical trials. While currently optimized for 2D cursor control, future work will focus on extending the system to high-degree-of-freedom robotic control and incorporating models of neural plasticity to account for long-term co-adaptation between the user and the decoder. Additionally, moving from simplified kinematics to full musculoskeletal models will further enhance the simulator's biological realism.
Summary updated