# Deep Learning-Based Detection Technology for SQL Injection Research and Implementation
## 5 Experiment and Result Analysis
### Experimental Results and Analysis
#### 5.4.1 Comparative Analysis of Important Hyperparameter Adjustment
The training time of the model using the five optimization algorithms is basically the same, and the relative time of Adam and RMSProp is shorter. Compared with the small-batch gradient descent method, the momentum descent method can speed up the convergence speed to a certain extent. Using the small-batch gradient descent method has relatively large fluctuations in the model training process, and the trained classifier has the lowest accuracy rate on the test set. In the experiment, since both the gradient descent method and the momentum method need to manually set the learning rate, it is difficult to adjust the hyperparameters. [PERSON] only needs to set the global learning rate, which can automatically adjust the learning rate during the model training process, and the parameter adjustment is relatively simple. Based on the figure, it is evident that in the deep learning model employed for SQL injection attack detection, the performance of the Adam optimization algorithm is better and its memory requirement is relatively low. In subsequent experiments, the Adam algorithm is used as the optimization algorithm for training classifiers. (2) batch_size  
This experiment also tuned the batch_size. Based on the size of the training data set, the batch_size was selected as 32, 64, 128, and 256. The accuracy of the model is shown in \[g\leftarrow+\frac{1}{m}\
abla_{\theta}\sum_{i}L(f(x_{i};\theta),y_{i}) \tag{10}\]0  
From Figure 6, we can see that when the batch_size value is 32, the algorithm fluctuates repeatedly within 80 epochs without convergence, and the accuracy rate is always very low, fluctuating around 0.35. When the batch_size value is 64, the accuracy rate gradually increases with the increase in the number of training rounds. However, the accuracy rate of the model also fluctuates slightly in the later stages of training. When the batch_size is 128 and 256, the final accuracy of the two is almost the same. \[g\leftarrow+\frac{1}{m}\
abla_{\theta}\sum_{i}L(f(x_{i};\theta),y_{i}) \tag{10}\]1 Model accuracy after using different optimization algorithms. The training time of the model under different batch_sizes is shown in \[g\leftarrow+\frac{1}{m}\
abla_{\theta}\sum_{i}L(f(x_{i};\theta),y_{i}) \tag{10}\]2 It can be seen from the execution time that when the batch_size exceeds 128, the model loss decreases slowly and the execution speed slows down significantly. However, due to the high precision of the model itself, the adjustment of the batch_size parameter is difficult to deal with individual bad cases, and there is no significant improvement in the final result. Therefore, considering the time and detection rate, the value of the batch_size parameter is finally set to 128, with the highest execution efficiency. \[g\leftarrow+\frac{1}{m}\
abla_{\theta}\sum_{i}L(f(x_{i};\theta),y_{i}) \tag{10}\]3 Model loss values after using different optimization algorithms. \[g\leftarrow+\frac{1}{m}\
abla_{\theta}\sum_{i}L(f(x_{i};\theta),y_{i}) \tag{10}\]4 Model accuracy under different batch_sizes. In the experiment, the hyperparameter K-value of the k-max pooling layer in the improved TextCNN structure in the deep learning model was also adjusted. When the K-value is 1, 2, 3, and 4, respectively, when K is 1, it is the maximum pooling, the sliding window is 3, 4, 5, the dropout is 0.5, and the L2 constraint value is 3. Among them, the activation layer in TextCNN uses the ReLU function, and the accuracy of the model changes with the K-value, as shown in \[g\leftarrow+\frac{1}{m}\
abla_{\theta}\sum_{i}L(f(x_{i};\theta),y_{i}) \tag{10}\]5 It can be found that when the K-value is 2, it means that the 2-max pooling operation is used in the model. When other K-values are used, the accuracy of the final model is higher and the detection effect is better. Unlike the enhanced TextCNN proposed in this study, the conventional TextCNN can solely extract the feature possessing the highest eigenvalue, and the accuracy rate is very close in the initial training stage.