mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-09-14 14:01:28 +08:00
b291ac4049
* dream(intelligence): discounted Thompson sampling for model-router bandit Adds an opt-in `priorDecay` config field (default 1 = disabled, fully backward compatible) to ModelRouter's Beta-Bernoulli bandit. When enabled, every bucket/model's alpha/beta decays geometrically once per recordOutcome() call before that round's reward is added (arXiv 2305.10718 discounted Thompson sampling), so accumulated routing history from a long-running persisted state file no longer permanently dominates the posterior after a real-world model-quality shift. Benchmark (n=30 paired trials, seeded PRNG, identical stream baseline vs candidate): non-stationary regime-shift recovery 26.5 -> 21.9 rounds (-17.6%, t=7.24); post-shift correct-routing rate +1.3pp (t=6.10); stationary-workload invariant held (delta +0.02pp, not a regression). Receipt: v3/@claude-flow/cli/benchmarks/results/prior-decay-receipt.json. Mirrors the epsilon-decay pattern q-learning-router.ts already applies to its own exploration rate -- an internal-consistency fix, not an imported pattern. Evaluation and adversarial critique in progress; this commit is the checkpointed, test-passing candidate + its baseline/candidate receipt. Co-Authored-By: RuFlo <ruv@ruv.net> * dream(intelligence): #3048 fix adversarial-critique findings, add gist + ledger Independent adversarial critique found and this commit fixes: a paired-t statistics bug (population vs sample stddev inflated every t-value by n/(n-1)), an unguarded priorDecay input (NaN/negative could silently poison persisted .swarm/model-router-state.json forever, bypassing sampleBeta's own defensive fallback), and a single-bucket benchmark blind spot (now covers low + med complexity buckets -- the med bucket shows no significant effect, disclosed rather than hidden). Also adds the research gist and backfills 3 missing ledger rows for 2026-08-14/15/16 (real PRs/issues existed for those nights but the ledger table wasn't updated) plus tonight's own row. Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: Claude <noreply@anthropic.com>
59 lines
2.0 KiB
JSON
59 lines
2.0 KiB
JSON
{
|
|
"config": {
|
|
"TRIALS": 30,
|
|
"SHIFT_AT": 1500,
|
|
"POST_ROUNDS": 300,
|
|
"TOTAL_ROUNDS": 1800,
|
|
"STATIONARY_ROUNDS": 400,
|
|
"CANDIDATE_DECAY": 0.995,
|
|
"RECOVERY_WINDOW": 20,
|
|
"RECOVERY_THRESHOLD": 14
|
|
},
|
|
"scenarios": [
|
|
{
|
|
"bucket": "low",
|
|
"task": "fix a typo in the readme file",
|
|
"shift": "haiku -> sonnet",
|
|
"nonStationary": {
|
|
"baselineMeanRecoveryRound": 26.533333333333335,
|
|
"candidateMeanRecoveryRound": 21.866666666666667,
|
|
"recoveryRoundDeltaMean": 4.666666666666667,
|
|
"recoveryRoundDeltaT": 7,
|
|
"baselineMeanPostShiftCorrectRate": 0.9582222222222222,
|
|
"candidateMeanPostShiftCorrectRate": 0.9712222222222221,
|
|
"postShiftRateDeltaMean": 0.013000000000000012,
|
|
"postShiftRateDeltaT": 5.8956649538645785
|
|
},
|
|
"stationary": {
|
|
"baselineMeanCorrectRate": 0.9976666666666668,
|
|
"candidateMeanCorrectRate": 0.9978333333333335,
|
|
"deltaMean": 0.00016666666666666682,
|
|
"deltaT": 0.7010887416930878,
|
|
"invariantHeld": true
|
|
}
|
|
},
|
|
{
|
|
"bucket": "med",
|
|
"task": "refactor the payment processing module to support multiple currencies and add integration tests",
|
|
"shift": "sonnet -> opus",
|
|
"nonStationary": {
|
|
"baselineMeanRecoveryRound": 20.4,
|
|
"candidateMeanRecoveryRound": 20.566666666666666,
|
|
"recoveryRoundDeltaMean": -0.16666666666666666,
|
|
"recoveryRoundDeltaT": -0.7397092748646286,
|
|
"baselineMeanPostShiftCorrectRate": 0.9802222222222222,
|
|
"candidateMeanPostShiftCorrectRate": 0.9798888888888888,
|
|
"postShiftRateDeltaMean": -0.000333333333333341,
|
|
"postShiftRateDeltaT": -0.3324851555379874
|
|
},
|
|
"stationary": {
|
|
"baselineMeanCorrectRate": 0.9955,
|
|
"candidateMeanCorrectRate": 0.9946666666666669,
|
|
"deltaMean": -0.0008333333333333452,
|
|
"deltaT": -3.010398644698114,
|
|
"invariantHeld": true
|
|
}
|
|
}
|
|
],
|
|
"generatedAt": "2026-08-17T06:29:03.189Z"
|
|
} |