--- license: mit library_name: pytorch tags: - artificial-life - evolution - thegrid - genome - mutation-operator datasets: - flaukowski/thegrid-colony-one-transitions --- # gridlm: a mutation screen and generator learned from a thegrid fossil record [thegrid](https://github.com/EckmanTechLLC/thegrid) (Matt Eckman, MIT) is an artificial-life lab. Its organisms are small programs on an evolvable instruction set, and they compete for real CPU, memory and heat on the host. Every birth goes into a fossil record. thegrid's own findings (`tools/analyse/LESSONS.md`) include this one: **model-authored mutation founded nothing.** 4,554 genomes written by a general LLM from a prompt produced 4,554 births and no lineage. Over the same period, blind segment transfer compounded at 1.3x. gridlm asks whether a model trained on **what actually reproduced** does better than one prompted with the instruction set. The idea is borrowed from DNA language models such as Hugging Face's Carbon-X: give each unit of the sequence its own token and learn from outcomes. Here the unit is an opcode, and the outcomes come from the fossil record. Two models, about 0.8M parameters each: - **screen** (`screen.pt`): an encoder over `[CLS] parent [SEP] child`. It outputs P(the child genome is born at least twice in its epoch), meaning it copied itself and founded something. - **generator** (`generator.pt`): a causal LM over `[BOS] parent [SEP] child [EOS]`, trained only on children that reproduced. It writes a child for a given parent. There is also **`gridlm_operator.py`**, a drop-in operator for thegrid's `odin` mutator. It reads the same `request.json` / `proposal.json` queue that thegrid's `tools/operator` answers. For each request it samples 8 children, the screen picks the best, and it proposes that one. It runs on CPU in milliseconds. The colony validates every proposal with its own parser, so a proposal it cannot use costs one birth, never the colony. ## Data The fossil record of **colony-one**, the thegrid colony that kannaka-grid runs on its own host, read 2026-10-27 (dataset: `flaukowski/thegrid-colony-one-transitions`): - 1,573,008 rows: one per (epoch, child genome), with its earliest parent and exact self-copies excluded. - Label: the child was born at least twice in its epoch. The positive rate is 24.8%. - 614 epochs. **This is an older thegrid version and a starvation economy** (613 of 614 epochs ended in extinction). It is not the eviction or class worlds Matt runs today. Deliberately excluded from the inputs: - `mutation_type`: thegrid records a mutation origin only when its child was born, so its presence leaks the label. - The parent's birth count for the epoch: it includes births after the child appeared. The inputs are the two instruction sequences and nothing else. ## Results (held out in time) Split by epoch: train epochs 1–565 (1.27M rows), validation 566–593, test 594–614 (152k rows). The "novel" columns use only test children whose genome never appears in training (145k). | model | AUROC | avg precision | precision in top 10% | AUROC, novel | top 10%, novel | |---|---|---|---|---|---| | base rate | | 0.248 | 0.248 | | 0.240 | | rule: has alloc+copy+fork | 0.526 | 0.267 | 0.283 | 0.528 | 0.265 | | logistic regression, 15 hand features | 0.609 | 0.327 | 0.384 | 0.605 | 0.362 | | **gridlm screen** | **0.667** | **0.385** | **0.452** | **0.659** | **0.418** | | gridlm generator, log p(child \| parent) | 0.582 | 0.296 | 0.321 | 0.586 | 0.320 | **What this says:** the outcome of a single mutation is mostly noise, which the weak baselines show. But the screen ranks children well above chance and well above hand features. The 10% it likes best reproduce at 1.8x the base rate (1.7x on genomes it has never seen). **What it does not say:** whether the generator's children found lineages in a live colony. That needs a colony. The generator's 1,000 samples on held-out parents: - 100% are valid length; - 83.2% contain alloc+copy+fork; - 2.3% are identical to the parent. The screen rates them higher than the real test mutants: mean P 0.525 against 0.469. That is one model judging another and is no evidence of fitness. The samples look like what LESSONS says evolution does there. They include tandem duplications of an earning motif and duplicated `fork copy alloc` blocks. Some are bad, for example substitutions that remove `fork`. ## Limits - **One colony, one ISA version, one economy.** Instruction names colony-one never used are unknown tokens, and the model's taste is a starvation world's taste. It should be retrained on the target fleet's own record. `extract.py` and `train.py` do that end to end from any thegrid `history.sqlite3`. - **No replicate colonies.** thegrid's own rule is "never run one of anything you intend to learn from". The time split is held out, but it is one colony. The real test is several replicate colonies with this operator against the same colonies on blind variation, compared on lineages founded per proposal. - **LESSONS 11–12 say the economy decides where a world ends up**, not the mutation operator. A better mutator may only reach stasis faster. That is worth measuring, not assuming away. ## Use ```bash pip install torch numpy # one proposal python gridlm_operator.py --model-dir . --once-genome "harvest harvest alloc copy ifnotdone jmpb fork scan move" # serve one or more colonies' odin queues python gridlm_operator.py --model-dir . --queue /path/to/colony/operator # retrain on your own fossil record python extract.py /path/to/history.sqlite3 transitions.jsonl.gz python train.py transitions.jsonl.gz out --device cuda ``` Trained on one qBraid RTX 4090 in about 7 minutes (12.8 credits, about $0.13). ## Credits Built by Kannaka (an AI) with Nick Flach, on top of Matt Eckman's thegrid. thegrid's instruction set, fossil record format and operator protocol are his. The model, code and card are MIT.