Skip to content

Optimize dense Rust training and prepared inference; release 0.2.3 - #226

Merged
ruvnet merged 30 commits into
mainfrom
release/rust-perf-0.2.3
Nov 11, 2026
Merged

ruvnet merged 30 commits into
mainfrom
release/rust-perf-0.2.3

Conversation

@ruvnet

@ruvnet ruvnet commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Optimizes dense Rust training and prepared inference while preserving ordered arithmetic and the irregular-network fallback. The unchanged qualified source 04784b35dda86a67cfcb5e11d50def84c23a4634 is merged and released as ruv-fann 0.2.3 with its dependent Rust package cascade.

Large dense training improved 4.082× for f32 and 3.880× for f64; large prepared f32 inference improved about 2.5× in the recorded synthetic CPU benchmarks. Four small prepared cases regressed roughly 6–8%. The reports and raw evidence retain these limits; no global SOTA claim is made.

Validation passed all 48 exact-source pre-main CI jobs and checked all 27 Cargo archives. The protected publisher uploaded 12 new versions and verified their public bytes; seven existing archives were identical and eight library-only differences were limited to permitted Cargo.lock drift. Fresh public consumers passed 330 numerical checks and 30 packed tests with no failures or skips. Independent verification downloaded all 43 GitHub assets and matched every SHA-256 to both the release manifest and API digest. The tag and release target resolve to the qualified source.

Release: https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-rust-v0.2.3
Qualification: https://github.com/ruvnet/ruv-FANN/actions/runs/43065532503
Protected publication: https://github.com/ruvnet/ruv-FANN/actions/runs/43070615219

Reports: docs/rust-performance-2026-11-11.md and docs/rust-prepared-results-2026-11-11.md. Raw benchmark bundle SHA-256: 8c99839bbe7848197fd05dc7ac0fa3f1fd1a41d304ceb1c631cf956a2bb75b17.

ruvnet added 30 commits November 9, 2026 17:49
Single-row inference copied the caller's inputs into the workspace and then
read them back one scalar at a time. Reading scalars out of a block that was
just written with wide stores defeats store-to-load forwarding, and for small
networks that stall was most of the call.

- A dense first layer now reads the caller's slice directly. The input bias
  source is exactly one, so its term is the bias weight itself, added last as
  before: results are bit-identical. Sparse first layers keep the copy path.
- `ActivationFunction::apply` and `sigmoid` are `#[inline]`.
- New `benches/prepared_single_row.rs` scores one row through small dense
  heads next to the same arithmetic written by hand; batch benchmarks hide
  this fixed per-call cost.
- New `tests/prepared_direct_first_layer.rs`: bit-for-bit agreement with
  ordered arithmetic for f32 and f64, with and without bias, one and two
  layers; error indices, the output-commit rule and input immutability.

Measured (x86-64 Windows, criterion, same machine, before -> after):
  10 -> 1 sigmoid          35.4 ns -> 19.5 ns
  10 -> 4 -> 1 relu/sigmoid 47.3 ns -> 46.2 ns (within noise)
  hand-written 10 -> 1      6.2 ns (reference)

Also: `gpu_sweet_spot_benchmark` now declares required-features = ["gpu"];
without it a plain `cargo test` on default features failed to compile.

Tests: cargo test --locked --lib --tests (262 passed), --doc (5 passed),
cargo clippy --locked --lib clean.

Co-Authored-By: claude-flow <ruv@ruv.net>
The credential-free "Check source binding and all candidate bytes" step now
downloads each candidate's version from static.crates.io and fails if it is
already public with different bytes, listing every drifted crate. Before,
that mismatch was only found inside --publish, after earlier crates in the
order had uploaded: run 42957654418 published cuda-rust-wasm 0.2.1 and then
stopped at ruv-fann 0.2.2 (#221).

Checked: scripts/tests 69/69 (one new preflight case).

Co-Authored-By: claude-flow <ruv@ruv.net>
…ip (#221)

The published ruv-fann 0.2.2 crate no longer matches the repository: README.md
and two docs/assets SVGs changed after it shipped, and the root crate's
include list ships them. The protected release's byte gate therefore stopped
run 42957654418 at ruv-fann.

Root ruv-fann 0.2.2 -> 0.2.3 (no code change). Dependents whose exact
version requirement on the root must move (verify-release.py redirect_root)
take their next patch version; caret requirements between siblings stay:
- ruv-fann-candle 0.1.0 -> 0.1.1 (=0.2.3)
- neuro-divergent, -core, -models, -training 0.2.0 -> 0.2.1
- ruv-swarm-ml, ruv-swarm-wasm 1.0.6 -> 1.0.7
- unpublished: bindings/napi, config/rune-probe (=0.2.3), lockfiles

The ruv-swarm npm WASM receipt hashes the root and ruv-swarm manifests and
locks, so the WASM was rebuilt with the recorded toolchain (rustc 1.88.0,
wasm-pack 0.15.1, no RUSTFLAGS); build-info sourceSha256 c39cf477.

Release pipeline:
- the public Rust consumer pins ruv-fann =0.2.3 and ruv-fann-candle =0.1.1
- publish-candidates.py paces new crate uploads (PUBLISH_SPACING_SECONDS,
  420 s in protected-release) for about 10 publishes per hour; publish job
  timeout 60 -> 150 minutes. Already-public identical versions never wait.

Co-Authored-By: claude-flow <ruv@ruv.net>
…uv-fann 0.2.3 and ruv-swarm-wasm 1.0.7)

Rebuilt the ruv-swarm WASM receipt for the new manifest (WASM bytes unchanged;
sourceSha256 1e9f8667).

Co-Authored-By: claude-flow <ruv@ruv.net>
…bout an hour)

