The connection between epoch and batch size lies in the division of the dataset during training. The dataset is split into smaller chunks called batches, and in each epoch, several iterations are performed based on the batch size chosen. Smaller batch sizes can result in more iterations per epoch, potentially causing a higher convergence rate but at the expense of increased training time. On the other hand, larger batch sizes can help train the model faster, but there is a risk of convergence to suboptimal local minima.