🚀 Feature Request: Memory Decay & Salience Pruning in STLTMemory
📖 Background & Problem Statement
Currently, STLTMemory operates by asking the LLM to summarize and continuously update the long_term_memory string upon consolidation.
While this accurately replaces the string rather than doing naive appending, the long-term memory lacks strict forgetfulness thresholds. Over thousands of simulation steps, the LLM naturally tries to persist historical details. This causes the summary string to grow indefinitely, presenting two critical problems:
- Context Window Limitations: Prompting the LLM with an ever-expanding summary string will eventually breach context limits or severely increase latency/API costs.
- Behavioral Realism: Real-world entities experience decay curve memory—older or less relevant information is naturally forgotten or compressed. Currently, agents possess perfect lifelong recall.
💡 Proposed Solution
Introduce a Memory Decay Mechanism directly into the STLT architecture.
Key Additions:
- Decay/Salience Factor: We propose adding a configurable
decay_rate or a token-limit threshold to STLTMemory.
- Periodic Re-summarization (Pruning): Instead of only appending to
long_term_memory, if the long-term string exceeds a specified token limit/character length, the memory system should trigger a "Pruning/Compression" LLM pass.
- Prompt Update:
Your current long-term memory is too long. Please compress it, retaining only the most critical overarching facts and discarding less salient/older details.
🛠 Impact & Value
- Scalability: Allows simulations to run infinitely without crashing due to LLM context overflow.
- Cost-Efficiency: Prevents sending massive text accumulations to costly high-tier APIs.
- Scientific Realism: Brings psychological decay principles into ABM modeling, creating more realistic agent behaviors.
👋 Implementation Plan
I am an active contributor and would love to take ownership of implementing this architecture. I will:
- Introduce
long_term_token_limit configs.
- Expand
st_lt_memory.py to support compression prompting.
- Write full unit tests verifying the decay threshold behaviors.
Let me know if the maintainers are aligned on this architectural direction, and I will happily open a PR!
🚀 Feature Request: Memory Decay & Salience Pruning in
STLTMemory📖 Background & Problem Statement
Currently,
STLTMemoryoperates by asking the LLM to summarize and continuously update thelong_term_memorystring upon consolidation.While this accurately replaces the string rather than doing naive appending, the long-term memory lacks strict forgetfulness thresholds. Over thousands of simulation steps, the LLM naturally tries to persist historical details. This causes the summary string to grow indefinitely, presenting two critical problems:
💡 Proposed Solution
Introduce a Memory Decay Mechanism directly into the STLT architecture.
Key Additions:
decay_rateor a token-limit threshold toSTLTMemory.long_term_memory, if the long-term string exceeds a specified token limit/character length, the memory system should trigger a "Pruning/Compression" LLM pass.🛠 Impact & Value
👋 Implementation Plan
I am an active contributor and would love to take ownership of implementing this architecture. I will:
long_term_token_limitconfigs.st_lt_memory.pyto support compression prompting.Let me know if the maintainers are aligned on this architectural direction, and I will happily open a PR!