Gradient-enhanced physics-informed neural networks based on transfer
  learning for inverse problems of the variable coefficient differential
  equations
We propose gradient-enhanced PINNs based on transfer learning (TL-gPINNs) for
inverse problems of the function coefficient discovery in order to overcome
deficiency of the discrete characterization of the PDE loss in neural networks
and improve accuracy of function feature description, which offers a new angle
of view for gPINNs. The TL-gPINN algorithm is applied to infer the unknown
variable coefficients of various forms (the polynomial, trigonometric function,
hyperbolic function and fractional polynomial) and multiple variable
coefficients simultaneously with abundant soliton solutions for the well-known
variable coefficient nonlinear Schr\"{o}odinger equation. Compared with the
PINN and gPINN, TL-gPINN yields considerable improvement in accuracy. Moreover,
our method leverages the advantage of the transfer learning technique, which
can help to mitigate the problem of inefficiency caused by extra loss terms of
the gradient. Numerical results fully demonstrate the effectiveness of the
TL-gPINN method in significant accuracy enhancement, and it also outperforms
gPINN in efficiency even when the training data was corrupted with different
levels of noise or hyper-parameters of neural networks are arbitrarily changed.
Shuning Lin, Yong Chen
Gradient-enhanced physics-informed neural networks based on transfer learning for inverse problems of the variable coefficient differential equations

###### Abstract.

We propose gradient-enhanced PINNs based on transfer learning (TL-gPINNs) for inverse problems of the function coefficient discovery in order to overcome deficiency of the discrete characterization of the PDE loss in neural networks and improve accuracy of function feature description, which offers a new angle of view for gPINNs. The TL-gPINN algorithm is applied to infer the unknown variable coefficients of various forms (the polynomial, trigonometric function, hyperbolic function and fractional polynomial) and multiple variable coefficients simultaneously with abundant soliton solutions for the well-known variable coefficient nonlinear Schrodinger equation. Compared with the PINN and gPINN, TL-gPINN yields considerable improvement in accuracy. Moreover, our method leverages the advantage of the transfer learning technique, which can help to mitigate the problem of inefficiency caused by extra loss terms of the gradient. Numerical results fully demonstrate the effectiveness of the TL-gPINN method in significant accuracy enhancement, and it also outperforms gPINN in efficiency even when the training data was corrupted with different levels of noise or hyper-parameters of neural networks are arbitrarily changed.

Keywords: TL-gPINN; transfer learning; variable coefficients; inverse problem.

## 1. Introduction

With the vigorous development of nonlinear science, nonlinear models have been applied in more and more fields [1, 2, 3, 4, 5], such as optical fiber communication, fluid mechanics, biophysics and information science. Among them, nonlinear evolution equations, especially the variable coefficient ones, are an important class of nonlinear models and have attracted widespread attention [6, 7, 8] since the model with variable-coefficients is often preferable and suitable in describing real phenomena in many physical and engineering situations. For example, variable coefficient nonlinear Schroodinger models plays an important role in the study of optical fiber system or the Rossby waves [9]. Variable coefficient higher-order nonlinear Schrodinger and the variable coefficient Hirota equation can be used to describe the femtosecond pulse propagation [10] and the certain ultrashort optical pulses propagating in a nonlinear inhomogeneous fiber [11], respectively. Besides, many classical methods in the field of integrable systems have been widely used to derive exact solutions of variable coefficient equations, e.g., auto-Backlund transformation [12, 13], the Riemann-Hilbert method [14], the Hirota bilinear method [15, 16, 17], the Darboux transformation [18, 19, 20], etc.

As early as the 1990s, the idea of solving partial differential equations (PDEs) by using the technique of neural networks was put forward [21]. However, limited by the level of science and technology at that time, it failed to get further development. With the explosive growth of computing resources, there has been renewed interest in researches of the numerical methods based on neural networks in recent years. This idea was revived by Raissi, Perdikaris and Karniadakis [22] in 2019, and the physics-informed neural network (PINN) method was proposed to solve forward and inverse problems involving nonlinear partial differential equations. Based on the universal approximation theorems of neural networks [23], it can accurately approximate functions with extraordinarily less data by embodying underlying physical constraints into neural networks. Due to its high accuracy and efficiency, the PINN method opens up a new approach for numerically solving nonlinear PDEs and immediately sets off a new research upsurge. On this foundation, variants and extensions targeted at different application scenarios also subsequently emerged in multitude, like fPINN [24] for solving fractional PDEs, NN-arbitrary polynomial chaos (NN-aPC) for solving stochastic problems [25], XPINN [26] and FBPINN [27] for multiscale problems, B-PINN [28] for forward and inverse PDE problems with noisy data, hp-VPINN [29] for rough solutions/input data such as singularities, steep solution, and sharp changes, etc. In addition, there have been many attempts to improve accuracy of the PINN method, such as locally adaptive activation functions with slope recovery [30], residual-based adaptive sampling [31, 32], gradient-enhanced PINN (gPINN) [33], PINN with multi-scale Fourier features [34] and so on. Overall, the framework of PINNs, a model integrating data and mathematical physics seamlessly, is groundbreaking and has had a significant impact on the field of scientific computing and beyond.

Integrable deep learning, a concept first brought forward by Chen, deals with the combination of deep neural networks with integrable systems. In 2020, Li and Chen [35, 36] pioneered the use of the PINNs method in the field of integrable systems. Later, the dynamic behavior of rogue wave solution for the nonlinear Schrodinger equation [37] was reproduced for the first time by PINN. Abundant localized wave solutions are also simulated including the rogue periodic wave solution for the Chen-Lee-Liu equation [38], vector localized waves for Manakov system [39], data-driven soliton solutions for the nonlocal Hirota equation [40] and so on. Then the framework of the PINN method is extended to solve the \((N+1)\)-dimensional initial-boundary value problem with \(2N+1\) hyperplane boundaries and is applied to
###### Abstract

We consider the problem of the stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PDEs) of a stochastic differential equation (PD) of a stochastic differential equation (PDEs) of a stochastic differential equation (PD
The first part gives a brief overview of physics-informed neural networks (PINNs), an effective tool in solving forward and inverse problems of partial differential equations.

Let's consider the general form of a \((N+1)\)-dimensional partial differential equation with parameters \(\mathbf{\lambda}\)

\[f\left(\mathbf{x},t;\frac{\partial u}{\partial x_{1}},\dots,\frac{\partial u}{ \partial x_{N}},\frac{\partial u}{\partial x_{1}^{2}};\dots,\frac{\partial^{2} u}{\partial x_{1}\partial x_{N}},\frac{\partial^{2}u}{\partial x_{1}\partial t}; \dots;\mathbf{\lambda}\right)=0,\quad\mathbf{x}=(x_{1},\cdots,x_{N})\in\Omega, \quad t\in[t_{0},t_{1}], \tag{2.1}\]

where \(u(\mathbf{x},t)\) is the solution and \(\Omega\) is a subset of \(\mathbb{R}^{N}\).

To solve the above PDE with the first kind of boundary condition (Dirichlet boundary condition)

\[\begin{cases}u(\mathbf{x},t_{0})=u_{0}(\mathbf{x}),&\forall\mathbf{x}\in \Omega\\ u(\mathbf{x},t)=\mathcal{B}(\mathbf{x},t),&\forall\mathbf{x}\in\partial \Omega,t\in[t_{0},t_{1}],\end{cases} \tag{2.2}\]

we construct a neural network of depth \(L\) consisting of one input layer, \(L-1\) hidden layers and one output layer. Suppose that the \(l\)th \((l=0,1,\cdots,L)\) layer has \(N_{l}\) neurons, and then the connection between layers can be achieved by the following affine transformation \(\mathcal{A}\) and activation function \(\sigma(\cdot)\)

\[\mathbf{x}^{l}=\sigma(\mathcal{A}_{l}(\mathbf{x}^{l-1}))=\sigma(\mathbf{w}^{l }\mathbf{x}^{l-1}+\mathbf{b}^{l}), \tag{2.3}\]

where \(\mathbf{w}^{l}\in\mathbb{R}^{N_{l}\times N_{l-1}}\) and \(\mathbf{b}^{l}\in\mathbb{R}^{N_{l}}\) denote the weight matrix and bias vector separately. Especially, the input is \(\mathbf{x}^{0}=(x_{1},\cdots,x_{N},t)\) and output \(\mathbf{o}(\mathbf{x}^{0},\mathbf{\Theta})\) is given by

\[\mathbf{o}(\mathbf{x}^{0},\mathbf{\Theta})=(\mathcal{A}_{L}\circ\sigma\circ \mathcal{A}_{L-1}\circ\cdots\circ\sigma\circ\mathcal{A}_{1})(\mathbf{x}^{0}), \tag{2.4}\]

which is used to approximate the solution \(u(\mathbf{x},t)\), and \(\mathbf{\Theta}=\left\{\mathbf{w}^{l},\mathbf{b}^{l}\right\}_{l=1}^{L}\) represents the trainable parameters of PINN. With the initial-boundary dataset \(\{\mathbf{x}_{u}^{i},t_{u}^{i},u_{i}^{i}\}_{i=1}^{N_{u}}\) and the set of collocation points of \(f(\mathbf{x},t)\), denoted by \(\{\mathbf{x}_{f}^{i},t_{f}^{i}\}_{i=1}^{N_{f}}\), the loss function can be defined to measure the difference between the predicted values and the true values of each iteration

\[MSE_{forward}=MSE_{u}+MSE_{f}, \tag{2.5}\]

where

\[MSE_{u}=\frac{1}{N_{u}}\sum_{i=1}^{N_{u}}|\widehat{u}(\mathbf{x}_{u}^{i},t_{ u}^{i})-u^{i}|^{2}, \tag{2.6}\]

\[MSE_{f}=\frac{1}{N_{f}}\sum_{i=1}^{N_{f}}|f(\mathbf{x}_{f}^{i},t_{f}^{i})|^{2}. \tag{2.7}\]

With regard to the inverse problem, namely, the situation that the parameters \(\mathbf{\lambda}\) are unknown, some extra measurements \(\{\mathbf{x}_{in}^{i},t_{in}^{i},u_{in}^{i}\}_{i=1}^{N_{u_{in}}}\) of the internal area should be obtained and utilized to define a new loss function to learn the unknown parameters \(\mathbf{\lambda}\)

\[MSE_{inverse}=MSE_{u}+MSE_{f}+MSE_{u_{in}}, \tag{2.8}\]

where

\[MSE_{u_{in}}=\frac{1}{N_{u_{in}}}\sum_{i=1}^{N_{u_{in}}}|\widehat{u}(\mathbf{ x}_{in}^{i},t_{in}^{i})-u_{in}^{i}|^{2}. \tag{2.9}\]

Later, a deep learning method, gradient-enhanced physics-informed neural networks (gPINNs) [33] was proposed for improving the accuracy and training efficiency of PINNs by leveraging gradient information of the PDE residual and embedding the gradient into the loss function. The basic idea of gPINNs is that it enforces the derivatives of the PDE residual \(f\) to be zero since \(f(\mathbf{x},t)\) is zero for any \(\mathbf{x}\) and \(t\), i.e.,

\[\nabla f(\mathbf{x})=\left(\frac{\partial f}{\partial x_{1}},\frac{\partial f }{\partial x_{2}},\cdots,\frac{\partial f}{\partial x_{N}},\frac{\partial f }{\partial t}\right)=\mathbf{0},\quad\mathbf{x}\in\Omega,\quad t\in[t_{0},t_ {1}]. \tag{2.10}\]

Then, based on the set of residual points \(\{\mathbf{x}_{g}^{i},t_{g}^{i}\}_{i=1}^{N_{g}}\) for the derivatives, the loss functions of the forward and inverse problems are separately defined as

\[MSE_{forward}^{g}=MSE_{u}+MSE_{f}+MSE_{g}, \tag{2.11}\] \[MSE_{inverse}^{g}=MSE_{u}+MSE_{f}+MSE_{u_{in}}+MSE_{g}, \tag{2.12}\]

where

\[MSE_{g}=\frac{1}{N_{g}}\left(\sum_{j=1}^{N}\sum_{i=1}^{N_{g}}|\frac{\partial f }{\partial x_{j}}(\mathbf{x}_{g}^{i},t_{g}^{i})|^{2}+\sum_{i=1}^{N_{g}}|\frac{ \partial f}{\partial t}(\mathbf{x}_{g}^{i},t_{g}^{i})|^{2}\right). \tag{2.13}\]

The set of residual points \(\{\mathbf{x}_{g}^{i},t_{g}^{i}\}_{i=1}^{N_{g}}\) for the derivatives can be different from the set of collocation points \(\{\mathbf{x}_{f}^{i},t_{f}^{i}\}_{i=1}^{N_{f}}\) of \(f(\mathbf{x},t)\), but we usually choose the same set for convenience.
### Gradient-enhanced PINNs based on transfer learning for data-driven variable coefficients

For the inverse PDE problems with the aid of PINNs and its variants, the existing researches are mainly focused on the parameter discovery rather than the function discovery. Here, we propose the gradient-enhanced PINNs based on transfer learning (TL-gPINNs) to infer variable coefficients.

\(\bullet\)**Motivation**

For the inverse problem of identifying the variable coefficients, we aim to improve the neural network method to enhance prediction precision.

Consider the \((N+1)\)-dimensional PDE with variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\)

