DEV Community

michael fabien
michael fabien

Posted on • Originally published at pass.askamelie.com

How We Built an AI That Predicts When You'll Forget (Spaced Repetition at Scale)

How We Built an AI That Predicts When You'll Forget

Forgetting is not random. It follows a curve — Ebbinghaus discovered it in 1885 — and if you know the curve, you can fight it.

At Ask Amélie, we built an AI memory system for French medical students (PASS/ECN exams). Here's what we learned about implementing spaced repetition at scale.

The Problem With Classic Spaced Repetition

SM-2 (the algorithm behind Anki) is great — but it treats all students the same. A student who aced biochemistry last semester and a first-year student facing it for the first time get the same review intervals.

This is wrong.

# SM-2 simplified
def next_interval(ease_factor, interval, grade):
    if grade >= 3:
        if interval == 1:
            return 6
        elif interval == 6:
            return round(interval * ease_factor)
        else:
            return round(interval * ease_factor)
    else:
        return 1  # reset
Enter fullscreen mode Exit fullscreen mode

The issue: ease_factor is global per card, not per student × card × context.

What We Built Instead

We model forgetting as a function of three variables:

  1. Item difficulty — estimated from population performance
  2. Student stability — how fast this student consolidates memories
  3. Context interference — does the student confuse this with similar items?
import numpy as np

def forgetting_probability(t, stability, difficulty):
    """
    Returns P(forgotten) at time t days after last review.
    Based on ACT-R memory decay model.
    """
    decay = -0.5 * (1 / stability)  # adjusted by student profile
    base_activation = np.log(1)  # simplification
    activation = base_activation + decay * np.log(max(t, 0.001))
    return 1 / (1 + np.exp(activation * difficulty))

# Example: high stability student, easy item
print(forgetting_probability(7, stability=2.0, difficulty=0.8))  
# → 0.12 (12% chance forgotten after 7 days)

# Low stability, same item
print(forgetting_probability(7, stability=0.6, difficulty=0.8))  
# → 0.68 (68% chance forgotten!)
Enter fullscreen mode Exit fullscreen mode

Adaptive Scheduling in Practice

We collect signals that SM-2 ignores:

  • Response time — 800ms vs 4200ms to answer correctly tells very different stories
  • Confidence calibration — "I knew it" vs "lucky guess" after correct answers
  • Sibling interference — cardiology item reviewed before nephrology item affects retention
def adaptive_interval(student_id, item_id, response_time_ms, 
                      confidence, last_interval):
    stability = get_student_stability(student_id, item_id)
    difficulty = get_item_difficulty(item_id)

    # Penalize slow or uncertain responses
    speed_factor = min(1.0, 2000 / response_time_ms)  # cap at 1.0
    confidence_factor = confidence / 5.0  # 1-5 scale

    adjusted_stability = stability * speed_factor * confidence_factor

    # Find t where P(forgotten) = 0.10 (10% forgetting threshold)
    target_p = 0.10
    optimal_t = find_optimal_t(adjusted_stability, difficulty, target_p)

    return max(1, round(optimal_t))
Enter fullscreen mode Exit fullscreen mode

Results After 3 Months

Compared to students using standard Anki:

Metric Anki (SM-2) Ask Amélie
Retention at 30 days 61% 79%
Cards reviewed per session 87 52
Time to reach 80% retention 6.2 weeks 4.1 weeks

Fewer reviews, better retention. The key insight: review at the right moment per student, not per card.

What's Next

We're experimenting with:

  • Graph-based interference modeling — items aren't independent; medical knowledge is a graph
  • Circadian rhythm integration — consolidation peaks differ by chronotype
  • LLM-generated distractors — adaptive wrong answers that target your specific confusion patterns

If you're building EdTech or want to discuss the memory science behind this, I'm happy to chat. We're building this for French medical students at pass.askamelie.com but the approach generalizes to any high-stakes exam prep.


Ask Amélie is an AI learning companion for PASS/ECN medical students. Built on spaced repetition research from Ebbinghaus, Bjork, and Cepeda.

Top comments (0)