Regularization
The collective name for everything done to stop a model memorizing the training data instead of learning the pattern. The price is always the same: a worse fit on training data, a better one on new data.
The classics are L2 (weight decay), which penalizes large weights and keeps the model smooth, and L1, which drives weights to exactly zero and thereby prunes features. Add dropout, which randomly switches off neurons during training so the network can't rely on individual pathways, early stopping when validation loss starts rising, data augmentation that creates more variants of the same example, and label smoothing to temper overconfidence. In large language models most of these matter less — the dataset is so large relative to the number of epochs that overfitting rarely gets a chance to occur.