Repository navigation
Fix #2364: [Bug] MIN_ADAPTIVE_BASELINE floor untuned for v2.0.7 normalized backprop reward - #2604
Open
syzsunshine219 wants to merge 1 commit into
Open
syzsunshine219 wants to merge 1 commit into
syzsunshine219 wants to merge 1 commit into
Conversation
adaptiveBaseline(poolMean) is documented as adaptive between MIN_ADAPTIVE_BASELINE (0.2) and V7_NEUTRAL_BASELINE (0.5), but the post-v2.0.7 normalized-credit backprop rewrite left per-trace V values in a ~0.02-0.5 band. Since typical poolMean sits at ~0.01-0.06 (well below 0.2), Math.max(0.2, poolMean) pinned the baseline at a stale 0.2 for effectively every pool, capping computeGain output and skewing shrinkTowardBaseline against low-without-count candidate policies. Policy/skill promotion stalled fleet-wide. Retune MIN_ADAPTIVE_BASELINE to 0.005, matching the v2.0.7 minTraceValue floor in core/config/defaults.ts. The adaptive branch of adaptiveBaseline is now reachable across the full observed V distribution; the constant only kicks in for degenerate near-zero pools. - gain.ts: constant 0.2 -> 0.005, docstring rewritten to reference v2.0.7 backprop distribution and the issue's regression history - README.md: replace stale "V_with ~ 0.7-0.85" description with the v2.0.7 0.02-0.5 range, cross-link MIN_ADAPTIVE_BASELINE + minTraceValue - gain.test.ts: two new regression cases (adaptive branch reachable at typical poolMean 0.03; MIN_ADAPTIVE_BASELINE <= minTraceValue) Refs: MemTensor#2364
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.
Restores the proposal from #2367 as an open PR against
main; its former base branch,dev-v2.0.34, is no longer available. This proposal requires maintainer review of the feature or design direction before merging.Source head:
9dcb98a44346c9a02437fb6500af65ea73e30ef0. No new source-code changes are introduced by restoring this proposal. Earlier discussion and evidence remain in #2367; validation claims in the original description refer to the earlier snapshot.Outstanding review scope
旧 PR 将 adaptiveBaseline 最低值从0.2调到0.005,依据是生产已经采用V≈R/N的归一化贡献值;当前main实际仍调用旧的右到左递推backprop,该前提不成立。不得把缺少0.005直接认定遗漏修复,需结合当前打分分布决定阈值。
Original proposal
Description
Retunes MIN_ADAPTIVE_BASELINE in apps/memos-local-plugin/core/memory/l2/gain.ts from 0.2 to 0.005, restoring the adaptive-baseline behavior that adaptiveBaseline() has always documented. Root cause: the v2.0.7 reward-backprop rewrite moved per-trace V values into a ~0.02–0.5 band (typical poolMean ~0.01–0.06), but the 0.2 floor was left over from the pre-v2.0.7 reward scale. Since Math.max(0.2, poolMean) pinned every real pool at 0.2, the adaptive branch became dead code — computeGain output was capped and shrinkTowardBaseline systematically penalized low-without-count candidate policies, stalling policy/skill promotion fleet-wide.
The retuned constant (0.005) matches the v2.0.7 minTraceValue floor already documented in core/config/defaults.ts, so poolMean values across the entire observed distribution now reach the adaptive branch. The MIN_ADAPTIVE_BASELINE guard only triggers for degenerate near-zero pools, which is the original design intent.
Verification: two new regression cases in tests/unit/memory/l2/gain.test.ts assert (a) the adaptive branch is reachable at typical v2.0.7 poolMean 0.03 and (b) MIN_ADAPTIVE_BASELINE ≤ config.minTraceValue. Full apps/memos-local-plugin unit suite green (1552 tests, 0 failures) and tsc --noEmit passes clean. gain.ts docstring plus the neighboring L2 README were updated to describe the v2.0.7 distribution and cross-link the shared floor with minTraceValue.
Files touched (3): apps/memos-local-plugin/core/memory/l2/gain.ts, apps/memos-local-plugin/core/memory/l2/README.md, apps/memos-local-plugin/tests/unit/memory/l2/gain.test.ts. Fix is minimal, reversible, and does not require a data migration — the change only affects gain computation for new promotion decisions. Refs #2364.
Related Issue (Required): Fixes #2364
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Not run; documentation-only change.
Checklist
@WeiminLeeplease review this PR.Reviewer Checklist