Neural mechanisms of flexible perceptual inference

John Schwarcz, Jan O. Bauer, Hamid Rajabi, Gabrielle Marmur, Eran Lottem, Jonathan KadmonbioRxiv 2025

TL;DR

This paper introduces a new task and framework to study how brains (and AI) infer both the current situation and the underlying rules of the environment simultaneously. They show that both mice and trained neural networks can adapt to changing environmental "contexts" within a single trial, demonstrating a flexible, inference-driven learning process rather than simple trial-and-error.

What Problem Does This Paper Address?

Imagine you're trying to understand a conversation. You're not just processing the words (sensory input), but also trying to figure out if the speaker is being sarcastic, serious, or joking (context). This is "perceptual inference" – making sense of the world. The challenge is that the context itself can change, and we need to infer both the current situation and the changing rules of the game simultaneously. Traditional models often assume a fixed context or rely on explicit cues. This paper tackles the harder problem: how does the brain (or an AI) infer an implicit context that's constantly shifting, and how does this inference dynamically shape how we process incoming information, all without explicit feedback? This is crucial for navigating complex, unpredictable environments.

Methods

The authors developed a novel change-detection task where subjects (mice and artificial neural networks) had to infer a hidden binary state (safe vs. unsafe) based on noisy sensory cues. The twist? The reliability of these cues (the "context") also changed unpredictably between blocks of trials.

  • Bayesian Optimal Policy: They derived the theoretically optimal strategy (a Bayes-optimal policy) for this task using a partially observable Markov decision process (POMDP) framework. This provides a benchmark for ideal performance.
  • Mice Experiments: They trained mice on this task and observed their behavior, specifically their "waiting times" (how long they waited before acting).
  • Recurrent Neural Networks (RNNs): They trained Actor-Critic LSTM networks using reinforcement learning to perform the same task. This allowed them to investigate how neural network dynamics might implement Bayesian inference.
  • Analysis: They compared the behavior and internal dynamics of the mice and RNNs to the Bayes-optimal policy, looking for evidence of simultaneous state and context inference and real-time adaptation.

Datasets

The paper does not explicitly mention using pre-existing datasets. Instead, it describes:

  • A newly introduced change-detection task: This task serves as the benchmark for both animal and artificial agent experiments.
  • Simulated data: The RNNs were trained on simulated data generated by the task environment.

Key Insights and Ideas

  • First-Trial Adaptation: Both mice and trained RNNs adapted their behavior to new contexts within the very first trial after a context switch, suggesting they infer context implicitly rather than relying on reward feedback. This is a key demonstration of flexible perceptual inference.
  • Counterintuitive Dynamics: In high-uncertainty contexts, the Bayes-optimal agent (and the trained RNNs) exhibit a surprising behavior: the decision variable starts closer to the action threshold but accumulates evidence more slowly. This is a hallmark of simultaneously inferring both state and context, where each observation informs both.
  • Learned Recurrent Connectivity is Key: Simply providing context as an input to an untrained RNN wasn't enough. Training the recurrent connections within the network was essential for it to learn the complex, context-dependent dynamics required for near-optimal performance.
  • RNNs as Models for Brain Function: The trained RNNs not only matched the behavioral performance but also replicated the specific, counterintuitive dynamics of the Bayes-optimal solution, suggesting that reinforcement learning can drive neural networks to implement sophisticated Bayesian-like inference mechanisms.

Key Results

  • Mice: Showed rapid, first-trial adaptation to context changes, waiting longer in higher-uncertainty environments, consistent with inference rather than reward feedback.
  • Bayes-Optimal Agent: Achieved near-perfect performance, serving as the gold standard.
  • Trained RNNs: Achieved near-optimal performance, closely matching the Bayes-optimal agent's reward rates and waiting time distributions. They also demonstrated rapid context adaptation within the first trial.
  • Neural Activity Analysis (RNNs): PCA revealed that the network's internal representations were low-dimensional and that specific principal components tracked key variables like action values and context. Crucially, linear decoders could accurately reconstruct the Bayesian decision variable from the network's activity.

Limitations and Future Work

  • Artificial vs. Biological Neurons: While LSTM networks offer a plausible computational model, they are not direct biological replicas. The authors suggest further work to explore how microscopic neuronal circuits might implement these computations.
  • Generalizability: The study focuses on a specific task. Future work could explore how these principles apply to more complex, real-world scenarios.
  • Neural Correlates: While the RNNs provide a mechanistic hypothesis, directly identifying these specific neural computations in the brain remains a challenge. The authors suggest focusing on brain regions like the orbitofrontal cortex, implicated in planning and adaptation, for future investigation.
  • Exploration vs. Exploitation: The current work focuses on optimal policy execution. Future research could delve deeper into how agents learn to balance exploration and exploitation in dynamic environments.

Summary updated

BibTeX
@misc{schwarcz2025neural,
  author = {John Schwarcz and Jan O. Bauer and Hamid Rajabi and Gabrielle Marmur and Eran Lottem and Jonathan Kadmon},
  title = {{Neural mechanisms of flexible perceptual inference}},
  year = {2025},
  doi = {10.1101/2025.02.05.636696},
  howpublished = {bioRxiv},
}
Figure