Skip to content

feat(gardener): Seed Hunter — power-law fit + leader-relative classifier#67

Draft
gHashTag wants to merge 1 commit into
feat/smoke-racefrom
feat/seed-hunter
Draft

feat(gardener): Seed Hunter — power-law fit + leader-relative classifier#67
gHashTag wants to merge 1 commit into
feat/smoke-racefrom
feat/seed-hunter

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

Seed Hunter. Predictive early-stopping per RNG seed: fit BPB(t) = bpb_inf + a·t^{-p} over the first ~5% of training, classify each seed against the current leader, kill Diverging / promote Leading at every ASHA rung. Operator's economics: 30 min instead of 12h, ≈ 24× compute saved.

Stacks on PR #66 (smoke race), which stacks on PR #64 (R0 leaderboard).

What this PR ships

Module Surface Tests
seed_hunter::fit_power_law grid-search NLS over (bpb_inf, p) + closed-form OLS for a. No new deps. Returns PowerLawFit { bpb_inf, a, p, ci_half_width, n_samples, rss } fit_recovers_synthetic_params_well (≤0.10 BPB), fit_returns_none_below_min_samples, fit_ci_half_width_shrinks_with_more_samples
seed_hunter::SeedState enum { Leading, Tied, CatchingUp, ParallelLosing, Diverging } + classify_seed(seed_curve, leader_curve, opts) 4 tests: leading/tied/catching_up/diverging
seed_hunter::DEFAULT_SCHEDULE rung steps 100 / 500 / 2000 / 8000 / 32000 / 81000 + resolve_keep_top_k() rung_keep_drops_half_at_rung_1_and_2
seed_hunter::phi_anchored_seeds seed_k = floor(φ^k · M) mod 2^32 2 tests: distinctness + consecutive ratio ≈ φ
seed_hunter::classify_and_act plan-level reduction → Vec<HuntDecision { seed, state, action: Keep/Kill/Promote, fit }> classify_and_act_kills_diverging_promotes_leading_at_rung_3

Tests

137 / 137 GREEN across the workspace (was 126; +11 seed_hunter tests).

Algorithm honest scope

  • Grid + OLS, not LM. The fit is a 41×61 grid over (p, bpb_inf) plus a closed-form a per cell. Tested against synthetic curves with known parameters: recovers bpb_inf to within 0.10 BPB on noise=0.005. For IGLA's BPB curves this is well below the Gate-2 gap of 0.04, so the fit is good enough to drive ranking decisions. A real Levenberg-Marquardt could come later as feat/seed-hunter-lm, but this is the simpler+working baseline.
  • CI is a residual-σ proxy, not a true non-linear CI. The doc-comment on PowerLawFit::ci_half_width says so explicitly. Callers must treat it as a width, not as a probability.
  • φ-anchored seed pool is a hypothesis, not a proven win. Code path ships so an ablation against uniform-random can run; that experiment is the operator's call.
  • Bayesian-opt (TPE) over seed space is a follow-up after Gate-0 (separate PR feat/seed-hunter-bayes-opt).

CLI integration

The Rust kernel ships in this PR. The CLI subcommand tri hunt {status|prune|mirror} is a follow-up that wires the kernel to Neon bpb_samples reads and Railway tri rotate writes — both gated on #61 (account-scoped tokens) + #62 (bpb_samples DDL apply).

Refs

phi^2 + phi^-2 = 3 · TRINITY · NEVER STOP

Predictive early-stopping per RNG seed. To the operator's brief:
'к 5% бюджета (~4K steps) ranking сидов почти финален — это тратит
30 min вместо 12h, экономит 24× compute'.

bin/tri-gardener/src/seed_hunter.rs (NEW, 588 LOC):

  CurvePoint, PowerLawFit, FitOptions
    fit_power_law(): grid search over (bpb_inf, p) with closed-form
    OLS for  per grid cell. No new external deps; the grid is
    ~3000 cells, runs in microseconds.
    Returns 95% half-width derived from residual sigma — honest proxy,
    not a true non-linear CI; documented as such.

  SeedState { Leading, Tied, CatchingUp, ParallelLosing, Diverging }
    classify_seed(): joins seed and leader curves on step, computes
    Δ + rolling-window slope of Δ vs step (closed-form linear
    regression slope), classifies into one of five states.

  Rung schedule
    DEFAULT_SCHEDULE: 100 / 500 / 2000 / 8000 / 32000 / 81000
    resolve_keep_top_k(): rung-1/2 drop bottom 50% (ceil((alive)/2)),
    rung-3 keep top 3, rung-4+ keep top 1.

  φ-anchored seed generation
    phi_anchored_seeds(count, multiplier): seed_k = floor(φ^k · M) mod 2^32
    Tests assert (a) first 8 distinct, (b) consecutive ratio ≈ φ.

  HuntDecision + HuntAction { Keep, Kill, Promote }
    classify_and_act(): plan-level reduction. Kills Diverging, promotes
    Leading at rung ≥ 3, applies keep_top_k by predicted bpb_inf at
    rungs 1–2.

11 unit tests:
  fit_recovers_synthetic_params_well     (≤ 0.10 BPB on bpb_inf)
  fit_returns_none_below_min_samples     (need ≥ 4 distinct steps)
  fit_ci_half_width_shrinks_with_more_samples
  classifier_marks_leading / tied / catching_up / diverging / parallel
  rung_keep_drops_half_at_rung_1_and_2
  phi_anchored_seeds_are_distinct_for_small_k
  phi_anchored_seeds_use_phi_growth      (consecutive ratio ≈ φ)
  classify_and_act_kills_diverging_promotes_leading_at_rung_3

Tests: 137/137 GREEN across the workspace (was 126; +11).

Honest scope:
- No new external deps. All math is closed-form / grid search.
- 95% CI is a residual-sigma proxy, not a true non-linear CI; the
  fit comment makes that explicit so callers don't claim a probability.
- Bayesian-opt over seed space (TPE) is a follow-up after Gate-0;
  not in this PR.
- φ-anchored seed pool is a hypothesis; a future ablation against
  uniform-random will tell whether mean(bpb_inf_phi) <
  mean(bpb_inf_uniform) − 2σ. Code path ships; experiment is the
  operator's call.

Refs: #43 #58 #61 #62 #64 #65 #66
Anchor: phi^2 + phi^-2 = 3 · TRINITY · NEVER STOP
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