\[f\left(\mathbf{x},t;\frac{\partial u}{\partial x_{1}},\dots,\frac{\partial u}{ \partial x_{N}},\frac{\partial u}{\partial t};\frac{\partial^{2}u}{\partial x _{1}^{2}},\dots,\frac{\partial^{2}u}{\partial x_{1}\partial x_{N}},\frac{ \partial^{2}u}{\partial x_{1}\partial t};\dots;\mathbf{\Lambda}\right)=0,\quad \mathbf{x}=(x_{1},\cdots,x_{N})\in\Omega,\quad t\in[t_{0},t_{1}]. \tag{2.14}\]

Obviously, neural networks are constrained by the PDE loss \(MSE_{f}=\frac{1}{N_{f}}\sum_{i=1}^{N_{f}}|f(\mathbf{x}_{f}^{i},t_{f}^{i})|^{2}\) to satisfy the equation above. In other words, PINNs enforce the PDE residual \(f\) to be \(0\) to make the data-driven variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\) close to the exact ones.

Since this constraint is characterized by discrete points \(\{\mathbf{x}_{f}^{i},t_{f}^{i}\}_{i=1}^{N_{f}}\), it can only ensure that values of the obtained \(\mathbf{\Lambda}(\mathbf{x},t)\) are close to the true ones at these selected points. However, even if the predicted values of the variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\) are equal to the true values at these discrete points, the values of the identified \(\mathbf{\Lambda}(\mathbf{x},t)\) outside the given point set \(\{\mathbf{x}_{f}^{i},t_{f}^{i}\}_{i=1}^{N_{f}}\) have little direct effect on \(MSE_{f}\) and thus the data-driven variable coefficients may be a considerable departure from the exact ones.

Consequently, it is biased and inaccurate to characterize a function (i.e., the unknown variable coefficient here) solely by the values at discrete points. It is necessary to introduce much more rigorous constraints considering the partial derivative values of variable coefficients from the perspective of enhancing gradients. Due to the lack of partial derivative values of variable coefficient at configuration points, a way with similar effect is to enforce the partial derivatives of it to satisfy the corresponding equation. Then residuals of equations satisfied by not only variable coefficients but also the partial derivatives of them should be taken into account in the design of loss functions. Specifically, neural networks enforce the residual of equations satisfied by both variable coefficients and the partial derivatives to be \(0\) to require the values of them to approximate the true ones at the discrete points. It happens to coincide with gradient-enhanced PINNs, the idea of which stems from that derivatives of the zero-valued function, (i.e., the PDE residual \(f\)) should also be \(0\).

Note that the equations satisfied by the partial derivatives of variable coefficients \((\frac{\partial\mathbf{\Lambda}}{\partial t},\frac{\partial\mathbf{\Lambda}} {\partial x_{1}},\frac{\partial\mathbf{\Lambda}}{\partial x_{2}},\cdots)\) can be derived by direct differentiation with respect to the equation satisfied by variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\) themselves. Although our perspective and concerned aspects are different from that of gPINNs, the implementation method is the same.

Ulteriorly, we improve the original gPINNs by means of the idea of transfer learning since the introduction of additional constraints on gradients probably gives rise to low efficiency.

\(\bullet\)**Procedure**

By fully leveraging the combined advantages of gradient-enhanced effect and transfer learning, TL-gPINN is proposed.

The followings are the main steps involved:

Firstly, the traditional PINNs are constructed to obtain the data-driven variable coefficients after defining the following loss function

\[MSE_{inverse}=MSE_{u}+MSE_{f}+MSE_{u_{in}}+MSE_{\mathbf{\Lambda}}, \tag{2.15}\]

where

\[MSE_{u}=\frac{1}{N_{u}}\sum_{i=1}^{N_{u}}|\widehat{u}(\mathbf{x}_{u}^{i},t_{ u}^{i})-u^{i}|^{2}, \tag{2.16}\]

\[MSE_{f}=\frac{1}{N_{f}}\sum_{i=1}^{N_{f}}|f(\mathbf{x}_{f}^{i},t_{f}^{i})|^{2}, \tag{2.17}\]

\[MSE_{u_{in}}=\frac{1}{N_{u_{in}}}\sum_{i=1}^{N_{u_{in}}}|\widehat{u}(\mathbf{ x}_{in}^{i},t_{in}^{i})-u_{in}^{i}|^{2}, \tag{2.18}\]

\[MSE_{\mathbf{\Lambda}}=\frac{1}{N_{\mathbf{\Lambda}}}\sum_{i=1}^{N_{\mathbf{ \Lambda}}}|\widehat{\mathbf{\Lambda}}(\mathbf{x}_{\mathbf{\Lambda}}^{i},t_{ \mathbf{\Lambda}}^{i})-\mathbf{\Lambda}^{i}|^{2}, \tag{2.19}\]

and the set \(\{\mathbf{x}_{\mathbf{\Lambda}}^{i},t_{\mathbf{\Lambda}}^{i},\mathbf{\Lambda}^{ i}\}_{i=1}^{N_{\mathbf{\Lambda}}}\) denotes the boundary training data of the variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\). In particular, the networks of the solution \(u(\mathbf{x},t)\) and the variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\) are set to be separate and named as the trunk and branch networks respectively in order to eliminate mutual influence. What's more, with regard to the network of variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\), the width and depth of it are usually narrower and shallower than that of the solution \(u(\mathbf{x},t)\) since the function expression of variable coefficient is simpler in general.
Then at the end of the iteration process, the weight matrixes and bias vectors of PINNs are saved to initialize the gradient-enhanced PINNs with the advantage of transfer learning. The mean squared error loss function of gPINNs is given by

\[MSE_{inverse}^{g}=MSE_{u}+MSE_{f}+MSE_{u_{in}}+MSE_{\mathbf{A}}+MSE_{g}, \tag{2.20}\]

where

\[MSE_{g}=\frac{1}{N_{g}}\left(\sum_{j=1}^{N}\sum_{i=1}^{N_{g}}|\frac{\partial f }{\partial x_{j}}(\mathbf{x}_{g}^{i},t_{g}^{i})|^{2}+\sum_{i=1}^{N_{g}}|\frac{ \partial f}{\partial t}(\mathbf{x}_{g}^{i},t_{g}^{i})|^{2}\right). \tag{2.21}\]

Based on MSE criteria, the parameters of gPINNs are optimized and we finally obtain the data-driven variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\).

To better understand our new angle of view for gPINNs, we take the inverse problem of identifying the time-varying variable coefficient \(\Lambda(t)\) as an example to illustrate the effect of gradient information on the optimization of loss (PDE residual) and inference of time-varying variable coefficient. The corresponding sketch map is displayed in Fig. 1. Wherein, the value of the predicted variable coefficient will close to that of the exact one at the selected point if the term of PDE residual \(MSE_{f}\) is considered solely. The derivative \(\frac{\partial\hat{\Lambda}(t)}{\partial t}\) of the predicted variable coefficient \(\hat{\Lambda}(t)\) is constrained to approximate \(\frac{\partial\Lambda(t)}{\partial t}\) at the given point due to the incorporation of the gradient term \(MSE_{g}\), which reflects the equation information satisfied by the derivative of variable coefficient. Then the combined effect is remarkable and it enables the predicted \(\hat{\Lambda}(t)\) to tend to the exact \(\Lambda(t)\).

Our method uses a two-step optimization strategy and gradually increases the difficulty, resulting in better results than the direct one-step optimization, i.e., the original gPINN method. The process draft of the TL-gPINN method is sketched and shown in Fig. 2.

Partial derivatives of higher orders, of course, can be considered by adding the loss of \(\frac{\partial^{2}f}{\partial x_{i}\partial x_{j}},\frac{\partial^{2}f}{ \partial x_{i}\partial t}\) and so on into the term \(MSE_{g}\). However, excessive constraints may lead to high training costs and low efficiency, which is the reason why the transfer learning technique is introduced here.

The difficulty of the inverse problem lies in that the information about variable coefficients is insufficient and meanwhile, the properties or physical laws (if any) of variable coefficients remain to be discovered, which can be used to achieve higher accuracy. Therefore, we should make full use of existing information. For example, the equations satisfied by the partial derivatives of variable coefficients (\(\frac{\partial\mathbf{A}}{\partial t},\frac{\partial\mathbf{A}}{\partial x_{1 }},\frac{\partial\mathbf{A}}{\partial x_{2}},\cdots\)) can be derived by differentiating the equation satisfied by variable coefficients \(\mathbf{\Lambda}(\mathbf{x},t)\) themselves. Thus, the gradient-enhanced PINN can be served as an effective tool to improve the accuracy of variable coefficients by fully utilizing the information of equations satisfied by the derivatives of variable coefficients. Further, TL-gPINNs can improve the accuracy and training efficiency of the original gPINNs.

All the codes in this article are based on Python 3.7 and Tensorflow 1.15, and the presented numerical experiments are run on a DELL Precision 7920 Tower computer with 2.10 GHz 8-core Xeon Silver 4110 processor, 64 GB memory and 11 GB NVIDIA GeForce GTX 1080 Ti video card.

Figure 1. (Color online) The effect of gPINN compared to PINN on the optimization of loss (PDE residual) and inference of time-varying variable coefficient \(\Lambda(t)\).
## 3. Applications in the variable coefficient nonlinear Schroodinger equation

The nonlinear Schroodinger (NLS) equation, one of the most classical equations in integrable systems, is commonly used in the field of optical fiber communication to describe the propagation of optical solitons [46, 47]. When it comes to inhomogeneous optical fibers, it is believed that the variable coefficient Schroodinger equation is more accurate and realistic than the standard one since variable coefficients can reflect the inhomogeneities of media and nonuniformities of boundaries [48]. The research on variable coefficient NLS-type models has achieved very fruitful results [49, 50, 51, 52, 53], like the groundbreaking work of Serkin et al. [54]. Meanwhile, solutions of the variable coefficient NLS-type equations are also obtained by using powerful means, such as the Hirota bilinear method [55, 56], the Darboux transformation [57], the Riemann-Hilbert approach [58] and so on.

