Skip to content

Conversation

@edwinyyyu
Copy link
Contributor

@edwinyyyu edwinyyyu commented Nov 7, 2025

Description

DeclarativeMemory was sensitive to insertion order, making batch ingestion difficult to implement. Now episodes are only connected by timestamp during search.

Implement batch ingestion: LoCoMo ingestion time reduced from 5-10 minutes to 30-40 seconds (huge improvement!) from cold start.

DeclarativeMemory configuration is too complicated for most people. Make it into a black box to make it easier to use and get some extra performance.

Returning chunks instead of episodes allows future implementation of chunk size limits. Previously there was clustering, which only made things bigger.

Security logic was easy to compromise in the case of a poor DerivativeDeriver, DerivativeMutator, or RelatedEpisodePostulator implementation. Blackboxing makes security easier to reason about.

Data type changes:

  • Remove EpisodeCluster
  • Add Chunk
  • Minor changes to Episode, Derivative
  • content_type and episode_type use cases unified

Ingestion/search changes:

  • complicated workflow system removed in favor of routing by content_type
  • queries are used as is -- no need for symmetry with ingestion

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g., code style improvements, linting)
  • Documentation update
  • Project Maintenance (updates to build scripts, CI, etc., that do not affect the main project)
  • Security (improves security without changing functionality)

How Has This Been Tested?

Manually tested on LoCoMo dataset (updated scripts not committed yet), agentless.

Mean Scores Per Category:
          llm_score  count         type
category                               
1            0.7270    282    multi_hop
2            0.7850    321     temporal
3            0.5000     96  open_domain
4            0.8847    841   single_hop

Overall Mean Scores:
llm_score    0.811
dtype: float64

TODO: Unit/integration tests. Update evaluation scripts.

  • Unit Test
  • Integration Test
  • End-to-end Test
  • Test Script (please provide)
  • Manual verification (list step-by-step instructions)

Checklist

  • I have signed the commit(s) within this pull request
  • My code follows the style guidelines of this project (See STYLE_GUIDE.md)
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • Confirmed all checks passed
  • Contributor has signed the commit(s)
  • Reviewed the code
  • Run, Tested, and Verified the change(s) work as expected

@edwinyyyu edwinyyyu changed the title WIP: Refactor declarative memory WIP (based on #485, #489): Refactor declarative memory Nov 7, 2025
@edwinyyyu edwinyyyu force-pushed the refactor_declarative_memory branch from a57eb1c to 77fb288 Compare November 7, 2025 19:12
@edwinyyyu edwinyyyu changed the title WIP (based on #485, #489): Refactor declarative memory WIP (based on #485, #489): Rewrite declarative memory Nov 7, 2025
@edwinyyyu edwinyyyu force-pushed the refactor_declarative_memory branch 3 times, most recently from 14b7288 to 8dd94bf Compare November 7, 2025 22:21
Signed-off-by: Edwin Yu <edwinyyyu@gmail.com>
Signed-off-by: Edwin Yu <edwinyyyu@gmail.com>
@edwinyyyu edwinyyyu force-pushed the refactor_declarative_memory branch from 8dd94bf to 33055b5 Compare November 7, 2025 22:25
Signed-off-by: Edwin Yu <edwinyyyu@gmail.com>
@edwinyyyu edwinyyyu force-pushed the refactor_declarative_memory branch from 33055b5 to 1590677 Compare November 7, 2025 22:26
@edwinyyyu
Copy link
Contributor Author

Split 3 of #473

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.

1 participant