We can't avoid overfitting completely, but what we can do is to estimate how well your model performs accounting for it. This is done via a process called “cross validation,” where we divide our labeled data into “training data” and “test data.” You tune a model to the training data, but you only evaluate its performance on the test data.