In this part, we discuss the mathematical model which can be used to describe the optical fiber system or the Rossby waves [9], i.e., the variable coefficient nonlinear Schroodinger (vcNLS) equation

\[\mathrm{i}A_{t}+\alpha(t)A_{xx}+\beta(t)A+\gamma(t)|A|^{2}A=0, \tag{3.1}\]

where the variable coefficient \(\alpha(t)\) denotes the dispersion effect and \(\gamma(t)\) denotes the Kerr nonlinearity. When considering the inhomogeneities, the varying dispersion and Kerr nonlinearity are of practical importance in the optical-fiber transmission system.

Under the assumption that the amplitude \(A(x,t)\) has the transformation

\[A(x,t)=\mathrm{e}^{\mathrm{i}\int\beta(t)dt}\frac{h(x,t)}{g(x,t)}, \tag{3.2}\]

Figure 2. (Color online) Schematic diagram of the TL-gPINN algorithm.
the one-soliton solution can be derived by the Hirota method [56]

\[A(x,t)=\mathrm{e}^{\mathrm{i}\int\beta(t)dt}\frac{\mathrm{e}^{\theta}}{1+\frac{ \gamma(t)}{2\alpha(t)(k+k^{\prime})^{2}}\mathrm{e}^{\theta+\theta^{*}}}, \tag{3.3}\]

where

\[\phi(t)=\mathrm{i}\int\alpha(t)k^{2}dt, \tag{3.4}\]

\[\theta=kx+\phi(t)+\eta, \tag{3.5}\]

\[\theta^{*}=k^{*}x+\phi(t)+\eta. \tag{3.6}\]

Here, \(k\) is a complex constant and \(\eta\) is a real constant.

The PINN, gPINN and TL-gPINN methods are applied to infer the unknown time-varying variable coefficients of the vcNLS equation. To avoid repetition, hyper-parameters of neural networks used for each case are listed in Table 1 and other parameters are selected as \(k=1+\mathrm{i},\eta=0\).

### Data-driven discovery of single variable coefficient

The general aim is to utilize TL-gPINNs to solve the inverse problem for the discovery of function coefficient \(\gamma(t)\), and systematically compare the performance of three methods (PINNs, gPINNs and TL-gPINNs) under the circumstances that the other two variable coefficients \(\alpha(t)\) and \(\beta(t)\) are already known.

Several types of time-varying variable coefficients \(\gamma(t)\) in common use are provided, such as linear, quadratic, sine, hyperbolic tangent and fractional functions: \(\gamma(t)=t,t^{2},\sin(t),\tanh(t),\frac{1}{1+t^{2}}\) separately.

#### 3.1.1. Data-driven discovery of linear variable coefficient \(\gamma(t)\)

In this part, we take \(\alpha(t)=\frac{t}{2},\beta(t)=\frac{t}{5}\) and choose \([x_{0},x_{1}]=[-4,4],[t_{0},t_{1}]=[-4,4]\) as the training region.

In consideration of the complexity of the structure of complex-valued solution \(A(x,t)\), we decompose it into real part \(u(x,t)\) and imaginary part \(v(x,t)\), i.e., \(A(x,t)=u(x,t)+\mathrm{i}v(x,t)\). After substituting it into the governing equation

\[f:=\mathrm{i}A_{t}+\alpha(t)A_{xx}+\beta(t)A+\gamma(t)|A|^{2}A=0, \tag{3.7}\]

we have

\[f_{u}:=-v_{t}+\alpha(t)u_{xx}+\beta(t)u+\gamma(t)(u^{2}+v^{2})u, \tag{3.8}\]

\[f_{v}:=u_{t}+\alpha(t)v_{xx}+\beta(t)v+\gamma(t)(u^{2}+v^{2})v. \tag{3.9}\]

Define the loss function of PINNs for the inverse problem as follows:

\[MSE_{inverse}=MSE_{A}+MSE_{f}+MSE_{A_{in}}+MSE_{\gamma}, \tag{3.10}\]

where

\[MSE_{A}=MSE_{u}+MSE_{v},\quad MSE_{f}=MSE_{f_{u}}+MSE_{f_{v}},\quad MSE_{A_ {in}}=MSE_{u_{in}}+MSE_{v_{in}}, \tag{3.11}\]

\[MSE_{u}=\frac{1}{N_{A}}\sum_{i=1}^{N_{A}}|\widehat{u}(x_{A}^{i},t_{A}^{i})-u^ {i}|^{2}, \tag{3.12}\]

\[MSE_{v}=\frac{1}{N_{A}}\sum_{i=1}^{N_{A}}|\widehat{v}(x_{A}^{i},t_{A}^{i})-v^ {i}|^{2}, \tag{3.13}\]

\[MSE_{f_{u}}=\frac{1}{N_{f}}\sum_{i=1}^{N_{f}}|f_{u}(x_{f}^{i},t_{f}^{i})|^{2}, \tag{3.14}\]

\begin{table}
\begin{tabular}{c|c c c c c c} \hline \multirow{2}{*}{Section} & \multicolumn{4}{c|}{Variable coefficients} & Trunk network & Branch network \\ \cline{2-7}  & Fixed & Inferred & Depth & Width & Depth & Width \\ \hline
3.1.1 & \(\alpha(t)=\frac{t}{2},\beta(t)=\frac{t}{5}\) & \(\gamma(t)=t\) & 8 & 40 & 4 & 30 \\
3.1.2 & \(\alpha(t)=\frac{t}{2},\beta(t)=\frac{t}{5}\) & \(\gamma(t)=t^{2}\) & 8 & 40 & 4 & 30 \\
3.1.3 & \(\alpha(t)=\sin(t),\beta(t)=\frac{t}{5}\) & \(\gamma(t)=\sin(t)\) & 8 & 40 & 4 & 30 \\
3.1.4 & \(\alpha(t)=\tanh(t),\beta(t)=\frac{t}{5}\) & \(\gamma(t)=\tanh(t)\) & 8 & 40 & 4 & 30 \\
3.1.5 & \(\alpha(t)=\frac{1}{2(1+t^{2})},\beta(t)=\frac{t}{5}\) & \(\gamma(t)=\frac{1}{1+t^{2}}\) & 8 & 40 & 4 & 30 \\
3.2.1 & \(\alpha(t)=\sin(t)\) & \(\beta(t)=\frac{t}{5},\gamma(t)=\sin(t)\) & 8 & 40 & 4 & 30 \\
3.2.2(1) & - & \(\alpha(t)=\frac{t}{2},\beta(t)=\frac{t}{5},\gamma(t)=t\) & 8 & 40 & 2 & 10 \\
3.2.2(2) & - & \(\alpha(t)=\frac{1}{2(1+t^{2})},\beta(t)=\frac{t}{5},\gamma(t)=\frac{1}{1+t^{2}}\) & 8 & 40 & 4 & 10 \\ \hline \end{tabular}
\end{table}
Table 1. Hyper-parameters used for each case
\[MSE_{f_{u}}=\frac{1}{N_{f}}\sum_{i=1}^{N_{f}}|f_{v}(x_{f}^{i},t_{f}^{i})|^{2}, \tag{3.15}\]

\[MSE_{u_{in}}=\frac{1}{N_{A_{in}}}\sum_{i=1}^{N_{A_{in}}}|\widehat{u}(x_{in}^{i}, t_{in}^{i})-u_{in}^{i}|^{2}, \tag{3.16}\]

\[MSE_{v_{in}}=\frac{1}{N_{A_{in}}}\sum_{i=1}^{N_{A_{in}}}|\widehat{v}(x_{in}^{i },t_{in}^{i})-v_{in}^{i}|^{2}, \tag{3.17}\]

\[MSE_{\gamma}=\frac{1}{N_{\gamma}}\sum_{i=1}^{N_{\gamma}}|\widehat{\gamma}(t_{ \gamma}^{i})-\gamma^{i}|^{2}=|\widehat{\gamma}(t_{0})-\gamma^{0}|^{2}. \tag{3.18}\]

Here, \(\{x_{A}^{i},t_{A}^{i},u^{i},v^{i}\}_{i=1}^{N_{A}}\) and \(\{x_{in}^{i},t_{in}^{i},u^{i},v^{i}\}_{i=1}^{N_{A_{in}}}\) denote the training dataset consisting of initial-boundary points and internal points separately. Correspondingly, \(\{\widehat{u}(x_{A}^{i},t_{A}^{i}),\widehat{v}(x_{A}^{i},t_{A}^{i})\}_{i=1}^{ N_{A}}\) and \(\{\widehat{u}(x_{in}^{i},t_{in}^{i}),\widehat{v}(x_{in}^{i},t_{in}^{i})\}_{i=1} ^{N_{A_{in}}}\) are the predicted values. In order to calculate \(\{f_{u}(x_{f}^{i},t_{f}^{i}),f_{v}(x_{f}^{i},t_{f}^{i})\}_{i=1}^{N_{f}}\), the derivatives of the networks \(u\) and \(v\) with respect to time \(t\) and space \(x\) are derived by automatic differentiation [59]. Considering that the unknown time-varying variable coefficient \(\gamma(t)\) is independent of space \(x\) and the objective \(\gamma(t)\) takes the form of linear function, we take \(N_{\gamma}=1\) and choose \(\{t_{0},\gamma^{0}\}\) as the training data.

Similarly, after additionally embedding the term of gradient-enhanced information into the loss function of PINNs, the mean squared error function of gPINNs is given by

\[MSE_{inverse}^{g}=MSE_{A}+MSE_{f}+MSE_{A_{in}}+MSE_{\gamma}+MSE_{g}, \tag{3.19}\]

where

\[MSE_{g}=MSE_{g_{u}}+MSE_{g_{v}}, \tag{3.20}\]

\[MSE_{g_{u}}=\frac{1}{N_{g}}\left(\sum_{i=1}^{N_{g}}|\frac{\partial f_{u}}{ \partial t}(x_{g}^{i},t_{g}^{i})|^{2}\right), \tag{3.21}\]

\[MSE_{g_{v}}=\frac{1}{N_{g}}\left(\sum_{i=1}^{N_{g}}|\frac{\partial f_{v}}{ \partial t}(x_{g}^{i},t_{g}^{i})|^{2}\right), \tag{3.22}\]

\[\frac{\partial f_{u}}{\partial t}=-v_{tt}+\alpha(t)_{t}u_{xx}+\alpha(t)u_{xxt }+\beta(t)_{t}u+\beta(t)u_{t}+\gamma(t)_{t}(u^{2}+v^{2})u+\gamma(t)(2uu_{t}+2 vv_{t})u+\gamma(t)(u^{2}+v^{2})u_{t}, \tag{3.23}\]

\[\frac{\partial f_{v}}{\partial t}=u_{tt}+\alpha(t)_{t}v_{xx}+\alpha(t)v_{xxt }+\beta(t)_{t}v+\beta(t)v_{t}+\gamma(t)_{t}(u^{2}+v^{2})v+\gamma(t)(2uu_{t}+2 vv_{t})v+\gamma(t)(u^{2}+v^{2})v_{t}. \tag{3.24}\]

For the time-varying variable coefficient \(\gamma(t)\), the gradient-enhanced effect of \(t\) is solely considered here by adding mean squared errors involving the partial derivatives of the governing functions with respect to time \((\frac{\partial f_{u}}{\partial t}\) and \(\frac{\partial f_{v}}{\partial t})\). Besides, the functions \(f_{u}\) and \(f_{v}\) only reflect the value of variable coefficient itself while \(\frac{\partial f_{u}}{\partial t}\) and \(\frac{\partial f_{v}}{\partial t}\) embody the extra derivative information of \(\gamma(t)\), i.e., the information of equations satisfied by \(\gamma_{t}\).

With the aid of the MATLAB software, the spatial region \([-4,4]\) and the temporal region \([-4,4]\) are divided into \(N_{x}=513\) and \(N_{t}=201\) discrete equidistance points, respectively. Thus, the reference one-soliton solution

\[A(x,t)=\frac{\mathrm{e}^{\frac{\mathrm{i}\mathrm{\gamma}t^{2}}{\mathrm{e}^{(1+ 1)x-\frac{t^{2}}{\gamma}}}}}{1+\frac{\mathrm{e}^{-x^{2}+2x}}{4}}, \tag{3.25}\]

is discretized into \(513\times 201\) data points in the given spatiotemporal domain. Then \(N_{A}=200\) points are randomly selected from the initial-boundary dataset and \(N_{A_{in}}=2000\) points from interior point set. By means of the Latin hypercube sampling method [60], \(N_{f}=N_{g}=40000\) collocation points are also sampled.

The neural network of the complex valued solution \(A(x,t)\) (called as the trunk network) consists of one input layer, 7 hidden layers with 40 neurons per hidden layer and one output layer. The output layer has 2 neurons to learn the real part \(u(x,t)\) and imaginary part \(v(x,t)\). Given that the function expression of variable coefficient is simpler than that of the solution, we construct the branch network consisting of one input layer, 3 hidden layers as well as one output layer with one neuron to obtain the data-driven variable coefficient \(\gamma(t)\) and each hidden layer has 30 neurons. The linear activation function is used in the branch network while \(tanh\) function is selected as the activation function in the trunk network. Weights of the neural networks are initialized with Xavier initialization [61]. In addition, we apply L-BFGS algorithm [62] to minimize the value of the loss function by optimizing the parameters of the neural networks.
To evaluate the performance of three methods (PINNs, gPINNs, TL-gPINNs), we calculate the absolute error and relative error of \(\gamma(t)\): the mean absolute error (\(MAE\)) and relative \(\mathbb{L}_{2}\) error (\(RE\)) of the variable coefficient \(\gamma(t)\)

\[MAE_{\gamma} =\frac{1}{N_{t}^{\prime}}\sum_{k=0}^{N_{t}^{\prime}-1}|\widehat{ \gamma}(t_{0}+k\frac{t_{1}-t_{0}}{N_{t}^{\prime}-1})-\gamma^{k}|, \tag{3.26}\] \[RE_{\gamma} =\frac{\sqrt{\sum_{k=0}^{N_{t}^{\prime}-1}|\widehat{\gamma}(t_{0 }+k\frac{t_{1}-t_{0}}{N_{t}^{\prime}-1})-\gamma^{k}|^{2}}}{\sqrt{\sum_{k=0}^{ N_{t}^{\prime}-1}|\gamma^{k}|^{2}}}, \tag{3.27}\]

after choosing the corresponding parameter as \(N_{t}^{\prime}=500\).

Firstly, the original PINNs is applied. Then, we save the weight matrixes and bias vectors of PINNs at the end of the iteration process to initialize corresponding parameters of gPINNs. After 1862.3727 seconds, the relative \(\mathbb{L}_{2}\) errors of the real part \(u\), the imaginary part \(v\) and the modulus \(|A|\) are 1.331004e-03, 1.407320e-03 and 9.441619e-04 separately. Besides, the mean absolute error and relative \(\mathbb{L}_{2}\) error of the variable coefficient \(\gamma(t)\) are: 1.915842e-05 and 9.511436e-06. Obviously, the training by gPINNs is based on training results of PINNs instead of training from scratch, which helps to accelerate convergence to the approximate optimal solution and variable coefficient.

Ultimately, the unknown variable coefficient \(\gamma(t)\) is learned simultaneously with the one-soliton solution \(A(x,t)\) by TL-gPINNs. Density diagrams of the data-driven one-soliton solution, comparison between the predicted solution and exact solution as well as the evolution plots are shown in Fig. 3. It implies there is little difference between the exact solution and the predicted one. Fig. 4 (a) is a double coordinate plot, where the solid blue line and the dashed red line corresponding to the left coordinate axis represent the exact and predicted variable coefficient \(\gamma(t)\) respectively while the curve of the absolute error is drawn with black dotted line corresponding to the right one. Obviously, the curve of the absolute error exhibits a characteristic of linear variation, and the error is close to 0 at the initial moment since the data of \(\gamma(t)\) at \(t_{0}=-4\) is provided and the linear activation function is selected in the branch network. The predicted 3D plot of the soliton solution with a parabolic shape for the vcNLS equation are shown in Fig. 4 (b). From the above figures, it can be intuitively seen that the experimental results of \(\gamma(t)\) are in good agreement with the theoretical ones.

For intuitive comparison of the prediction accuracy of different methods, the error reduction rate (\(ERR\)) can be obtained according to the mean absolute error and relative \(\mathbb{L}_{2}\) error achieved by PINNs and gPINNs (TL-gPINNs)

\[ERR_{1} =\frac{MAE_{\gamma}^{PINNs}-MAE_{\gamma}^{new}}{MSE_{\gamma}^{ \prime PINNs}}, \tag{3.28}\] \[ERR_{2} =\frac{RE_{\gamma}^{PINNs}-RE_{\gamma}^{new}}{RE_{\gamma}^{ \prime PINNs}}, \tag{3.29}\]

where 'new' can be replaced by 'gPINNs' and 'TL-gPINNs'.

Finally, the contrast in respect of efficiency and accuracy is presented in Table 2, including the elapsed time, mean absolute error, relative \(\mathbb{L}_{2}\) error and error reduction rates.

#### 3.1.2 Data-driven discovery of quadratic variable coefficient \(\gamma(t)\).

Figure 3: (Color online) One-soliton solution \(A(x,t)\) of the vcNLS equation by TL-gPINNs: (a) The density diagrams and comparison between the predicted solutions and exact solutions at the three temporal snapshots of \(|A(x,t)|\); (b) The error density diagram of \(|A(x,t)|\).
Here, we fix \(\alpha(t)=\frac{t^{2}}{2},\beta(t)=\frac{t}{5}\) and our objective function is \(\gamma(t)=t^{2}\) based on the dataset of the corresponding solution \(A(x,t)\) for the variable coefficient nonlinear Schroodinger equation:

\[A(x,t)=\frac{\mathrm{e}^{\frac{\mathrm{i}}{\mathrm{i}\hbar}t^{2}}\mathrm{e}^{(1 +x)-\frac{t^{3}}{\hbar}}}{1+\frac{\mathrm{e}^{2x}-\frac{2t^{3}}{\hbar}}{4}}. \tag{3.30}\]

Since the functional form of the target variable coefficient \(\gamma(t)\) is quadratic and no longer linear as in Sec. 3.1.1, we add sampling data of it and change the term measuring the difference between the predicted values and the true values of \(\gamma(t)\) into

\[MSE_{\gamma}=\frac{1}{2}\left(|\widehat{\gamma}(t_{0})-\gamma^{0}|^{2}+| \widehat{\gamma}(t_{1})-\gamma^{1}|^{2}\right). \tag{3.31}\]

But apart from that, the loss functions of PINNs and gPINNs (TL-gPINNs) are consistent with the previous subsection.

Obviously, \(N_{\gamma}=2\) here and then the training region is selected as \([x_{0},x_{1}]\times[t_{0},t_{1}]=[-4,4]\times[-2,2]\). After exploiting the same data discretization method, we divide the spatial region \([x_{0},x_{1}]=[-4,4]\) into \(N_{x}=513\) discrete equidistance points and the time region \([t_{0},t_{1}]=[-2,2]\) into \(N_{t}=201\) discrete equidistance points. The initial-boundary dataset (\(N_{A}=200\)) and the internal point set (\(N_{A_{in}}=2000\)) are sampled randomly from \(513\times 201\) data points of the solution \(A(x,t)\) and extract \(N_{f}=N_{g}=40000\) collocation points via the Latin hypercube sampling method.

We firstly initialize weights of PINNs with Xavier initialization. A 7-hidden-layer feedforward neural network with 40 neurons per hidden layer and a 3-hidden-layer feedforward neural network with 30 neurons per hidden layer are constructed to learn the one soliton solution and the variable coefficient \(\gamma(t)\) of the vNLS equation, respectively. We use the hyperbolic tangent (tanh) activation function to add nonlinear factors into neural networks. At the end of the iteration process, the parameter data of PINNs is stored and then we use the saved data to fine-tune gPINNs with the same structure by changing the loss function into (3.19).

In about 2293.3249 seconds, the data-driven solution of the vcNLS equation is obtained by gPINNs based on transfer learning (TL-gPINNs) and the relative \(\mathbb{L}_{2}\) errors of the real part \(u\), the imaginary part \(v\) and the modulus \(|A|\) are 1.336860e-03, 1.452912e-03 and 8.587186e-04. Simultaneously, the variable coefficient \(\gamma(t)\) is successfully inferred with the mean absolute error of 3.100830e-03 and relative \(\mathbb{L}_{2}\) error of 2.163681e-03. Fig. 5 displays the exact, learned and error density diagrams as well as evolution plots of one-soliton solution at different time points \(t=-1.5,0,1.5\). In Fig. 6, the curve plots of the predicted and the exact variable coefficient \(\gamma(t)\), the absolute error and the predicted 3D graph of the cubic soliton solution for the vcNLS equation are plotted. As can be seen from these diagrams and performance comparison of three methods shown in Table 3, TL-gPINN is capable of correctly identifying the unknown variable coefficient \(\gamma(t)\) and learning the cubic soliton solution with very high accuracy while gPINN doesn't work as expected.

\begin{table}
\begin{tabular}{c|c|c|c} \hline \hline
**ResultsMethod** & PINNs & gPINNs & TL-gPINNs \\ \hline Elapsed time (s) & 302.1032 & 2579.5674 & 1862.3727 \\ \hline \(MAE_{\gamma}\) & 3.438509e-05 & 2.405417e-05 & 1.915842e-05 \\ \hline \(RE_{\gamma}\) & 1.732523e-05 & 1.199509e-05 & 9.511436e-06 \\ \hline \(ERR_{1}\) & - & 30.04\% & 44.28\% \\ \hline \(ERR_{2}\) & - & 30.77\% & 45.10\% \\ \hline \hline \end{tabular}
\end{table}
Table 2. Performance comparison of three methods: the elapsed time, mean absolute errors and relative \(\mathbb{L}_{2}\) errors of the linear variable coefficient \(\gamma(t)\) as well as error reduction rates.

Figure 4. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) The absolute error and comparison between the predicted and exact variable coefficient \(\gamma(t)\); (b) The three-dimensional plot of the data-driven one-soliton solution \(|A(x,t)|\).
#### 3.1.3. Data-driven discovery of sine variable coefficient \(\gamma(t)\)

After fixing \(\alpha(t)=\sin(t),\beta(t)=\frac{t}{5}\), we aim to infer the unknown \(\gamma(t)\) in the variable coefficient nonlinear Schroodinger equation based on the solution data:

\[A(x,t)=\frac{\mathrm{e}^{\frac{\mathrm{e}^{\frac{\mathrm{i}}{\hbar}\ell^{2}} \mathrm{e}^{(1+\mathrm{i})x+2\cos(t)}}{1+\frac{\mathrm{e}^{\frac{\mathrm{i}}{ \hbar}\ell^{2}+\mathrm{e}^{\mathrm{i}}\cos(t)}}{8}}}. \tag{3.32}\]

For simplicity, we confine our sampling and training in a rectangular region \((x,t)\in[-4,4]\times[-5,5]\). To generate a dataset for this example, we choose \(N_{A}=200\) points from the initial-boundary dataset and \(N_{A_{in}}=2000\) points from interior point set at random after equidistant discretization. In addition, we employ the Latin hypercube sampling method to select \(N_{f}=N_{g}=40000\) collocation points.

Similarly, we also establish the fully-connected PINNs with Xavier initialization at first and proceed by adopting gPINNs with the advantage of transfer learning. The structure of networks, including the width and depth, activation function, definition of loss functions as well as the optimization algorithm, is the same as the previous subsection.

Dynamic behaviors of the soliton solution \(A(x,t)\) and variable coefficient \(\gamma(t)\) inferred by TL-gPINNs are shown in Fig.7 and Fig.8, which contain comparison between the predicted solutions and exact ones, the three-dimensional

\begin{table}
\begin{tabular}{c|c|c|c} \hline \hline
**ResultsMethod** & PINNs & gPINNs & TL-gPINNs \\ \hline Elapsed time (s) & 789.8311 & 3133.7038 & 2293.3249 \\ \hline \(MAE_{\gamma}\) & 4.211790e-03 & 1.072530e-02 & 3.100830e-03 \\ \hline \(RE_{\gamma}\) & 3.003559e-03 & 7.299052e-03 & 2.163681e-03 \\ \hline \(ERR_{1}\) & - & -154.65\% & 26.38\% \\ \hline \(ERR_{2}\) & - & -143.01\% & 27.96\% \\ \hline \hline \end{tabular}
\end{table}
Table 3. Performance comparison of three methods: the elapsed time, mean absolute errors and relative \(\mathbb{L}_{2}\) errors of the quadratic variable coefficient \(\gamma(t)\) as well as error reduction rates.

Figure 5. (Color online) One-soliton solution \(A(x,t)\) of the vcNLS equation by TL-gPINNs: (a) The density diagrams and comparison between the predicted solutions and exact solutions at the three temporal snapshots of \(|A(x,t)|\); (b) The error density diagram of \(|A(x,t)|\).

Figure 6. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) The absolute error and comparison between the predicted and exact variable coefficient \(\gamma(t)\); (b) The three-dimensional plot of the data-driven one-soliton solution \(|A(x,t)|\).
plots of predicted \(A(x,t)\) and the curve graph of the variable coefficient \(\gamma(t)\). The absolute error curve of \(\gamma(t)\) is drawn with black dotted line corresponding to the right coordinate axis in Fig.8 (a). An empirical inference is given that the high-frequency oscillation of absolute error is caused by the periodic oscillation and the change in concavity and convexity of the variable coefficient. It can be observed that we obtain a periodical soliton solution as sine or cosine function and the predicted variable coefficient is well fitted with the exact one with absolute error less than \(2\times 10^{-3}\). In addition, based on the results in Table 4, it illustrates that both the mean absolute error and relative \(\mathbb{L}_{2}\) error of the variable coefficient \(\gamma(t)\) achieved by TL-gPINNs reach the level of \(10^{-4}\), about one order of magnitude lower than those by PINNs.

#### 3.1.4. Data-driven discovery of hyperbolic tangent variable coefficient \(\gamma(t)\)

Given \(\alpha(t)=\tanh(t),\beta(t)=\frac{t}{5}\), our goal is to identify the unknown variable parameter \(\gamma(t)\) from the vcNLS equation with remarkable accuracy.

\begin{table}
\begin{tabular}{c|c|c|c} \hline
**ResultsMethod** & PINNs & gPINNs & TL-gPINNs \\ \hline Elapsed time (s) & 729.1269 & 5283.3492 & 4272.9441 \\ \hline \(MAE_{\gamma}\) & 1.463990e-03 & 7.123562e-04 & 4.664226e-04 \\ \hline \(RE_{\gamma}\) & 2.703498e-03 & 1.363048e-03 & 7.559607e-04 \\ \hline \(ERR_{1}\) & - & 51.34\% & 68.14\% \\ \hline \(ERR_{2}\) & - & 49.58\% & 72.04\% \\ \hline \end{tabular}
\end{table}
Table 4. Performance comparison of three methods: the elapsed time, mean absolute errors and relative \(\mathbb{L}_{2}\) errors of the sine variable coefficient \(\gamma(t)\) as well as error reduction rates.

Figure 8. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) The absolute error and comparison between the predicted and exact variable coefficient \(\gamma(t)\); (b) The three-dimensional plot of the data-driven one-soliton solution \(|A(x,t)|\).

Figure 7. (Color online) One-soliton solution \(A(x,t)\) of the vcNLS equation by TL-gPINNs: (a) The density diagrams and comparison between the predicted solutions and exact solutions at the three temporal snapshots of \(|A(x,t)|\); (b) The error density diagram of \(|A(x,t)|\).
After utilizing the same generation and sampling method of training data as above, we acquire the training set consists of \(N_{A}=200\) initial-boundary points, \(N_{A_{in}}=2000\) internal points and a random selection of \(N_{f}=N_{g}=40000\) collocation points in the given spatiotemporal domain \([x_{0},x_{1}]\times[t_{0},t_{1}]=[-2,4]\times[-5,5]\) where the corresponding soliton solution is

\[A(x,t)=\frac{\mathrm{e}^{\frac{\mathrm{i}}{6}t^{2}}\mathrm{e}^{(1+\mathrm{i}) x-2\ln(\cosh(t))}}{1+\frac{\mathrm{e}^{2x-4\ln(\cosh(t))}}{8}}. \tag{3.33}\]

The first step is to construct the conventional PINNs. The architecture of multi-out neural networks consists of one input layer, 7 hidden layers with 40 neurons per hidden layer and one output layer with 2 neurons to learn the real part \(u(x,t)\) and imaginary part \(v(x,t)\) of the soliton solution. A 3-hidden-layer feedforward neural network with 30 neurons per hidden layer is employed to infer the variable parameter \(\gamma(t)\). This process can be regarded as the pre-training of the gPINNs, which helps accelerate the convergence of training. Next, we initialize gPINNs with the saved weights of PINNs. The activation function and optimization algorithm used here are the \(tanh\) function and L-BFGS optimizer respectively.

By leveraging TL-gPINNs, the data-driven soliton solution \(A(x,t)\) and variable coefficient \(\gamma(t)\) are plotted in Fig. 9 and Fig. 10. For the double coordinate plot in Fig. 10 (a), the black dotted line corresponding to the right coordinate axis represents the absolute error curve, which exhibits a certain degree of symmetry since the variable coefficient itself is centrosymmetric. Empirically speaking, the error will increase accordingly when the value of the function to be learned is large or changes greatly. However, the error is relatively small during the period with high slopes, i.e. \(t\in[-2,2]\). Presumably it's because the introduction of gradient information into the loss function is conducive to learn the features of variable coefficient where the slope is relatively large. We observe that this V-shaped soliton and the variable coefficient with the function type of hyperbolic tangent are both accurately inferred. Furthermore, Table 5 gives a brief overview of accuracy and efficiency of three methods.

Figure 10. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) The absolute error and comparison between the predicted and exact variable coefficient \(\gamma(t)\); (b) The three-dimensional plot of the data-driven one-soliton solution \(|A(x,t)|\).

Figure 9. (Color online) One-soliton solution \(A(x,t)\) of the vcNLS equation by TL-gPINNs: (a) The density diagrams and comparison between the predicted solutions and exact solutions at the three temporal snapshots of \(|A(x,t)|\); (b) The error density diagram of \(|A(x,t)|\).
#### 3.1.5. Data-driven discovery of fractional variable coefficient \(\gamma(t)\)

When \(\alpha(t)\), \(\beta(t)\) are respectively fixed as \(\frac{1}{2(1+t^{2})}\), \(\frac{t}{5}\) and the training of this case is confined in a rectangular region \((x,t)\in[-4,5]\times[-5,5]\), the target here is to infer the unknown variable coefficient \(\gamma(t)\) on the basis of the dataset of the corresponding solution

\[A(x,t)=\frac{\mathrm{e}^{\frac{1}{10}t^{2}\mathrm{e}^{(1+1)x-\mathrm{arctan}( t)}{1+\frac{(2t^{2}+2)\mathrm{e}^{2x-\mathrm{arctan}(t)}}{8(t^{2}+1)}}}. \tag{3.34}\]

Since there are large amounts of descriptions of the sampling method and network structure above, we won't reiterate them here to avoid repetition. All details are the same as the previous subsection.

Table 6 summarizes the results of our experiment and compares the performance of PINNs, TL-gPINNs and gPINNs. A more detailed assessment of the predicted soliton solution \(A(x,t)\) and variable coefficient \(\gamma(t)\) by leveraging TL-gPINNs is presented in Fig.11 and Fig.12. Specifically, the comparison between the exact and the predicted solutions at different time points \(t=-3.75,0,3.75\) as well as that between the predicted and exact variable coefficient \(\gamma(t)\) is also displayed. A rule of thumb is that the error is large when the value of variable coefficient \(\gamma(t)\) is large or \(\gamma(t)\) changes sharply. The change of the absolute error curve plotted with black dashed line shown in Fig.12 (a) is in good agreement with this experiential conclusion to a certain extent. In addition, TL-gPINN is capable of accurately capturing the intricate nonlinear behaviors of the vcNLS equation, including the dynamic behaviors of the solution and the Kerr nonlinearity \(\gamma(t)\).
### Data-driven discovery of multiple variable coefficients

We extend the research of data-driven discovery for single variable coefficient to that of multiple ones, and the hyper-parameters of which are given in outline in Table 1. For each case discussed here, the L-BFGS algorithm is utilized to optimize loss functions.

.2.1. Data-driven discovery of two variable coefficients: linear \(\beta(t)\) and sine \(\gamma(t)\)

In this part, we use the TL-gPINNs to identify two unknown variable coefficients: linear \(\beta(t)\) and sine \(\gamma(t)\) when the other variable coefficient (\(\alpha(t)=\sin(t)\)) is fixed and the training dataset consisting of initial-boundary data \(\{x_{A}^{i},t_{A}^{i},u^{i},v^{i}\}_{i=1}^{N_{A}}(N_{A}=200)\) and internal data \(\{x_{in}^{i},t_{in}^{i},u^{i},v^{i}\}_{i=1}^{N_{A_{im}}}(N_{A_{in}}=2000)\) is randomly selected. Then the loss functions of PINNs and gPINNs are redefined

\[MSE_{inverse}=MSE_{A}+MSE_{f}+MSE_{A_{in}}+MSE_{\mathbf{A}}, \tag{3.35}\]

\[MSE_{inverse}^{g}=MSE_{A}+MSE_{f}+MSE_{A_{in}}+MSE_{\mathbf{A}}+MSE_{g}, \tag{3.36}\]

where

\[MSE_{\mathbf{A}}=MSE_{\beta}+MSE_{\gamma}, \tag{3.37}\]

\[MSE_{\beta}=|\widehat{\beta}(t_{0})-\beta^{0}|^{2}, \tag{3.38}\]

\[MSE_{\gamma}=\frac{1}{2}\left(|\widehat{\gamma}(t_{0})-\gamma^{0}|^{2}+| \widehat{\gamma}(t_{1})-\gamma^{1}|^{2}\right). \tag{3.39}\]

The depth and width of neural networks for inferring the solution and variable coefficients are listed in Table 1.

By employing the TL-gPINN method, the data-driven soliton solution and variable coefficients for the vcNLS equation are successfully simulated. Comparison between the predicted and exact variable coefficients \(\beta(t)\) and \(\gamma(t)\) as well as the corresponding absolute errors is displayed in Fig. 13. It can be seen that the absolute error of linear \(\beta(t)\) is negligible compared with that of nonlinear \(\gamma(t)\), which exhibits the feature of high-frequency oscillation due to the periodic oscillation and the change in concavity and convexity of the variable coefficient. Table 7 gives a brief overview of the method performance.

Figure 12. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) The absolute error and comparison between the predicted and exact variable coefficient \(\gamma(t)\); (b) The three-dimensional plot of the data-driven one-soliton solution \(|A(x,t)|\).

