The study of wave-like propagation of information in nonlinear and dispersive media is a complex phenomenon. In this paper, we provide a new approach to studying this phenomenon, paying special attention to the nonlinear solitary wave problem of the Korteweg–De Vries (KdV) equation. Our proposed algorithm is based on the traveling wave transformation of the KdV equation, which reduces the dimensionality of the system, enabling us to obtain a highly accurate solution with fewer data. The proposed algorithm uses a Lie-group-based neural network trained via the Broyden–Fletcher–Goldfarb–Shanno (BFGS) optimization method. Our experimental results demonstrate that the proposed Lie-group-based neural network algorithm can simulate the behavior of the KdV equation with high accuracy while using fewer data. The effectiveness of our method is proved by examples.