NLNicolas Legrand

Nicolas Legrand

*This is an algorithmically generated author record based on publicly available information.

Current Organizations / Institutes

The organizations/institutes from the scholar's latest article


Nicolas Legrand has a total of 50 co-authors. Here are the top co-authors by number of shared publications:


Latest Publications

  • Open Access

    Cardiac belief updating from volatile physiological afferents

    by Nicolas Legrand, Lilian Weber, Christoph Mathys

    Cardiac interoception is commonly assessed by comparing subjective estimates of heart rate with physiological measurements. But beliefs can easily obscure these measures, such that they cannot readily distinguish sensitivity to afferent signals from the influence of prior expectations; this ultimately challenges the notion that behaviours under these tasks could reflect interoceptive processes at all. Here, we develop a computational framework that uses naturally occurring heart rate variability to quantify how strongly perceptual beliefs are updated by physiological evidence. We formalise interoception as weighted Bayesian updating under the joint influence of expectations and afferents, and derive a new measure, cardiac interoceptive sensitivity, that quantifies the extent to which beliefs move with incoming signals. Applying this to the largest Heart Rate Discrimination dataset to date (n=549), a task providing robust estimates of cardiac beliefs, we find that sensitivity is weak in the healthy population, but shows large interindividual differences, with 43% of the participants exhibiting behaviours at least minimally compatible with interoceptive processing. These findings challenge the interpretation of conventional measures of cardiac interoception. They also introduce a new framework to relate bodily signals that cannot be controlled experimentally to external signals that can, laying a computational foundation for embodied psychophysics.

  • Open Access

    pyhgf: A neural network library for predictive coding

    by Nicolas Legrand, Lilian Weber, Peter Thestrup Waade, Anna Hedvig Møller Daugaard, Mojtaba Khodadadi, Nace Mikuš, Christoph Mathys

    Bayesian models of cognition have gained considerable traction in computational neuroscience and psychiatry. Their scopes are now expected to expand rapidly to artificial intelligence, providing general inference frameworks to support embodied, adaptable, and energy-efficient autonomous agents. A central theory in this domain is predictive coding, which posits that learning and behaviour are driven by hierarchical probabilistic inferences about the causes of sensory inputs. Biological realism constrains these networks to rely on simple local computations in the form of precision-weighted predictions and prediction errors. This can make this framework highly efficient, but its implementation comes with unique challenges on the software development side. Embedding such models in standard neural network libraries often becomes limiting, as these libraries’ compilation and differentiation backends can force a conceptual separation between optimization algorithms and the systems being optimized. This critically departs from other biological principles such as self-monitoring, self-organisation, cellular growth, and functional plasticity. In this paper, we introduce pyhgf: a Python package backed by JAX and Rust for creating, manipulating, and sampling dynamic networks for predictive coding. We improve over other frameworks by enclosing the network components as transparent, modular, and malleable variables in the message-passing steps. The resulting graphs can implement arbitrary algorithms as belief propagation. Moreover, the transparency of core variables can also translate into inference processes that leverage self-organisation principles and express structure learning, meta-learning, or causal discovery as the consequence of network structural adaptation to surprising inputs. The main functions of the library are differentiable and seamlessly integrate into sampling or optimization workflows. Additionally, we offer generalized Bayesian filtering and the hierarchical Gaussian filter as key examples of dynamic networks implemented in our library. The source code, tutorials, and documentation are hosted under the main repository at https://github.com/ComputationalPsychiatry/pyhgf .


  • Open Access

    It Is What It Isn’t: Introducing a Constraint-Based Approach to Structure Learning

    by Christoffer Lundbak Olesen, Nace Mikuš, Mads Hansen, Nicolas Legrand, Peter Thestrup Waade, Christoph Mathys

    Biological cognition depends on learning-structured representations in ambiguous environments. Computational models of structure learning typically frame this as an inference problem, but often overlook the temporally extended dynamics that shape learning trajectories under ambiguity. In this paper, we reframe structure learning as an emergent consequence of constraint-based dynamics. Informed by the literature on the role of constraints in complex biological systems, we develop a constraint-based approach to computational cognitive modelling and provide a proof-of-concept model. The model consists of an ensemble of components, each comprising an individual learning process, whose internal updates are locally constrained by both external observations and system-level relational constraints. This is formalised using Bayesian probability as a description of constraint satisfaction rather than epistemic inference. Representational structure is not encoded directly in the model equations, but emerges over time through the interaction, stabilisation, and elimination of components under these constraints. Through a series of simulations in environments with varying degrees of ambiguity, we demonstrate that the model reliably differentiates the observation space into stable representational categories. We further analyse how global parameters controlling internal constraint and initial component precision shape learning trajectories and long-term behavioural alignment with the environment. We discuss the formal relationship between the present approach and Bayesian inference accounts, and argue that a constraint-based approach offers a conceptually distinct foundation for relating computational models to biological systems.

  • Open Access

    It Is What It Isn’t: Introducing a Constraint-Based Approach to Structure Learning

    by Christoffer Lundbak Olesen, Nace Mikuš, Mads Hansen, Nicolas Legrand, Peter Thestrup Waade, Christoph Mathys

    Biological cognition depends on learning structured representations in ambiguous environments. Computational models of structure learning typically frame this as an inference problem, but often overlook the temporally extended dynamics that shape learning trajectories under ambiguity. In this paper, we reframe structure learning as an emergent consequence of constraint-based dynamics. Informed by a literature on the role of constraints in complex biological systems, we develop a constraint-based approach to computational cognitive modelling and provide a proof-of-concept model. The model consists of an ensemble of components, each comprising an individual learning process, whose internal updates are locally constrained by both external observations and system-level relational constraints. This is formalised using Bayesian probability as a description of constraint satisfaction rather than epistemic inference. Representational structure is not encoded directly in the model equations but emerges over time through the interaction, stabilisation, and elimination of components under these constraints. Through a series of simulations in environments with varying degrees of ambiguity, we demonstrate that the model reliably differentiates the observation space into stable representational categories. We further analyse how global parameters controlling internal constraint and initial component precision shape learning trajectories and long-term behavioural alignment with the environment. We discuss the formal relationship between the present approach and Bayesian inference accounts, and argue that a constraint-based approach offers a conceptually distinct foundation for relating computational models to biological systems.

  • Top Cited Papers
    Open Access

    The heart rate discrimination task: A psychophysical method to estimate the accuracy and precision of interoceptive beliefs

    by Nicolas Legrand, Niia Nikolova, Camile Correa, Malthe Brændholt, Anna Stuckert, Nanna Kildahl, Melina Vejlø, Francesca Fardo, Micah Allen


  • Open Access

    The Respiratory Resistance Sensitivity Task: An Automated Method for Quantifying Respiratory Interoception and Metacognition

    by Niia Nikolova, Olivia K Harrison, Sophie Toohey, Malthe Braendholt, Nicolas Legrand, Camile C Correa, Melina Vejlø, Martin Snejbjerg Jensen, Francesca Fardo, Micah Allen

    The ability to sense, monitor, and control respiration - e.g., respiratory interoception (henceforth, respiroception) is a core homeostatic ability. Beyond the regulation of gas exchange, enhanced awareness of respiratory sensations is directly related to psychiatric symptoms such as panic and anxiety. Indeed, chronic breathlessness (dyspnea) is associated with a fourfold increase in the risk of developing depression and anxiety, and the regulation of the breath is a key aspect of many mindfulness-based approaches to the treatment of mental illness. Physiologically speaking, the ability to accurately monitor respiratory sensations is important for optimizing cardiorespiratory function during athletic exertion, and can be a key indicator of illness. Given the important role of respiroception in mental and physical health, it is unsurprising that there is increased interest in the quantification of respiratory psychophysiology across different perceptual and metacognitive levels of the psychological hierarchy. Compared to other more popular modalities of interoception, such as in the cardiac domain, there are relatively few methods available for measuring aspects of respiroception. Existing inspiratory loading tasks are difficult to administer and frequently require expensive medical equipment, or offer poor granularity in their quantification of respiratory-related perceptual ability. To facilitate the study of respiroception, we here present a new, fully automated and computer-controlled apparatus and psychophysiological method, which can flexibly and easily measure respiratory-related interoceptive sensitivity, bias and metacognition, in as little as 30 minutes of testing, using easy to make 3D printable parts.


  • Open Access

    The heart rate discrimination task: a psychophysical method to estimate the accuracy and precision of interoceptive beliefs

    by Nicolas Legrand, Niia Nikolova, Camile Correa, Malthe Brændholt, Anna Stuckert, Nanna Kildahl, Melina Vejlø, Francesca Fardo, Micah Allen

    Interoception - the physiological sense of our inner bodies - has risen to the forefront of psychological and psychiatric research. Much of this research utilizes tasks that attempt to measure the ability to accurately detect cardiac signals. Unfortunately, these approaches are confounded by well-known issues limiting their validity and interpretation. At the core of this controversy is the role of subjective beliefs about the heart rate in confounding measures of interoceptive accuracy. Here, we recast these beliefs as an important part of the causal machinery of interoception, and offer a novel psychophysical “heart rate discrimination” method to estimate their accuracy and precision. By applying this task in 218 healthy participants, we demonstrate that cardiac interoceptive beliefs are more biased, less precise, and are associated with poorer metacognitive insight relative to a matched exteroceptive control. Our task, provided as an open-source python package, offers users an intuitive, robust approach to quantifying cardiac beliefs. Highlights Current interoception tasks conflate cardiac beliefs with accuracy. We introduce a Bayesian method for estimating cardiac belief accuracy and precision. Individuals underestimate their heart rate by −7 BPM (95% CI [−8.6 −5.3]) on average. Cardiac beliefs are associated with reduced precision and metacognitive insight. The task and modelling tools are provided in the Python Cardioception Package.


  • Emotional metacognition: stimulus valence modulates cardiac arousal and metamemory

    by Nicolas Legrand, Sebastian Scott Engen, Camile Maria Costa Correa, Nanna Kildahl Mathiasen, Niia Nikolova, Francesca Fardo, Micah Allen

    Emotion alters how we feel, see, and experience the world. In the domain of memory, the emotional valence and arousal of memorised stimuli can modulate both the acuity and content of episodic recall. However, no experiment has investigated whether arousal and valence also influence metacognition for memory (i.e. the process of self-monitoring memories). In a pre-registered study, we applied a novel psychophysiological design together with computational models of metacognition to assess the influence of stimulus valence and arousal on the sensitivity, bias, and efficiency of metamemory. To estimate the role of physiological arousal in mediating these effects, we recorded cardiac measures through pulse oximetry. We found that negative valence substantially decreased both memory performance and subjective confidence, in particular for low arousal words. Simultaneously, we found that emotional valence modulated both heart rate and heart-rate variability (HRV) during recognition memory. Exploratory trial-level analyses further revealed that subjective confidence was encoded in instantaneous heart-rate fluctuations and that this relationship was also modulated by emotional valence. Our results demonstrate that recognition memory and metacognition are influenced by the emotional valence of encoded items and that this correlation is in part related to cardiac activity.


  • Open Access

    Emotional Metacognition: Stimulus Valence Modulates Cardiac Arousal and Metamemory

    by Nicolas Legrand, Sebastian Scott Engen, Camile Maria Costa Correa, Nanna Kildahl Mathiasen, Niia Nikolova, Francesca Fardo, Micah Allen

    Emotion alters how we feel, see, and experience the world. In the domain of memory, the emotional valence and arousal of memorised stimuli can modulate both the acuity and content of episodic recall. However, no experiment has investigated whether arousal and valence also influence metacognition for memory (i.e., the process of self-monitoring memories). In a pre-registered study, we applied a novel psychophysiological design together with computational models of metacognition to assess the influence of stimulus valence and arousal on the sensitivity, bias, and efficiency of metamemory. To estimate the role of physiological arousal in mediating these effects, we recorded cardiac measures through pulse oximetry. We found that negative valence substantially decreased both memory performance and subjective confidence, in particular for low arousal words. Simultaneously, we found that emotional valence modulated both heart rate and heart-rate variability (HRV) during recognition memory. Exploratory trial-level analyses further revealed that subjective confidence was encoded in instantaneous heart-rate fluctuations and that this relationship was also modulated by emotional valence. Our results demonstrate that recognition memory and metacognition are influenced by the emotional valence of encoded items and that this correlation is in part related to cardiac activity.