mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-08-26 00:52:18 +00:00
* feat(sona): metaharness-Darwin evolves EWC++ config beyond hand-tuned SOTA examples/darwin_ewc: applies the Meta-Harness 'freeze the model, evolve the harness' pattern to SONA's continual-learning layer — frozen = the EWC++ algorithm (EwcPlusPlus), evolved = its EwcConfig genome (lambda schedule, Fisher decay, auto task-boundary threshold, learning rate). Benchmark: a single weight vector trained on a sequence of tasks (no replay, auto-detected boundaries) — the canonical plasticity-vs-forgetting frontier. Darwin (GA + coordinate-descent polish) evolves the genome on TRAIN task- sequences; results reported on HELD-OUT sequences (different seeds). Measured (deterministic), held-out: the evolved config beats EwcConfig::default() (the crate's hand-tuned 'OPTIMIZED' values) by 35% lower final loss and 98.6% less forgetting — a strict Pareto win (plasticity also improves), and it generalizes to unseen task sequences. clippy -D warnings clean, fmt clean. Co-Authored-By: claude-flow <ruv@ruv.net> * feat(sona): weightAdapter gene — Darwin selects/prunes a fine-tuned adapter Extends the metaharness-Darwin line: expose a fine-tuned adapter (e.g. a LoRA distilled from verified SWE-bench trajectories — the 'autonomous data engine') as a gene (which_adapter, alpha) so evolutionary selection decides whether/how much to apply it (w_eff = w_base + alpha·Δw) instead of assuming new weights are better. examples/darwin_weightadapter demonstrates it on two conflicting domains with a generalizing adapter and an overfit one. Key finding (sharpens the idea): 'selection prunes overfit adapters' holds ONLY under per-domain evaluation. Measured (held-out, in-dist-majority eval): overfit α=0.55 → ΔA +0.249 / ΔB -0.357 (regresses out-dist) AGGREGATE (volume-weighted) fitness → picks the overfit adapter (silent B regression) PER-DOMAIN (no-regression Pareto) → prunes it, keeps the generalizing adapter So: evolve the adapter as a gene, but score it per-repository. clippy/fmt clean. Co-Authored-By: claude-flow <ruv@ruv.net> * docs(adr): ADR-271 metaharness-Darwin for SONA self-improvement Documents the metaharness-Darwin-evolves-SONA architecture: EWC++ config evolution (PR #615), the weightAdapter gene (per-domain Pareto selection of fine-tuned adapters), the Autonomous Data Engine (execution-verified SWE-bench trajectories -> DPO pairs), and four Ornith-1.0 borrows (immutable-boundary + deterministic-monitor-with-exclude-from-advantage + frozen-LLM-judge-veto reward-hacking defense; per-task-category specialization; two-stage scaffold reward credit; staleness-weighted replay). Method-not-model: external evolutionary vs Ornith's in-weights RL. Co-Authored-By: claude-flow <ruv@ruv.net> * feat(sona): darwin-guard reward-hacking defense (Ornith-1.0 borrow, ADR-271) 3-layer defense for evolutionary config search: (1) immutable verifier boundary (screen is a pure fn of verifier output the candidate can't fabricate); (2) deterministic monitor — non-finite / out-of-bounds / degenerate candidates are EXCLUDED from selection (best_accepted), not zero-scored, so a hack can neither win nor bias the advantage; (3) IntentJudge trait = frozen-LLM veto-only layer. Wired into darwin_ewc: NaN/collapsed configs are excluded from the GA ranking (also fixes the partial_cmp().unwrap() NaN-panic). 4 unit tests; benchmark still reaches beyond-SOTA (35% lower loss, 98.6% less forgetting) unchanged. clippy -D warnings + fmt clean. Co-Authored-By: claude-flow <ruv@ruv.net> * feat(sona): per-task-category genome router beats single global config (ADR-271) Ornith-1.0 borrow #2 (per-category specialization): evolve a router task-class -> genome instead of one global EwcConfig. Two continual-learning workload classes with conflicting optima (STABLE wants high lambda / retain; VOLATILE wants low lambda / stay plastic). Guard-screened evolution. Measured (held-out, adequate per-class data): per-category router 0.1122 vs single best global genome 0.1144 -> router ~1.9% better on unseen sequences, because one config cannot serve conflicting workloads. Honest caveat (discovered + documented): the gain REVERSES when per-class data is scarce — a specialized config overfits while the pooled global generalizes. Per-category routing needs enough per-category samples (Ornith's regime). ADR-271 updated; clippy/fmt clean. Co-Authored-By: claude-flow <ruv@ruv.net> * feat(sona): online auto-tuner with staleness-weighted replay (ADR-271, Ornith borrow #4) auto_tuner module: StalenessSchedule (Ornith w(d_t): fresh<=k1, exp-decay, drop>k2) + StalenessWindow (staleness-weighted running estimate of recent config performance, evicts stale obs). 4 unit tests. examples/darwin_autotuner: a (1+1)-ES that adapts a DEPLOYED EwcConfig to a drifting workload stream (regime A -> B at the midpoint), scoring the incumbent on the staleness window and accepting a perturbation only when it beats the recent score. Measured: online tuner ~3% lower post-drift loss than the static deployment config (10 accepted re-tunes). Margin is modest on synthetic regimes; the durable win is the reusable staleness machinery + the online-adaptation principle (a fixed offline-tuned config goes stale under drift). Completes the four ADR-271 components. clippy --all-targets -D warnings + fmt clean; 102 sona tests pass. Co-Authored-By: claude-flow <ruv@ruv.net> * feat(sona): contamination/disjointness guard in darwin-guard (weight-eft/ADR-198 borrow) Adds the train/eval contamination guard — the gap @metaharness/weight-eft exposed in our reward-hacking-only guard. contamination()/assert_train_eval_disjoint() fail on any train∩eval instance-ID overlap (training/selecting on eval instances is fake lift); filter_holdout() partitions a set disjoint-by-construction and surfaces what was excluded. The SONA-side analog of weight-eft's assertTrainEvalDisjoint. 2 new tests (6 total in darwin_guard). ADR-271 updated: §3 Data Engine now cites @metaharness/weight-eft + adopts its RLHF-correct recipe (SFT distills ALL gold incl. off-policy frontier successes; DPO ON-POLICY cheap-vs-cheap only), and the darwin-guard borrow gains layer (iv) the contamination disjointness guard. clippy -D warnings + fmt clean. Co-Authored-By: claude-flow <ruv@ruv.net> * chore(release): ruvector-sona 0.2.1 — darwin_guard + auto_tuner modules Non-breaking minor feature release (new public modules darwin_guard, auto_tuner). Patch bump keeps the ^0.2 requirement of all in-workspace dependents (ruvllm, rvlite, mcp-brain, ...) satisfied. Co-Authored-By: claude-flow <ruv@ruv.net> --------- Co-authored-by: ruvnet <ruvnet@gmail.com>
263 lines
7.8 KiB
TOML
263 lines
7.8 KiB
TOML
[package]
|
|
name = "ruvector-sona"
|
|
version = "0.2.1"
|
|
edition = "2021"
|
|
rust-version = "1.70"
|
|
authors = ["RuVector Team <team@ruvector.dev>"]
|
|
description = "Self-Optimizing Neural Architecture - Runtime-adaptive learning for LLM routers with two-tier LoRA, EWC++, and ReasoningBank"
|
|
license = "MIT OR Apache-2.0"
|
|
repository = "https://github.com/ruvnet/ruvector"
|
|
homepage = "https://github.com/ruvnet/ruvector/tree/main/crates/sona"
|
|
documentation = "https://docs.rs/ruvector-sona"
|
|
readme = "README.md"
|
|
keywords = ["neural", "learning", "lora", "llm", "adaptive"]
|
|
categories = ["science", "algorithms", "wasm"]
|
|
include = [
|
|
"src/**/*",
|
|
"Cargo.toml",
|
|
"README.md",
|
|
"LICENSE-MIT",
|
|
"LICENSE-APACHE",
|
|
]
|
|
|
|
[package.metadata.wasm-pack.profile.release]
|
|
wasm-opt = false
|
|
|
|
[lib]
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
[features]
|
|
default = ["serde-support"]
|
|
wasm = ["wasm-bindgen", "wasm-bindgen-futures", "console_error_panic_hook", "js-sys", "web-sys", "getrandom", "serde-support"]
|
|
napi = ["dep:napi", "dep:napi-derive", "serde-support"]
|
|
serde-support = ["serde", "serde_json"]
|
|
|
|
[dependencies]
|
|
# Core dependencies
|
|
parking_lot = "0.12"
|
|
crossbeam = "0.8"
|
|
rand = "0.8"
|
|
|
|
# Serialization (optional)
|
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
|
serde_json = { version = "1.0", optional = true }
|
|
|
|
# WASM dependencies (optional)
|
|
wasm-bindgen = { version = "0.2", optional = true }
|
|
wasm-bindgen-futures = { version = "0.4", optional = true }
|
|
js-sys = { version = "0.3", optional = true }
|
|
console_error_panic_hook = { version = "0.1", optional = true }
|
|
getrandom = { version = "0.2", features = ["js"], optional = true }
|
|
|
|
# NAPI dependencies (optional)
|
|
napi = { version = "2.16", optional = true }
|
|
napi-derive = { version = "2.16", optional = true }
|
|
|
|
[dependencies.web-sys]
|
|
version = "0.3"
|
|
optional = true
|
|
features = [
|
|
"console",
|
|
"Performance",
|
|
"Window",
|
|
]
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
getrandom = { version = "0.2", features = ["js"] }
|
|
|
|
[dev-dependencies]
|
|
criterion = "0.5"
|
|
rand = "0.8"
|
|
once_cell = "1.19"
|
|
|
|
[[bench]]
|
|
name = "sona_bench"
|
|
harness = false
|
|
|
|
# Workspace cleanup pass: research-tier crate, doc/style churn deferred. Correctness + suspicious lints stay denied.
|
|
[lints.rust]
|
|
unexpected_cfgs = { level = "allow", priority = -1 }
|
|
unused_imports = "allow"
|
|
dead_code = "allow"
|
|
unused_variables = "allow"
|
|
unused_mut = "allow"
|
|
|
|
unused_assignments = "allow"
|
|
unused_must_use = "allow"
|
|
missing_docs = "allow"
|
|
unsafe_op_in_unsafe_fn = "allow"
|
|
unused_parens = "allow"
|
|
unused_comparisons = "allow"
|
|
non_local_definitions = "allow"
|
|
static_mut_refs = "allow"
|
|
non_camel_case_types = "allow"
|
|
deprecated = "allow"
|
|
ambiguous_glob_reexports = "allow"
|
|
non_upper_case_globals = "allow"
|
|
unused_doc_comments = "allow"
|
|
unused_unsafe = "allow"
|
|
unreachable_patterns = "allow"
|
|
suspicious_double_ref_op = "allow"
|
|
|
|
[lints.clippy]
|
|
pedantic = { level = "allow", priority = -2 }
|
|
correctness = { level = "deny", priority = -1 }
|
|
suspicious = { level = "deny", priority = -1 }
|
|
needless_range_loop = "allow"
|
|
needless_borrow = "allow"
|
|
needless_borrows_for_generic_args = "allow"
|
|
needless_update = "allow"
|
|
needless_bool = "allow"
|
|
needless_pass_by_value = "allow"
|
|
manual_div_ceil = "allow"
|
|
manual_is_multiple_of = "allow"
|
|
manual_range_contains = "allow"
|
|
manual_clamp = "allow"
|
|
manual_checked_ops = "allow"
|
|
manual_let_else = "allow"
|
|
manual_memcpy = "allow"
|
|
manual_repeat_n = "allow"
|
|
manual_contains = "allow"
|
|
manual_flatten = "allow"
|
|
manual_abs_diff = "allow"
|
|
manual_slice_size_calculation = "allow"
|
|
redundant_closure = "allow"
|
|
redundant_closure_for_method_calls = "allow"
|
|
redundant_field_names = "allow"
|
|
len_zero = "allow"
|
|
get_first = "allow"
|
|
useless_vec = "allow"
|
|
too_many_arguments = "allow"
|
|
derivable_impls = "allow"
|
|
approx_constant = "allow"
|
|
assertions_on_constants = "allow"
|
|
field_reassign_with_default = "allow"
|
|
nonminimal_bool = "allow"
|
|
collapsible_if = "allow"
|
|
collapsible_match = "allow"
|
|
inconsistent_digit_grouping = "allow"
|
|
unnecessary_sort_by = "allow"
|
|
unnecessary_map_or = "allow"
|
|
unnecessary_filter_map = "allow"
|
|
unnecessary_lazy_evaluations = "allow"
|
|
unnecessary_cast = "allow"
|
|
unnecessary_to_owned = "allow"
|
|
unnecessary_wraps = "allow"
|
|
unnecessary_literal_unwrap = "allow"
|
|
unnecessary_struct_initialization = "allow"
|
|
should_implement_trait = "allow"
|
|
ptr_arg = "allow"
|
|
let_unit_value = "allow"
|
|
let_and_return = "allow"
|
|
type_complexity = "allow"
|
|
identity_op = "allow"
|
|
match_like_matches_macro = "allow"
|
|
match_same_arms = "allow"
|
|
match_single_binding = "allow"
|
|
vec_init_then_push = "allow"
|
|
absurd_extreme_comparisons = "allow"
|
|
incompatible_msrv = "allow"
|
|
unused_enumerate_index = "allow"
|
|
unused_self = "allow"
|
|
|
|
map_clone = "allow"
|
|
map_unwrap_or = "allow"
|
|
result_map_or_into_option = "allow"
|
|
unusual_byte_groupings = "allow"
|
|
if_same_then_else = "allow"
|
|
unnested_or_patterns = "allow"
|
|
uninlined_format_args = "allow"
|
|
single_match_else = "allow"
|
|
single_char_pattern = "allow"
|
|
mixed_attributes_style = "allow"
|
|
arc_with_non_send_sync = "allow"
|
|
bool_assert_comparison = "allow"
|
|
bool_comparison = "allow"
|
|
bind_instead_of_map = "allow"
|
|
cloned_ref_to_slice_refs = "allow"
|
|
large_stack_arrays = "allow"
|
|
implicit_saturating_sub = "allow"
|
|
ignored_unit_patterns = "allow"
|
|
explicit_iter_loop = "allow"
|
|
elidable_lifetime_names = "allow"
|
|
doc_markdown = "allow"
|
|
doc_overindented_list_items = "allow"
|
|
comparison_chain = "allow"
|
|
clone_on_copy = "allow"
|
|
items_after_statements = "allow"
|
|
inline_always = "allow"
|
|
format_push_string = "allow"
|
|
format_collect = "allow"
|
|
for_kv_map = "allow"
|
|
float_cmp = "allow"
|
|
if_not_else = "allow"
|
|
return_self_not_must_use = "allow"
|
|
missing_fields_in_debug = "allow"
|
|
upper_case_acronyms = "allow"
|
|
wildcard_imports = "allow"
|
|
must_use_candidate = "allow"
|
|
cast_possible_truncation = "allow"
|
|
cast_possible_wrap = "allow"
|
|
cast_precision_loss = "allow"
|
|
cast_lossless = "allow"
|
|
cast_sign_loss = "allow"
|
|
unreadable_literal = "allow"
|
|
struct_excessive_bools = "allow"
|
|
trivially_copy_pass_by_ref = "allow"
|
|
missing_safety_doc = "allow"
|
|
missing_errors_doc = "allow"
|
|
missing_panics_doc = "allow"
|
|
similar_names = "allow"
|
|
module_name_repetitions = "allow"
|
|
assign_op_pattern = "allow"
|
|
iter_cloned_collect = "allow"
|
|
excessive_precision = "allow"
|
|
await_holding_refcell_ref = "allow"
|
|
unnecessary_unwrap = "allow"
|
|
unit_arg = "allow"
|
|
redundant_pattern_matching = "allow"
|
|
question_mark = "allow"
|
|
partialeq_to_none = "allow"
|
|
new_without_default = "allow"
|
|
map_flatten = "allow"
|
|
manual_unwrap_or = "allow"
|
|
len_without_is_empty = "allow"
|
|
format_in_format_args = "allow"
|
|
single_char_add_str = "allow"
|
|
useless_conversion = "allow"
|
|
useless_format = "allow"
|
|
doc_lazy_continuation = "allow"
|
|
manual_strip = "allow"
|
|
double_ended_iterator_last = "allow"
|
|
unwrap_or_default = "allow"
|
|
single_component_path_imports = "allow"
|
|
needless_return = "allow"
|
|
int_plus_one = "allow"
|
|
needless_lifetimes = "allow"
|
|
explicit_counter_loop = "allow"
|
|
unnecessary_mut_passed = "allow"
|
|
module_inception = "allow"
|
|
option_as_ref_deref = "allow"
|
|
print_literal = "allow"
|
|
explicit_auto_deref = "allow"
|
|
manual_swap = "allow"
|
|
writeln_empty_string = "allow"
|
|
items_after_test_module = "allow"
|
|
no_effect = "allow"
|
|
non_canonical_partial_ord_impl = "allow"
|
|
wildcard_in_or_patterns = "allow"
|
|
large_enum_variant = "allow"
|
|
not_unsafe_ptr_arg_deref = { level = "allow", priority = 1 }
|
|
erasing_op = { level = "allow", priority = 1 }
|
|
almost_swapped = { level = "allow", priority = 1 }
|
|
cast_abs_to_unsigned = { level = "allow", priority = 1 }
|
|
let_underscore_lock = { level = "allow", priority = 1 }
|
|
no_effect_replace = { level = "allow", priority = 1 }
|
|
await_holding_lock = { level = "allow", priority = 1 }
|
|
needless_character_iteration = { level = "allow", priority = 1 }
|
|
unnecessary_get_then_check = { level = "allow", priority = 1 }
|
|
let_underscore_future = { level = "allow", priority = 1 }
|
|
overly_complex_bool_expr = { level = "allow", priority = 1 }
|
|
zombie_processes = { level = "allow", priority = 1 }
|
|
repeat_vec_with_capacity = { level = "allow", priority = 1 }
|
|
missing_transmute_annotations = { level = "allow", priority = 1 }
|