Skip to content

Fit Jev decision settings (thresholds, cuts, weights) on recorded answers, after DSPy's ReAnchor #9659

Closed

Description

@AtlantisPleb

Our Jev decisions use hard-coded settings (for example YES: f64 = 0.5 in crates/coder-one/src/component/evidence.rs and crates/coder-one/src/ask/gather.rs). DSPy 3.4.0's ReAnchor (stanfordnlp/dspy#10475, MIT) fits them against an outcome metric without changing any wording and without new model calls. Reimplement the algorithm in Rust; don't copy source, and name it in the commit message ("Reimplemented from DSPy 3.4.0's ReAnchor, stanfordnlp/dspy#10475, MIT").

The algorithm:

  • Record the probabilities each decision was made from, per example.
  • Candidate values are the midpoints between neighboring observed probabilities (Noul thresholds, Score cuts), capped per setting; Choice weights are searched on a log scale between the points where an option's pick flips.
  • A candidate replaces the current value only if it scores strictly better on the training set and passes a deterministic 5-fold held-out check; otherwise the current value stays. Ties go to the candidate in the widest gap.
  • Scoring uses recorded answers only (JevMode::Recorded), so fitting costs no Jev spend.

Where it fits: a new study beside crates/coder-one/src/study/pack.rs, with numeric slots in study/space.rs; the fold rule may live in crates/gym beside its gates. Choice weights are a decision rule stored with the policy, not a Gym calibration map: crates/gym/src/calibrate.rs keeps the rule that a map never overrides the model's argmax.

Done when: the study runs on a retained component's recorded answers with a stated metric, reports the fitted settings, the held-out result, and the before and after metric with intervals, and writes the settings in the format from the companion issue. Depends on the decision-settings issue for storage.

Activity

  1. AtlantisPleb commented on Sep 25, 2026

    @AtlantisPleb
    ContributorAuthor

    Landed in e7c9a1f.

    What was built

    • coder-one study run decision-fit (crates/coder-one/src/study/decisions.rs), with the fit in crates/coder-one/src/study/reanchor.rs. Candidates are midpoints between neighboring observed probabilities, at most 40 per setting. Choice weights are searched on a log scale between the points where a pick flips. A candidate is accepted only when it's strictly better on the fit partition and passes a deterministic 5-fold held-out check, with folds by SHA-256 of the group name. Ties go to the widest gap. Recorded answers only; no Jev calls.
    • Sources: --component control.stall, --component checks.verdict, or --questions FILE --examples FILE for any question set.
    • Output uses Store Jev decision settings in question-set files, digested apart from the wording #9660's format: decisions.json holds the moved settings as decision blocks, plus the digest policy.jev.decision would record. A question-set run also writes a copy of the set with each block joined. Proposals only; no policy changed.
    • The fold rule stays in crates/coder-one, not crates/gym, because Coder One doesn't depend on the Gym.

    Real run, offline (write-up, protocol). Both splits were frozen by earlier studies; the primary metric is each component's own threshold rule.

    • Stall detector (Microluna: typed next-step choice and stall and done detection (pivot algorithms 4 and 5) #9627), recall at 80% precision. stall.progress moved from 0.5 to 0.97, and stall.repeating stayed at 0.5. On the evaluation tasks, recall went from 30 of 85 (35%, 26–46%) to 45 of 85 (53%, 42–63%), and precision from 86% (71–94%) to 83% (71–91%). The metric's difference is +0.18, with an interval of −0.61 to +0.33, so it doesn't beat the hard-coded setting. The fitted detector makes exactly the code-suspect-only calls the stall write-up recommended.
    • Truthful checks (Luna pivot: truthful checks, calibrated against graded runs #9584), recall at 90% precision. The best candidate was better on the fit partition but failed the held-out check (0.387 to −0.161), so checks.verdict.admission stays at 0.8.
    • Secondary F1 runs, for reading only: both settings move, and both evaluation intervals exclude zero (stall +0.015 to +0.243; verdict +0.044 to +0.222). Both trade precision for recall, which neither protocol chose.

    Tests: synthetic recorded answers with a known right threshold, a coin-flip case where a training-only winner fails the held-out check and the original value stays, and cases for ties, weights, cuts, folds, and metrics. At the settings in effect, the stall rule reproduces the protocol's 88 calls with 80 right, and the verdict rule matches corroborated on all 317 rows. cargo test -p coder-one: 881 passed. The 2 failures are the two tests that need make, which this host lacks. clippy is clean, and the contamination check is clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions