-
-
Notifications
You must be signed in to change notification settings - Fork 139
How does the scheduler work?
This wiki page describes the execution process of the custom scheduling code, which has been outdated since FSRS was integrated into Anki 23.10+ and AnkiDroid 2.17+.
To more deeply understand the working process of the FSRS4Anki scheduler, we recommend you install AnkiWebView Inspector
. The following text will use the screenshot with the Inspector
window.
And please note, open the inspector before you start the review.
Launch the inspector before you clicking Study Now
, and then enter into a deck, you will see the following:
The left window shows the running code of custom scheduling.
F10
or the button in the next figure is used to execute the code per line.
Important!: Don't click the show answer
before the code run to the end. You can use F8
to execute to the end.
There are three parts of the scheduler's code.
Line 5-18 are setting the parameters for all cards. Line 24-40 are setting the parameters for a specific deck.
Related discussion: [Question] How to workaround with Anki custom scheduling not being "Per Deck"
Line 142-192 are used to check the scheduling states. In Anki, there are four types of states for card scheduling: New
, Learning
, Review
, and Relearning
. Learning
and Relearning
are the same in scheduling. And there are two types of decks: normal and filtered. In normal decks, all reviews will modify the interval of cards. But in filtered decks, only checking the box Reschedule cards based on my answer in this deck
will allow Anki to update the interval of cards. The FSRS4Anki scheduler also supports filtered decks.
The FSRS4Anki scheduler will calculate memory states from your rating and the DSR model. The scheduled interval is based on memory states and your custom parameters.
If the memory states are not available during review, the FSRS4Anki scheduler will convert the Anki's built-in scheduling information to the memory states.
The interval
and factor
of Anki's built-in scheduling, an SM-2 variation, will be automatically converted to the memory states of FSRS.
If the card's memory states are empty, FSRS assumes that the
So,
In SM-2, after a recall, the interval (stability) increases by the Ease Factor.
In FSRS, after a recall, the stability increases by a factor of
If we equate these two, the Difficulty can be calculated as:
After the stability and difficulty are calculated as above, they are used for the calculation of the next stability and the next difficulty (after the review).
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