About this project

NEAT-AI is a neuroevolution library written in Deno/TypeScript that implements and extends the NEAT (NeuroEvolution of Augmenting Topologies) algorithm originally published by Stanley and Miikkulainen in 2002. The project has grown into a hybrid evolutionary and gradient-based system that layers modern research techniques on top of the classic NEAT approach. The core architecture centers on "creatures" — genomes that mutate and breed in TypeScript, with forward passes executed inside a vendored WebAssembly (WASM) module. An optional Rust extension (NEAT-AI-Discovery) provides GPU-accelerated structural analysis via Deno FFI, proposing new synapses based on error-guided analysis. Key features include: 1. **Extendable Observations**: Input and output features are identified by stable UUIDs rather than positional indices, allowing new observations to be added without restarting evolution and enabling multi-machine recombination. 2. **Distributed Training**: Training and evolution can run on multiple independent nodes, with best-of-breed creatures combined on a central controller, mirroring the island model from evolutionary algorithms. 3. **Life Long Learning**: Designed for continuous learning in changing environments, supporting continual learning as new data arrives over weeks or months. 4. **WASM Activation**: The library initializes the WASM backend automatically; callers simply call `activate()` for a single forward pass. 5. **Unique Squash Functions**: Supports activation functions like IF, MAX, and MIN beyond standard options. 6. **Neuron Pruning**: Removes neurons whose activations don't vary during training, using a zeroth-order saliency criterion. 7. **CRISPR**: Allows injection of hand-crafted genes (neurons and synapses) into a population during evolution, borrowing the biology acronym for population seeding. 8. **Grafting**: Enables cross-island interbreeding between genetically incompatible parents, preserving diversity. 9. **Memetic Evolution**: Records and utilizes biases and weights of fittest creatures to fine-tune future generations, writing learned weights back into the genome (Lamarckian approach). 10. **Error-Guided Structural Evolution (Discovery)**: Dynamically identifies and creates new synapses by analyzing neuron activations and errors. The Rust extension performs GPU-accelerated analysis and proposes structural candidates over FFI. 11. **Adaptive Mutation Rate**: Automatically adjusts mutation strategy based on creature size and fitness progress, balancing exploration and exploitation. 12. **Transfer Learning**: Export trained creatures as checkpoints with metadata, import them into new tasks with UUID mapping, and seed populations with pre-trained creatures. 13. **ONNX Export**: Export trained creatures to the ONNX format for deployment in standard ML inference pipelines. 14. **MCMC Mutation Acceptance**: Uses the Metropolis-Hastings criterion for mutation acceptance, with adaptive temperature tuning toward a ~23.4% acceptance rate. 15. **Advanced Breeding Strategies**: Multiple strategies for genetically incompatible creatures, including input-weight cosine similarity, subgraph transplantation, and diversity-driven breeding. 16. **Synthetic Synapse Training**: Temporarily densifies inter-layer connectivity during backpropagation, then prunes near-zero synapses after training. 17. **Random Immigrants**: When the population stalls, replaces weakest non-elite creatures with freshly seeded genomes to introduce new genetic material. The project is published to the JavaScript Registry (JSR) and requires no installation — the WASM backend initializes itself on first use. It is part of a family of repositories including NEAT-AI-core (shared Rust computation crate), NEAT-AI-Discovery (Rust FFI extension for GPU-accelerated structural analysis), NEAT-AI-scorer (Rust scoring application), NEAT-AI-Backpropagation (native Rust backpropagation), NEAT-AI-Lamarck (experimental Rust optimiser), NEAT-AI-Explore (TypeScript visualisation tool), and several other experimental optimisers and tools. The library is designed for use in a DenoJS environment and provides a comprehensive toolkit for neuroevolution, from basic creature creation and activation to advanced distributed training, structural discovery, and production deployment via ONNX export.