23  The brain as an adaptive process

(ns meme-constructor.adaptation.post-iii6-brain
  (:require [scicloj.kindly.v4.kind :as kind]
            [meme-constructor.population :as pop]
            [meme-constructor.convergence :as cv]
            [meme-constructor.adaptation.brain :as b]
            [meme-constructor.figures :as fig]))

Post III.6 of Part III, “A Constructor Theory of Adaptation”.

In a toy brain, ideas that nothing removes still accumulate design, as long as selection reads the task somewhere: in what attention picks, or in the rule that decides which idea stays. A limited budget of variation did no work of its own. And ideas that persist and vary in place search cumulatively without being copied.

This post runs two small experiments on the adaptive process in the brain, and asks what they say about the objection of Fernando, Goldstein & Szathmáry (2010) that a brain needs replicators.

The answer of this post
Selection must read the task somewhere
in what attention picks, or in the rule that decides which idea stays
The budget of variation
did no work of its own
Persist and vary in place
ideas search cumulatively without being copied

23.1 1. An adaptive process in the brain

The adaptive process in the brain (AD7) is Conjecture 7.14 of post 7: a brain that produces hard-to-vary ideas implements unspecific variation (A1′) and selection by the task (A3) over ideas. The argument for it is short. Ideas are designs, the genes do not contain them, and whatever produces a design without containing it implements the two conditions. The last step is the design conjecture (Conjecture I.5.12), so the argument is exactly as good as that conjecture and adds nothing to it.

The argument for the adaptive process in the brain (AD7)
ideas are designs
→
the genes do not contain them
design conjecture (I.5.12)→
the brain implements A1′ and A3 over ideas
The last step is the design conjecture, so the argument is exactly as good as it and adds nothing to it.

A Darwinian brain is not a new idea:

Darwinian brains
who
what varies and is selected
Campbell (1960)
creative thought as blind variation and selective retention
Edelman (1987)
selection among neuronal groups
Calvin (1987)
the brain as a "Darwin machine"
Fernando, Goldstein & Szathmáry (2010)
neuronal replicators
this book
the idea, an abstract constructor; the neuronal group is only its neuronal phase

What is ours is the reading: the unit is the idea, an abstract constructor, not the neuronal group, which is only the phase in which the idea is carried in a head (post 1). The function of a culture meme has no recipe and no vehicle in Marletto’s sense (post 6). Which physical resources the ideas share (working memory, cleanup attractors, reconsolidation, attention) is a question for neuroscience that nothing here tests.

Attention that goes to better ideas presupposes a criterion (post 4). Post I.6 found that such a criterion grows content only with an external anchor. Below, \(F_\text{real}\) stands for an anchored criterion. Where the anchor comes from is not modelled.

23.2 2. The competition-for-variation experiment (Y7)

One might think that where storage is unlimited, competition has moved to the budget of variation: a step of thought given to one idea is not given to another. It does not hold. The competition-for-variation experiment (Y7) gives every rule the same budget, and the budget decides nothing.

Definition III.6.1 (Attention over an unlimited store). A store holds ideas, variants of the toy world of post 4, and nothing is ever removed. At each tick attention picks one stored idea, one noisy reconstruction (pop/reconstruct) makes a new idea from it, and the new idea is stored too. The rules differ only in how attention picks:

Definition III.6.1: attention over an unlimited store
the store
nothing is ever removed
attention picks one idea→
one noisy reconstruction
pop/reconstruct
→
a new idea
↺stored too; next tick
Three rules of attention
Uniform
every stored idea equally
Task-weighted
idea i with weight e^F_real(i)
Focus
  • one idea is in focus and is always the one varied
  • the new idea takes the focus if its F_real is at least that of the focus

The step never reads the task. Uniform attention does not either.

Proposition III.6.2 (A blind budget finds nothing). If neither the step nor what is varied nor what is stored depends on the hidden patterns of the point blocks, the expected hit rate of the ideas made stays at chance, at most 1/20 per block, whatever the budget. The ideas made are then independent of the patterns; this is the information bound (S1′) of post I.5 in small.

Proposition III.6.2: a blind budget finds nothing
step, what is varied, what is stored
none depends on the hidden patterns
→
the ideas made are independent of the patterns
whatever the budget→
hit rate at chance
at most 1/20 per block

