Skip to content

MemorySafe-Labs/memorysafe

Repository files navigation

MemorySafe Labs

Memory Governance for Continual Learning Systems

MemorySafe is a memory governance framework for continual learning systems, designed to prevent safety-critical information from being forgotten under memory and compute constraints.

Rather than modifying how models learn, MemorySafe governs what they retain.

It operates as a policy-level decision layer for memory, acting as an intelligent governor that disciplines data retention independently of the learning algorithm.

Use cases include medical AI, edge systems, fraud detection, robotics, and privacy-aware AI.


🚀 Try MemorySafe in 30 seconds

Experience predictive memory governance in action.

The demo compares MemorySafe against FIFO, Reservoir, and Random Replay under memory pressure.

[Open in Colab] (https://colab.research.google.com/github/MemorySafe-Labs/memorysafe/blob/main/benchmarks/Taste_demo_v2/demo.ipynb)

No setup required. Just click Run all.


Problem

Modern continual learning systems implicitly conflate exposure with importance.

Under standard replay strategies:

  • frequent samples dominate memory
  • rare but critical events are overwritten
  • long-term reliability degrades

This is especially harmful in:

  • medical AI
  • edge systems
  • fraud detection
  • safety-critical robotics

MemorySafe reframes memory as a resource allocation and lifecycle management problem, explicitly separating:

Risk ≠ Value ≠ Decision


Core Concepts

Memory Vulnerability Index (MVI)

MVI estimates how likely a memory is to be forgotten under future learning pressure.

It captures:

  • interference from new tasks
  • sensitivity to gradient updates
  • temporal competition effects

MVI is:

  • predictive (not retrospective)
  • continuous and interpretable
  • model-agnostic

Memory Relevance (Value)

Relevance estimates how valuable a memory is independently of vulnerability.

Guiding principles:

  • repetition ≠ importance
  • rare but salient events retain value
  • relevance decays over time

ProtectScore (Decision Signal)

ProtectScore combines MVI and Relevance into a deterministic decision signal that governs:

  • protection
  • consolidation
  • eviction under fixed capacity

This treats forgetting as an active functional choice, not a system failure.


What MemorySafe Is (and Is Not)

MemorySafe is:

  • a memory governance layer
  • model-agnostic and pluggable
  • compatible with any learning algorithm
  • interpretable and low-overhead

MemorySafe is not:

  • a training algorithm
  • a benchmark-optimized model
  • a replacement for continual learning methods

It governs memory decisions, not learning dynamics.


Architecture

MemorySafe acts as a policy layer on top of replay buffers or memory modules.

Each memory maintains:

  • task_id
  • MVI
  • relevance
  • protect_score
  • replay_count
  • protected flag

Design guarantees:

  • no gradients inside memory logic
  • no dataset-specific heuristics
  • deterministic and auditable behavior

Generalization & Validation

The same unchanged MemorySafe policy was evaluated across heterogeneous continual learning benchmarks:

  • MNIST
  • Fashion-MNIST
  • CIFAR-10
  • CIFAR-100
  • Omniglot
  • Permuted MNIST
  • PneumoniaMNIST (medical imaging)

Without dataset-specific tuning, MemorySafe demonstrated:

  • consistent Task-0 protection
  • strong rare-event retention
  • stability across increasing task difficulty

These results suggest zero-shot generalization of a memory allocation policy.


Use Cases

Medical AI
Protection of rare pathologies and safety-critical cases.

Edge AI (Jetson / embedded)
Memory governance under tight RAM and compute budgets.

Fraud Detection
Retention of delayed or rare anomalies.

Robotics
Preservation of critical failures and safety events.

Privacy-Aware AI
Predictive forgetting and sensitive data governance (MVI-P).


Integration

MemorySafe can integrate with:

  • Experience Replay
  • GEM / A-GEM
  • PackNet
  • Progressive Neural Networks
  • Custom replay buffers

Integration modes:

  • replay gate
  • eviction governor
  • diagnostic layer for memory risk

Technology Stack

  • PyTorch
  • CUDA / GPU acceleration
  • Continual learning research prototype (Alpha)

One-Sentence Essence

MemorySafe treats AI memory as a governed resource, separating vulnerability from value to enable intentional, interpretable, and generalizable memory decisions under real-world constraints.


License

Apache 2.0 License