LSTMs address the vanishing gradient problem by introducing memory cells and gates, allowing them to capture long-range dependencies more effectively than basic RNNs.