Repository navigation
feat(sleep): add opt-in leave-one-out edit ablation for accepted gate trials - #390
Open
Intelligence Research Project (sunghunkwag) wants to merge 1 commit into
Open
Intelligence Research Project (sunghunkwag) wants to merge 1 commit into
Intelligence Research Project (sunghunkwag) wants to merge 1 commit into
Conversation
… trials The gate accepts or rejects a candidate as a whole, so when a multi-edit candidate passes, the report cannot say which of its edits the held-out score depends on. microsoft#174 left this per-edit attribution as follow-up work because it needs ablation runs. With `gate_edit_ablation` on, each skill or memory candidate that passes the gate is scored again on the same validation tasks once per edit, each time without that one edit. The result is recorded on the trial as an `edit_ablation` row per edit: the gate score with and without the edit, an effect of positive / none / negative / unmeasured, and the validation tasks whose score differs. The rows are report-only. No gate decision reads them, so accepted edits and documents are identical with the option on or off. The default (off) adds no replay; its only visible change is a `gate_edit_ablation: false` field in diagnostics.json and in the logged cycle config. Cost and edge cases: - A single-edit candidate needs no extra replay: the trial already compared the document with and without the edit. - An N-edit candidate costs up to N validation replays. They are skipped, and listed once in `budget_skipped`, when the token budget is spent. - An edit another edit of the same trial overrides is reported without a replay, since the document is the same without it. - Edits that only matched through the removed edit are listed as `co_dropped`, so a row is not read as the effect of one edit. - A missing or non-finite ablation score is `unmeasured`, never an effect in either direction. - With `gate_mode` off there is no validation replay, so the option has no effect. Rows flow through the existing `gate_trials` path, so they appear in `report.md`, `report.json`, `diagnostics.json`, the CLI `--json` output and the evidence log with the existing redaction. In multi-skill fan-out each group's rows are written to the evidence log. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015s4y5QVk9hfpeGNR7dzrHb
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
When a multi-edit candidate passes the Sleep gate, the report shows which validation tasks moved, but not which edit moved them. The maintainers' reply in #174 left that open: "true per-rule causal attribution would require separate ablation runs and can be explored as a follow-up." This PR is that follow-up.
With
gate_edit_ablation: true(defaultfalse), each skill or memory candidate that passes the gate is scored again on the same validation tasks once per edit, each time without that one edit. Every edit gets a row on its trial: the gate score with and without the edit, an effect ofpositive/none/negative/unmeasured, and the validation tasks whose score differs.The rows are report-only. No gate decision reads them, so accepted edits and documents are the same with the option on or off.
Example
The #174 shape: one edit lifts a task, another lowers a different task, and the slice mean still rises (0.400 → 0.850). This is what the report renderer produces for that case (the scenario in
test_ablation_names_the_edit_behind_a_hidden_regression), shown as source:The task table already shows that
routerregressed. The ablation table adds which edit it came from, and that the candidate scores 0.900 without it.Behavior and cost
report.md,report.jsonand the CLI--jsonoutput are unchanged. The only default-visible change is agate_edit_ablation: falsefield indiagnostics.jsonand in the logged cycle config. A test compares the option on and off: the same decision, documents, edit lists and trial rows, apart from the addededit_ablationkey.gate_ablation:<target>in the evidence log. Oncemax_tokens_per_nightis spent they are skipped, the step is listed once inbudget_skipped, and the rows areunmeasured.gate_no_regression.nonewithout a replay, because the document is the same without it.replaceanchored on a line that anaddin the same trial created) are listed asco_dropped, so the row is not read as the effect of one edit.unmeasured, with no score and no per-task direction.gate_mode: offhas no validation replay, so the option has no effect there.gate_trialspath, so they reachreport.md,report.json,diagnostics.json, the CLI--jsonoutput and the evidence log with the existing redaction. In multi-skill fan-out each group's rows are in the evidence log; group trials are not inreport.mdtoday and I did not change that.Limits
none.Tests
tests/test_gate_edit_ablation.py, 21 test cases: the default-off path, the two cases above, memory trials, the no-regression gate, the single-edit, overridden-edit and co-dropped paths, a spent budget, NaN / inf / missing scores, the evidence log, report rendering, CLI redaction, a full mock night, and multi-skill fan-out.python -m pytest -q: 2118 passed, 13 skipped, 4 xfailed (Python 3.13, project dependencies plus theparallelextra).ruff checkon the changed files: clean.python -m mkdocs build --strict: passes.Docs:
docs/sleep/README.md, the advanced-config key list inplugins/README.md, andCHANGELOG.md. I left the per-pluginSKILL.mdkey lists alone.🤖 Generated with Claude Code
https://claude.ai/code/session_015s4y5QVk9hfpeGNR7dzrHb