Occam’s razor, also known as the law of parsimony or Ockham’s razor, is the principle that among competing explanations that fit the evidence equally well, the simplest one should be preferred. In AI fundamentals and in artificial intelligence more broadly, it serves as a guiding heuristic for model selection: when two models achieve similar accuracy on observed data, the one with fewer assumptions or lower complexity is expected to generalize better to unseen data.
The principle is named after the fourteenth-century philosopher William of Ockham. Machine learning gave it precise mathematical forms, including Bayesian model comparison, minimum description length and generalization bounds, but it remains a preference, not a law of nature, and modern deep learning complicates its simplest readings.
How Occam’s razor guides learning algorithms
Occam’s razor guides learning by penalizing unnecessary complexity so that a model captures the underlying pattern rather than the noise in its training data. A model that memorizes every training example can reach zero training error yet fail on new inputs, a failure known as overfitting.
Learning algorithms implement the razor through an inductive bias toward simplicity. Decision tree pruning removes branches that add little predictive value, regularization such as L1 or L2 penalties shrinks weights, and early stopping halts training before the model fits noise. Each technique trades a slightly worse fit on training data for better expected performance on test data.
The table below shows how common techniques express the principle in practice.
| Technique | How it favors simplicity | Typical setting |
|---|---|---|
| L1 regularization | Drives many weights to exactly zero | Sparse linear models |
| L2 regularization | Penalizes large weights | Neural networks, ridge regression |
| Tree pruning | Removes low-value branches | Decision trees |
| Early stopping | Limits effective training time | Gradient-based training |
| Feature selection | Keeps only informative inputs | Tabular data models |
| Dropout | Discourages co-adapted units | Deep neural networks |
Formal versions of the principle
Several branches of theory turn the informal razor into measurable quantities. They differ in how they define simplicity, but all of them link shorter or more constrained descriptions to more reliable prediction.
| Framework | Measure of simplicity | Core idea |
|---|---|---|
| Minimum description length | Total bits for model and data | Best model compresses data most |
| Bayesian model comparison | Marginal likelihood | Complex models spread probability thinly |
| Kolmogorov complexity | Shortest program length | Ideal but uncomputable measure |
| Solomonoff induction | Prior weighted by program length | Shorter programs get higher prior |
| VC dimension bounds | Capacity of a hypothesis class | Lower capacity tightens error bounds |
| Information criteria (AIC, BIC) | Parameter count penalty | Fit minus a complexity term |
The Bayesian view is especially instructive: a flexible model must distribute its prior probability across many possible datasets, so it assigns lower evidence to any single outcome. This effect, sometimes called the Bayesian Occam factor, produces a preference for simplicity without any explicit penalty.
Occam’s razor and modern deep learning
Modern deep learning appears to contradict Occam’s razor, because networks with billions of parameters often generalize well even though they can fit random labels. This observation, together with the double descent curve, shows that raw parameter count is a poor measure of complexity.
Researchers now argue that simplicity in deep networks lies in the functions they actually learn, not in their size. Stochastic gradient descent tends to find flat minima and smooth functions, an implicit regularization that acts like a built-in razor. The principle therefore survives, but in a more subtle form.
| Aspect | Classical reading | Modern deep learning reading |
|---|---|---|
| Complexity measure | Number of parameters | Norms, flatness, compressibility |
| Source of simplicity | Explicit penalties | Optimizer and architecture biases |
| Overparameterization | Expected to overfit | Often generalizes well |
| Test error curve | U-shaped | Double descent possible |
Applying the razor in model selection
In practice, the razor acts as a tie-breaker, not a replacement for validation. Practitioners compare candidate models on held-out data and choose the simpler model only when the difference in performance is within statistical noise.
| Situation | Recommended choice | Reason |
|---|---|---|
| Equal validation accuracy | Simpler model | Lower variance, easier maintenance |
| Complex model clearly better | Complex model | Evidence outweighs the preference |
| Small training dataset | Strong regularization | Limited data cannot support complexity |
| Interpretability required | Sparse or rule-based model | Decisions must be explained |
| Large data and compute | Scaled model with regularizers | Implicit biases control overfitting |
Simpler models bring practical benefits beyond accuracy: lower inference cost, easier debugging, fewer failure modes and clearer explanations for auditors. These operational advantages often justify a simpler choice even when a complex model is marginally better.
Misconceptions and limits
The razor is frequently misread as a claim that simple explanations are always true. It only says that, given equal explanatory power, simplicity is the better bet. The no free lunch theorem reminds practitioners that no bias, including a simplicity bias, helps on every possible problem.
- Simplicity depends on representation: a function that looks complex in one encoding can be short in another.
- Oversimplification causes underfitting, which is as harmful as overfitting.
- Parameter count alone misleads, especially for overparameterized neural networks.
- The razor does not replace evidence; validation results take priority.
A further limit concerns what counts as an assumption. Two models with the same number of parameters can embody very different prior commitments, and a model with more parameters may encode weaker assumptions about the data. Experienced practitioners therefore judge simplicity by behavior on held-out data, robustness to distribution shift and ease of explanation, rather than by any single numeric proxy. Used this way, the razor remains a valuable discipline that keeps model development honest about the evidence it actually has.
The idea in brief
Occam’s razor says: do not make things more complicated than needed. If two explanations fit the facts equally well, pick the simpler one.
In AI, this helps a system learn real patterns. A model that is too complex can memorize its examples. It then fails on new cases. A simpler model often handles new situations better. Still, simple is not always right. The data must decide first, and simplicity only breaks the tie.
A practical scenario
A data science team at a regional bank builds a model to predict loan defaults from about 40,000 historical applications. A gradient-boosted ensemble with 1,500 trees reaches an AUC of 0.861 on validation data. A logistic regression with 14 carefully selected features reaches an AUC of 0.856.
Repeated cross-validation shows that the gap is within the range of random variation. The team applies Occam’s razor and deploys the logistic regression. It runs faster, its coefficients can be explained to regulators, and it is easier to monitor for drift.
Six months later, a shift in applicant demographics occurs. The simpler model loses only two points of AUC, while a shadow copy of the ensemble loses five, which confirms that the parsimonious model generalized more robustly.