Did you try leaving a portion of your data (10% to 15%) for validation purpose? You can define early stopping callback object (read here: tf.keras.callbacks.EarlyStopping  |  TensorFlow Core v2.5.1 1) and use it in training. Callback keeps track of the model accuracy on validation data while training it on the train data. If no progress is made for several epochs it stops training and restores the best weights. It should work regardless of the model architecture or task.