This post investigates the paper Evolvability by computer scientist Leslie Valiant analyzing evolution and its limits through the lens of machine learning theory.
The first section gives an overview of Valiant’s now famous Probably Approximately Correct learning model, and the material is derived from Kearns and Vazirani’s short textbook Introduction to Computational Learning Theory. Valiant’s more recent notion of evolvability (explored in the second section) implies PAC learnability, but not conversely. In particular, the parity functions (i.e. the mod 2 linear functions ) are learnable, but provably not evolvable (under Valiant’s or any similar notion of evolvability).
Throughout, I’ve included some fun pictures, produced by simple simulations in Python with matplotlib.
1. Probably Approximately Correct
As motivation for Valiant’s Probably Approximately Correct (PAC) learning model, consider the following scenario. There is some closed axis-aligned rectangle (called the target) in the unit cube whose shape we’d like to learn from data. Say, we can draw examples from some oracle which outputs a sequence of pairs with drawn iid uniformly from and the boolean value of the proposition .
We want a learning algorithm that can form a reasonable hypothesis for ‘s shape from a finite sample of data like the following.
Here positive and negative examples are labeled black and white, respectively. Ten points don’t constitute a lot of data, but it’s enough to suggest an obvious candidate guess for ‘s shape, namely the closest-fit rectangle around the positive examples.
A nice property of the closest-fit algorithm is that it always produces a hypothesis consistent with the data, assuming the oracle does its job perfectly. Of course, with such a small sample size, there may be substantial error (measured in area) between the closest-fit rectangle and the true target.
The hope is that this error quickly converges to as the number of samples grows. The pictures above and below are produced by this simulation code, and they indeed suggest convergence.
Here’s a graph of the error in the above simulation as a function of the number of samples.
Rerunning the simulation 100 times suggests this behavior is typical.
The closest-fit algorithm is very simple, and convergence should come as no surprise. But what does convergence mean here? If we’re very unlucky, we could see a long sequence of data points that doesn’t result in low error for the closest-fit algorithm.
The importance of Valiant’s work on the PAC model is that it provides a rigorous mathematical framework for proving the correctness of such algorithms. (All of the standard disclaimers about the model being unrealistically simple and so forth apply. Some such concerns, e.g. learning from a noisy oracle, have been studied, but this overview isn’t really the place for them.)
The PAC criterion essentially says that the error quickly converges to 0 in probability for any target , and actually for any (Borel) probability distribution on . Explicitly, we mean:
- is both the training distribution used by the oracle to produce samples and the target distribution according to which the error of the algorithm is judged.
- Convergence in probability means for any and there’s a number called the sample complexity such that after samples, the probability is at most that the algorithm will output a hypothesis with error exceeding . (So the chance of noticeable failure is slim in the face of a large amount of data.)
- By “quickly”, I mean that we can put an upper bound on the sample complexity which is polynomial in , , and the ambient dimension .
- The parameter corresponds to “probably”, and the parameter corresponds to “approximately correct”. To the extent that we only care about bounds being polynomial, we could replace and with their minimum, without changing the criterion of learnability.
- It’s sometimes worthwhile to allow the algorithm to output hypotheses from a slightly more general class than the target can actually come from.
- And there are a few more subtleties that I’m happy to brush under the rug.
Theorem 1 The closest-fit rectangle algorithm suffices to learn axis-aligned rectangles in in the PAC model with sample complexity
Proof: The main idea is that the algorithm can only output a hypothesis rectangle with error if at least one of the sides of the target rectangle is not “well-defined” by the data by having a positive example nearby, and a reasonably large number of samples makes this occurrence rare.
Explicitly, for fixed target , we mean for each , let be least such that the sub-rectangle with -th component has at least less area than , relative to . Note that if has a probability density function, i.e. is absolutely continuous, then the measure of is exactly .
Define and similarly.
If the sample hits every and every , the output hypothesis will have error . So error can only occur if the samples miss at least one of these sets, which each have measure at least . That is,
using the inequality , valid for all real by linear approximation and convexity. Finish the proof by solving for to make the rightmost expression in the above .
Corollary 2 The class of conjunctions of boolean literals, e.g. is PAC-learnable with the same sample complexity as for axis-aligned rectangles.
Proof: Boolean conjunctions are the special case of axis-aligned rectangles where the target distribution is supported on the finite set of bit vectors . Explicitly, the initial empty rectangle corresponds to the unsatisfiable conjunction , and expansion of the closest-fit rectangle corresponds exactly to dropping literals from the hypothesis conjunction when they’re inconsistent with the data:
- means is in the conjunction and is not.
- means is in the conjunction and is not.
- means neither nor is in the conjunction.
One notable difference between rectangles and conjunctions is that there are only finitely many conjunctions (and finitely many bit vectors). There are exactly satisfiable boolean conjunctions, as for each , at most one of and can appear, and (functionally) there is only one unsatisfiable conjunction, containing some and its negation.
We mentioned that one desirable aspect of the closest-fit rectangle (and hence the closest-fit conjunction) algorithm is that it always produces a hypothesis consistent with the data. Conveniently, production of a consistent hypothesis is actually sufficient for PAC learning, for finite classes of functions which grow no faster than for some polynomial .
Theorem 3 (General Learning Bound for Finite Classes) A learning algorithm which always produces a consistent hypothesis from some finite set will, with probability at least , have error for sample size
In addition to simplifying (probable approximate) correctness proofs for many natural classes of functions , this result improves the bound for learning boolean conjunctions (without changing the algorithm), from dependence on dimension to .
The proof is surprisingly simple.
Proof: Consider all hypotheses with error at least . For such to remain consistent with labeled examples, each example must independently miss the region on which differs from the target, which we assumed has area under the target distribution. For individual , this happens with probability at most , using . Summing this bound over all , we see that the probability that there exists any hypothesis with error at least remaining consistent with samples is at most . Solve for a lower bound on that makes this .
The General Learning Bound is often billed as a version of Occam’s Razor, expressing the idea that simple explanations (or rather, explanations belonging to a small reference class , which is basically the same thing) are more likely to be correct than elaborate ones, in the case that simple ones are sufficient for explaining the data.
A very important example is the class of parity functions . These are the mod-2 linear functions ; equivalently, they are formed as xor’s of sets of positive boolean literals.
Proof: There are only parity functions, so by the General Learning Bound, it suffices to give an algorithm that produces results consistent with the data. By linearity over , values for any set of bit vectors determine values for any bit vectors in the linear span of that set. So the algorithm should find a maximal linearly independent subset of the examples, extend it to a basis of all of , and output the linear function that sends any labeled to its appropriate label , and sends basis vectors in to .
To end this section, I’ll note that the General Learning Bound/Occam’s Razor actually admits a generalization to sufficiently simple infinite function classes, such as the axis-aligned rectangles in . Namely, for classes with finite Vapnik-Chervonenkis dimension growing only polynomially in , identification of consistent hypotheses is sufficient for PAC learning. See Chapter 3 of Kearns and Vazirani for details and examples.
Now we’re ready to talk about Valiant’s idea that evolution can be studied via computational learning theory, particularly from within the PAC model.
Let’s look first at the negative result that the parity functions can’t feasibly be evolved under his definition, despite the fact they can be learned as in Corollary 4 above. (Valiant then provides a few modest positive results, so the negative result is non-vacuous.) The particulars of his definition are rather complex, but non-evolvability of the parity functions will still hold for any notion of evolvability bearing a few reasonable similarities.
Given a function class (of possible “genotypes”), a reasonable notion of being evolvable should include a biased random walk through .1
While the set of possible successors of any element can and should depend on the particular details of how is represented as a mathematical expression (analogous to small genetic mutations), the bias determining which is selected should not. Rather, selection should only be biased in terms of error relative to an unknown target function (“high-fitness phenotypes” are reliably selected for “in the wild”).
Then evolvability should require (at least) that a polynomial-length walk should have a non-negligible probability of producing a non-negligible increase in performance. Valiant asks for high probability of low error, but notes that it may be worthwhile to consider relaxations; for example fitness may improve for a while before getting stuck at a local optimum.
But the issue with parity functions is that there’s no such thing as approximating one with another: the difference (xor) of two parity functions is itself a parity function. So two parity functions either agree exactly, or they differ on half of all possible inputs.
Under the uniform distribution on inputs, no performance feedback is possible, short of accidentally stumbling upon the target function exactly. With parity functions, this won’t realistically happen in a polynomial-length walk. And so one can say that the generally misguided irreducible complexity argument actually does apply to parity functions!
But what about trying to make positive progress? How might we evolve axis-aligned rectangles, say under the uniform distribution on ? Under Valiant’s model (which is rather laborious to write down in full generality), it might look something like this.
- Initialize the hypothesis rectangle to all of .
- At each time step (“for each generation”), find neighboring rectangles by individually perturbing each side by for some small , possibly chosen randomly.
- For some predetermined number , take a sample of uniform random points , and judge all the hypotheses above based on their performance on this sample, relative to the correct labels. The number of times that a hypothesis gets a label wrong, divided by , is called the empirical error.
- A “mutation” resulting in lower empirical error than the old hypothesis by at least some threshold amount is called beneficial. If there is a beneficial mutation, choose one of them uniformly at random as the new hypothesis.
- (If there is no beneficial mutation, then pick the new hypothesis uniformly at random from the “neutral mutations” whose empirical error has not increased by more than . If the old hypothesis is included in the new generation, this step will never fail.)
- Repeat for some number of steps .
Note that we can’t really expect the error to get much lower than the perturbation amount , but hopefully with small, the other constants , , and don’t need to be too large for the error in the process above to reliably settle around something small in .
Giving phrases like “reliably settle” and “not too large” meanings in terms of ‘s, ‘s, and polynomial bounds as Valiant does, it’s clear the the above process can be simulated in the PAC framework so that evolvability (over a distribution) should imply PAC learnability (over that distribution). One subtlety is that the neighborhood around each hypothesis needs to depend on the desired precision and confidence, as through above.
I claim the above works reasonably well for what it claims to do. Figuring out all the necessary polynomial bounds to formally prove evolvability seems quite a bit more involved than proving PAC learnability, and not necessarily something I wanted to do. (Although the different approach in Valiant’s Proposition 5.1 on conjunctions might be possible to adapt to rectangles.)
Here’s an animation from a small simulation I ran (code here, animated gif created with imagemagick convert) in 2 dimensions with , , , and relatively large perturbation chosen uniformly randomly between and for each mutation. As above, the hypothesis is shown in blue and the target in green. Click to start the animation.
It seems to stabilize relatively quickly around a small error.
A larger simulation with , , , and uniform random between and shows similar behavior. The settling is, of course, slower with smaller perturbations, but the steady-state error is much less.
So it seems likely that this algorithm can evolve axis-aligned rectangles in the unit square , over the uniform distribution, starting from itself. This, of course, not a proof, and I have not even considered the general -dimensional case.
It would be nice if evolution could start from anywhere and still reliably reach the “correct” result. However, this seems to be too much to ask: evolution can get stuck at local optima, and this phenomenon indeed shows itself for rectangles. If the initial rectangle has little or no overlap with the target, error is decreased by simply shrinking the hypothesis to the empty rectangle!
The particular way I’ve written the simulation, it’s possible for a small or zero-area rectangle to “drift” by a sequence of neutral mutations toward the target, at which point expansion will start to decrease error again. But this requires a relatively specific sequence of mutations, so the local optimum at an empty rectangle is almost stable.
Valiant’s full, general definition of evolvability actually does make the requirement that evolution could proceed from any starting point, as well as the requirement that any target distribution will do. The idea, then, is that this distribution could even change at some point in time, and evolution could proceed in another direction, without having backed itself into a corner during the first phase. This seems like quite a bit to ask, and even Valiant’s two positive results each ignore one or both of these desiderata! They are:
- Theorem 5.1: Conjunctions of positive boolean literals (e.g. , but not ) are evolvable over the discrete uniform distribution, from any starting point.
- Proposition 5.1: Conjunctions of arbitrary boolean literals are evolvable over the discrete uniform distribution, starting from the (always true) conjunction of no literals, and actually assuming a slightly more general representation class. Specifically, Valiant uses (integer, conjunction, conjunction) triplets at each step, as kind of a hack to simulate “evolution with optimization”, which tries to pick the best mutation at each step.
Ultimately I think Valiant’s full wish list for evolvability is a bit much if any non-trivial class is to satisfy the whole thing, and I’d say the lack of completely satisfactory results in the paper is telling.
The most obvious issue to my mind is that distributions which are highly concentrated on a subset of extremely small measure will throw a wrench into reasonable mutation processes: extremely small genotypic mutations (and hence many generations) will be required to tune phenotypes accurately.
A reasonable relaxation of “evolvable over any distribution” should take such concentration of measure into account, perhaps only considering distributions which never differ from the uniform distribution (continuous or discrete version, as appropriate) by more than a constant multiplicative factor in their probability density/mass functions. Perhaps all relevant bounds on , , and so forth should be required to depend only polynomially on and as well. This unfortunately complicates the already large definition, but I do suspect something like this is necessary.
- One might still try to evolve parity functions with some richer class , where the argument we give no longer holds. Valiant’s full argument is slightly more sophisticated: it points out that evolvability under any representation class implies learnability in the Statistical Query model, which is a weaker version of PAC in which parity functions are famously not learnable.