Predator-Prey Model: Driven Hunt for Accelerated Grokking
Authors: I. A. Lopatin, S. V. Kozyrev, A. N. Pechen
Organizations: Steklov Mathematical Institute of Russian Academy of Sciences, Gubkina str. 8, 119991 Moscow, Russia · Ivannikov Institute for System Programming of the Russian Academy of Sciences, Moscow, 109004 Russia
A machine learning method is proposed using two agents (representing two coupled replicas of the model parameters) that simulate the biological behavior of a predator and a prey. In this method, the two agents interact with each other via a pair of potentials that simulate the dynamics when the predator chases the prey while the prey runs away from the predator - to perform an optimization on the landscape. This method allows, for optimization landscapes with narrow ravines with gentle slope or even flat bottoms, to avoid optimization getting stuck in a ravine. For some examples of grokking (i.e., delayed generalization) problems we show that this method allows for achieving up to a hundred times faster learning in gradient evaluations and up to 60 times in the wall-clock time compared to the standard learning procedure.
Figures & tables
Figure 1: Typical training processes for ModuloOperation and MNIST with the standard AdamW algorithm. Upper row: for ModuloOperation. Bottom row: for MNIST. In each row from left to right: accuracy of the training model vs epoch, weight norm of the training model vs epoch, effective optimizer step norm ∥m^t/(v^t+ϵ)∥ for Adam/AdamW vs optimization process step, and distance to the initial model vs optimization process step.
Figure 2: Training after the memorization phase using the PPM in the no Pred. grad mode (no gradient calls for the predator) using the Algorithm 1 . Adam with λ=10−2 is used as the optimizer. Two upper rows are for ModuloOperation and two bottom rows are for MNIST. The 1st column is the prey and predator accuracies for train and test data sets over epochs. The 2nd and the 3rd plots in the upper row for each task (i.e. the second and the third rows) represent Prey model weight norm and norm distance between initial Prey model and current Prey model respectively over steps. The 2nd plots in the 2nd and the 4th rows contain comparison of the optimizer step norm ∥m^t/(v^t+ϵ)∥ for Adam with the prey-predator potential value over steps. We set in ( 3 ) A=150,σ=10 for ModuloOperation and A=15,σ=1 for MNIST. For each task we set αp=2A/3 and Nd=5 .
Figure 3: A typical example of the PPM standard training process for the ModuloOperation with gradient enabled for the predator. The quantities on the plots are the same as on Fig. 2 .
Figure 4: Training with PP-conn. In both cases we do not call the gradient for the predator. For the MNIST we use exponential moving average (EMA) for the first moment, for the ModuloOperation we do not use it. The quantities on the plots are the same as on Fig. 2 . Comparing with the standard procedure shown in Fig. 1 , PP-conn achieves an acceleration of training up to a hundred times in the number of gradient calls. We perform additional optimizer epochs after achieving grokking phase to show that accuracy does not decrease, as shown in the left column after the vertical dashed green line.
Figure 5: Training for PP-conn with A>αp . The quantities on the plots are the same as on Fig. 2 .
Figure 6: Grokking time dependence for addition modulo 139. Left: (in logarithm of the number of epochs) on the sample size β , which is the proportion of training and test data compared to the maximal possible sample. It shows linear decrease with β . Right: on the initial weight model norm. It shows linear growth with the weight model norm. Each point is obtained by averaging over 3 runs.
Figure 7: Comparing optimization process for standard Adam algorithm and PPM-conn with optimizer reboots. Upper and bottom rows show Rosenbrock function value (left column) and distance to the minimum (right column). Subplots (a) and (b) for Adam algorithm (with reboots, but for Adam without reboots holds the same trajectory) and subplots (c) and (d) for PPM-conn with reboots.
σ
A\αp
100
500
1000
2000
5000
1
100
1.00, 107.12 (15.48)
x
x
x
x
200
1.00, 104.72 (13.37)
x
x
x
x
500
1.00, 106.75 (16.88)
1.00, 90.94 (9.87)
x
x
x
1000
1.00, 110.05 (16.19)
1.00, 71.43 (7.92)
1.00, 102.15 (11.30)
x
x
2000
1.00, 113.79 (15.85)
1.00, 67.00 (8.64)
1.00, 62.09 (10.03)
0.98, 185.37 (43.19)
x
5000
1.00, 119.31 (17.54)
1.00, 75.13 (10.61)
1.00, 50.17 (10.14)
–
0.99, 150.29 (36.52)
Table 1: Ablation for Modulo Operation for various values of the parameters of PPM-conn.
σ
A\αp
10
50
100
500
1000
1
10
1.00, 80.30 (10.35)
x
x
x
x
50
1.00, 88.48 (13.20)
1.00, 77.17 (10.03)
x
x
x
100
1.00, 92.28 (14.82)
1.00, 101.63 (15.86)
1.00, 112.99 (20.51)
x
x
200
1.00, 99.76 (19.51)
1.00, 128.66 (27.36)
0.98, 175.34 (37.48)
x
x
500
0.95, 131.08 (36.49)
0.90, 191.33 (41.03)
–
1.00, 114.88 (17.96)
x
1000
0.77, 185.72 (46.96)
–
–
–
1.00, 119.08 (18.92)
Table 2: Ablation for MNIST for various values of the parameters of PPM-conn.
Figure 8: Histograms for ablation. Upper row shows acceleration in epochs for PPM-conn compared with standard AdamW for (a) ModuloOperation and (b) MNIST. Bottom row shows the number of epochs for achieving grokking with PPM-conn for (c) ModuloOperation and (d) MNIST. Parameters for PPM-conn have been chosen as best parameters according to ablation procedure, i.e. tables 1 and 2 for ModuloOperation and MNIST tasks respectively.
Figure 9: Curriculum learning for modular division task. Sudden drops in train accuracy are caused by changing pj .
Recent growth in compute power has made it increasingly feasible to use large-scale agent-based models to simulate complex adaptive systems. A central difficulty is that such models contain many local rules and parameters, where small changes can lead to runaway behaviour, population collapse, or saturation at artificial bounds. We study this problem in a continuous predator-prey system where sheep and wolves are active agents with local sensing, internal energy, and recurrent neural network-based controllers. We ask whether environmental and demographic parameters can be tuned so that the resulting population dynamics resemble classical Lotka-Volterra cycles. We optimise these parameters with a feature-based loss that rewards sustained oscillations, phase lag, bounded populations, and long-term persistence, first for random controllers and then for evolved controllers in a more naturalistic setting. The model is implemented in ABMax, a JAX-based agent-based modelling framework that enables efficient batched simulation on hardware accelerators.
Corinna Mandl, Siddharth Chaturvedi, Marcel van Gerven
Department of Machine Learning and Neural Computing Donders Institute for Brain, Cognition and Behaviour, Radboud University Nijmegen, the Netherlands
Delayed generalization, or grokking, remains poorly understood despite extensive empirical study. We identify an exactly solvable late-time relaxation mechanism for grokking in linear models trained with full-batch heavy-ball optimization and weight decay, together with a locally quadratic extension to nonlinear neural networks. Our analysis reveals a distinguished population-active component of the empirical null space, which we call the grokking subspace. Along this subspace, the training predictions remain unchanged, leaving weight decay as the sole restoring force and giving rise to a slow dissipative relaxation governed by an exact discrete-time and continuous-time law. We show that only this subspace contributes to the slow asymptotic decay of the population risk and derive explicit iteration-scale predictions for the grokking time, recovering the familiar (1−β)/(ηλ) scaling in the weak-regularization regime. The theory further predicts distinct effects of optimizer choice, distinguishing coupled L2 regularization from decoupled weight decay, and yields causal predictions for interventions that modify the grokking component. We verify all theoretical identities without fitted parameters in a synthetic model where every subspace and relaxation rate is computable in closed form. We further observe genuine delayed generalization in modular addition, where the measured delay follows the predicted scaling and the late-time relaxation agrees closely with the theoretical clock.
Taeyoung Kim
Center for AI and Natural Sciences Korea Institute for Advanced Study Seoul 02455, Republic of Korea
Delayed generalization (\ie~grokking) refers to the phenomenon in which a neural network fits its training data early in training but only begins to generalize after a prolonged delay, often through an abrupt transition. Despite extensive empirical study, its underlying mechanism remains poorly understood. In this work, we first theoretically characterize a shell--core topological configuration of the reachable solution space induced by Adam's optimization dynamics with weight-shrinkage regularization, supported by empirical evidence. This optimization-induced topological configuration gives rise to grokking. In model's parameter space, random initialization solutions concentrate on a thin outer spherical shell, enclosing another spherical shell of memorization solutions, which in turn contains a core corresponding to the generalization solutions. Leveraging stopping-time theory, we then analyze the geometry of this topological configuration and the solution transition time at which optimization trajectories escape the memorization manifold and first reach the boundary of the generalization manifold. Our theoretical analysis derives grokking scaling laws for the learning rate, batch size, and ℓ2 regularization coefficient, which are further validated through experiments and shown to recover results from prior literature.
Róisín Luo, Christian Gagné, Jonas Ngnawé +2
Research Ireland – Centre for Research Training in AI · University of Galway · Universit´e Laval +2