**Setup of simulated laser cavity.** The analysis of pulse formation in fiber lasers based on NNs commences with the preparation of training samples. Here, SSFT is utilized to generate these training samples. Each individual sample encapsulates laser cavity parameters and output pulse information. The configuration of the laser utilized for simulation is depicted in Fig. 1, which is consist of a saturable absorber (SA), a section of passive fiber (PF) and an erbium-doped fiber (EDF) in the laser cavity. The selected laser employs a Gaussian pulse with a central wavelength of 1550 nm as the seed pulse and undertakes the simulation under normal dispersion conditions by modifying different laser cavity parameters. The pulse within the laser cavity is programmed to repeat 1000 times, with a 5 picosecond (ps) time window set up to record the dynamic behavior of ultrashort pulses. Eventually, a stable pulse is produced.

### Simulation results

We initiated with the construction of the first NN with the output layer symbolizing the pulse duration. The MSE for this model is calculated as 0.0419 for the training set, 0.0446 for the validation set, 0.1060 for the test set, and 0.0520 for the overall dataset. As can be deciphered from Fig. 2, the regression coefficients for the training set, validation set, test set, and the complete dataset are 99.83%, 99.861%, 99.68%, and 99.815% respectively. The correlation between the target value and the predicted value across all datasets exceeds 99%, and the fitting curve in each graph nearly coincides with y = x. This evidence indicates that the NN delivered commendable fitting performance on the training, validation, and testing sets.

The accuracy of the fitting function generated by the NN was put to test by employing 40 sets of randomly generated data. We compared the predicted pulse duration by the NN and the pulse duration computed using the SSFT. Figure 5 demonstrates the relative difference in the pulse's duration obtained by two methods, which is calculated using the following formula:

$$\Delta =\frac{{{\tau _{NN}} - {\tau _{SSFT}}}}{{{\tau _{SSFT}}}} \times 100\%$$

1

,

where, *τ*NN is the pulse’s duration predicted by the NN, *τ*SSFT is the pulse’s duration generated by SSFT. From Fig. 3, it can be observed that the maximum relative error between the two methods is 7%, illustrating that the pulse's duration foreseen by the NN algorithm aligns well with the SSFT method. This evidence indicates that the NN delivered commendable fitting performance on the training, validation, and testing sets.

After fitting through NNs, a Genetic algorithm (GA) is employed to identify the minimal value of pulse duration. Figure 4 shows the performance of GA in progressively discovering the optimal state. It can be observed that as the number of evolutionary generations increases, the optimal value of the fitness function gradually decreases until it stabilizes at a minimum value. This indicates that the GA might have found a solution near the optimal solution in the search space. A comparison between the best fitness function value (Best) and the average fitness function value (Mean) curves serves as an estimation of the performance of GAs and the potency of the evolutionary process. If the Best curve is stable and close to the Mean curve, it indicates that the algorithm can find better solutions in the population and the search process is relatively balanced. Moreover, if the trend of fitness values ceases to improve or stabilizes with an increase in iterations, it might suggest that the algorithm has converged and halted evolving.

The GA successfully succeeded in pinpointing the minimum pulse duration, predicted by the NN, to be 2.03159 ps. This coincided with the following seven laser cavity parameters: *Ω* = 4.529 × 10− 8 nm, *E*s=4.2786 × 10− 11 J, *γ*EDF = 1 × 10− 3 /(W*m), *γ*PF = 1 × 10− 3 /(W*m), *L*0 = 0.9, *P*sat =100 W, *g*0 = 1 dB/m. Figure 5 shows the ultrashort pulse’s parameter obtained by SSFT. The temporal evolution and spectral evolution of pulse in the laser cavity are depicted in Fig. 5(a) and 5(b) respectively. The steady temporal and spectral pulse profiles within the laser cavity are reflected in Fig. 5(c) and 5(d) respectively. The pulse duration, calculated by the SSFT method with the corresponding seven parameters, is measured to be 2.0269 ps. This implies a negligible relative difference in the pulse duration calculated by both methods and \(\Delta =2.31\%\).

For the second phase, the NN was adapted to fit the seven parameters of the laser cavity and pulse energy. Figure 6 displays the MSE derived from comparing the predicted and target values of energy produced by the second NNs. On fitting the NN, the MSE on the training set was found to be 1.5037, on the validation set it was 0.1024, on the test set at 0.0912, and on the entire dataset it scored 1.0816. As per Fig. 8, the regression coefficient of the training set is marked at 99.79%, the validation set at 99.98%, the test set at 99.99%, and the entire dataset at 99.85%, indicating that the NN has excellent fitting of pulse energy.

To evaluate the difference between pulse energy values predicted by the NN and those obtained by using the SSFT method, we used 40 sets of randomly generated data. Figure 9 depicts the relative difference in pulse energy values computed by the two methods across these 40 sets. The calculation formula can be denoted as:

$$\Delta =\frac{{{Q_{NN}} - {Q_{SSFT}}}}{{{Q_{SSFT}}}} \times 100\%$$

2

,

where, *Q*NN is the energy predicted by the NN, *Q*SSFT is the energy generated by SSFT. As demonstrated in Fig. 7, the relative error between the two methods peaks at 4% in the 27th set of data. This comparison suggests that the pulse energy predicted by the NN algorithm aligns reasonably well with the results of the SSFT method.

Figure 8 shows the performance of GA in progressively discovering the optimal state of pulse energy. It can be observed that as the number of evolutionary generations increases, the optimal value of the fitness function gradually decreases until it reaches a stable maximum value. If the fitness values plateau or cease to improve with increased iterations, it might suggest that the GA algorithm has converged and has ceased evolving. The maximum predicted pulse energy of 115.345 pJ was successfully located through GA, and in correspondence with the following seven parameters of laser cavity: *Ω* = 5.45×10− 8 nm, *E*s=2×10− 10 J, *γ*EDF = 1×10− 3 /(W*m), *γ*PF = 1.1×10− 3 /(W*m), *L*0 = 0.2, *P*sat =10 W, *g*0 = 10 dB/m. The pulse energy, computed by the SSFT method with the corresponding seven parameters, is recorded as 115.4176 pJ. This calculation leads to a negligible relative difference when compared to the results obtained by the two methods and \(\Delta = - 0.06\%\).

The peak power of an ultrashort pulse in a laser can be described as:

.

where, *P* represents the peak power of ultrashort pulses, *Q* represents the energy of the ultrashort pulse, and *τ* represents the pulse duration of the ultrashort pulse. The third NN was developed with the output layer representing the peak power of ultrashort pulse. The MSE of this model on the training set scored 0.002, on the validation set 0.024, on the test set 0.0029, and on the entire dataset 0.0054. Figure 9 shows the MSE of comparison between predicted and target values of peak power generated by the third NNs. It is evident that the correlation between the target value and the predicted value across all datasets surpasses 99%, with the fitting curve in each graph nearly coinciding with y = x. This indication suggests the successful fitting of the seven cavity parameters and peak power of the ultrashort pulse.

Similar to previous methods, Fig. 10 depicts the relative difference between pulse’s peak power as calculated by the two methods across 40 sets of randomly generated data points. The specific calculation formula is as follows:

$$\Delta =\frac{{{P_{NN}} - {P_{SSFT}}}}{{{P_{SSFT}}}} \times 100\%$$

4

,

where, *P*NN represents the peak power predicted by the NN, *P*SSFT represents the peak power generated by SSFT. Reviewing Fig. 10, it is evident that all errors fluctuate between 0% and 7%. Particularly on the seventh set of data, the relative error peaks at 7%. This data corroborates the consistency between the peak power predicted by the NN algorithm and the results of the SSFT method.

Figure 11 shows the performance of GA in increasingly identifying the optimal state of pulse's peak power. As the number of evolutionary generations grows, the optimal value of the fitness function appears to diminish gradually until it stabilizes at a maximum value. GA successfully located the maximum predicted peak power of the pulse to be 21.1061 W, and the corresponding seven parameters of laser cavity are as follows: *Ω* = 2×10− 8 nm, *E*s=2×10− 10 J, *γ*EDF = 5×10− 3 /(W*m), *γ*PF = 5×10− 3 /(W*m), *L*0 = 0.9, *P*sat =100 W, *g*0 = 10 dB/m. The peak power of the pulse, calculated by the SSFT method with these corresponding parameters, is found to be 22.2118 W. The relative difference in the duration of the pulse obtained by two methods is a negligible and \(\Delta = - 4.9\%\).

evaluate the influence of multiple parameters on the ultrashort pulse characteristics, eliminating the need for extensive experiments and complex theoretical analysis. It also offers invaluable insight for the design and optimization of various parameters affecting pulses, which contributes to the formulation of laser schemes. The investigation of ultrashort pulse based on AI paves the way for potential applications in laser precision machining.Resolution is a key parameter of temporal-frequency converter, and it is paramount to determine the upper and lower limits of proposed converter.