Task-weighted attention needs no experiment either. Picking an idea with weight \(w\) from a store that only grows is, step for step, drawing a parent with weight \(w\), so it is the weighted pool of the competition experiment (E14) by construction, and its curve coincides with that pool’s. What is new is the focus: one slot, one comparison per tick.

World, copy noise and founder are those of the competition experiment (E14): landscape seed 1, block size 5, no size cost, four small points among ten blocks, jump probability 0.05, one random founder (seed 1001) stored 60 times. 36,000 ticks, as many variation steps as 600 generations of 60. The hit rate is the share of small points carried by the ideas made. Seeds 1 to 10.

(def landscape (pop/make-landscape {:block-size 5 :seed 1 :size-cost 0.0}))
(def copy-noise {:p-loss 0.02 :p-gain 0.01 :p-jump 0.05})
(def founder (cv/random-variant (:n-tasks landscape) 1001))
(def seeds (range 1 11))
(def ticks 36000)
(def rules
  [["uniform" {:kind :weighted :beta 0.0}]
   ["task-weighted" {:kind :weighted :beta 1.0}]
   ["focus" {:kind :focus}]])
(defn attend [attention seed]
  (b/run-attention {:landscape landscape :copy copy-noise :init founder
                    :ticks ticks :window 60 :attention attention :seed seed}))
