Fix #2364: [Bug] MIN_ADAPTIVE_BASELINE floor untuned for v2.0.7 normalized backprop reward - #2367
Open
Memtensor-AI wants to merge 1 commit into
Open
Memtensor-AI wants to merge 1 commit into
Memtensor-AI 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
3 tasks
Collaborator
Author
🤖 Open Code ReviewTarget: PR #2367 ✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). Generated by cloud-assistant via Open Code Review. |
Collaborator
Author
✅ Automated Test Results: PASSEDAll tests passed (83/83 executed, 5 skipped). memos_github_open_source/smoke: 1/1, memos_local_plugin/unit: 11/11, memos_python_core/changed-repo-python: 71 passed, 5 skipped. Duration: 15s [advisory, non-gating] AI-generated tests on branch test/auto-gen-df2d3cfc906de175-20260915054146: 39/39 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
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.
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
@WeiminLee please review this PR.
Reviewer Checklist