---
title: "What is overfitting and how do I prevent it?"  
description: "What is overfitting and how do I prevent it?"  
author: "Dmitry Belov"  
published: 2026-11-18  
updated: 2026-11-18  
canonical: https://www.mindstick.com/forum/163065/what-is-overfitting-and-how-do-i-prevent-it  
category: "AI and Machine Learning"  
tags: ["machine learning", "overfitting", "generalization", "regularization", "model training"]  
reading_time: 1 minute  

---

# What is overfitting and how do I prevent it?

My model scores 99% on training data but only 70% on test data. What is wrong?

## Replies

### Reply by Sagar Poudel

That gap is the classic sign of **overfitting**: the model has memorised the training examples, including noise, instead of learning the general pattern, so it fails on new data. The opposite problem, **underfitting**, is when the model is too simple to learn the pattern at all.

Ways to reduce overfitting:

- **Get more (and more varied) data.**
- **Simplify the model**: fewer features, shallower trees, fewer layers.
- **Regularisation** (L1, L2, dropout) to penalise over-complex models.
- **Cross-validation** to estimate performance more reliably.
- **Early stopping**: stop training when validation error starts rising.
- **Data augmentation** for images and text.

Always keep a separate **test set** that you touch only at the end. Also check for **data leakage**, where information from the test data accidentally reaches training, which gives falsely high scores. Plot training and validation scores together; the point where they split apart tells you when overfitting begins.


---

Original Source: https://www.mindstick.com/forum/163065/what-is-overfitting-and-how-do-i-prevent-it

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