Figure 13. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) Comparison between the predicted and exact variable coefficients \(\beta(t)\) and \(\gamma(t)\); (b) The absolute errors.
#### 3.2.2. Data-driven discovery of three variable coefficients

Note that all variable coefficients of the vcNLS equation are unknown here.

\(\bullet\)**Linear \(\alpha(t)\), \(\beta(t)\) and \(\gamma(t)\)**

For the identification of three linear variable coefficients, the term embodying the training data in the loss functions in Eq. (3.35) and (3.36) need to be modified

\[MSE_{\mathbf{A}}=MSE_{\alpha}+MSE_{\beta}+MSE_{\gamma}, \tag{3.40}\]

\[MSE_{\alpha}=|\widehat{\alpha}(t_{0})-\alpha^{0}|^{2}, \tag{3.41}\]

\[MSE_{\beta}=|\widehat{\beta}(t_{0})-\beta^{0}|^{2}, \tag{3.42}\]

\[MSE_{\gamma}=|\widehat{\gamma}(t_{0})-\gamma^{0}|^{2}. \tag{3.43}\]

With the aid of the same generation and sampling method above, we obtain the training data (size: \(N_{A}=200,N_{A_{in}}=2000\)) in the given spatiotemporal region \([-4,4]\times[-4,4]\), where the corresponding soliton solution is

\[A(x,t)=\frac{\mathrm{e}^{\frac{\mathrm{i}\pi t}{6}^{2}}\mathrm{e}^{(1+\mathrm{ i})x-2\ln(\cosh(t))}}{1+\frac{\mathrm{e}^{\mathrm{i}\pi-4\ln(\cosh(t))}}{8}}. \tag{3.44}\]

The linear and tanh activation functions are adopted to infer the variable coefficients and soliton solution separately.

Finally, Fig. 14 shows the curve plots of the predicted and the exact variable coefficients as well as absolute errors obtained by TL-gPINN, and Table 8 summarizes the detailed results of three methods in the term of prediction accuracy. The change of absolute error curves here is similar to that in Sec. 3.1.1.

\begin{table}
\begin{tabular}{c|c|c c|c} \hline \hline \multicolumn{2}{c|}{Results} & \multicolumn{3}{c|}{Method} \\ \cline{2-5} \multicolumn{2}{c|}{} & PINNs & gPINNs & TL-gPINNs \\ \hline \multirow{2}{*}{\(\beta(t)\)} & \(MAE_{\beta}\) (\(ERR_{1}\)) & 1.246162e-05 & 1.861258e-05 (**-49.36\%**) & 8.680616e-06 **(30.34\%)** \\ \cline{2-5}  & \(RE_{\beta}\) (\(ERR_{2}\)) & 2.323916e-05 & 3.888068e-05 **(-67.31\%)** & 1.517259e-05 **(30.34\%)** \\ \hline \multirow{2}{*}{\(\gamma(t)\)} & \(MAE_{\gamma}\) (\(ERR_{1}\)) & 1.412442e-03 & 1.128851e-03 **(-67.31\%)** & 7.726441e-04 **(34.71\%)** \\ \cline{2-5}  & \(RE_{\gamma}\) (\(ERR_{2}\)) & 2.712897e-03 & 2.220811e-03 **(18.14\%)** & 1.309694e-03 **(51.72\%)** \\ \hline \hline \end{tabular}
\end{table}
Table 7. Performance comparison of three methods: mean absolute errors and relative \(\mathbb{L}_{2}\) errors of the variable coefficients \(\beta(t)\) and \(\gamma(t)\) as well as error reduction rates.

Figure 14. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) Comparison between the predicted and exact variable coefficients \(\alpha(t)\), \(\beta(t)\) and \(\gamma(t)\); (b) The absolute errors.

\begin{table}
\begin{tabular}{c|c|c c|c} \hline \hline \multicolumn{2}{c|}{Results} & \multicolumn{3}{c|}{Method} \\ \cline{2-5} \multicolumn{2}{c|}{} & PINNs & gPINNs & TL-gPINNs \\ \hline \multirow{2}{*}{\(\alpha(t)\)} & \(MAE_{\alpha}\) (\(ERR_{1}\)) & 7.617165e-05 & 1.224185e-04 **(-60.71\%)** & 6.102315e-05 **(19.89\%)** \\ \cline{2-5}  & \(RE_{\alpha}\) (\(ERR_{2}\)) & 7.604356e-05 & 1.225268e-04 **(-61.13\%)** & 6.186360e-05 **(18.65\%)** \\ \hline \multirow{2}{*}{\(\beta(t)\)} & \(MAE_{\beta}\) (\(ERR_{1}\)) & 2.193591e-04 & 5.647830e-04 **(-157.47\%)** & 8.066458e-05 **(63.23\%)** \\ \cline{2-5}  & \(RE_{\beta}\) (\(ERR_{2}\)) & 5.484737e-04 & 1.412454e-03 **(-157.52\%)** & 2.025123e-04 **(63.08\%)** \\ \hline \multirow{2}{*}{\(\gamma(t)\)} & \(MAE_{\gamma}\) (\(ERR_{1}\)) & 1.086061e-04 & 4.343718e-04 **(-299.95\%)** & 3.701118e-05 **(65.92\%)** \\ \cline{2-5}  & \(RE_{\gamma}\) (\(ERR_{2}\)) & 5.447867e-05 & 2.165039e-04 **(-297.41\%)** & 1.842847e-05 **(66.17\%)** \\ \hline \hline \end{tabular}
\end{table}
Table 8. Performance comparison of three methods: mean absolute errors and relative \(\mathbb{L}_{2}\) errors of three linear variable coefficients as well as error reduction rates.
\(\bullet\)**Linear \(\beta(t)\), fractional \(\alpha(t)\) and \(\gamma(t)\)**

Based on the initial-boundary data of the soliton solution

\[A(x,t)=\frac{\mathrm{e}^{\frac{\mathrm{e}\hbar t}{t}\mathrm{e}^{2}(1+\mathrm{i} )x-\arctan(t)}}{1+\frac{(2t^{2}+2)\mathrm{e}^{2x-2\arctan(t)}}{8(t^{2}+1)}}, \tag{3.45}\]

corresponding to \(\alpha(t)=\frac{1}{2(1+t^{2})},\beta(t)=\frac{t}{5},\gamma(t)=\frac{1}{1+t^{2}}\), we utilize the TL-gPINNs to infer these three unknown variable coefficients. Here, the loss term of nonlinear variable coefficients should be changed into

\[MSE_{vc}=MSE_{\alpha}+MSE_{\beta}+MSE_{\gamma}, \tag{3.46}\]

where

\[MSE_{\beta}=|\widehat{\beta}(t_{0})-\beta^{0}|^{2}, \tag{3.47}\]

\[MSE_{\alpha}=\frac{1}{2}\left(|\widehat{\alpha}(t_{0})-\alpha^{0}|^{2}+| \widehat{\alpha}(t_{1})-\alpha^{1}|^{2}\right), \tag{3.48}\]

\[MSE_{\gamma}=\frac{1}{2}\left(|\widehat{\gamma}(t_{0})-\gamma^{0}|^{2}+| \widehat{\gamma}(t_{1})-\gamma^{1}|^{2}\right). \tag{3.49}\]

Results of function discovery for the vcNLS equation, i.e. comparisons between the predicted and exact variable coefficients \(\alpha(t)\), \(\beta(t)\) and \(\gamma(t)\) as well as their respective absolute errors are presented in Fig. 15. Similarly, the absolute error of linear variable coefficient \(\beta(t)\) is negligible compared with those of nonlinear ones. The variable coefficients \(\alpha(t)\) and \(\gamma(t)\) in the form of fractional polynomials also basically meets the rule of thumb mentioned in Sec. 3.1.5. However, the phenomenon of multiple intersections between error curves and more specific feature analysis remain to be further explored in future work. Besides, the running time of PINNs, TL-gPINNs and gPINNs is: 242.0248, 320.302 and 892.13 seconds, respectively. The performance comparison of these three methods is shown in Table 9.

\begin{table}
\begin{tabular}{c|c|c c|c} \hline \hline \multicolumn{2}{c|}{Results} & \multicolumn{3}{c}{Method} \\ \cline{3-5} \multicolumn{2}{c|}{} & PINNs & gPINNs & TL-gPINNs \\ \hline \multirow{2}{*}{\(\alpha(t)\)} & \(MAE_{\alpha}(ERR_{1})\) & 2.536442e-03 & 2.372040e-03 **(6.48\%)** & 2.069355e-03 **(18.42\%)** \\ \cline{2-5}  & \(RE_{\alpha}(ERR_{2})\) & 1.855795e-02 & 1.840729e-02 **(0.81\%)** & 1.616184e-02 **(12.91\%)** \\ \hline \multirow{2}{*}{\(\beta(t)\)} & \(MAE_{\beta}(ERR_{1})\) & 3.263991e-05 & 2.116216e-05 **(35.16\%)** & 9.873565e-06 **(69.75\%)** \\ \cline{2-5}  & \(RE_{\beta}(ERR_{2})\) & 5.729922e-05 & 3.738890e-05 **(34.75\%)** & 1.751263e-05 **(69.44\%)** \\ \hline \multirow{2}{*}{\(\gamma(t)\)} & \(MAE_{\gamma}(ERR_{1})\) & 5.610852e-03 & 5.163366e-03 **(7.98\%)** & 4.453668e-03 **(20.62\%)** \\ \cline{2-5}  & \(RE_{\gamma}(ERR_{2})\) & 2.201791e-02 & 2.034598e-02 **(7.59\%)** & 1.753237e-02 **(20.37\%)** \\ \hline \hline \end{tabular}
\end{table}
Table 9. Performance comparison of three methods: mean absolute errors and relative \(\mathbb{L}_{2}\) errors of three variable coefficients as well as error reduction rates.

Figure 15. (Color online) Results of function discovery for the vcNLS equation by TL-gPINNs: (a) Comparison between the predicted and exact variable coefficients \(\alpha(t)\), \(\beta(t)\) and \(\gamma(t)\); (b) The absolute errors.
### Result analysis

According to the performance comparison of three methods (PINNs, TL-gPINNs and gPINNs) presented in Table. 2 - Table. 9, TL-gPINNs possess the notable performance of high accuracy whether in identifying single variable coefficient or in inferring multiple ones compared with the other two methods. Meanwhile, TL-gPINNs can accelerate convergence of iteration and reduce calculation time since the technique of transfer learning helps to mitigate the problem of inefficiency caused by extra loss terms of the gradient.

