Summarize the following text in less than 50 words. Let's think step by step: the mathematics of small things: on grokking and the double descent phenomenon last updated on july 23, 2024 by editorial team author(s): ayo akinkugbe originally published on towards ai. the conundrum to overfit or generalize? so here's the thing when training a model you are often advised never to overfit. somehow it makes sense because overfitting is when a model's algorithm learns its training data so well that it fails to make accurate predictions on new, unseen data. however, understanding when your model begins to overfit can be useful. a model that overfits also shows the point where the objective function for the model's algorithm has been optimized. this can be useful in knowing when to stop training. conversely, a model that makes accurate predictions on new, unseen data is said to generalize well. the goal of model development is generalization, not overfitting. however, there is often a tension between optimizing the objective function during training and being able to generalize using the model on new data. the goal is not to overfit. though overfitting isn't desirable, it can serve as a guide to generalization if understood and leveraged accordingly. for context, a model is trained on training data, evaluated on a validation set, and then tested on a test dataset. in each instance, an error that measures how well the model predicts accurately is measured training error and test error, respectively. the difference between these errors is often referred to as the generalization error. when small, it means the model generalized well. when large, the model is said to most likely overfit. there are numerous books, papers, and techniques written on how to ensure a good fit in a model how to overcome overfitting and how to enhance generalization. that is not the subject of this article. this article explores two observed phenomena (grokking and double descent) in large models regarding how they overfit and generalize, and some speculations about these types of behavior. grokking imagine you have been trying to learn a language. let's say you have tried everything you can for the past five years. you are bad at it. you aren't learning, not even the fundamentals. then suddenly, one morning after five years of trying, you wake up and you are speaking the language fluently. this described scenario has been observed in large neural networks and is referred to as grokking. grokking in machine learning refers to a model suddenly achieving a deep and thorough understanding of the data it is being trained on. this phenomenon is characterized by a sharp and unexpected improvement in performance after a relatively long period of seemingly stagnated or mediocre results. it is as if the model suddenly "gets it!" the interesting thing about this phenomenon is that even though it has been observed, it isn't explainable. we don't know why large models behave this way, as it is contrary to the observed behaviors of neural models explained earlier. models are often nipped right before they begin to overfit to ensure they can generalize on unseen data. why would a model generalize far after overfitting on a dataset? double descent double descent refers to another phenomenon observed in the training of deep learning models. it describes the relationship between model complexity and performance in large models. unlike the traditional u-shaped curve usually observed, double descent has an additional descent phase that occurs beyond the point where the model fits the training data perfectly. that is, the model at first performs well on new data, starts to overfit, and then starts performing better than the first time. simply put, double descent is a phenomenon where models appear to perform better, then worse, and then better again as they get bigger. differences between grokking and double descent even though similar and sometimes referred to as the same phenomenon, grokking is distinct from double descent on the following criteria: - pattern of model improvement: grokking involves a sudden improvement in model performance after a prolonged period of suboptimal performance. it's more about the learning process within a fixed model structure. double descent describes a non-monotonic relationship between model complexity and performance, with an initial increase, a degradation at the interpolation threshold, and then an unexpected improvement as complexity continues to increase. - timing: grokking happens after extensive training, with the model suddenly improving. double descent occurs as model complexity is varied, showing different performance phases depending on complexity. - scope: grokking focuses on the training process and the model's internalization of data patterns. double descent focuses on the impact of model complexity on performance, highlighting unexpected behavior beyond the traditional bias-variance tradeoff. - underlying mechanism: grokking may be related to the model finally understanding intricate data structures and patterns after extensive training. double descent relates to how over-parameterized models can find simpler, more generalizable solutions despite their complexity. even though these are different phenomena, one thing they both have in common is that they veer off from classical machine learning theory of how a model learns and generalizes. a concept that helps explain how and why models learn the way they do classically is the manifold hypothesis. manifold hypothesis imagine you have a sheet of paper (a 2-dimensional surface) that you can twist, fold, and crumple. now, this paper exists in a 3-dimensional space (length, width, and height), but its true intrinsic dimensionality is still just 2d. when the paper is flat, it's easy to see that it's just a 2d surface. when you crumple the paper, it might appear more complex and seem to fill more of the 3d space. however, it still fundamentally has only two dimensions. if the paper were crumpled, the paper does not fill the entire 3d space but instead exists on a constrained, lower-dimensional surface within the manifold. the manifold hypothesis is a fundamental concept in machine learning that explains how and why models might learn the way they do. the hypothesis suggests that high-dimensional data (such as images, sounds, or other complex data) lies on a lower-dimensional manifold within the high-dimensional space. for example, most realistic images (faces, objects, etc.) do not randomly occupy the entire high-dimensional space but are instead concentrated in specific regions (the manifold). these regions capture the underlying structure and relationships between the data points. this hypothesis has important implications for understanding how machine learning models, especially deep learning models, operate and generalize. - if a machine learning model can identify and learn this lower-dimensional manifold, it can more efficiently understand and generalize from the data, as any new realistic combination of the features should exist in that manifold. - by focusing on the manifold, the model avoids the noise and irrelevant parts of the high-dimensional space, leading to better performance and generalization. speculations what might the manifold hypothesis have to do with these two unexplainable phenomena? below are a few speculations o - more time required to unravel the manifold for different dataset structures: in grokking, an over-parameterized model suddenly has a eureka moment after a long time of training. this phenomenon has mainly been observed with algorithmically generated datasets. the manifold hypothesis suggests that real-world data has intricate structures. what if there are degrees of intricacies? what if different data types exhibit different degrees of manifold in a higher dimension space? what if this behavior leads to more complexity in how the model learns the information structure, leading to phenomena like grokking and double descent? - correspondence principle in ai: in physics, a similar dichotomy exists between classical and quantum physics. quantum physics is the physics of very small things where atoms and electrons collide or act accordingly. however, classical physics is straightforward often deterministic and established. the coexistence of these two subfields in the field of physics has been made possible through a reconciliation that when quantum numbers are large, the predictions of quantum physics match those of classical physics. this is the correspondence principle. maybe artificial intelligence needs a correspondence principle one that connects the phenomena between how large models behave in relation to statistical laws that govern and predict how traditional smaller models behave. - unexplored laws for patterns in complex data structures: like the laws of large numbers, maybe there are laws yet to be discovered for patterns as they pertain to language, arithmetic, and other complex real-world data structures ingested by large models. learning theory demarcates easily. lines are drawn like a linear classifier. however, we step into the real world and there are nuances. "it depends," we like to say. many factors that might seem insignificant in theory determine the outcome the small significant things we overlooked. in a world fast approaching where we demand machines to think and act like humans, the small, significant things need to be calculated and accounted for. this is the mathematics of really small things. these phenomena are strange until we discover this hidden beneath the manifold. join thousands of data leaders on the ai newsletter. join over 80,000 subscribers and keep up to date with the latest developments in ai. from research to projects and ideas. if you are building an ai startup, an ai-related product, or a service, we invite you to consider becoming a sponsor. published via towards ai