Skip to content

test(memory): establish semantic retrieval no-go baseline - #1304

Merged
XingYu-Zhong merged 7 commits into
KunAgent:developfrom
SunwardL:codex/add-kun-semantic-memory-retrieval
Sep 9, 2026
Merged

test(memory): establish semantic retrieval no-go baseline#1304
XingYu-Zhong merged 7 commits into
KunAgent:developfrom
SunwardL:codex/add-kun-semantic-memory-retrieval

Conversation

@SunwardL

@SunwardL SunwardL commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a versioned, synthetic P2-A retrieval dataset with 31 Memory records and 40 English/Chinese queries, including semantic paraphrase, cross-lingual, scope, lifecycle, authority, temporal, abstention, and multi-record cases.
  • Add strict dataset/manifest validation, a common safety prefilter, deterministic metrics, resource accounting, an offline network guard, and a frozen lexical reference baseline.
  • Evaluate two local q8 multilingual candidates through an evaluation-only adapter and record the locked E5 hybrid candidate, fallback behavior, Windows x64 resource evidence, and deterministic clean-process runs.
  • Record a no-go decision: the candidate passes every safety, offline, determinism, precision, lexical-control, and desktop-resource gate, but does not meet the pre-registered holdout Recall@5 and MRR improvement thresholds.

This PR intentionally does not change production Memory retrieval. SQLite FTS5 and filesystem fallback remain the supported path.

Why a no-go result is useful

The decision thresholds were frozen before holdout execution. The selected candidate improved holdout Recall@5 from 0.500 to 0.625 (+0.125), below the required +0.150, and holdout MRR stayed at 0.500, below the required +0.100 improvement. Lowering the thresholds or tuning against the revealed holdout would invalidate the experiment, so P2-B is not proposed from this candidate.

Changes

  • Add strict schemas and integrity checks for the frozen dataset and manifest.
  • Add a common authorized-record prefilter before any candidate sees records.
  • Add split/language/category Recall@K, Precision@K, MRR, abstention, false-positive, and hard-safety accounting.
  • Add deterministic resource percentile helpers and an in-process offline network guard.
  • Add the lexical control adapter and split machine-readable baseline artifacts.
  • Add an evaluation-only normalized-vector adapter with deterministic ties, semantic-gated RRF, and exact lexical fallback for missing, corrupt, unsupported, or failed candidate initialization.
  • Add development screening, resource evidence, the candidate lock, holdout/full decision evidence, and a threshold-by-threshold decision evaluator.
  • Add a dedicated npm --prefix kun run eval:memory-retrieval command.
  • Add a complete OpenSpec proposal, design, specification, candidate screening record, and task ledger.

Frozen candidate and result

Item Result
Candidate multilingual-e5-small-q8-hybrid-0.8-1
Model revision 761b726dd34fb83930e26aab4e9ac3899aa1fa78
Quantized ONNX SHA-256 f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193
Fusion similarity >= 0.80, equal-weight RRF, rank constant 60
Holdout Recall@5 0.625 vs lexical 0.500 (+0.125; required +0.150)
Holdout MRR 0.500 vs lexical 0.500 (+0.000; required +0.100)
Full Recall@5 / Precision@5 / MRR 0.833 / 0.345 / 0.729
Safety violations 0 scope, lifecycle, authority, unknown, network, or fallback mismatches
Determinism 3 fresh processes, identical report SHA-256 4bee9d01b3bd48fe3da18917bd009b3fdb8b105681d653e377c6427dc608eada
Decision no-go; keep SQLite FTS5/filesystem and do not start P2-B

Windows x64 resource evidence

  • Cold readiness: 584.333 ms
  • Warm query p50/p95: 3.581 / 4.738 ms over 30 samples
  • 10,000-record index build: 17,011.378 ms
  • Incremental update: 5.178 ms
  • Model assets: 135,392,016 bytes
  • Generated 10,000-record index: 15,590,000 bytes
  • Peak RSS delta: 351,342,592 bytes
  • Network attempts: 0

All frozen resource limits passed. Model assets and the generated stress index remain outside the repository.

Tests

  • npm --prefix kun run eval:memory-retrieval — 7 files, 38 tests passed
  • npm run build:kun — passed
  • npm run typecheck — passed
  • npm run build — passed
  • npm run check:file-lines — 6,947 tracked text files passed
  • npm run lint — 0 errors; 30 existing warnings
  • npm exec -- openspec validate add-kun-semantic-memory-retrieval --strict — passed
  • git diff --check — passed

The complete npm test run finished with 5,751 passed, 27 skipped, and 22 failures in seven files outside this change. Seven Chromium-cookie failures were caused by the isolated runner PATH omitting the installed sqlite3.exe; both cookie files passed on focused rerun after restoring the normal user PATH (22 tests). Eleven failures remain reproducible in five unchanged upstream files: eight file-session index assertions, two Windows/POSIX path expectations, and one POSIX permission-bit expectation. No failed file or its production module is changed here.

Non-goals

  • No production embedding index or hybrid ranking wiring
  • No canonical Memory schema change
  • No model download, model binary, generated vector index, or new runtime dependency
  • No hosted Memory upload or LLM reranking
  • No hidden feature flag that can activate the candidate
  • No real user Memory, account data, machine path, credential, or conversation excerpt

@XingYu-Zhong
XingYu-Zhong merged commit 1db0254 into KunAgent:develop Sep 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants