Abstract
Neuroimaging-based pain decoding faces two underappreciated challenges: between-subject variability that prevents classifiers from generalizing across patients, and within-session cross-validation designs that inflate reported accuracy by conflating within- and between-person variance. Here we address both using portable functional near-infrared spectroscopy (fNIRS) during pharmacologically verified local nerve anesthesia. Twenty-five patients with clinically painful teeth underwent 36-channel bilateral fNIRS during percussion before ("Pre") and after ("Post") local nerve anesthesia. In 13 block-success patients, a paired Pre-versus-Post comparison with healthy-tooth control identified three temporal hemodynamic response function (HRF) features – late slope, mean first derivative, and baseline-normalized amplitude – whose analgesia interaction effects (d = 0.63–0.79) exceeded that of raw general linear model (GLM) amplitude (d = 0.56), with a significant difference-in-differences interaction (p = 0.011). Per-patient calibration with these features yielded leave-one-subject-out (LOSO) AUC = 0.68–0.76 for nonlinear classifiers (permutation p = 0.002), with HbO-specific feature selection achieving the best performance (RF AUC = 0.760); a healthy-tooth negative control was non-significant. End-to-end deep learning on raw time series (CNN-LSTM AUC = 0.719) was competitive with feature-based classifiers, while linear models did not reach significance. Critically, head-to-head comparison of within-session CV and LOSO on the same data revealed mean inflation of +0.13 AUC across all model types, including deep learning – demonstrating that high within-session accuracy alone does not establish subject-independent validity. Exploratory analyses suggested complementary roles for oxyhemoglobin (HbO; within-patient analgesia detection) and deoxyhemoglobin (HbR; cross-patient information), and that trial-to-trial response variability may complement amplitude for cross-patient pain detection. These results show that per-patient calibration with temporal HRF features supports subject-independent analgesic-state detection under strict LOSO evaluation, and that within-session validation – standard in the fNIRS pain-decoding literature – can substantially overestimate performance.
Competing Interest Statement
The content described within this fNIRS study has been developed at the University of Michigan and disclosed to the University of Michigan Office of Technology Transfer called CLARAi (Clinical Augmented Reality and Artificial Intelligence). All intellectual property rights including but not limited to patents/patent applications, trademark and copyright of software, algorithms, reports, displays, and visualizations are owned by the Regents of the University of Michigan. Dr. DaSilva is the co-founder of MELD Health Inc, a startup that licenses the mobile technology from University of Michigan for pain monitoring and rating called PainTrek. The remaining authors have no conflicts of interest to declare.
Funding Statement
This work was supported by the PI Discretionary Fund within the School of Dentistry/Biologic and Materials Sciences & Prosthodontics, University of Michigan.
Author Declarations
I confirm all relevant ethical guidelines have been followed, and any necessary IRB and/or ethics committee approvals have been obtained.
Yes
The details of the IRB/oversight body that provided approval or exemption for the research described are given below:
This study was approved by the University of Michigan Institutional Review Board (protocol number: HUM00164611). All participants provided written informed consent prior to enrollment.
I confirm that all necessary patient/participant consent has been obtained and the appropriate institutional forms have been archived, and that any patient/participant/sample identifiers included were not known to anyone (e.g., hospital staff, patients or participants themselves) outside the research group so cannot be used to identify individuals.
Yes
I understand that all clinical trials and any other prospective interventional studies must be registered with an ICMJE-approved registry, such as ClinicalTrials.gov. I confirm that any such study reported in the manuscript has been registered and the trial registration ID is provided (note: if posting a prospective study registered retrospectively, please provide a statement in the trial ID field explaining why the study was not registered in advance).
Yes
I have followed all appropriate research reporting guidelines, such as any relevant EQUATOR Network research reporting checklist(s) and other pertinent material, if applicable.
Yes
Data Availability
The data that support the findings of this study are available from the corresponding author upon reasonable request.





