✨ A modern Anki custom scheduling based on Free Spaced Repetition Scheduler algorithm ✨
- Introduction
- How to Get Started?
- Configuring Different Parameters for Different Decks
- FAQ
- Compatibility
- Contribute
- Stargazers over time
FSRS4Anki consists of two main parts: the scheduler and the optimizer.
- The scheduler replaces Anki's built-in scheduler and schedules the cards according to the FSRS algorithm.
- The optimizer uses machine learning to learn your memory patterns and finds parameters that best fit your review history. For details about the working of the optimizer, please read the mechanism of optimization.
For details about the FSRS algorithm, please read the algorithm. If you are interested, you can also read my papers:
- A Stochastic Shortest Path Algorithm for Optimizing Spaced Repetition Scheduling (free access), and
- Optimizing Spaced Repetition Schedule by Capturing the Dynamics of Memory (submit a request).
FSRS4Anki Helper is an Anki add-on that complements the FSRS4Anki Scheduler. You can read about it here: https://github.com/open-spaced-repetition/fsrs4anki-helper
中文版请见:FSRS4Anki 使用指北
To get started with FSRS, you'll need to follow a two-step process.
- First, you'll need to enable the FSRS scheduler in your Anki application.
- Next, you'll need to personalize FSRS to suit your learning patterns.
Let's now discuss both of these steps in detail.
Go to Tools > Preferences > Review > Enable V3 Scheduler.
- Go to the following page and copy all of the code. https://github.com/open-spaced-repetition/fsrs4anki/blob/main/fsrs4anki_scheduler.js
- In Anki, open the deck options of any deck (it doesn’t matter which deck). Find the Advanced Settings column, and paste the code you copied into the Custom Scheduling field:
- Ensure that the learning and re-learning steps are shorter than 1 day in any deck you want to use with FSRS. Other settings, such as “Graduating interval” and “Easy interval”, don’t matter. For more details about which Anki settings matter and which are obsolete, see the FAQs.
After you perform the above steps, the FSRS4Anki Scheduler should ideally be active. If you want to confirm this, you can change this part of the code:
const display_memory_state = false;
to:
const display_memory_state = true;
Then open any deck for review and you'll see the following message:
This shows that the FSRS scheduler is running normally. If you don’t see D, S and R, and only see “FSRS enabled”, it means that the card is in the “learning” or “relearning” stage, not in the “review” stage.
You can then change the code back and the message will no longer display.
Personalizing FSRS for your learning needs involves a two-step process.
- First, you'll need to train the FSRS parameters for your collection using the FSRS optimizer, tailoring the algorithm to your learning patterns.
- Next, you'll need to choose the desired retention rate and maximum interval.
Let's now discuss both of these steps in detail.
For most users, it is advisable to use one of the following two methods (Google Colab and Hugging Face) for training the parameters. Advanced users can explore other options mentioned here.
Note that the FSRS optimizer requires a minimum of 2,000 reviews to produce accurate results. If you don't have enough data, you can skip this step and use the default parameters instead, which are already entered into the scheduler code.
Method 1: Training using Google Colab
Open the optimizer's notebook. You don't need to configure the coding environment yourself and you can use Google's machines for free (you'll need to have a Google account):
After the Colab website opens, switch to the folder tab. Once the Optimizer connects to Google's machines, you can right-click to upload your deck file/collection file exported from Anki.
When exporting these files, make sure to select "Include scheduling information" and "Support older Anki versions". You don't need to include media.
A note on Privacy
The decks that you upload to the optimizer can't be accessed by the author of FSRS. This can be verified by anyone who understands code because the code of the optimizer is open-source.
Google may have access to the uploaded data. But, the risk is similar to uploading the data to your personal Google Drive folder.
If you are too worried about privacy, you still have two options.
- Advanced users can run the script locally using the options mentioned here.
- Other users can export their collection with blanked-out fields. To do this, go through the following steps:
- Take a backup by going to
File → Create Backup
just in case anything goes wrong. - Go to
Browse > Notes > Find and Replace
. - Type
(.|\n)*
in the "Find" field and keep the "Replace With" field empty. - Check (✓) the "Treat input as regular expression" option. Uncheck "Selected notes only" if you want to apply this to all notes.
- Export your collection using the steps mentioned above.
- Restore the contents of your notes by going to
Edit → Undo Find and Replace
.
- Take a backup by going to
- After uploading the file, replace the
collection-2022-09-18@13-21-58.colpkg
with the name of your uploaded file. - Replace
Asia/Shanghai
with your timezone. The notebook contains a link to the list of time zones. - Also, replace the value of
next_day_starts_at
. To find this value, Go toTools > Preferences > Review > Next day starts at
in your Anki.
Then, run the optimizer by either pressing Ctrl+F9
or going to Runtime > Run all
.
Wait for the code to finish running. Then, go to section 2.2 (Result), where the optimized parameters will be available. Copy these parameters.
Method 2: Training using Hugging Face
Simply upload your exported decks to this website and it will optimise it for you.
https://huggingface.co/spaces/open-spaced-repetition/fsrs4anki_app
After training the parameters by either of the methods above, replace the parameters in the FSRS code that you copied earlier.
Even after you start using FSRS, you should re-train the parameters once in every two months. However, it depends on how old your collection is. Users with relatively newer collections might want to re-optimize monthly. Re-optimization will ensure that FSRS works well with your current patterns of learning.
Now, you need to choose your requestRetention
, which denotes the retention rate (i.e. the fraction of the cards recalled successfully) that FSRS will try to achieve.
As an aid in deciding this value, you can view your past retention rate in Anki stats. For example, if your retention rate in the past was 90%, you can set 0.90 as your requestRetention
.
You can set a higher requestRetention
but keep in mind that as you increase the requestRetention
above 0.90, the review load (reviews/day) will increase very rapidly. For the same reason, it is not advisable to use a requestRetention
greater than 0.97.
After deciding the value of requestRetention
, put this into the scheduler code. At the same time, decide the value of maximumInterval
, which is the maximum interval any card is allowed to attain. The value in the FSRS scheduler code overrides the value set in Anki's deck options.
After performing the above steps, you are ready to start using FSRS. Just start reviewing and FSRS will do its work.
After setting up FSRS in your Anki, you can install the FSRS4Anki Helper add-on and use it to reschedule your existing cards. This is a one-time measure to reschedule the cards that were previously scheduled according to Anki's built-in algorithm. The add-on also offers many other useful features. Read more about the add-on here: https://github.com/open-spaced-repetition/fsrs4anki-helper
You can also generate different parameters for different decks and configure them separately in the code. In the default configuration, deckParams
already contains three groups of parameters.
The group "global config for FSRS4Anki" is global parameters.
The group "MainDeck1" are the parameters applied to the deck "MainDeck1" and its sub-decks.
Similarly, the third group is the parameters applied to the deck "MainDeck2::SubDeck::SubSubDeck" and its sub-decks. You can replace these with the decks you want to configure. If you need more, feel free to copy and add them.
const deckParams = [
{
// Default parameters of FSRS4Anki for global
"deckName": "global config for FSRS4Anki",
"w": [0.4, 0.6, 2.4, 5.8, 4.93, 0.94, 0.86, 0.01, 1.49, 0.14, 0.94, 2.18, 0.05, 0.34, 1.26, 0.29, 2.61],
// The above parameters can be optimized via FSRS4Anki optimizer.
// For details about the parameters, please see: https://github.com/open-spaced-repetition/fsrs4anki/wiki/The-Algorithm
// User's custom parameters for global
"requestRetention": 0.9, // recommended setting: 0.75 - 0.95
"maximumInterval": 36500,
// FSRS only modifies the long-term scheduling. So (re)learning steps in deck options work as usual.
// I recommend setting steps shorter than 1 day.
},
{
// Example 1: User's custom parameters for this deck and its sub-decks.
"deckName": "MainDeck1",
"w": [0.6, 0.9, 2.9, 6.8, 4.72, 1.02, 1, 0.04, 1.49, 0.17, 1.02, 2.15, 0.07, 0.35, 1.17, 0.32, 2.53],
"requestRetention": 0.9,
"maximumInterval": 36500,
},
{
// Example 2: User's custom parameters for this deck and its sub-decks.
// Don't omit any keys.
"deckName": "MainDeck2::SubDeck::SubSubDeck",
"w": [0.6, 0.9, 2.9, 6.8, 4.72, 1.02, 1, 0.04, 1.49, 0.17, 1.02, 2.15, 0.07, 0.35, 1.17, 0.32, 2.53],
"requestRetention": 0.9,
"maximumInterval": 36500,
}
];
If there are some decks you don't want to use FSRS with, you can add their names to the skip_decks
list.
const skip_decks = ["MainDeck3", "MainDeck4::SubDeck"];
Here, I have collected some frequently asked questions: FAQ
Some add-ons modify the scheduling of Anki, which would cause conflict with the FSRS4Anki scheduler.
Add-on | Compatible? | Comment |
---|---|---|
Advanced Review Bottom Bar | Yes✅ | Please use the latest version. |
The KING of Button Add-ons | Yes✅ | Please use the latest version. |
Pass/Fail | Yes✅ | Pass is the equivalent of Good . |
Incremental Reading v4.11.3 (unofficial clone) | No❌ | It shows the interval given by Anki's built-in scheduler, not the custom scheduler. |
Auto Ease Factor | No❌ | The Ease Factor doesn't affect the interval given by FSRS. So, you won't benefit from using this add-on. |
Delay siblings | No❌ | Delay siblings will modify the intervals given by FSRS. However, the FSRS4Anki Helper add-on has a similar feature that works better with FSRS. So, use the FSRS4Anki Helper add-on instead. |
autoLapseNewInterval | No❌ | The New Interval doesn't affect the interval given by FSRS. So, you won't benefit from using this add-on. |
Straight Reward | No❌ | The Ease Factor doesn't affect the interval given by FSRS. So, you won't benefit from using this add-on. |
Let me know via issues if I miss any add-ons.
You can contribute to FSRS4Anki by beta testing, submitting code, or sharing your data. If you want to share your data with me, please fill out this form: https://forms.gle/KaojsBbhMCytaA7h8
Expertium |
user1823 |