Modelling cyclic behaviour of granular soils under both drained and undrained conditions with a good performance is still a challenge. This study presents a new way of modelling the cyclic behaviour of granular materials using deep learning. To capture the continuous cyclic behaviour in time dimension, the long short-term memory (LSTM) neural network is adopted, which is characterised by the prediction of sequential data, meaning that it provides a novel means of predicting the continuous behaviour of soils under various loading paths. Synthetic datasets of cyclic loading under drained and undrained conditions generated by an advanced soil constitutive model are first employed to explore an appropriate framework for the LSTM-based model. Then the LSTM-based model is used to estimate the cyclic behaviour of real sands, ie, the Toyoura sand under the undrained condition and the Fontainebleau sand under both undrained and drained conditions. The estimates are compared with actual experimental results, which indicates that the LSTM-based model can simultaneously simulate the cyclic behaviour of sand under both drained and undrained conditions, ie, (a) the cyclic mobility mechanism, the degradation of effective stress and large deformation under the undrained condition, and (b) shear strain accumulation and densification under the drained condition. K E Y W O R D S constitutive model, cyclic loading, deep learning, liquefaction, neural network, sand