The reason why gPINN doesn't perform up to expectations here may be that the solution \(A(x,t)\) for the variable coefficient nonlinear Schroodinger equation is complex-valued and each constraint function in neural networks should be decomposed into two parts: the real and imaginary parts. Thus, the loss function itself consists of many constraint terms even without regard to the gradient restriction. When solving the multi-objective optimization problems, the local optimum that it ultimately converges to is obtained based on the competitive relationship between various objectives. Therefore, the result may not necessarily be better even if more constraints are imposed. Evidently, the experiments show that gPINN has lower prediction accuracy than PINN even at the cost of sacrificing efficiency especially in Case 3.1.2 (shown in Table 3), Case 3.1.5 (Table 6) and Case 3.2.2 (Table 8). The advantage of the TL-gPINN method lies in that gPINN inherits the saved weight matrixes and bias vectors of PINN at the end of the iteration process as the initialization parameters, and thus the subsequent training of gPINN is based on that of PINN by leveraging the transfer learning technique instead of training from scratch. Consequently, TL-gPINN is steadier on precision promotion compared to gPINN, a method which has been proved to be efficient in improving the accuracy of PINN [33].

What's more, the loss curve figures of inferring linear variable coefficient \(\gamma(t)\) in Sec. 3.1.1 are plotted in Fig. 16 for the sake of more intuitive analysis. Here, only loss functions corresponding to the real part, i.e. \(MSE_{u},MSE_{f_{u}}\) and \(MSE_{g_{u}}\), are considered and counterparts of the imaginary part (\(MSE_{v},MSE_{f_{e}}\) and \(MSE_{g_{v}}\)) change approximately in the same way. The values of each loss term at the beginning and end of iterations are listed in Table 10.

As we can see from Fig. 16 (a), \(MSE_{g_{u}}\) fluctuated at a relatively high level and the value of the last iteration is almost the same as that at the beginning of the iteration while \(MSE_{u}\) and \(MSE_{f_{u}}\) decreased to 4.078804e-07 and 9.956128e-07 respectively during the training process of PINNs, where the loss of gradient \(MSE_{g_{u}}\) has no contribution to optimization. In Fig. 16 (b) and Table 10, it is obvious to note that the values of loss terms of the gradients

\begin{table}
\begin{tabular}{c|c|c|c|c|c|c} \hline \multirow{2}{*}{**ResultsMethod**} & \multicolumn{2}{c|}{PINNs} & \multicolumn{2}{c|}{gPINNs} & \multicolumn{2}{c}{TL-gPINNs} \\ \cline{2-7}  & The zeroth & The last & The zeroth & The last & The zeroth & The last \\  & iteration & iteration & iteration & iteration & iteration & iteration \\ \hline \(MSE_{u}\) & 6.672856e-02 & 4.078804e-07 & 6.672856e-02 & 1.650002e-07 & 4.078804e-07 & 1.530691e-07 \\ \(MSE_{v}\) & 8.681140e-02 & 4.347213e-07 & 8.681140e-02 & 2.090391e-07 & 4.347213e-07 & 2.113367e-07 \\ \(MSE_{f_{u}}\) & 2.073652e-04 & 9.956128e-07 & 2.073652e-04 & 1.071937e-07 & 9.956128e-07 & 8.313516e-08 \\ \(MSE_{f_{v}}\) & 4.143952e-04 & 1.020429e-06 & 4.143952e-04 & 1.637525e-07 & 1.020429e-06 & 1.001443e-07 \\ \(MSE_{g_{u}}\) & 5.406206e-05 & 2.326252e-05 & 5.406206e-05 & 6.86929e-07 & 2.326252e-05 & 5.017756e-07 \\ \(MSE_{g_{v}}\) & 8.511276e-05 & 3.057861e-05 & 8.511276e-05 & 7.017902e-07 & 3.057861e-05 & 4.487380e-07 \\ \(MSE_{\gamma}\) & 16.521566 & 3.637979e-12 & 16.521566 & 2.273737e-13 & 3.637979e-12 & 2.273737e-13 \\ \hline \end{tabular}
\end{table}
Table 10. Results of losses at the beginning and end of iteration in inferring linear variable coefficient \(\gamma(t)\) for the vNLS equation by three methods.

Figure 16. (Color online) Evolution of the loss functions in inferring linear variable coefficient \(\gamma(t)\) for the vNLS equation by two methods: (a) PINN; (b) TL-gPINN.
(i.e.,\(MSE_{g_{u}}\) and \(MSE_{g_{v}}\)) are larger by several orders of magnitude than those of other loss terms in the zeroth iteration when the weight transfer is just completed. Specifically, the values of \(MSE_{u},MSE_{v},MSE_{f_{u}},MSE_{f_{v}},MSE_{u_{in}},MSE_{v_{in}}\) are approximately remain between 10e-07 and 10e-06, and that of \(MSE_{\gamma}\) maintains at 10e-11 to 10e-10 while the values of \(MSE_{g_{u}}\) and \(MSE_{g_{v}}\) are at a high level of 10e-5 to 10e-4. It reveals that there is still some deviation between the variable coefficients themselves and the ones learned by the PINN method from the perspective of gradients. In other words, the PINN method lacks sufficient attention to gradients and leads to inadequate optimization, which may be an underlying cause why the training of gPINNs can go on effectively after finishing the weight transfer. Then the values of \(MSE_{g_{u}}\) dropped pretty steadily while \(MSE_{u}\) and \(MSE_{f_{u}}\) showed a downward trend after an initial ascent. Meanwhile, the process of their ascent happens to be that of the fastest descent of \(MSE_{g_{u}}\), and we deduced that it may be a process of escaping from the local optimal point obtained by PINN, where the values of gradient loss are large although those of other loss terms are at a fairly low level.

With regard to efficiency, gPINNs significantly increase the time cost of training due to the introduction of additional gradient constraints while TL-gPINNs shorten the training time in contrast to the original gPINNs by taking full advantage of transfer learning.

In short, the TL-gPINN method achieves the highest prediction accuracy among the three methods whether in inferring unknown single variable coefficient or in identifying multiple ones. However, gPINN shows an unstable performance here and even performs no better than PINN in accuracy in some cases. For TL-gPINNs, the application of transfer learning technique can contribute to both higher efficiency and greater reliability than the original PINN. It outperforms the PINNs in accuracy and gPINNs in both accuracy and efficiency. Thereupon the TL-gPINN method is more superior compared with the PINN and gPINN here.

## 4. Analysis and discussion

### Robustness analysis

Numerical results presented in Sec. 3.1 are based on noise-free training data, and here we carry out experiments when the training data was corrupted with noise to test the robustness of the TL-gPINNs.

Specifically, the training data, including the initial-boundary data \(\{x_{A}^{i},t_{A}^{i},u^{i},v^{i}\}_{i=1}^{N_{A}}\), internal data \(\{x_{m}^{i},t_{in}^{i},u^{i},v^{i}\}_{i=1}^{N_{A_{in}}}\) and the data \(\{t_{\gamma}^{i},\gamma^{i}\}_{i=1}^{N_{\gamma}}\) of the variable coefficient \(\gamma(t)\), is corrupted by four different noise levels: 0.5%, 1%, 3% and 5%.

Performance comparison of three methods in identifying variable coefficient \(\gamma(t)\) for the vNLS equation under different noise conditions.

\begin{table}
\begin{tabular}{c|c|c|c c c c c} \hline \multicolumn{2}{c|}{Results} & \multicolumn{5}{c}{Correct \(\gamma(t)\)} \\ \cline{3-8} \multicolumn{2}{c|}{} & \multicolumn{1}{c|}{} & \(t\) & \(t^{2}\) & \(\sin(t)\) & \(\tanh(t)\) & \(\frac{1}{1+t^{2}}\) \\ \hline \multirow{8}{*}{0.5\% noise} & \multicolumn{2}{c|}{\(MAE_{\gamma}\)} & 1.322670e-04 & 9.615011e-03 & 1.097929e-03 & 3.973503e-03 & 1.009619e-03 \\ \cline{2-8}  & \multicolumn{2}{c|}{\(RE_{\gamma}\)} & 6.551441e-05 & 7.959068e-03 & 2.579889e-03 & 5.486678e-03 & 2.968212e-03 \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{1}\)} & TL-gPINNs & 0.00\% & 3.16\% & 49.86\% & 51.81\% & 5.06\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & gPINNs & -73.90\% & -90.00\% & -26.63\% & 39.10\% & -10.64\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & TL-gPINNs & 0.00\% & 1.55\% & 39.72\% & 50.65\% & 10.76\% \\ \hline \multirow{8}{*}{1\% noise} & \multicolumn{2}{c|}{\(MAE_{\gamma}\)} & 3.642581e-04 & 1.241316e-02 & 3.276918e-03 & 1.005220e-02 & 2.160257e-03 \\ \cline{2-8}  & \multicolumn{2}{c|}{\(RE_{\gamma}\)} & 1.825354e-04 & 1.403889e-02 & 8.239684e-03 & 1.449078e-02 & 6.147466e-03 \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{1}\)} & TL-gPINNs & 48.18\% & 14.93\% & 9.34\% & 9.38\% & 13.12\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & gPINNs & 27.43\% & -0.74\% & -12.80\% & 11.36\% & 7.65\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & TL-gPINNs & 48.11\% & 0.09\% & -2.99\% & 8.76\% & 33.17\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & gPINNs & 27.17\% & -2.20\% & -5.96\% & 10.90\% & 1.89\% \\ \hline \multirow{8}{*}{3\% noise} & \multicolumn{2}{c|}{\(MAE_{\gamma}\)} & 3.007159e-04 & 3.890978e-02 & 5.462772e-03 & 8.25448e-03 & 2.393983e-03 \\ \cline{2-8}  & \multicolumn{2}{c|}{\(RE_{\gamma}\)} & 1.475556e-04 & 3.570587e-02 & 1.526540e-02 & 1.280577e-02 & 7.430092e-03 \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{1}\)} & TL-gPINNs & 32.08\% & 5.61\% & 25.55\% & 11.41\% & 26.18\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{1}\)} & gPINNs & 23.02\% & 6.66\% & 20.13\% & -24.42\% & -27.61\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & TL-gPINNs & 32.65\% & 0.68\% & 9.56\% & 9.59\% & 37.61\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & gPINNs & 23.34\% & -1.64\% & 7.05\% & -23.97\% & -7.41\% \\ \hline \multirow{8}{*}{5\% noise} & \multicolumn{2}{c|}{\(ERR_{1}\)} & TL-gPINNs & 32.08\% & 5.61\% & 25.55\% & 11.41\% & 26.18\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{1}\)} & gPINNs & 23.02\% & 6.66\% & 20.13\% & -24.42\% & -27.61\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & TL-gPINNs & 32.65\% & 0.68\% & 9.56\% & 9.59\% & 37.61\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & gPINNs & 23.34\% & -1.64\% & 7.05\% & -23.97\% & -7.41\% \\ \cline{2-8} \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{1}\)} & \multicolumn{2}{c|}{\(ERR_{2}\)} & \multicolumn{2}{c|}{\(ERR_{1}\)} & \multicolumn{2}{c|}{\(ERR_{2}\)} & \multicolumn{2}{c|}{\(ERR_{2}\)} & \multicolumn{2}{c|}{\(ERR_{2}\)} & \multicolumn{2}{c|}{\(ERR_{2}\)} & \multicolumn{2}{c|}{\(ERR_{2}\)} \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{1}\)} & TL-gPINNs & 32.65\% & 0.68\% & 9.56\% & 9.59\% & 37.61\% \\ \cline{2-8}  & \multicolumn{2}{c|}{\(ERR_{2}\)} & gPINNs
Table 11 summarizes the results of the numerical experiments in the conditions of different noise levels and the indexes \(MAE_{\gamma}\) and \(RE_{\gamma}\) listed here are achieved by TL-gPINNs. The detailed results of PINNs and gPINNs are not provided here but shown in Table 13 in Appendix A due to length limitations. Here, the reason why 0.00% appears is that TL-gPINNs converge rapidly after merely a few iterations, which means the local optimum obtained by PINNs also belongs to TL-gPINNs and then the training will not continue after initialization with saved weight data of PINNs.