(def y7
  (into {} (for [[nm a] rules] [nm (mapv #(attend a %) seeds)])))
(defn mean-of [xs] (/ (reduce + 0.0 xs) (count xs)))
(defn r3 [x] (/ (Math/round (* 1000 (double x))) 1000.0))
(def y7-table
  (vec (for [[nm _] rules
             :let [runs (y7 nm)]]
         {:rule nm
          :final-hit (r3 (mean-of (map #(b/final-mean (:rows %) :hit 50) runs)))
          :first-idea-with-all-points (mapv :first-full runs)})))
(kind/table y7-table)
rule final-hit first-idea-with-all-points
uniform 0.02
[nil nil nil nil nil nil nil nil nil nil]
task-weighted 0.883
[2334 4438 792 360 507 731 332 605 1371 161]
focus 0.884
[421 542 1290 2424 1157 282 344 448 989 289]

“Final” is the mean over the last 3,000 ticks, averaged over seeds. :first-idea-with-all-points is the first tick at which a made idea carried all four points (nil: never).

Observation III.6.4 (seeds 1 to 10). Uniform attention ends at a hit rate of 0.02, at chance, and never makes an idea with all four points. Task-weighted attention and the focus end at 0.883 and 0.884, the shortfall being copy noise, and first make an idea with all points after 161 to 4,438 and 282 to 2,424 ticks.

The same budget under every rule (36,000 steps, seeds 1–10)
rule
reads the task?
final hit rate
an idea with all four points
uniform
no
0.02, chance
never
task-weighted
in what is varied
0.883
after 161 to 4,438 ticks
focus
in what stays
0.884
after 282 to 2,424 ticks
The shortfall from 1 is copy noise. The budget decided nothing; whether selection read the task decided.

The budget did no work. It was the same under every rule. What decided was whether selection read the task. So competition did not move to the budget of variation. Under task-weighted attention there is no competition anywhere, and design was found and held by selection alone, as in the competition experiment (E14) (post I.5).

What the focus adds. It needs one comparison per tick, not the weights of the whole store: a weak climber (post III.4) with a perfect memory beside it. And in the focus, unlike the store, staying is an achievement: an idea stays only while no rival beats it, and two ideas cannot both be in focus. That gives the knowledge condition (D1) content on a resource of attention, with storage unlimited. It does not show that keeping needs this: the store kept the design too, because nothing removes anything from it.

The store and the focus
unlimited
The store
  • nothing is removed, so staying is free
  • it kept the design too
one slot
The focus
  • one comparison per tick: a weak climber with a perfect memory beside it
  • an idea stays only while no rival beats it
  • gives the knowledge condition (D1) content on a resource of attention
It does not show that keeping needs the focus.

23.3 3. Persistence and variation, or replication?

Fernando, Goldstein & Szathmáry (2010) argue that selection among neuronal groups is not enough and that replicators, units that copy their information into other units, overcome its limits. Our two conditions do not demand copying, only persistence and variation from what exists. Is that enough for cumulative search?

Definition III.6.6 (Units). Twenty units each hold one idea, all starting from the founder. Each tick attention picks one unit, uniformly or with weight \(e^{F_\text{real}}\), and one candidate is made, in one of three modes. Same world, 36,000 ticks, seeds 1 to 10.

Definition III.6.6: three modes for twenty units
mode
the candidate
where it goes, if at least as good
what it is
fresh
a new random idea
replaces the unit's idea
selection without heredity
in place
a step from the unit's idea
replaces it
persistence and variation, nothing copied
replicate
a step from the unit's idea
into a uniformly drawn other unit
copying
(def unit-conditions
  [["fresh draws, uniform attention" {:mode :fresh :attention :uniform} "#7f7f7f"]
   ["in place, uniform attention" {:mode :in-place :attention :uniform} "#1f77b4"]
   ["in place, task-weighted attention" {:mode :in-place :attention :fitness} "#9467bd"]
   ["replicate, task-weighted attention" {:mode :replicate :attention :fitness} "#ff7f0e"]])
(def units
  (into {} (for [[nm o _] unit-conditions]
             [nm (mapv #(b/run-units (merge {:landscape landscape :copy copy-noise :init founder
                                             :m 20 :ticks ticks :window 600 :seed %}
                                            o))
                       seeds)])))
(kind/plotly
 {:data (vec (concat
              (for [[nm _ colour] unit-conditions]
                {:type "scatter" :mode "lines" :name (str nm ": mean over units")
                 :x (map :tick (first (units nm))) :y (b/window-means (units nm) :mean-hit)
                 :line {:color colour :width 2}})
              (for [[nm _ colour] unit-conditions]
                {:type "scatter" :mode "lines" :name (str nm ": best unit")
                 :x (map :tick (first (units nm))) :y (b/window-means (units nm) :max-hit)
                 :line {:color colour :width 1 :dash "dash"}})))
  :layout {:title {:text "Units: hit rate of the ideas held (mean of seeds 1–10)"}
           :xaxis {:title {:text "variation steps"}}
           :yaxis {:title {:text "hit rate"} :range [-0.02 1.02]}
           :legend {:orientation "h" :y -0.3}
           :height 520}})
(def units-table
  (vec (for [[nm _ _] unit-conditions
             :let [runs (units nm)]]
         {:condition nm
          :final-mean-hit (r3 (mean-of (map (comp :mean-hit peek) runs)))
          :final-best-unit (r3 (mean-of (map (comp :max-hit peek) runs)))
          :first-unit-with-all-points (mapv (fn [rows] (:tick (first (filter #(== 1.0 (:max-hit %)) rows))))
                                            runs)})))
units-table
[{:condition "fresh draws, uniform attention",
  :final-mean-hit 0.548,
  :final-best-unit 0.775,
  :first-unit-with-all-points
  [nil nil 21000 nil nil nil nil nil nil nil]}
 {:condition "in place, uniform attention",
  :final-mean-hit 0.988,
  :final-best-unit 1.0,
  :first-unit-with-all-points
  [3600 4200 3600 4200 2400 2400 4200 6600 4800 4200]}
 {:condition "in place, task-weighted attention",
  :final-mean-hit 0.05,
  :final-best-unit 1.0,
  :first-unit-with-all-points
  [600 1200 1200 1200 600 1200 600 600 1200 600]}
 {:condition "replicate, task-weighted attention",
  :final-mean-hit 1.0,
  :final-best-unit 1.0,
  :first-unit-with-all-points
  [1800 600 1200 1800 1200 1800 1200 1200 1200 1200]}]

:first-unit-with-all-points is read every 600 ticks (nil: never).

Observation III.6.7 (seeds 1 to 10, table above). Fresh draws end at a mean hit rate of 0.548 over units and 0.775 in the best unit; only in seed 3 did a unit get all four points, by tick 21,000. In place with uniform attention, every seed had a unit with all points by tick 2,400 to 6,600, and the units end at 0.988. In place with task-weighted attention, the best unit had all points by tick 600 to 1,200, but the mean ends at 0.05: attention stays with one unit and the other nineteen gain nothing. With replication a unit had all points by tick 600 to 1,800, and at the end every unit has them.

Units: the outcome (seeds 1–10)
condition
final mean over units
a unit with all points
fresh draws, uniform attention
0.548 (best unit 0.775)
only seed 3, by tick 21,000
in place, uniform attention
0.988
every seed, by tick 2,400 to 6,600
in place, task-weighted attention
0.05: nineteen units gain nothing
by tick 600 to 1,200
replicate, task-weighted attention
every unit has them
by tick 600 to 1,800

Uniform attention finds everything here, although it does not read the task, because the rule “replace if at least as good” does. That is the general point, and it corrects the tempting claim that attention helps only by reading the task: selection must read the task somewhere, in what gets varied or in what stays. Proposition III.6.2 excludes only the case where neither does.

Selection must read the task somewhere
In what gets varied
task-weighted attention
In what stays
  • the focus; the takeover rule "replace if at least as good"
  • units in place under uniform attention found everything
Neither
uniform attention over a store: chance (Proposition III.6.2)
This corrects the tempting claim that attention helps only by reading the task.

Cumulative search without replication. In the toy, persistence plus variation from what exists suffices for cumulative search, as the cumulative-selection proposition (S2) of post I.5 leads one to expect for a climber. Selection without heredity does not: chance offers all four points about once in a million draws. The line runs between heredity and no heredity, not between copying and self-maintenance. Copying spread what one unit found, so that attention could concentrate without leaving the other units behind.

Where the line runs: heredity, not copying
fresh draws
No heredity
chance offers all four points about once in a million draws
in place
Heredity without copying
persistence plus variation from what exists: cumulative search
replicate
Heredity with copying
spread what one unit found, so attention could concentrate without leaving the others behind

The toy’s blocks are independent and there is no recombination, so an advantage of replicators that lies in combining partial solutions cannot show here; in post III.5 recombination helped exactly where many points were in flight at once. “In place” assumes that a unit can vary its content while keeping the rest; whether neuronal groups can is a question about neuronal groups. And a design held in one unit is lost with it, so replication may matter more for keeping than for finding. The toy never loses a unit.

23.4 Summary

  • The adaptive process in the brain (AD7) follows from the process-free definition of design plus the design conjecture, and is only as good as that conjecture.
  • With unlimited storage and one variation step per tick, the small points were found and held when attention read the task, and not with uniform attention. The budget of variation did no work (Proposition III.6.2); competition did not move there.
  • Task-weighted attention is weighted parent choice by construction. A single focus does the same with one comparison per tick, and makes staying an achievement.
  • Selection must read the task somewhere: units varied in place under uniform attention found everything because the takeover rule read it.
  • Units that persist and vary in place search cumulatively; fresh draws do not; copying spread the design without finding it faster.

23.5 Open problems

  • Keeping. Does keeping an idea under ongoing variation need a resource like the focus, or only selection that keeps reading the task? This is the book’s central open question (post I.5); the toy cannot answer it, because its store and its units never lose anything.
  • Replication where it could matter: with recombination, structured tasks and the loss of units.
  • The anchor. Attention by \(F_\text{real}\) assumes an anchored criterion. How a brain gets one is the question of post I.6.
  • The physical resources. Which of working memory, cleanup attractors, reconsolidation and attention the ideas of a brain share is untested. A hardware version of the competition experiment (E14), on a high-dimensional memory model, is planned.

23.6 References

  • Calvin, W. H. (1987). The brain as a Darwin machine. Nature 330, 33–34. doi:10.1038/330033a0 (verified in post 7)
  • Campbell, D. T. (1960). Blind variation and selective retention in creative thought as in other knowledge processes. Psychological Review 67, 380–400. (verified in post 7)
  • Edelman, G. M. (1987). Neural Darwinism: The Theory of Neuronal Group Selection. Basic Books. (verified in post 7)
  • Fernando, C., Goldstein, R. & Szathmáry, E. (2010). The neuronal replicator hypothesis. Neural Computation 22(11), 2809–2857. (verified in post 7)
source: book2/notebooks/meme_constructor/adaptation/post_iii6_brain.clj