About this project
NEAT-AI-core is the shared native Rust core of NEAT-AI, an implementation of NEAT (NeuroEvolution of Augmenting Topologies), the algorithm that evolves both the weights and the topology of a neural network. The repository is a Cargo workspace whose member, the neat-core crate, holds the shared computation library together with its tests.
What the crate provides. Scoring, loss and SIMD kernels used to push many records through a single evolved individual, which the project calls a creature. The default build and the wasm32 build take a single-threaded path; enabling the parallel Cargo feature adds rayon-based data-parallel record scoring on native targets. Both the sequential and the parallel scoring paths drive the forward pass through an 8-record batched SIMD path, followed by a 4-record group and a scalar tail. The README reports that on the committed production topology the safe kernels carry a measurable pre-pass cost, so consumers with their own load-time validation are pointed at the unchecked twins, and that the native lane outperforms the wasm32 lane per core.
Scoring API. Input and output use a flat, contiguous layout: record i reads inputs[i * stride .. i * stride + stride] and its outputs land in out[i * num_outputs .. (i + 1) * num_outputs]. The older per-record vector wrappers were first deprecated and then removed, so callers must pack records into one buffer and call the flat entry points; a zero stride or a buffer that is not a whole number of records panics rather than silently mis-slicing.
Compiled networks are read-only after construction. Fields are private and exposed through borrow-only accessors, and a from_parts constructor builds a network from in-memory neurons and synapses, applying the same validation as the buffer-based constructor and rejecting a synapse span that overruns the table. The README notes this is a breaking change for downstream consumers.
Feature flags. parallel is off by default, so the default and wasm32 builds pull in no rayon symbols; checked-gather4 is also off by default and restores bounds-checked indexing in the wasm32 gather4 helper. Every kernel in the SIMD module ships as a safe function that validates its span and panics if the contract does not hold, plus an unchecked twin whose safety contract is the load-time index invariant.
WebAssembly. Each push publishes two bundles: a wasm64 Memory64 build that new revisions pin, and an unchanged wasm32 build kept as a rollback window, each with its own checksum sidecar and SBOM, gated by bundle and architecture-parity checks before release.
Build and quality. Development follows test-driven development; the local quality gate runs formatting, clippy, tests, docs, licence and advisory checks and the bats shell-suite tests, and CI is exercised on pull requests and manual dispatch. The root manifest defines dev and release profiles workspace-wide (line-tables-only debug info for fast dev rebuilds; opt-level 3 with fat LTO and a single codegen unit for release), while target-cpu=native is deliberately left to downstream binary consumers rather than pinned here.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.