Abstract
Pain is a complex, multi-level phenomenon integrating sensory, motivational, and cognitive processes. Computational approaches bridge theoretical frameworks with neural and behavioural data, providing descriptive, mechanistic, and normative explanations. We review key computational approaches, including reinforcement learning, control theory, Bayesian inference, and active inference, illustrating their role in understanding pain prediction, avoidance, and modulation. Forward and reverse engineering techniques synergistically refine our models and generate testable hypotheses. This framework not only advances fundamental neuroscience but also informs clinical applications, offering potential for computational phenotyping, personalised therapies, and adaptive neuro-engineering interventions for pain management.
Why do we need a computational approach to understanding pain?
Theories play an important role in driving neuroscience research of shaping hypothesis generation and constraining the search space for experiments. Computational models bridge theories and observable behaviour, serving as mathematical structures that represent observed data [30]. They sit in direct contrast to a purely data-driven approach, which aims to discover structure in data alone [18]. Thus, computational models offer an intermediary between behavioural theories (e.g., psychology) and physiological accounts (e.g., molecular, cellular, or circuit neuroscience).
Pain can be studied through the lens of its evolutionary and phenomenological components, suggesting a framework based on its adaptive function operating across different spatiotemporal scales. Reaching a common understanding of the data from dramatically different modalities and methodologies requires a multi-level approach, which is afforded by different types of computational models providing different explanations, namely, descriptive, mechanistic and normative explanations. Each of these play distinct roles in building a multi-level account of neural and behavioural phenomena. That is, whenever a new phenomenon is observed, it is often first explained descriptively delineating what problem is the brain solving, for example see [7]. This is often followed by mechanistic and normative (or interpretative) explanations delineating how is the brain solving it and why is the brain solving this problem [9]. We structure the rest of this review around the past, present and future of computational modelling in pain research.
The advent of computational frameworks for pain
Computational models of pain trace back to early models of learning and conditioning, with roots in classical animal learning theory and its foundational paradigms of Pavlovian and instrumental conditioning [32]. By the late 1990s, theorists developed computational descriptions of these learning phenomena to provide unifying explanations of a variety of behavioural and neural data: most notably the reinforcement learning model of dopamine and reward [40]. Reinforcement learning (RL) is a framework for learning a behavioural policy that maximises cumulative reward (or minimise punishments) over time. This approach was soon extended to explain simple predictive pain learning [43], aligning with fear and aversive conditioning [23], and affective-motivational theories of pain [14,15]. Central to these models was the concept of the prediction error: the difference between what was predicted and what actually occurred, which works as the central teaching signal in these models. RL showed how prediction errors could solve difficult prediction problems [46] across a broad range of learning phenomena involving credit assignment, optimal action learning, and the architecture of pain avoidance learning. Notably, computational parametric human neuroimaging showed that structures such as a striatum and ventromedial prefrontal cortex that had traditionally been thought of as reward-focused, were clearly also involved in pain [44].
In parallel, models of sensory perception, particularly Bayesian perceptual inference offered insights into how prior beliefs shape pain experience, especially in placebo and nocebo effects [6,20,22,26,42,47,51]. These showed how expectations alter pain through perceptual biases, offering a normative account of the sensory-discriminative aspects of pain. However, such perceptual accounts differ from motivational models of endogenous analgesia studied in animals, where pain modulation reflects a flexible, value-based decision that balances competing goals like pain avoidance and reward seeking [13,14]. These motivational models draw from the idea of value shaping, in which the perceived value of outcomes is not fixed but flexibly constructed to optimise decisions on-the-fly, paralleling theories in behavioural economics [48]. This approach indeed explained a number of types of endogenous analgesia beyond simple perceptual biases; showing that pain was shaped by both perceptual and motivational factors, which was also implied by the anatomical complexity of descending pathways [3].
Theory considerations
Here we outline a conceptual map of computational approaches relevant to pain research, offering readers multiple entry points for future modelling efforts. At its core, the brain (and pain system) must solve a difficult control problem under uncertainty — selecting protective actions based on beliefs about the state of the body and world. One influential way to formalise this is by viewing it as a partially observable Markov decision process (POMDP) [25,33], for which Bayesian Decision Theory provides one principled solution [10], and aids as an organising map for understanding the landscape of various computational models. It requires inferring the states or beliefs over states from observations which then is used to learn and direct optimal behaviour with respect to some utilities.
Models focusing primarily on state inference, without control, typically employ Bayesian models of perception [6,47] or special cases of POMDPs such as drift-diffusion models [51]. These reveal how pain perception is shaped by expectations and their modification through learning, and help quantify such effects [51,52]. Recent work extends them to account for biased pain perception (e.g., confirmation bias) [22] and to model sub-optimal learning and information integration in chronic pain [49].
Models emphasising control, while assuming full state observability, simplify the problem to a Markov decision process (MDP) and use reinforcement learning to solve it [46]. Leveraging methods from safe reinforcement learning [17], these models reveal how pain-related control systems guide cautious and self-preserving behaviour [41], inform safe exploration [34] and are being adapted to model maladaptive avoidance [2] and higher punishment sensitivity [35] in chronic pain.
When both inference and control are necessary, full POMDP solutions are required. Some use explicit models of the environment to infer beliefs and plan in belief space (belief MDPs) [31] while others use function approximators like recurrent neural networks to learn belief-like representations through reinforcement learning [19]. These Bayesian decision theoretic models reveal how protective behaviours may obscure evidence of recovery, promoting persistent injury beliefs and transitions to chronic pain—a hypothesis formalised as the information restriction hypothesis [33,41].
Early frameworks such as the Helmholtz machine [11] and predictive coding models [16] further provide a recipe for learning and inference in neural networks, informing recent theories of plasticity and back-propagation in the brain [50] and implementation-level accounts of placebo analgesia [6]. Related approaches unified planning and inference, as in Active Inference, where utilities are replaced with preference priors and the agent performs Bayes-optimal behaviour [39]. An algebraic mapping between BDT approaches and active inference approaches is present in control-as-inference [36], KL-control [5] or soft Bellman equations [53].
Framing the pain system’s challenge as a POMDP allows researchers to map different aspects of pain to components such as belief states, value functions, predictive state representations, expected utilities, prediction errors, or Bayesian surprise, facilitating clearer and more testable hypotheses [8,20,21,33,47] (Fig. 1).
Fig. 1. An illustration of computations underlying pain.
An internal environment POMDP (e.g. body), which is solved using Bayesian Decision Theory (BDT) by the agent (e.g. mind), necessitating the elements of pain in the mind. The sensory processing of pain is captured via the Bayesian filtering of nociceptive and other relevant sensory observations. The motivational aspect of pain is captured through the precise punishment signal generated and used for temporal credit assignment. Both play a role in affective value learning and subsequent action policy to drive protective behaviour (e.g. pain avoidance).
Forward and reverse engineering the pain system
In pain research, forward engineering builds models from first principles to simulate behaviour and generate predictions, while reverse engineering infers mechanisms by testing specific hypotheses on existing systems (e.g., through experiments). In practice, one can test competing models against behavioural or neural data using techniques like Bayesian model comparison [45]. These findings can then inform forward-engineered models that explain multiple observations across datasets. Such models simulate neural and behavioural responses in diverse paradigms, generating predictions that serve as testable hypotheses. Better data analysis methods and experiments that clearly separate one computation improve reverse engineering attempts, whereas better theories guide what and where to search for and improve forward engineering attempts [24].
As a recent example, we studied how humans combine Pavlovian and instrumental responses to minimise pain/harm [34]. Forward simulations showed that adding Pavlovian fear biases to withdraw enhanced safe learning but at the cost of efficiency in reward acquisition. This led to a normative hypothesis: uncertainty-gated Pavlovian responses could balance safety and efficiency effectively, as demonstrable in simulations. We then tested this prediction in a behavioural task using computational modelling. This illustrates the interplay between the constructivist model building and the reductionist hypothesis testing through carefully designed experiments.
Clinical applications and neuro-engineering
This approach offers promise for clinical translation. First, forward-engineered models of pain chronification [33] provide principled hypotheses for predicting outcomes and computomics [29] or computational phenotyping [38]. This can support stratification with more robust outcome-prediction biomarkers, with fewer data than brute-force machine learning.
Second, forward-engineered models can be used to design personalised task controllers — interactive agents that guide a patient’s learning process in cognitive behavioural therapies (CBT)-like settings [28]. Framed as a two-player game, the controller interacts with a forward-engineered model to best alter the patient’s generative model by guiding the learning process toward desired outcomes such as improved motivation, reduced avoidance, or resilience to stress. This builds on ideas from curriculum learning [4] and shaping [27].
Third, biases in pain and injury perception may affect post-injury behaviour [49] which could contribute to phenomena like boom-bust cycles in chronic pain [1,37]. Personalised models of temporal patterns in activity and pain perception could enhance activity pacing interventions by offering more targeted routine guidance.
Fourth, information-rich models beget information-rich solutions, such as functionally targeted neurotechnologies [12]. This dovetails with an understanding of how generative processes lead to biomarkers, allowing closed loop technologies that tune the intervention to the outcome. Ultimately, systems engineering approaches can integrate multiple sensing and interventional technologies (alongside drugs), utilising cognitive and behavioural platforms, yielding holistic therapies that exploit the combined strength of multiple individual approaches.
Acknowledgements
Authors thank lab members: Shuangyi Tong, RuoHan Liu, Rachel Crockett, Mattan Pelah and Lin Qiu for their helpful comments on the manuscript. Authors thank the funders: Wellcome Trust (214251/Z/18/Z, 203139/Z/16/Z and 203139/A/16/Z), IITP (MSIT 2019-0-01371) and JSPS (22H04998). This research was also partly supported by the NIHR Oxford Health Biomedical Research Centre (NIHR203316). The views expressed are those of the author(s) and not necessarily those of the NIHR or the Department of Health and Social Care. For the purpose of open access, the authors have applied a CC BY public copyright licence to any Author Accepted Manuscript version arising from this submission. Authors thank ChatGPT for helping draft the abstract after writing the manuscript themselves. They further used ChatGPT to help reduce the word count to fit 1500-word limit during revisions. Authors declare that they have no conflicts of interest, i.e. no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
References
- [1].Antcliff D, Keeley P, Campbell M, Woby S, McGowan L. Exploring patients’ opinions of activity pacing and a new activity pacing questionnaire for chronic pain and/or fatigue: a qualitative study. Physiotherapy. 2016;102:300–307. doi: 10.1016/j.physio.2015.08.001. [DOI] [PubMed] [Google Scholar]
- [2].Ball TM, Gunaydin LA. Measuring maladaptive avoidance: from animal models to clinical anxiety. Neuropsychopharmacol. 2022;47:978–986. doi: 10.1038/s41386-021-01263-4. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [3].Bannister K. Descending pain modulation: influence and impact. Current Opinion in Physiology. 2019;11:62–66. [Google Scholar]
- [4].Bengio Y, Louradour J, Collobert R, Weston J. Curriculum learning; Proceedings of the 26th Annual International Conference on Machine Learning ICML ‘09; New York NY, USA. 2009. pp. 41–48. [DOI] [Google Scholar]
- [5].van den Broek B, Wiegerinck W, Kappen H. Risk Sensitive Path Integral Control. 2012 doi: 10.48550/arXiv.1203.3523. [DOI] [Google Scholar]
- [6].Büchel C, Geuter S, Sprenger C, Eippert F. Placebo Analgesia: A Predictive Coding Perspective. Neuron. 2014;81:1223–1239. doi: 10.1016/j.neuron.2014.02.042. [DOI] [PubMed] [Google Scholar]
- [7].Cecchi GA, Huang L, Hashmi JA, Baliki M, Centeno MV, Rish I, Apkarian AV. Predictive Dynamics of Human Pain Perception. PLOS Computational Biology. 2012;8:e1002719. doi: 10.1371/journal.pcbi.1002719. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [8].Coll M-P, Walden Z, Bourgoin P-A, Taylor V, Rainville P, Robert M, Nguyen DK, Jolicoeur P, Roy M. Pain reflects the informational value of nociceptive inputs. Pain. 2024;165:e115–e125. doi: 10.1097/j.pain.0000000000003254. [DOI] [PubMed] [Google Scholar]
- [9].Dayan P, Abbott LF. Theoretical neuroscience: computational and mathematical modeling of neural systems. Cambridge, Mass: MIT Press; 2001. [Google Scholar]
- [10].Dayan P, Daw ND. Decision theory, reinforcement learning, and the brain. doi: 10.3758/CABN.8.4.429. n.d. [DOI] [PubMed] [Google Scholar]
- [11].Dayan P, Hinton GE, Neal RM, Zemel RS. The Helmholtz machine. Neural Computation. 1995;7:889–904. doi: 10.1162/neco.1995.7.5.889. [DOI] [PubMed] [Google Scholar]
- [12].Denison T, Morrell MJ. Neuromodulation in 2035: The Neurology Future Forecasting Series. Neurology. 2022;98:65–72. doi: 10.1212/WNL.0000000000013061. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [13].Dum J, Herz A. Endorphinergic modulation of neural reward systems indicated by behavioral changes. Pharmacology Biochemistry and Behavior. 1984;21:259–266. doi: 10.1016/0091-3057(84)90224-7. [DOI] [PubMed] [Google Scholar]
- [14].Fields H. A motivation-decision model of pain: The role of opioids. Proceedings of the 11th World Congress on Pain. 2006:449–459. [Google Scholar]
- [15].Fields HL. How expectations influence pain. PAIN. 2018;159:S3. doi: 10.1097/j.pain.0000000000001272. [DOI] [PubMed] [Google Scholar]
- [16].Friston K. A theory of cortical responses. Philosophical Transactions of the Royal Society B: Biological Sciences. 2005;360:815–836. doi: 10.1098/rstb.2005.1622. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [17].García J, Fern Fernández O. A Comprehensive Survey on Safe Reinforcement Learning. Journal of Machine Learning Research. 2015;16:1437–1480. [Google Scholar]
- [18].Gershman SJ. Just looking: The innocent eye in neuroscience. Neuron. 2021;109:2220–2223. doi: 10.1016/j.neuron.2021.05.022. [DOI] [PubMed] [Google Scholar]
- [19].Hennig JA, Pinto SAR, Yamaguchi T, Linderman SW, Uchida N, Gershman SJ. Emergence of belief-like representations through reinforcement learning. PLOS Computational Biology. 2023;19:e1011067. doi: 10.1371/journal.pcbi.1011067. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [20].Hoskin R, Berzuini C, Acosta-Kane D, El-Deredy W, Guo H, Talmi D. Sensitivity to pain expectations: A Bayesian model of individual differences. Cognition. 2019;182:127–139. doi: 10.1016/j.cognition.2018.08.022. [DOI] [PubMed] [Google Scholar]
- [21].Ishikawa R, Ono G, Izawa J. Bayesian surprise intensifies pain in a novel visual-noxious association. Cognition. 2025;257:106064. doi: 10.1016/j.cognition.2025.106064. [DOI] [PubMed] [Google Scholar]
- [22].Jepma M, Koban L, van Doorn J, Jones M, Wager TD. Behavioural and neural evidence for self-reinforcing expectancy effects on pain. Nat Hum Behav. 2018;2:838–855. doi: 10.1038/s41562-018-0455-8. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [23].Johansen JP, Tarpley JW, LeDoux JE, Blair HT. Neural substrates for expectation-modulated fear learning in the amygdala and periaqueductal gray. Nat Neurosci. 2010;13:979–986. doi: 10.1038/nn.2594. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [24].Jonas E, Kording KP. Could a Neuroscientist Understand a Microprocessor? PLOS Computational Biology. 2017;13:e1005268. doi: 10.1371/journal.pcbi.1005268. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [25].Kaelbling LP, Littman ML, Cassandra AR. In: Reasoning with Uncertainty in Robotics. Dorst L, van Lambalgen M, Voorbraak F, editors. Berlin, Heidelberg: Springer; 1996. Partially observable markov decision processes for artificial intelligence; pp. 146–163. [Google Scholar]
- [26].Kim J, Gim S, Yoo SBM, Woo C-W. A computational mechanism of cue-stimulus integration for pain in the brain. Science Advances. 2024;10:eado8230. doi: 10.1126/sciadv.ado8230. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [27].Krueger KA, Dayan P. Flexible shaping: how learning in small steps helps. Cognition. 2009;110:380–394. doi: 10.1016/j.cognition.2008.11.014. [DOI] [PubMed] [Google Scholar]
- [28].Lee JH, Heo SY, Lee SW. Controlling human causal inference through in silico task design. Cell Reports. 2024;43:113702. doi: 10.1016/j.celrep.2024.113702. [DOI] [PubMed] [Google Scholar]
- [29].Lee SW, Seymour B. Decision-making in brains and robots — the case for an interdisciplinary approach. Current Opinion in Behavioral Sciences. 2019;26:137–145. [Google Scholar]
- [30].Levenstein D, Alvarez VA, Amarasingham A, Azab H, Chen ZS, Gerkin RC, Hasenstaub A, Iyer R, Jolivet RB, Marzen S, Monaco JD, et al. On the Role of Theory and Modeling in Neuroscience. J Neurosci. 2023;43:1074–1088. doi: 10.1523/JNEUROSCI.1179-22.2022. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [31].Lovejoy WS. Computationally Feasible Bounds for Partially Observed Markov Decision Processes. Operations Research. 1991;39:162–175. [Google Scholar]
- [32].Mackintosh NJ, Nicholas J. Conditioning and associative learning. Oxford [Oxfordshire]: Clarendon Press; New York: Oxford University Press; 1983. [Accessed 12 Mar 2025]. Available: http://archive.org/details/conditioningasso0000mack. [Google Scholar]
- [33].Mahajan P, Dayan P, Seymour B. Homeostasis After Injury: How Intertwined Inference and Control Underpin Post-Injury Pain and Behaviour. 2025:2025.02.04.636410. doi: 10.1371/journal.pcbi.1013538. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [34].Mahajan P, Tong S, Lee SW, Seymour B. Balancing safety and efficiency in human decision making. eLife. 2024;13 doi: 10.7554/eLife.101371. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [35].Mancini F, Mahajan P, Guttesen Aá V, Onysk J, Scholtes I, Shenker N, Lee M, Seymour B. Enhanced behavioural and neural sensitivity to punishments in chronic pain and fatigue. Brain. 2024:awae408. doi: 10.1093/brain/awae408. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [36].Millidge B, Tschantz A, Seth AK, Buckley CL. In: Active Inference Communications in Computer and Information Science. Verbelen T, Lanillos P, Buckley CL, De Boom C, editors. Vol. 1326. Cham: Springer International Publishing; 2020. On the Relationship Between Active Inference and Control as Inference; pp. 3–11. [DOI] [Google Scholar]
- [37].Moseley GL. A pain neuromatrix approach to patients with chronic pain. Manual Therapy. 2003;8:130–140. doi: 10.1016/s1356-689x(03)00051-1. [DOI] [PubMed] [Google Scholar]
- [38].Patzelt EH, Hartley CA, Gershman SJ. Computational Phenotyping: Using Models to Understand Individual Differences in Personality, Development, and Mental Illness. Personal Neurosci. 2018;1:e18. doi: 10.1017/pen.2018.14. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [39].Sajid N, Ball PJ, Parr T, Friston KJ. Active Inference: Demystified and Compared. Neural Computation. 2021;33:674–712. doi: 10.1162/neco_a_01357. [DOI] [PubMed] [Google Scholar]
- [40].Schultz W, Dayan P, Montague PR. A Neural Substrate of Prediction and Reward. Science. 1997;275:1593–1599. doi: 10.1126/science.275.5306.1593. [DOI] [PubMed] [Google Scholar]
- [41].Seymour B, Crook RJ, Chen ZS. Post-injury pain and behaviour: a control theory perspective. Nat Rev Neurosci. 2023;24:378–392. doi: 10.1038/s41583-023-00699-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [42].Seymour B, Dolan RJ. In: Wall & Melzack’s Textbook of Pain. McMahon SB, Koltzenburg M, Tracey I, Turk DC, editors. Elsevier; 2013. Emotion, Motivation, and Pain; pp. 248–255. [Google Scholar]
- [43].Seymour B, O’Doherty JP, Dayan P, Koltzenburg M, Jones AK, Dolan RJ, Friston KJ, Frackowiak RS. Temporal difference models describe higher-order learning in humans. Nature. 2004;429:664–667. doi: 10.1038/nature02581. [DOI] [PubMed] [Google Scholar]
- [44].Seymour B, O’Doherty JP, Koltzenburg M, Wiech K, Frackowiak R, Friston K, Dolan R. Opponent appetitive-aversive neural processes underlie predictive learning of pain relief. Nat Neurosci. 2005;8:1234–1240. doi: 10.1038/nn1527. [DOI] [PubMed] [Google Scholar]
- [45].Stephan KE, Penny WD, Daunizeau J, Moran RJ, Friston KJ. Bayesian model selection for group studies. NeuroImage. 2009;46:1004–1017. doi: 10.1016/j.neuroimage.2009.03.025. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [46].Sutton RS, Barto A. Reinforcement learning: an introduction. Second edition. Cambridge, Massachusetts London, England: The MIT Press; 2020. [Google Scholar]
- [47].Tabor A, Thacker MA, Moseley GL, Körding KP. Pain: A Statistical Account. PLOS Computational Biology. 2017;13:e1005142. doi: 10.1371/journal.pcbi.1005142. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [48].Vlaev I, Seymour B, Dolan RJ, Chater N. The price of pain and the value of suffering. Psychol Sci. 2009;20:309–317. doi: 10.1111/j.1467-9280.2009.02304.x. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [49].Vlaeyen JWS. Learning to predict and control harmful events: chronic pain and conditioning. PAIN. 2015;156:S86. doi: 10.1097/j.pain.0000000000000107. [DOI] [PubMed] [Google Scholar]
- [50].Whittington JCR, Bogacz R. Theories of Error Back-Propagation in the Brain. Trends Cogn Sci. 2019;23:235–250. doi: 10.1016/j.tics.2018.12.005. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [51].Wiech K. Deconstructing the sensation of pain: The influence of cognitive processes on pain perception. Science. 2016;354:584–587. doi: 10.1126/science.aaf8934. [DOI] [PubMed] [Google Scholar]
- [52].Zaman J, Wiech K, Vlaeyen JWS. Perceptual Decision Parameters and Their Relation to Self-Reported Pain: A Drift Diffusion Account. The Journal of Pain. 2020;21:324–333. doi: 10.1016/j.jpain.2019.06.009. [DOI] [PubMed] [Google Scholar]
- [53].Ziebart BD. Modeling Purposeful Adaptive Behavior with the Principle of Maximum Causal Entropy. Carnegie Mellon University; 2010. [thesis] [DOI] [Google Scholar]

