AbstractLithology classification is a fundamental aspect of reservoir classification. Due to the limited availability of core samples, computational modelling methods for lithology classification based on indirect measurements are required. The main challenge for standard clustering methods is the complex vertical dependency of sedimentological sequences as well as the spatial coupling of well logs. Machine learning methods, such as recurrent neural networks, long short‐term memory and bidirectional long short‐term memory, can account for the spatial correlation of the measured data and the predicted model. Based on these developments, we propose a novel approach using two distinct models: a self‐attention‐assisted bidirectional long short‐term memory model and a multi‐head attention‐based bidirectional long short‐term memory model. These models consider spatial continuity and adaptively adjust the weight in each step to improve the classification using the attention mechanism. The proposed method is tested on a set of real well logs with limited training data obtained from core samples. The prediction results from the proposed models and the benchmark one are compared in terms of the accuracy of lithology classification. Additionally, the weight matrices from both attention mechanisms are visualized to elucidate the correlations between depth steps and to help analyse how these mechanisms contribute to improved prediction accuracy. The study shows that the proposed multi‐head attention‐based bidirectional long short‐term memory model improves classification, especially for thin layers.