• Growing from a Single Cube

    Until now, the simulated creatures arrived fully formed – the genome described a body and the engine assembled it at full size. But thats not the organic experience I’m after.

    So there is now a second kind of creature. It starts as one small cube, and grows.

    The genome describes development, not shape

    One starting cube, a few kinds of part (I call them roles), and rules. There are only four operations:

    1. extend – a part gets longer. Parts are born small and grow to their adult size.
    2. divide – a part that’s long enough splits in two across its length, like a cell. Both halves keep growing. A few rounds gives a segmented body, a tail or a trunk.
    3. bud – a part sprouts a different part from its surface: a leg from a body segment, a branch from a trunk.
    4. detach – a part lets go. That’s reproduction, and gets its own post.
    5. convert – a part transforms into another part

    The grey crawler is three rules

    • back divides into back – until there are four segments
    • back buds a leg, mirrored left and right – one pair per segment
    • back buds a tail – on the last segment
    "edges": [
      { "from": "back", "to": "back", "op": "divide" },
      { "from": "back", "to": "leg",  "op": "bud", "bilateral": true },
      { "from": "back", "to": "tail", "op": "bud" }
    ]

    (trimmed – the real rules also carry when to fire, which way to point and how the joint moves)

    The legs on neighbouring segments are half a cycle out of step, because the rule says each generation is 180° out of phase with its parent. So the alternating gait is laid down by the growth rule, not set leg by leg. The motors stay off until it has finished growing.

    Let the same body keep dividing and you get this:

    Centipede – 7 rules, 43 parts.

    Rules are local

    No part knows what the whole creature looks like. A rule fires when that part reaches its end condition, – right size and in the right generation, and has the materials.

    A branch sprouts two smaller copies of itself, until they are too small to fork. 4 rules.
    Pine – 6 rules.

    The nice consequence is that the same genome grows a different body in different conditions – a plant in shade stays stunted next to its well-lit twin.

    Contact inhibition

    Before growing, a part checks whether it would run into something. If so, it doesn’t. (Real cells do this, same name.) It stops bodies pushing parts through each other, which in a physics engine is free energy.

    It also bit me: two leg rules on one segment pointing nearly the same way, and the second pair is quietly refused. Four legs means two segments. That cost me – and several language models – a fair few two-legged cats.

    Its totally not reliable though..

    There’s a video of everything that grows so far on Patreon. If there’s something you’d like to see grow, tell me.

    Cheers!

  • Country-Policy LLMs: Co-Evolving near a Nash Equilibrium

    The problem I’m trying to solve is whether there are biases in the responses of the LLMs that are not explicit in their responses but can only be seen when they are asked to iterate on complex tasks.

    An interesting task im trying to test biases with is choosing policy decisions for a country.

    Changes to national and international policies can have surprising counterintuitive results, and it would be unreasonable to model this with any accuracy, so instead I use an NKC tuneable fitness landscape to model the complex interactions between countries and policy decisions. 

    Quick summary of the process:

    1. Create an NKC co-evolutionary system where each “country” (species) is controlled by an LLM to optimize its policy genome.
    2. Initialise and iterate the co-evolutionary participants until they achieve a weak nash equilibrium
    3. Back off the nash equilibrium by randomising a few elements in the policy genomes. 
    4. Assign an LLM to each genome, and names to each policy
    5. Repeatedly ask each LLM in turn if it wants to make a specific change to its genome, based on the resultant changes to its fitness and other countries finesses.
    6. Watch to see where it ends up: stability – chaos – oscillation etc. 

    I’m interested to see if an LLM pretending to be a country has biases that could only be winkled out using these co-evolving iterative strategies.

    Here is a quick pick of four differently complex fitness landscapes from the NKC System:

    And here is a picture of the 16 random countries optimising their fitness in a co-evolutionary setting

    Once the first weak Nash equilibrium is achieved, I pause the system and randomise 3 policies, and set it running again. This would be the point that i would let the LLMs take control fully but at the moment I can only run it for a few steps on my laptop. 

  • NKC – Tuneable Fitness Landscapes

    The NK model, developed by Stuart Kauffman, is a useful framework for studying how complex biological, social, or technological systems evolve over time. The key idea is that each of the “N” components in a system adds its fitness contribution to the total, but each of these components’ fitnesses is dependent on the qualities of “K” other elements in the same system

    Here is a nice article to describe this model: https://www.econstor.eu/bitstream/10419/217461/1/s41469-018-0039-0.pdf

    Stuart Kaufman’s original system is based around a random numbers siting on a hypercube. – which is a challenge to visualise, so historically, the surfaces have been “representations” rather than actual plots, such as this figure from Felipe A. Csaszar

    I always found this a little frustrating, so here is my attempt to visualise an actual surface extracted form an NK landscape. 

    Algorithm:

    1. Pick a random point on the hypercube. 
    2. attach that n-dimensional position to a 2D position on a grid
    3. create neighbours on the 2D grid that are not more than a hamming distance of 2 from the first point
    4. spiral out making more points that are no more than a hamming distance of 2 from any neighbours
    9 Points on a hyper cube each with a hamming distance of no more than 2 from its neighbour.
    Four plots with the same value of N (16) and different values of K from 0 (very smooth landscape) through to 12( rather rough)
  • More Water for Creatures

    Fluid Drag System

    Body parts now have a fluid drag system that calculates how water resists an object’s movement by analysing its shape, velocity, and surface orientation.

    Using Monte Carlo sampling, points across the object’s surface and determine how the water slows it down. This creates (semi) realistic water resistance

  • Water for Creatures

    The buoyancy system calculates how much of an object is submerged in water using Monte Carlo modelling and applies an upward force to counteract gravity. This allows creatures and their body parts to float naturally in simulated water.

    The system asses submersion by randomly sampling points across the object’s volume and checking how many fall below the water’s surface. If the object is partially submerged, the system estimates the submerged volume and applies the appropriate buoyant force at the centre of buoyancy.

  • Approaching Food

    First signs of directed life

    • Tree Drops Fruit
    • Creatures is hungry
      • Action Selection chooses “Approach food”
      • Target Selection chooses nearest food
      • Creature approaches nearest food.
    • Creature touches food
      • Food is consumed
      • Nutrients passed into creatures body
      • Creature is no longer hungry
      • Action Selection chooses “Random Explore”