Electrophysiological characterization of patients undergoing programmed ventricular stimulation (EP studies) requires accurate QRS duration measurement across all beat types present in the recording, including sinusoidal and stimulus beats acquired at varying coupling intervals. Existing QRS detectors do not address this setting: stimulus beats exhibit morphologies such as paced rhythms, aberrant conduction, and bundle branch blocks that rule-based methods and general-purpose detectors were not designed for. Additionally, labeled data is scarce since expert annotation of EP recordings is time-consuming.
We propose a semi-supervised neural approach trained on 500 annotated beats from 8 non-ischemic dilated cardiomyopathy patients. A frozen HuBERT-ECG-small foundation model provides morphology-aware representations, compensating for annotation scarcity. The architecture treats Pan-Tompkins detection as a structural prior over beat location, which is then updated by morphological context extracted from the foundation model. Both prior and update are instantiated as soft temporal masks, combined through a convolution module into a final mask prediction whose sum yields QRS duration, providing interpretable intermediate representations. A semi-supervised continuity constraint on unannotated beats regularizes cross-patient generalization. On a held-out patient, unseen during training, the model achieves approximately 20 ms mean absolute error — consistent with inter-annotator clinical precision and considerable better than a baseline Pan-Tompkins rule based with learned threshold — despite high morphological variability across patients and beat types.