# A Deep Learning Approach to Classify AI-Generated and Human-Written Texts
## 4 Results and Discussion
### Test 1  
The model was trained for a total of 20 epochs and 50 epochs. Figure 5 summarizes the results of test 1 for both 20 and 50 epochs. Based on the training results, the trends in the training and validation loss graphs were similar. The gap between training and validation loss was minimal, and there was no significant increase in validation loss, indicating that the model did not overfit. The early stopping strategy ensured that training was halted when the best validation loss was achieved, further contributing to overfitting prevention. Typical signs of overfitting, such as a rapid decrease in training loss alongside an increase in validation loss, were not observed in this study. Both training and validation losses decreased in a balanced manner. When interpreting the graph, we can analyze the model's performance by examining how the training and validation losses change per epoch. The graph shows the training loss and validation loss at the end of each epoch during training. However, during the 50-epoch training, there were imbalances and increases in the val_loss values. This suggests that the model overfitting led to a decrease in overall performance. Moreover, the 50-epoch model showed overfitting, adapting too much to the training data, which resulted in lower performance on the validation and test sets. Figure 5 depicts the training loss for test 1. Figure 4: Test pseudocode. Table 2 depicts a summary of results from test 1. The results demonstrate that this LSTM-based deep learning model can distinguish between human- and AI-generated texts with very high accuracy. The F1 scores and accuracy rates indicate that the model provides a balanced performance and successfully classifies both classes. Furthermore, the high and balanced F1 scores suggest that the model performed well. The model's overall performance is adequate and has the potential for application in various domains. The model trained with 20 epochs showed a better performance. This indicates that the model received sufficient training after 20 epochs and that further training caused overfitting. For the second model, the precision and recall values for AI and Human classes are less than those of the first model. This comparison highlights that the first model performs better in accuracy and F1 score. In contrast, the second model shows some deterioration in performance, particularly with increased loss and changes in the confusion matrix. This suggests that the model overfitted to the training data, leading to a decrease in overall performance. Moreover, the second model showed overfitting, adapting too much to the training data, which resulted in lower performance on the validation and test sets. As illustrated in Figure 6, the model trained with 20 epochs achieved a Kappa metric score of 0.9542, which is notably higher than the 0.9283 attained by the 50-epoch model. This metric, which measures the agreement between predicted and actual classifications while accounting for chance agreement, provides further evidence of model reliability. The superior Kappa score of the 20-epoch model reinforces our earlier findings, confirming that a shorter training duration--when coupled with appropriate regularization and architecture settings--can lead to more effective generalization and better classification consistency. \begin{table}
\begin{tabular}{l l l} \hline \hline
**Model Features** & **20-Epoch Model** & **50-Epoch Model** \\ \hline Patch size & 128 & 128 \\ Embedding size & 300 & 300 \\ Regularization (L1, L2) & 0.0001 & 0.001 \\ Dropout rate & 20\% & 20\% \\ Model’s test accuracy & 97.28\% & 95.99\% \\ AI precision & 97\% & 91\% \\ Human precision & 98\% & 92\% \\ AI recall & 98\% & 92\% \\ Human recall & 97\% & 91\% \\ AI F1 Score & 98\% & 87\% \\ Human F1 Score & 97\% & 88\% \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Test 1 results. Figure 5: Test 1 training loss validation.