← Back to blog
2025-12-229 min read

Memory Decay and Forgetting Curves: The Math Behind Remembering

neurosciencealgorithmsresearch
memory-decay-forgetting-curves.md

Memory Decay and Forgetting Curves

Hermann Ebbinghaus ran memory experiments on himself in the 1880s. His findings still guide how we build AI memory systems.

The Ebbinghaus Forgetting Curve

Ebbinghaus memorized nonsense syllables and tested recall over time. His results:

After 20 minutes: 58% retention
After 1 hour: 44% retention
After 1 day: 34% retention
After 1 week: 25% retention
After 1 month: 21% retention

The pattern: rapid initial decay, then a long tail.

Exponential vs Power-Law Decay

Two mathematical models fit forgetting:

**Exponential decay**: R(t) = e^(-t/τ)

Fast initial drop
Good for recent memories

**Power-law decay**: R(t) = (1 + t)^(-β)

Slower, more gradual
Good for older memories

Research shows human memory uses BOTH. Recent memories decay exponentially; older memories follow power-law.

Our Hybrid Implementation

```rust

fn calculate_retention(hours: f32, initial_strength: f32) -> f32 {

// Exponential component (half-life of 24 hours)

let exp_decay = (-hours / 24.0).exp();

// Power-law component (β = 0.5)

let power_decay = (1.0 + hours).powf(-0.5);

// Blend: more exponential early, more power-law later

let blend = (hours / 168.0).min(1.0); // 1 week transition

let retention = exp_decay * (1.0 - blend) + power_decay * blend;

initial_strength * retention

}

```

Spacing Effect

Ebbinghaus also discovered the spacing effect: memories reviewed at increasing intervals are retained longer. We implement this:

```rust

fn on_access(memory: &mut Memory) {

let interval = memory.last_access - memory.previous_access;

if interval > memory.optimal_interval {

// Spaced retrieval strengthens more

memory.strength += BOOST * 1.5;

memory.optimal_interval *= 2.0; // Increase next interval

} else {

memory.strength += BOOST;

}

}

```

Consolidation During Idle

The brain consolidates memories during sleep. Shodh-memory runs a consolidation loop during idle periods:

```rust

async fn consolidation_loop() {

loop {

sleep(Duration::from_secs(300)).await;

apply_decay_to_all_memories();

replay_important_memories(); // Like dreaming

prune_weak_connections();

}

}

```

This ensures memory quality degrades gracefully without active maintenance.

Results

With hybrid decay, our memory quality over time:

Day 1: 94% relevant context
Week 1: 87% relevant context
Month 1: 71% relevant context

Without decay, noise accumulates until retrieval quality collapses.