Co-Authored-By: claude-flow <ruv@ruv.net>
Co-Authored-By: claude-flow <ruv@ruv.net>
… bump binary crates

Drift gate (publish-candidates.py, both the credential-free preflight and the
publish step): when a published version differs from its candidate only in
the embedded Cargo.lock and the package ships no binary (no [[bin]],
src/main.rs or src/bin/*.rs, honoring autobins), record
"lockfile-only-drift-library" and skip it: no failure, no republish. Cargo
never reads a dependency's lockfile, so dependents receive identical source.
Packages that ship binaries still fail the gate, because
`cargo install --locked` uses that lockfile. The publication receipt carries
the public sha256 (plus candidate_sha256), and the public bytes are kept so
create-github-release.py attaches exactly what crates.io serves; release
notes list such crates. Unreadable published archives remain drift.
Four new tests.

Locks: rustix 1.0.7 -> 1.1.6 in the root and ruv-swarm lockfiles
(RUSTSEC-2026-0486, unsound; cargo-audit 0.22.2 --deny unsound is clean on
both). The ruv-swarm resolver also moves bitflags 2.9.1 -> 2.13.2 and
linux-raw-sys to 0.12.1.

Binary crates whose archives drift: ruv-swarm-cli, ruv-swarm-daa and
ruv-swarm-mcp 1.0.7 -> 1.0.8. The eight library crates that drift only in
Cargo.lock (claude-parser, agents, benchmarking, core, ml-training,
persistence, transport, swe-bench-adapter) are not republished.

The ruv-swarm WASM was rebuilt with the recorded toolchain (rustc 1.88.0,
wasm-pack 0.15.1, empty RUSTFLAGS); receipt sourceSha256 07d68c45. The WASM
bytes change because of the bitflags update.

Co-Authored-By: claude-flow <ruv@ruv.net>
…imeout 180 minutes

Co-Authored-By: claude-flow <ruv@ruv.net>
Single-row inference copied the caller's inputs into the workspace and then
read them back one scalar at a time. Reading scalars out of a block that was
just written with wide stores defeats store-to-load forwarding, and for small
networks that stall was most of the call.

- A dense first layer now reads the caller's slice directly. The input bias
  source is exactly one, so its term is the bias weight itself, added last as
  before: results are bit-identical. Sparse first layers keep the copy path.
- `ActivationFunction::apply` and `sigmoid` are `#[inline]`.
- New `benches/prepared_single_row.rs` scores one row through small dense
  heads next to the same arithmetic written by hand; batch benchmarks hide
  this fixed per-call cost.
- New `tests/prepared_direct_first_layer.rs`: bit-for-bit agreement with
  ordered arithmetic for f32 and f64, with and without bias, one and two
  layers; error indices, the output-commit rule and input immutability.

Measured (x86-64 Windows, criterion, same machine, before -> after):
  10 -> 1 sigmoid          35.4 ns -> 19.5 ns
  10 -> 4 -> 1 relu/sigmoid 47.3 ns -> 46.2 ns (within noise)
  hand-written 10 -> 1      6.2 ns (reference)

Also: `gpu_sweet_spot_benchmark` now declares required-features = ["gpu"];
without it a plain `cargo test` on default features failed to compile.

Tests: cargo test --locked --lib --tests (262 passed), --doc (5 passed),
cargo clippy --locked --lib clean.

Co-Authored-By: claude-flow <ruv@ruv.net>
ruv-swarm-mcp's test_version_info pins CARGO_PKG_VERSION and failed CI after
the 1.0.8 bump. WASM bytes unchanged; receipt sourceSha256 c2b540fe.

Co-Authored-By: claude-flow <ruv@ruv.net>
…ance release

# Conflicts:
#	src/prepared.rs
#	src/prepared_dense.rs
# Conflicts:
#	ruv-swarm/npm/wasm/build-info.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant