Bloat · evolutionary computation

Also known as: code bloat

On this page 7

Bloat in evolutionary computation is the tendency of evolved solutions, most often programs in genetic programming, to grow in size over generations without a corresponding improvement in fitness. Also called code bloat, it shows up as trees, expressions or rule sets that become steadily larger while their behavior and score barely change.

Bloat matters because it slows evaluation, consumes memory and hides useful structure inside large amounts of redundant material. It is one of the oldest and most studied problems in variable-length representations, and controlling it is a standard part of designing any serious genetic programming run.

How bloat emerges in variable-length representations

Bloat emerges when the representation allows individuals to change length and the variation operators do not penalize growth. In tree-based genetic programming, subtree crossover swaps branches of different sizes, so offspring can become larger than either parent. Over many generations, average program size often rises sharply, sometimes growing by an order of magnitude while best fitness stalls.

Much of the growth consists of introns: code that has no effect on the output. Examples include x * 1, x + 0, branches guarded by conditions that are never true, and subtrees whose results are overwritten. Introns are invisible to the fitness function, so selection neither rewards nor removes them.

The table below lists the common forms of redundant material found in bloated programs.

FormExampleEffect on fitness
Neutral operationsAdding zero or multiplying by oneNone
Unreachable branchesAn if-branch with an always-false conditionNone
Overwritten resultsA value computed and then replacedNone
Canceling pairsNegating a value twiceNone
Near-neutral subtreesTerms with tiny numeric contributionsNegligible
Forms of redundant code in bloated individuals

Theories that explain why bloat happens

Several theories explain bloat, and researchers generally accept that more than one mechanism operates at once. Their predictions differ, which matters when choosing a control method.

TheoryCore ideaImplication
Replication accuracyIntrons protect useful code from destructive crossoverLarger programs produce offspring that keep parental fitness
Removal biasCrossover removing small subtrees is less harmfulOffspring tend to gain more than they lose
Nature of program search spacesLarger programs vastly outnumber smaller ones with equal fitnessRandom drift moves toward larger sizes
Crossover biasSubtree crossover samples small programs oftenSmall programs are weeded out, pushing average length up
Size evolution equationSize change follows selection on length classesBloat requires a correlation of size with fitness
Main explanations of bloat

The replication accuracy theory, also called the protection hypothesis, is the most intuitive: when crossover hits an intron, the offspring stays as fit as its parent, so bulky individuals survive variation more reliably. The crossover bias theory offers a more formal account and explains why bloat appears even without fitness pressure on size.

Methods for controlling bloat

Bloat control methods limit growth directly or make size costly during selection. No single method is best in every case, and practitioners often combine a hard limit with a soft pressure.

MethodHow it worksMain trade-off
Depth or size limitsRejects offspring beyond a maximum depth, often 17Simple, but growth piles up at the limit
Parsimony pressureSubtracts a size penalty from fitnessCoefficient is hard to tune
Lexicographic parsimonyPrefers smaller programs only when fitness tiesWeak effect if ties are rare
Tarpeian methodAssigns very low fitness to some oversized individualsAdds a probability to tune
Double tournamentRuns a second tournament on sizeExtra selection parameter
Multi-objective selectionTreats size as a second objective, for example with NSGA-IIReturns a front of solutions, not one
Operator equalizationControls the length distribution of the populationMore complex to implement
Common bloat control methods

Multi-objective approaches are popular in symbolic regression, where a Pareto front of accuracy against complexity lets the analyst choose a readable model. Simplification of individuals, either algebraic or by removing introns, can also be applied, although removing introns may increase the destructive effect of crossover.

Bloat is often confused with overfitting and premature convergence, but the three describe different failures. Bloat concerns size without benefit; overfitting concerns fitness without generalization; premature convergence concerns loss of diversity.

ProblemSymptomTypical cause
BloatSize grows while fitness stagnatesNeutral code and crossover dynamics
OverfittingTraining error falls, test error risesPrograms memorize noise in the data
Premature convergencePopulation becomes uniform too earlyExcessive selection pressure
Bloat and neighboring failure modes

The problems interact. Large programs have more capacity to memorize training data, so bloat control often improves generalization as a side effect. This link is one reason parsimony is considered a form of regularization.

Where bloat appears and common mistakes

Bloat is strongest in tree-based genetic programming but also affects linear genetic programming, grammatical evolution and other variable-length encodings. Cartesian genetic programming largely avoids it because its genome has a fixed number of nodes, with inactive nodes acting as neutral material that does not raise evaluation cost.

  • Relying only on a depth limit, which caps growth but leaves programs filled to the limit.
  • Setting the parsimony coefficient too high, which collapses the population to trivial programs.
  • Measuring only best fitness, so the rise in average size goes unnoticed.
  • Ignoring evaluation cost, which can make late generations many times slower than early ones.

Put simply

Genetic programming breeds computer programs the way a farmer breeds crops. Over time, the programs often get longer and longer. Yet they do not get better at their task. This is bloat.

Picture an essay that keeps gaining sentences like “and also nothing changed”. The meaning stays the same, but it takes longer to read. Bloat wastes time and memory, so designers add rules that keep programs short.

In practice

An engineer uses symbolic regression to find a formula for the heat loss of a building from temperature, wind speed and insulation data. The first run uses standard tree-based genetic programming with a population of 1,000 and 100 generations. By generation 60, the average tree has grown from about 20 nodes to over 300, the best error has barely improved since generation 25, and each generation takes several times longer to evaluate.

The engineer reruns the search with a maximum depth of 12 and multi-objective selection on error and size. The new run finishes in a fraction of the time and returns a Pareto front of formulas. The engineer picks one with about 15 nodes and nearly the same accuracy as the best bloated tree, and it also predicts held-out data better.