-
-
Notifications
You must be signed in to change notification settings - Fork 140
The Optimal Retention
When we talk about spaced repetition, two things really matter:
- How many flashcards will I remember? (knowledge acquisition)
- How long will it take? (workload in minutes of studying per day)
We want to remember as much as possible while spending as little time as possible. In FSRS, both minimizing the workload and maximizing the rate of knowledge acquisition can be achieved by choosing the right value of desired retention.
Imagine we’re adding new cards constantly every day and doing reviews on time. Our knowledge acquisition will be high if we set a high desired retention.
where
But high desired retention means we have to review cards more often, which increases our workload. When we lower our desired retention, both our workload and how much we remember go down. However, if the desired retention is really low, we forget a lot and have to relearn cards, making our workload go up again. There are two "forces" at play here:
- As desired retention increases, intervals become shorter, and therefore the number of reviews per day increases.
- As desired retention decreases, we forget more and therefore have to re-learn more of our material.
As a result, if we plot the workload as a function of desired retention, it will be U-shaped.
The same is true if we divide workload by knowledge (the formula in the beginning of this article), which tells us how much we will have to study relative to how much we will remember. However, the exact value of desired retention that corresponds to the minimum is now different.
With FSRS, it's possible to simulate the learning process in Anki.
Here's a step-by-step overview of the simulation:
-
Initialization and Configuration Reading:
- Extract various parameters from the
SimulatorConfig
configuration, such as deck size, learning span, maximum cost per day, etc. Here and hereafter "cost" refers to seconds of studying. - Initialize the
card_table
as a zero matrix, then fill it with initial values based on the configuration (like learning span and very small values for difficulty and stability).
- Extract various parameters from the
-
Initialize Daily Counters and Cost Arrays:
- Initialize arrays for daily review counts, learning counts, memorized counts, and total daily costs.
-
Simulation Loop:
- For each day (within the learning span, "Days to simulate"), perform the following steps:
- Calculate the elapsed days since last review (
delta_t
) and retrievability for learned cards based on the card's stability and last review date. - Determine which cards need to be reviewed and generate random values for these cards to later decide if they are forgotten. The probability that a user will press Good/Hard/Easy is estimated from the user's review history.
- Based on retrievability and random values, determine which cards are forgotten and assign ratings to cards that need to be reviewed.
- Update the cost of cards based on whether they are forgotten, their review ratings, and the cost parameters defined in the configuration. Cost parameters, such as how much time the user spends per card when he answers "Good" or "Again", are estimated from the user's review history.
- Compute the cumulative sum of costs to determine which cards will be reviewed. Due to the daily maximum cost and review limits, not all cards can always be reviewed.
- Determine which new cards need to be reviewed for the first time.
- Randomly generate ratings for newly learned cards, update their stability and difficulty.
- Update cards'
last_date
,stability
,difficulty
,interval
, anddue
fields. - Update daily review counts, learning counts, memorized counts, and total costs.
- Calculate the elapsed days since last review (
- For each day (within the learning span, "Days to simulate"), perform the following steps:
-
Return Results:
- Return arrays of daily memorized counts, review counts, learning counts, and daily total costs.
With the simulator, it's possible to predict the workload for each desired retention level. The optimizer uses Brent's method to find the optimal retention.
My representative paper at ACMKDD: A Stochastic Shortest Path Algorithm for Optimizing Spaced Repetition Scheduling
My fantastic research experience on spaced repetition algorithm: How did I publish a paper in ACMKDD as an undergraduate?
The largest open-source dataset on spaced repetition with time-series features: open-spaced-repetition/FSRS-Anki-20k