The \(\big (\frac{G'}{G}\big )\) -expansion neural networks analytical method is proposed to solve nonlinear partial differential equations (NLPDEs), where \(G=G(\xi )\) satisfies a second order linear ordinary differential equation (ODE). The method integrates neural networks (NNs) models with symbolic computation to quickly obtain exact solutions for NLPDEs. Specifically, the \(\big (\frac{G'}{G}\big )\) derived from solutions of a linear ODE is innovatively employed as an activation function for NNs, establishing a new mathematical link between differential equations and deep learning. The output of NNs is obtained through feedforward computation, which is taken as a trial function for the NLPDEs. By introducing the novel activation function, the new trial functions for NLPDEs are derived. This method significantly improves computational efficiency and accuracy by combining the strong approximation capability of NNs with the high precision of symbolic computation. To demonstrate the effectiveness of the proposed method in solving NLPDEs, three numerical examples are investigated, including the Benjamin–Bona–Mahony–Peregrine–Burgers equation, the approximate long water wave equation, and the Carleman equation. The exact analytical solutions are expressed by the hyperbolic functions, the trigonometric functions and the rational functions. And some new solutions are obtained due to embedding the \(\big (\frac{G'}{G}\big )\) -expansion method into the NNs model. Three-dimensional plots, contour plots, and density plots are given to observe the dynamic characteristics of the obtained solutions. This study provides a new paradigm for solving NLPDEs, with broad potential applications in scientific and engineering fields.