According to the mean absolute error (\(MAE_{\gamma}\)) and relative \(\mathbb{L}_{2}\) error (\(RE_{\gamma}\)) achieved by TL-gPINNs, different types of the variable coefficients \(\gamma(t)\) can be identified accurately via this method. Evidently, the predictions of the unknown variable coefficient retain good robustness even when the training data was corrupted with different levels of noise. It also turns out that the accuracy of TL-gPINNs doesn't necessarily become worse with the increase of noise intensity, but may also increase in some cases.

Since the values of \(ERR_{1}\) and \(ERR_{2}\) indicate the degree of prediction accuracy improvement in the sense of the mean absolute error (\(MAE_{\gamma}\)) and relative \(\mathbb{L}_{2}\) error (\(RE_{\gamma}\)) respectively, the results demonstrated that the ability of TL-gPINNs in precision promotion also remains robust to noise. We observe that the vast majority of experiments by TL-gPINNs have better performance than that of gPINNs in enhancing the accuracy of inferring the unknown variable coefficient and improving the generalization capability after assessing and comparing \(ERR_{1}\) and \(ERR_{2}\) of these two methods. Meanwhile, the higher efficiency of TL-gPINNs compared with the original gPINNs is a distinct advantage as well.

Based on the performance in Sec. 3.1 and Sec. 4.1, regardless of whether the training data is corrupted with noise or not, TL-gPINNs possess the ability to successfully infer the unknown variable coefficient \(\gamma(t)\) with satisfactory accuracy. Taken overall, the TL-gPINNs meet the robustness and computational accuracy standards required in practice.

### Parametric sensitivity analysis

The training results of neural networks are influenced by many factors, such as the architecture of neural networks and the size of training dataset. Thus, the parametric sensitivity analysis is conducted here to disclose the effect of these hyper-parameters on predictions of the single nonlinear variable coefficient \(\gamma(t)\).

\(\bullet\)**The architecture of neural networks**

With regard to the structure of fully-connected neural networks (FNN), the emphasis is put on the number of weighted layers (depth) and the number of neurons per hidden layer (width). Then we explore how the change of width and depth of the branch network for inferring the variable coefficient will affect the experimental results.

Meanwhile, we mainly investigate nonlinear variable coefficient \(\gamma(t)\) mentioned in Sec. 3.1, which is more common in practice. For each form of the unknown nonlinear variable coefficient \(\gamma(t)\), two hyper-parameters are changed: depth from 4 to 5 and width from 10 to 50 with step size 10.

Finally, heat maps of relative \(\mathbb{L}_{2}\) errors are shown in Fig. 17 in order to display the experimental results more intuitively, and the detailed results are given in Table 14 in Appendix A.

The figures in the first, second and third columns are the visualization of relative \(\mathbb{L}_{2}\) errors given by PINNs, TL-gPINNs and gPINNs respectively. The darker the color, the greater the error. For each group of experiments, we will compare the performance of the three methods and use the red dotted line to frame the one with the smallest error in the heat maps. Evidently, the color of heat maps in the second column is the lightest on the whole. Also, the proportion of numerical experiments with the smallest error is the largest. Since the weights and biases as the initialization parameters of TL-gPINN are inherited from PINN, the color depth that reflects the value of relative \(\mathbb{L}_{2}\) errors of PINN and TL-gPINN is highly correlated according to heat maps in Fig. 17. It may contribute to the stability of TL-gPINN in significant accuracy enhancement.

Numerically, the average (10 runs) relative \(\mathbb{L}_{2}\) errors of nonlinear variable coefficient \(\gamma(t)\) as well as the error reduction rates of TL-gPINNs and gPINNs are listed in Table 12. Undoubtedly, it illustrates that our proposed method (TL-gPINN) outperforms the other two (PINN and gPINN) thoroughly.

For numerous cases above, TL-gPINN always performs well and has stable improvement of accuracy under different width and depth of the branch network for the identification of nonlinear variable coefficients.

\(\bullet\)**The size of training dataset**

\begin{table}
\begin{tabular}{c|c c|c} \hline \multirow{2}{*}{Correct nonlinear \(\gamma(t)\)} & \multicolumn{3}{c}{Relative \(\mathbb{L}_{2}\) errors(\(ERR_{2}\))} \\ \cline{2-4}  & PINNs & gPINNs & TL-gPINNs \\ \hline \(t^{2}\) & 5.375348e-03 & 6.562848e-03(**-22.09\%**) & 4.711041e-03(**12.36\%**) \\ \(\sin(t)\) & 2.603825e-03 & 2.651862e-03(**-1.84\%**) & 1.18419e-03(**54.52\%**) \\ \(\tanh(t)\) & 7.727333e-03 & 5.430929e-03(**29.72\%**) & 3.814903e-03(**50.63\%**) \\ \(\frac{1}{1+t^{2}}\) & 8.590022e-03 & 7.668054e-03(**10.73\%**) & 4.530164e-03(**47.26\%**) \\ \hline \end{tabular}
\end{table}
Table 12. Average performance comparison of three methods in identifying nonlinear variable coefficient \(\gamma(t)\) for the vcNLS equation under different width and depth.
The difference between the inverse problem and the forward one lies in the incorporation of some extra measurements \(\{x_{in}^{i},t_{in}^{i},u^{i},v^{i}\}_{i=1}^{N_{A_{in}}}\) of the internal region. Hence, the major consideration is the size of internal data, i.e. the value of \(N_{A_{in}}\).

Considering the randomness involved in sampling and initialization, the setting of the parameter _seed_ in the codes will affect the numerical results. We perform six groups of numerical experiments for each nonlinear variable coefficient \(\gamma(t)\) and the value of \(N_{A_{in}}\) changes from 500 to 3000 with step size 500. Meanwhile, each group contains five experiments under the condition of different initial seeds to explore the impact of randomness on the results.

Here, we are chiefly concerned with the accuracy of the nonlinear \(\gamma(t)\) obtained by TL-gPINNs as well as the error reduction rates of TL-gPINNs and gPINNs compared with PINNs, which are shown in Fig. 18 and Table 15 in Appendix A. In Fig. 18, the orange and blue lines correspond to the mean error reduction rates (\(ERR_{2}\)) of five numerical experiments by using TL-gPINNs and gPINNs respectively, and the shade regions depict the max-min ones. It can be concluded from figures above that TL-gPINN has higher error reduction rates for each case whether in average, maximum, or minimum sense. However, \(ERR_{2}\) of gPINNs is even less than 0% in many examples, which means the accuracy of gPINN is reduced rather than improved compared to the traditional PINN method. Furthermore, the size of the shaded area to some extent reflects the stability of the method. Thus, TL-gPINN apparently is more stable and accurate than gPINN based on error reduction rates of relative \(\mathbb{L}_{2}\) error (\(ERR_{2}\)) under different size of training dataset.

Figure 17. (Color online) Relative \(\mathbb{L}_{2}\) errors of nonlinear variable coefficients \(\gamma(t)\) via three methods under different depth and width: (a) quadratic \(\gamma(t)\); (b) sine \(\gamma(t)\); (c) hyperbolic tangent \(\gamma(t)\); (d) fractional \(\gamma(t)\).
## 5. Conclusion

Traditional numerical methods have many limitations in solving inverse problems, especially in dealing with noisy data, complex regions, and high-dimensional problems. Moreover, the inverse problem of the function discovery is a relatively under explored field. In this paper, for the sake of overcoming deficiency of the discrete characterization of the PDE loss in neural networks and improving accuracy of function feature description, we propose gradient-enhanced PINNs based on transfer learning (TL-gPINNs) for inverse problems of inferring unknown variable coefficients and give a new viewpoint on gPINNs.

The TL-gPINN method uses a two-step optimization strategy and gradually increases the difficulty. Firstly, the original PINN is applied in the inverse problem of the variable coefficient equations. Then for further optimization, gPINN inherits the saved weight matrixes and bias vectors of PINN at the end of the iteration process as the initialization parameters and the introduction of the gradient term contributes to the accuracy enhancement of variable coefficients. Moreover, the trunk and branch networks are established to infer the solution and variable coefficients separately in order to eliminate mutual influence.

The effectiveness of TL-gPINNs is demonstrated in identifying several types of single variable coefficients, including linear, quadratic, sine, hyperbolic tangent and fractional functions as well as multiple ones for the well-known variable coefficient nonlinear Schroodinger (vcNLS) equation in the field of integrable systems. Meanwhile, abundant dynamic behaviors of the corresponding soliton solution can be well reproduced. Plenty of numerical experiments are carried out to compare the performance of PINNs, TL-gPINNs and gPINNs. It has been proved that gPINN learned the unknown parameters more accurately than PINN for the inverse problems in many examples, such as Poisson equation, diffusion-reaction equation, Brinkman-Forchheimer model and so on by Yu et al. However, the accuracy of gPINN is reduced rather than improved compared with the standard PINN method in inverse PDE problems of the vcNLS equation. Presumably it's because the loss function itself consists of many constraint terms even without regard to the gradient restriction and thus the result may not necessarily be better even if more constraints are imposed when solving the multi-objective optimization problems. What's worse, the computational cost of gPINN is higher than PINN unavoidably since the introduction of additional constraints on gradients gives rise to low efficiency. Consequently, one viable path towards accelerating the convergence of training could come by adopting the technique of transfer learning and thus the TL-gPINN method is put forward here. Through the comparison among the three methods, TL-gPINN has the highest prediction precision and can improve efficiency compared to gPINN. In other words, TL-gPINNs can successfully infer the unknown variable coefficients with satisfactory accuracy and outperform the PINNs in accuracy, and gPINNs in both accuracy and efficiency. Besides, we ulteriorly conduct robustness analysis

Figure 18. (Color online) Error reduction rates of relative \(\mathbb{L}_{2}\) error (\(ERR_{2}\)) in identifying nonlinear variable coefficient \(\gamma(t)\) for the vcNLS equation achieved by TL-gPINNs and gPINNs compared with PINNs under different number of \(N_{A_{in}}\): (a) quadratic \(\gamma(t)\); (b) sine \(\gamma(t)\); (c) hyperbolic tangent \(\gamma(t)\); (d) fractional \(\gamma(t)\).
and parametric sensitivity analysis. Numerical results also illustrate that the ability of TL-gPINNs to improve accuracy compared to the standard PINNs, and gPINNs also remains robust to noise and other hyper-parameters, including width and depth of the branch network and the size of training dataset.

The TL-gPINN method applied in this paper is universal and can be adapted to the inverse problems of inferring unknown high-dimensional variable coefficients. In future work, we will strive to propose more targeted improvements that enhance accuracy without sacrificing efficiency on this subject.

## Acknowledgments

The authors would like to thank Zhengwu Miao sincerely for providing with support and help. The project is supported by National Natural Science Foundation of China (No. 12175069 and No. 12235007), Science and Technology Commission of Shanghai Municipality (No. 21JC1402500 and No. 22DZ2229014) and Natural Science Foundation of Shanghai (No. 23ZR1418100).
