Abstract
Fluctuations in pain, stress and craving are thought to contribute to opioid misuse. Developing accurate prediction models is vital for intervention and prevention efforts. In this work, we leverage physiological data and semantic analysis of electronic health records to tackle the challenge of detecting opioid misuse. Utilizing personalized hierarchical deep-learning models, we analyze trajectories of predicted pain, stress and craving states with 10,140 hours of heart-rate data collected by wearables from patients on long-term opioid therapy. From these trajectories, we extract entropy features from nonlinear dynamical analysis and develop a novel relevance-based temporal fusion model of opioid misuse risk. We incorporate clinical data into a large language model to enhance opioid misuse risk detection. We then fuse these modalities to achieve an accurate opioid misuse risk assessment with area under the precision-recall curve of 0.94 ± 0.05. This study marks a substantial advancement in personalized prediction of addictive behavior by elucidating the entropic nature of underlying affective state dynamics.
This is a preview of subscription content, access via your institution
Access options
Subscribe to this journal
Receive 12 digital issues and online access to articles
$79.00 per year
only $6.58 per issue
Buy this article
- Purchase on SpringerLink
- Instant access to the full article PDF.
USD 39.95
Prices may be subject to local taxes which are calculated during checkout




Similar content being viewed by others
Data availability
The data are available upon request with a signed data access agreement. For the detailed permission to access the data, please contact egarland@health.ucsd.edu.
Code availability
This software is © 2025 The Regents of the University of California. It is made available for educational and research use; for permission to use it in such contexts, please contact the corresponding author. For commercial use or licensing inquiries, please contact the Office of Innovation and Commercialization at innovation@ucsd.edu.
References
Ciotti, M. et al. The COVID-19 pandemic. Crit. Rev. Clin. Lab. Sci. 57, 365–388 (2020).
Drug overdose deaths: facts and figures. NIDA https://nida.nih.gov/research-topics/trends-statistics/overdose-death-rates (2023).
Mann, B. & Pattani, A. In 2023 fentanyl overdoses ravaged the US and fueled a new culture war fight. NPR https://www.npr.org/2023/12/28/1220881380/overdose-fentanyl-drugs-addiction (2023).
Garland, E. L., Froeliger, B., Zeidan, F., Partin, K. & Howard, M. O. The downward spiral of chronic pain, prescription opioid misuse, and addiction: cognitive, affective, and neuropsychopharmacologic pathways. Neurosci. Biobehav. Rev. 37, 2597–2607 (2013).
Lazarus, R. S. Stress and Emotion: A New Synthesis (Springer, 2006).
Price, D. D. Psychological and neural mechanisms of the affective dimension of pain. Science 288, 1769–1772 (2000).
Giuliani, N. R. & Berkman, E. T. Craving is an affective state and its regulation can be understood in terms of the extended process model of emotion regulation. Psychol. Inq. 26, 48–53 (2015).
Kuppens, P. It’s about time: a special section on affect dynamics. Emot. Rev. 7, 297–300 (2015).
Vanhasbroeck, N., Ariens, S., Tuerlinckx, F. & Loossens, T. Computational Models for Affect Dynamics (Springer, 2021).
Schupp, H. T., Junghöfer, M., Weike, A. I. & Hamm, A. O. The selective processing of briefly presented affective pictures: an ERP analysis. Psychophysiology 41, 441–449 (2004).
Buu, A. et al. The association between short-term emotion dynamics and cigarette dependence: a comprehensive examination of dynamic measures. Drug Alcohol Depend. 218, 108341 (2021).
Freeman, W. J. Societies of Brains: A Study in the Neuroscience of Love and Hate (Psychology Press, 2014).
Haken, H. Synergetics of brain function. Int. J. Psychophysiol. 60, 110–124 (2006).
Apkarian, A. V., Baliki, M. N. & Geha, P. Y. Towards a theory of chronic pain. Prog. Neurobiol. 87, 81–97 (2009).
McEwen, B. S. Allostasis and Allostatic Load: Implications for Neuropsychopharmacology (Routledge, 2013).
Thayer, J. F. & Lane, R. D. Claude Bernard and the heart–brain connection: further elaboration of a model of neurovisceral integration. Neurosci. Biobehav. Rev. 33, 81–88 (2009).
Thayer, J. F. & Lane, R. D. A model of neurovisceral integration in emotion regulation and dysregulation. J. Affect. Disord. 61, 201–216 (2000).
Kim, H.-G., Cheon, E.-J., Bai, D.-S., Lee, Y. H. & Koo, B.-H. Stress and heart rate variability: a meta-analysis and review of the literature. Psychiatry Investig. 15, 235–245 (2018).
Alinia, P. et al. Associations between physiological signals captured using wearable sensors and self-reported outcomes among adults in alcohol use disorder recovery: development and usability study. JMIR Form. Res. 5, 27891 (2021).
Gullapalli, B. T. et al. On-body sensing of cocaine craving, euphoria and drug-seeking behavior using cardiac and respiratory signals. Proc. ACM Interact. Mob. Wearable Ubiquitous Technol. 3, 46 (2019).
Bertz, J. W., Epstein, D. H. & Preston, K. L. Combining ecological momentary assessment with objective, ambulatory measures of behavior and physiology in substance-use research. Addict. Behav. 83, 5–17 (2018).
Määttänen, I. et al. Positive affect state is a good predictor of movement and stress: combining data from ESM/EMA, mobile HRV measurements and trait questionnaires. Heliyon 7, e06243 (2021).
Murray, D. W., Ridenour, T. A., Swingler, M. M., Morgan, A. & Hegarty-Craver, M. Feasibility of combining biosensor and ecological momentary assessment to measure stress experiences among economically disadvantaged adolescents. Stress Health 39, 684–689 (2023).
Jiang, M. et al. Ultra-short-term analysis of heart rate variability for real-time acute pain monitoring with wearable electronics. In Proc. 2017 IEEE International Conference on Bioinformatics and Biomedicine (BIBM) 1025–1032 (IEEE, 2017).
Kalkman, G. A. et al. Monitoring opioids in Europe: the need for shared definitions and measuring drivers of opioid use and related harms. Eur. Addict. Res. 28, 231–240 (2022).
Gudin, J. A., Mogali, S., Jones, J. D. & Comer, S. D. Risks, management, and monitoring of combination opioid, benzodiazepines, and/or alcohol use. Postgrad. Med. 125, 115–130 (2013).
Gullapalli, B. T. et al. OpiTrack: a wearable-based clinical opioid use tracker with temporal convolutional attention networks. Proc. ACM Interact. Mob. Wearable Ubiquitous Technol. 5, 102 (2021).
Benyamin, R. et al. Opioid complications and side effects. Pain. Physician 11, S105–S120 (2008).
Tejeda, H. A. & Bonci, A. Dynorphin/kappa-opioid receptor control of dopamine dynamics: implications for negative affective states and psychiatric disorders. Brain Res. 1713, 91–101 (2019).
Luo, Y. et al. Dynamic clustering via branched deep learning enhances personalization of stress prediction from mobile sensor data. Sci. Rep. 14, 6631 (2024).
Stark, J., Broomhead, D. S., Davies, M. E. & Huke, J. Takens embedding theorems for forced and stochastic systems. Nonlinear Anal. Theory Methods Appl. 30, 5303–5314 (1997).
Yan, Y. et al. Topological nonlinear analysis of dynamical systems in wearable sensor-based human physical activity inference. IEEE Trans. Hum. Mach. Syst. 53, 792–801 (2023).
Wolf, A., Swift, J. B., Swinney, H. L. & Vastano, J. A. Determining lyapunov exponents from a time series. Phys. D Nonlinear Phenom. 16, 285–317 (1985).
Hu, K., Ivanov, P. C., Chen, Z., Carpena, P. & Stanley, H. E. Effect of trends on detrended fluctuation analysis. Phys. Rev. E 64, 011114 (2001).
Qian, B. & Rasheed, K. Hurst exponent and financial market predictability. In Proc. IASTED Conference on Financial Engineering and Applications 203–209 (ACTA Press, 2004).
Garland, E. L., Froeliger, B. & Howard, M. O. Allostatic dysregulation of natural reward processing in prescription opioid misuse: autonomic and attentional evidence. Biol. Psychol. 105, 124–129 (2015).
Garland, E. L., Bryan, C. J., Nakamura, Y., Froeliger, B. & Howard, M. O. Deficits in autonomic indices of emotion regulation and reward processing associated with prescription opioid use and misuse. Psychopharmacology 234, 621–629 (2017).
Garland, E. L. & Howard, M. O. Prescription opioid misusers exhibit blunted parasympathetic regulation during inhibitory control challenge. Psychopharmacology 238, 765–774 (2021).
Roberts, R. L. & Garland, E. L. Association between opioid use disorder and blunted heart rate variability among opioid-treated chronic pain patients. Addict. Biol. 27, 13230 (2022).
Koob, G. F. & Le Moal, M. Drug addiction, dysregulation of reward, and allostasis. Neuropsychopharmacology 24, 97–129 (2001).
Shurman, J., Koob, G. F. & Gutstein, H. B. Opioids, pain, the brain, and hyperkatifeia: a framework for the rational use of opioids for pain. Pain. Med. 11, 1092–1098 (2010).
Elman, I. & Borsook, D. Common brain mechanisms of chronic pain and addiction. Neuron 89, 11–36 (2016).
Friedman, B. H. An autonomic flexibility–neurovisceral integration model of anxiety and cardiac vagal tone. Biol. Psychol. 74, 185–199 (2007).
Ottaviani, C., Medea, B., Lonigro, A., Tarvainen, M. & Couyoumdjian, A. Cognitive rigidity is mirrored by autonomic inflexibility in daily life perseverative cognition. Biol. Psychol. 107, 24–30 (2015).
Eddie, D., Price, J. L., Bates, M. E. & Buckman, J. F. Substance use and addiction affect more than the brain: the promise of neurocardiac interventions. Curr. Addict. Rep. 8, 431–439 (2021).
Zhu, Z. & Bonanno, G. A. Affective flexibility: relations to expressive flexibility, feedback, and depression. Clin. Psychol. Sci. 5, 930–942 (2017).
De Guzman, K. R., Snoswell, C. L., Taylor, M. L., Gray, L. C. & Caffery, L. J. Economic evaluations of remote patient monitoring for chronic disease: a systematic review. Value Health 25, 897–913 (2022).
El-Rashidy, N., El-Sappagh, S., Islam, S. R., M. El-Bakry, H. & Abdelrazek, S. Mobile health in remote patient monitoring for chronic diseases: principles, trends, and challenges. Diagnostics 11, 607 (2021).
Thompson, J. M. T., Stewart, H. B. & Turner, R. Nonlinear Dynamics and Chaos (Wiley, 1990)
Zhao, W. X. et al. A Survey of Large Language Models. Preprint at https://arxiv.org/abs/2303.18223 (2023).
Huang, J. & Chang, K.C.-C. in Findings of the Association for Computational Linguistics: ACL 2023 1049–1065 (Association for Computational Linguistics, 2023).
Wei, J. et al. Chain-of-thought prompting elicits reasoning in large language models. In Proc. 35th International Conference on Neural Information Processing Systems 24824–24837 (Curran Associates, 2022).
Wang, B. et al. Towards understanding chain-of-thought prompting: an empirical study of what matters. In Proc. 61st Annual Meeting of the Association for Computational Linguistics (eds Rogers, A. et al.) 2717–2739 (ACL, 2023); https://doi.org/10.18653/v1/2023.acl-long.153
Luo, Y., Liu, Y., Cai, R. & Rahman, T. Start simple: progressive difficulty multitask learning. In Proc. 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 4: Student Research Workshop) 48–55 (Association for Computational Linguistics, 2024).
Garland, E. L. et al. Zoom-based mindfulness-oriented recovery enhancement plus just-in-time mindfulness practice triggered by wearable sensors for opioid craving and chronic pain. Mindfulness 14, 1329–1345 (2023).
Myllymaki, T. Stress and Recovery Analysis Method Based on 24-Hour Heart Rate Variability (Firstbeat Technologies Ltd, 2014).
Charlton, P. H. et al. An assessment of algorithms to estimate respiratory rate from the electrocardiogram and photoplethysmogram. Physiol. Meas. 37, 610–626 (2016).
Föhr, T. et al. Subjective stress, objective heart rate variability-based stress, and recovery on workdays among overweight and psychologically distressed individuals: a cross-sectional study. J. Occup. Med. Toxicol. 10, 39 (2015).
Madison, A., Vasey, M., Emery, C. F. & Kiecolt-Glaser, J. K. Social anxiety symptoms, heart rate variability, and vocal emotion recognition in women: evidence for parasympathetically-mediated positivity bias. Anxiety Stress Coping 34, 243–257 (2021).
Myllymäki, T. et al. Effects of vigorous late-night exercise on sleep quality and cardiac autonomic activity. J. Sleep. Res. 20, 146–153 (2011).
Palesh, O. et al. Secondary outcomes of a behavioral sleep intervention: a randomized clinical trial. Health Psychol. 38, 196–205 (2019).
Rusko, H. et al. Stress and relaxation during sleep and awake time, and their associations with free salivary cortisol after awakening. In Proc. Nordic Ergonomics Society Congress (Nordic Ergonomics and Human Factor Society, 2006).
Teisala, T. et al. Associations of physical activity, fitness, and body composition with heart rate variability–based indicators of stress and recovery on workdays: a cross-sectional study. J. Occup. Med. Toxicol. 9, 16 (2014).
Uusitalo, A. et al. Heart rate variability related to effort at work. Appl. Ergon. 42, 830–838 (2011).
Butler, S. F. et al. Development and validation of the current opioid misuse measure. Pain 130, 144–156 (2007).
Tobin, R. M., Graziano, W. G., Vanman, E. J. & Tassinary, L. G. Personality, emotional experience, and efforts to control emotions. J. Personal. Soc. Psychol. 79, 656–669 (2000).
Hu, Y. et al. A cross-space CNN with customized characteristics for motor imagery EEG classification. IEEE Trans. Neural Syst. Rehabil. Eng. 31, 1554–1565 (2023).
Bansal, S., Gowda, K. & Kumar, N. Multilingual personalized hashtag recommendation for low resource Indic languages using graph-based deep neural network. Expert Syst. Appl. 236, 121188 (2024).
Jiang, M. et al. Personalized and adaptive neural networks for pain detection from multi-modal physiological features. Expert Syst. Appl. 235, 121082 (2024).
Chang, J. et al. PEPNet: parameter and embedding personalized network for infusing with personalized prior information. In Proc. 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining 3795–3804 (Association for Computing Machinery, 2023); https://doi.org/10.1145/3580305.3599884
Guo, P., Lee, C.-Y. & Ulbricht, D. Learning to branch for multi-task learning. In Proc. 37th International Conference on Machine Learning 3854–3863 (PMLR, 2020).
Jang, E., Gu, S. & Poole, B. Categorical reparameterization with Gumbel-Softmax. Preprint at https://arxiv.org/abs/1611.01144 (2017).
Park, J. S. et al. Generative agents: interactive simulacra of human behavior. In Proc. of the 36th Annual ACM Symposium on User Interface Software and Technology (Association for Computing Machinery, 2023).
Wang, G. et al. Optimized glycemic control of type 2 diabetes with reinforcement learning: a proof-of-concept trial. Nat. Med. 29, 2633–2642 (2023).
Muzammil, M. Finetuning EnDevSols/tinyllama-2.5T-Clinical model on Clinical Dataset, Hugging Face (accessed 19 March 2023); https://huggingface.co/muzammil-eds/tinyllama-2.5T-Clinical-v2
Wang, J. et al. Prompt engineering for healthcare: methodologies and applications. Preprint at https://arxiv.org/abs/2304.14670 (2023).
Acknowledgements
We thank the Supercomputing Center and Halıcıoğlu Data Science Institute at University of California San Diego for providing the working space and the computational resources necessary to conduct all experiments. E.L.G. was supported by R01DA058621 (PI: Garland), R01AT011772 (PI: Garland), R01DA056537 (PI: Garland), and R01DA057631 (PI: Garland) from the National Institutes of Health during the preparation of this paper. Opinions, interpretations, conclusions and recommendations are those of the authors and are not necessarily endorsed by the National Institutes of Health. T.R., Y.L. and B.T.G. were supported by NSF Smart and Connected Health (2320678), Google Research Scholar Award (Gift) and Optum Labs Award (UCSD Proposal Number 30223298; KR 46245).
Author information
Authors and Affiliations
Contributions
E.L.G. and T.R. as co-principal investigators conceived the original study and signal processing pipeline, and acquired funding and ran the data collection and analysis of the study. M.T. as the data engineer contributed to the preliminary data processing and analysis. M.B.F. as the senior peer contributed to the guidance of notions and methodologies in the clinical and machine-learning fields. Y.L., I.D. and B.T.G. led the research, data analysis, data visualization and machine-learning model development.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Peer review
Peer review information
Nature Mental Health thanks Maryam Khodaverdi and the other, anonymous, reviewer(s) for their contribution to the peer review of this work.
Additional information
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary information
Supplementary Information (download PDF )
Supplementary Appendices A–G, figures and tables.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Luo, Y., Deznabi, I., Gullapalli, B.T. et al. Personalized entropy-informed deep learning for identifying opioid misuse. Nat. Mental Health 4, 112–124 (2026). https://doi.org/10.1038/s44220-025-00555-8
Received:
Accepted:
Published:
Version of record:
Issue date:
DOI: https://doi.org/10.1038/s44220-025-00555-8


