 This paper proposes a novel framework for automatic sleep stage detection from EEG signals. It uses a transformer model with an attention-based module to extract relevant features from the EEG signal and then uses these features to classify the signal into one of four stages, wake, N2, N3, or REM. This approach outperforms existing methods and provides reliable results with high-interator reliability. Additionally, the authors provide visualizations of the correspondence between sleep-staging decisions and features extracted by their method, enhancing the interpretability of the proposal. This article was authored by Zheng Chen, Zi Wei Yang, Ling Wei Zhu, and others.