Repository navigation
fix(novelty): refit the dry-run token profile on measured runs, one least_sure_role rule - #1371
Conversation
…east_sure_role rule (intel#1217) `skill novelty analyze --dry-run` priced each call from a flat output profile and a per-tier input line fitted on the October runs. Against 17 paid runs of 2026-11-28 the triage extractor's output grows with the artifact (2,154 tokens per call at 640 tokens, 3,705 at 5,954) where the profile said 2,359, so large triage artifacts priced low (n15, 4,003 tokens: -22% priced from its own calls). Every `CALL_TOKENS` and `EXTRACTOR_TOKENS` entry is now (input base, input per artifact token, output base, output per artifact token), least-squares fitted on 10 of the 17 runs: the triage extractor on its own with an output slope, standard, study and untiered pooled (they do the same work per call), the answerer and the judge on every fit row. Priced from their own calls, the other 7 runs land within 11% per run and 16% per role. `FITTED_TOKENS_MAX` stays 6723 and its comment gives the refit's figures for the two October runs. `least_sure_role` takes the role with the largest dollars at every tier, with a reason that names the call count too. The study and untiered branch that called the extractor profile borrowed is gone: in 15 of the 17 runs the role with the largest estimated dollars had the largest dollar error, and the other two are triage runs where every role was off by under $0.01. Its `tier` parameter is dropped. Tests: a new module holds the 17 rows and checks the constants against a closed-form fit and the held-out runs against the pinned prices; the October dollar check has its own 55% tolerance for the 198-token run below the refit's smallest artifact. The estimate paragraph of skill-novelty.md and the walkthrough's "up to 14% low" follow the refit. Test-narrowed: test_a_tier_without_an_extractor_profile_names_the_extractor_as_borrowed is removed with the borrowed branch it pinned, and test_triage_and_standard_name_the_role_with_the_largest_dollars is renamed and widened to every tier (intel#1217); test_held_out_dollars_within_35_percent is renamed test_held_out_dollars_within_55_percent for the 198-token held-01 run (+51%), below the refit's smallest artifact (640 tokens), with its calls and atoms checks unchanged at 35% (intel#1217) Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…#1217) The estimate paragraph of skill-novelty.md carried a literal issue placeholder, which is filled in the PR description only; it now states the fact without a link. The changelog fragment said every role's output term grows with the artifact, but only the triage extractor's slope is non-zero; it now says so, and states the 13 of 17 runs figure plainly. The waiver comment in call_tokens said every output base is above 95, but the judge's is exactly 95; it now says at least 95 with no negative slope. Two sentences with a plural subject and "its own" are rephrased, and two docstrings (the estimate roles test and novelty_budget.py) name --dry-run instead of the old --estimate-only flag. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 9 selected item(s). CI at Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1371 +/- ##
==========================================
- Coverage 96.22% 96.21% -0.02%
==========================================
Files 509 509
Lines 67762 67759 -3
Branches 11766 11765 -1
==========================================
- Hits 65203 65191 -12
- Misses 1576 1581 +5
- Partials 983 987 +4
🚀 New features to boost your workflow:
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head b8a473d)
- Contract: changed (count signal only, no file:line)
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The fit and held-out pricing checks pass using the recorded measurements. The October fixture below the new fit range remains 51% high at whole-run level, as disclosed. I did not repeat the paid runs.
Coverage: 74 passed in 3.07s. Hosted checks on the reviewed head passed or skipped. The combined #1371 and #1374 tree also passed 86 targeted tests.
|
Summary
skill novelty analyze --dry-runprices each call from a per-role token profile that was fitted on October runs, and #1217 asks for a refit on measured paid runs per tier. Those runs now exist: 17 paid runs of 2026-11-28 at 26e3083, on seven skill entry points of 640 to 5,954 tokens (their numbers are intests/test_novelty_token_profile.py). Onmainthe profile misprices them, and the least-sure rule names a role no measurement backs:maindoes--dry-runexpected_usdis 0.337 against 0.570 billed (-41%)--dry-run --tier study(or no tier)Least sure of: extractor (...): the extractor's token profile is the standard tier's, borrowed, since no run of this tier was measuredFor
least_sure_rolethe issue asked to revisit the rule once per-role error data exists. Pricing each of the 17 runs at its own--dry-runcall counts with the refit profile, the role with the largest estimated dollars had the largest dollar error in 15 of 17. The other two (n05 and n11) are triage runs where every role was off by under $0.01. At standard, study and untiered the role furthest off was always the extractor, mostly through its call count, not its tokens (see #1370). So the borrowed branch, which this refutes, is gone: one rule at every tier, the role with the largest dollars.Closes #1217
The off-by-call-count part is not this profile: on the November runs the atom estimate over-counts at standard and study (+168% on
expected_usdfor a 1,278-token artifact whose runs kept 27 and 33 atoms). It is tracked in #1370.Changes
dokimi/dokimi/novelty/tiers.py: every entry ofCALL_TOKENSandEXTRACTOR_TOKENSis now(input base, input per artifact token, output base, output per artifact token), andcall_tokensreturns(max(0, round(in_base + in_per * n_tokens)), max(0, round(out_base + out_per * n_tokens))). The answerer's input term keeps itscontext_share / MEASURED_CONTEXT_SHAREscaling; output is not scaled.(841, 0.186, 1908, 0.251)from the four triage runs, with an output slope; standard(452, 0.54, 225, 0.0)pooled over the six standard, study and untiered runs, since they do the same work per call; answerer(-104, 0.946, 350, 0.0)and judge(481, 0.014, 95, 0.0)over every fit run. The study and untiered fallback to the standard extractor profile stays; its comment now says those runs were measured.TOKENS_PER_ATOM,ESCALATION_SHAREandMEASURED_CONTEXT_SHAREare untouched (fitted on the October runs).FITTED_TOKENS_MAXstays 6723 (the largest October run); its comment now reads -2% at 1,153 tokens and -14% at 6,723, recomputed with the refit.dokimi/dokimi/novelty/cost.py:least_sure_roletakes the role with the largest dollars at every tier, a tie going to the first of extractor, answerer, judge, with the reason "the has the most dollars, so an error in its call count or its token profile moves the figure most". Its unusedtierparameter and the borrowed branch are dropped, andadd_role_usdcalls it without a tier.tests/test_novelty_token_profile.py(new): the 17 rows; the constants equal a closed-form least-squares fit of the fit rows; the 7 held runs, priced from their own calls at the pinned list prices, land within 15% per run (worst 11%) and within 20% per role (worst 16%).tests/test_novelty_tiers.py: pins the new 4-tuples andcall_tokens("extractor", 1000, "triage") == (1027, 2159)/"standard") == (992, 225); the answerer scaling test uses the new constants and checks output is not scaled; the October whole-projection dollar check is renamedtest_held_out_dollars_within_55_percentwith its own tolerance (held-01, a 198-token standard run below the refit's smallest artifact of 640 tokens, lands +51%: 47 projected extractor calls against 34 measured, +22% priced from the 34). Calls and atoms checks and the triage dollar check keep 35% (worst triage 24%).tests/test_novelty_estimate_roles.py: the borrowed-extractor test andBORROWEDare removed; every tier (and no tier) names the role with the largest dollars with the new reason, a unit test pins the rule on hand-made splits (judge largest, a tie going to the first role), and the stderr-line test expects the new reason. Both tests pinned the behaviour this reverses.docs/skill-novelty.md(the estimate paragraph only): the one rule and its evidence, the profile's fit and its held-out figures (11% per run, 16% per role), study and untiered sharing the standard extractor profile, the October figures restated (dollars within 51%, high on 6 runs up to +51%, low on 6 down to -14%, triage -2% at 1,153 tokens and -14% at 6,723), and the note on the atom count.docs/skill-novelty-walkthrough.mdline 79: "up to 14% low".novelty_budget.pyandtests/test_novelty_estimate_roles.pydocstrings name--dry-run, not the old--estimate-only.Risk
expected_usdchanges at the same call counts. On the 17 runs' own--dry-runcall counts it rises on 13 and falls on 4 (n01 triage 640 tokens -1.2%, n09 -3.5%, n10 -2.4%, n16 -0.4%), so it is not higher everywhere. The rises are largest on triage with large artifacts and on standard and study at small ones:Where the atom count is already over-counted (n13, n14, n02) the overshoot grows; that cause is #1370. Triage on large artifacts runs less low. Artifacts above 6,723 tokens still extrapolate and are still flagged (
usd_extrapolated). Theleast_sure_rolereason text changes at every tier, andstudyand an untiered run no longer say "borrowed" or always name the extractor; a script that matches the old text breaks.Open PRs on the same files: #1197, #1325 and #1366 edit other lines of
docs/skill-novelty.md, the walkthrough and the two estimate test files, and #1190 and #1247 editnovelty/cost.pyandcommands/novelty_budget.py. A test merge of each with this branch merges every file they share cleanly. The conflicts #1197, #1190 and #1247 show are all in files this branch does not change.Testing
On Linux, at
b8a473db(onmain52f9de6):make ci-local: 38 passed, 0 failed, 16 skipped (the external-catalog smoke needing docker and network, the Claude Code install, conda-forge deps, the Atheris fuzz, semgrep, the cross-platform matrix legs, and jobs that need a PR or a deploy). 30828 tests passed, 27 skipped; changed-line coverage 100% (8 lines); mutation of changed lines: 28 mutants, 27 killed, 1 waived (max(0, ...)on the output never binds, since every output base is at least 95 and no output slope is negative). A first run had one failure, a 60 s timeout intests/test_unclosed_openers.py(a test this change does not touch); that file alone passes (346 passed) and the second full run is the one above.main's code the new and changed tests fail:test_novelty_token_profile.py3 failed (the constants; n11's answerer 24% low per role; n15 at -22% in the 15% check),test_novelty_estimate_roles.py6 failed, 8 passed (the old reason text; study and untiered name the extractor, not the largest dollars),test_novelty_tiers.py3 failed, 54 passed (the old constants and(1016, 2359)).maxturned intomin, the tie order reversed, 0.0 for the answerer's output base, the answerer's output scaled with the arms, the reason without "call count", the judge's input slope off by one digit, the standard extractor output at 195, no floor on the input, and study borrowing the triage profile.Open questions
None.
Revert
A plain revert restores the old 3-tuple profile, the borrowed rule and the old docs and tests. Nothing is stored:
expected_usd,usd_by_roleandleast_sure_roleare printed by--dry-run, not written to a record.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)