Learning involves using previous experiences to develop new behaviors and actions, and since all experiences are ultimately unique, learning always requires some generalization. An effective way to improve generalization is to expose learners to more variable and thus often more representative input, i.e., more variability makes learning somewhat more difficult initially, but eventually leads to more general and robust performance.
This basic principle has been repeatedly rediscovered and renamed in various domains, such as contextual diversity, desirable difficulty, or variability of practice. Researchers have attempted to identify key patterns to distinguish between different types of variability, discussed the role of different task-relevant and irrelevant dimensions, and examined the effects of introducing variability at different points in training.
This principle has been known for a very long time in motor learning, for example; when practicing the serve in tennis, it helps to execute the movement from as many different positions on the baseline as possible. In addition to variation, heterogeneity is also beneficial. For example, if you want to learn what a dog is, it helps to look at different types of dogs. After all, if you only look at pictures of large Great Danes, you might otherwise only recognize large Great Danes as dogs, but not other breeds as part of the category. Also essential is the context or situation, that is, learning in different environments. When learning to drive, it helps in the long run to drive different routes at different times of the day. In this context, a training plan is indispensable, because it helps to plan the exercises necessary for learning at different times and rhythms of the day.
So far, there are two approaches to explaining why variability makes for better learning outcomes that are also sustainable. On the one hand, variation in learning could lead to better filtering of what is important and what is unimportant in a task; on the other hand, more variability could also lead to more generalization, i.e., applying what has been learned once in different situations. Variations in learning lead to the fact that one has to recall the memory of what has been learned in the brain and adapt it a little bit each time, which strengthens the memories and makes them more sustainable.
Raviv, Limor, Lupyan, Gary & Green, Shawn C. (2022). How variability shapes learning and generalization. Trends in Cognitive Sciences, 26, 462-483.