feat(memory): HeLa-Mem spreading activation retrieval and query-bias tracing#3397
Merged
feat(memory): HeLa-Mem spreading activation retrieval and query-bias tracing#3397
Conversation
…tracing (#3346, #3379) Implements HL-F5 spreading activation as an opt-in alternative to pure cosine-ANN search in HeLa-Mem. Adds observability tracing to the query bias correction path. Spreading activation (#3346): - New `hela_spreading_recall()`: BFS from top-1 ANN anchor with multiplicative path weights; score = path_weight × cosine.max(0.0) - Multi-path convergence keeps max path_weight; depth as tie-break - Fallback to ANN result (real anchor cosine) when anchor has no outgoing edges - Dim-probe via OnceCell at startup; WARN + empty result on mismatch (#3382 pattern) - Hebbian reinforcement on traversed top-k edges (excludes synthetic anchor id=0) - Per-step 8 ms circuit breaker to protect p95 latency NFR (HL-NF3) - Controlled by new HebbianConfig fields: spreading_activation, spread_depth, spread_edge_types, step_budget_ms (all off by default — zero-change invariant) - New VectorStore::get_points trait method + Qdrant impl for entity vector fetch - Config migration step 31b; default.toml updated Tracing (#3379): - apply_query_bias() and profile_centroid_cached() wrapped in tracing::info_span! - tracing::debug! for all four bias branches (applied, disabled, not_first_person, no_centroid, dim_mismatch) and three centroid branches (computed, cache hit, stale) Closes #3346, #3379
… in async fns Replacing span.entered() held across .await in apply_query_bias, profile_centroid_cached, and hela_spreading_recall hot loop with #[tracing::instrument] and tracing::debug! to preserve Send bounds. Fixes zeph-context assembler build failure (E0277).
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.
Summary
[memory.hebbian] spreading_activation = false(zero-change invariant preserved).tracing::info_span!and structureddebug!events toapply_query_bias()andprofile_centroid_cached(): all four skip branches (disabled, not_first_person, no_centroid, dim_mismatch), apply branch with centroid dim and weight, and three centroid branches (computed, cache hit with TTL, stale).New public surface
graph::activation::{HelaFact, HelaSpreadParams, hela_spreading_recall}VectorStore::get_pointsdefault trait method + Qdrant implementationEmbeddingStore::get_vectors_from_collectionGraphStore::qdrant_point_ids_for_entitiesSemanticMemory::with_hebbian_spread+recall_graph_helainsemantic::recall[memory.hebbian]fieldsTest plan
cargo nextest run --config-file .github/nextest.toml -p zeph-memory -p zeph-config --lib --no-fail-fast— 1546 unit tests passcargo +nightly fmt --check -p zeph-memory -p zeph-config— cleancargo clippy -p zeph-memory -p zeph-config -- -D warnings— cleancrates/zeph-memory/tests/hela_spreading_activation.rs— require Qdrant container, marked#[ignore]hela-mem-spreadandquery-bias-tracing(status: Untested).local/testing/playbooks/hela-mem-spreading.mdCloses #3346, #3379