How to use the next-generation spaced repetition algorithm FSRS on Anki?

Long time no see, guys! Recently, Anki has updated to 2.1.55 with the support of custom scheduling with memory states. Today I want to introduce how to use the FSRS4Anki custom scheduling.

Introduction of FSRS4Anki

FSRS4Anki, aka Free Spaced Repetition Schedule for Anki, is based on the three-component model of memory proposed by Piotr Wozniak and the stochastic shortest path algorithm introduced in my paper. It makes great progress in memory prediction and scheduling optimization.

Prerequisite

FSRS4Anki currently only supports Anki for desktop computers and version >= 2.1.55.

Download site: Anki — powerful, intelligent flashcards (ankiweb.net)

But you can also review on your phone, then use the FSRS4Anki Helper on your computer to re-schedule the review (using the card’s entire review history, including your review logs on your phone).

Use FSRS4Anki by default

Step 1: Enable the V3 scheduler

Anki → Preferences → Scheduling → V3 scheduler

Step 2: Copy the code of FSRS4Anki

fsrs4anki repository → fsrs4anki_scheduler.js → Copy raw contents

If you are using Anki Qt5 variants, use fsrs4anki_scheduler_qt5.js

Step 3: Paste code into custom scheduling

Gear → Options → Custom Scheduling → Save

Congratulations! You are already using the default version of FSRS4Anki. But the parameters of the default version are generated from my review logs, only partially adaptive for you. If you have been using Anki for some time and have accumulated a lot of review logs, you can try FSRS4Anki optimizer to generate parameters for you.

Generate the optimal parameters for you

Step 1: Open the FSRS4Anki Optimizer

fsrs4anki repository → fsrs4anki_optimizer.ipynb → Open in Colab

To use Colab, you need a Google account.

Step 2: Upload your review logs

Anki: Gear → Export → Check “Include scheduling information” and “Support older Anki verions”-> Export

Colab: Folder → Right-click to call up the menu → Upload

Step 3: Fill in your Anki settings in the optimizer

Set the filename with the name of the deck file you uploaded.

Set the timezone with your time zone. Here is the full list of timezones: list of pytz time zones (github.com)

Set next_day_starts_at with the “New day starts at” in your Anki.

Step 4: Run all the code, wait for the result, and copy the output parameters

Runtime → Run all → Go to section 3 Result and wait for the output → Copy the parameters

Step 5: Replace the default parameters in FSRS4Anki with the optimized parameters

Replace the parameters in the red box in the picture and save them.

It’s done!

Other Tutorials

Set parameters separately for a specific deck:

Debug custom scheduling:

The memory model of FSRS:

The optimization principle of the algorithm:

I hope my work could help you~

14 Likes

Nice tutorial!

1 Like

I just read your article. I will try the algorithm! Nice job!!

1 Like

2 questions:

  • If I want to return to the standard Anki V3 scheduler do I just delete the custom scheduling in the deck options?

  • My maximum interval will be 100 days. Should I modify and set:
    let maximumInterval = 100; ?

  1. yes
  2. yes

There are my current settings, how can they work with FSRS?

image
image

per the wiki: FAQ · open-spaced-repetition/fsrs4anki Wiki · GitHub

FSRS only modifies the long-term scheduling. So Learning steps and Relearning steps work as usual. And I recommend using the default Learning steps and Relearning steps. It is best not to set a step of more than one day.

In the latest version of FSRS4Anki, maximum interval, easy bonus, and hard interval have been supported. You can modify them in fsrs4anki_scheduler.js.

The graduating interval, easy interval, new interval, starting ease, and interval modifier become irrelevant. The requestRetention of FSRS4Anki is equivalent to interval modifier.

I’m just going to comment in the modified settings from your image. Leech treshold will work as usual. Starting ease and new interval are not relevant to FSRS, so they will be ignored. So will the interval modifier setting, but you have the option of selecting your target retention in FSRS.

1 Like

I did read the Wiki, but my worry was that the model might have been trained on vastly different settings than mine which have to be accounted for. I’m probably not understanding correctly what FSRS is doing, I’m just too dumb for all the math explanations lol.
Thank you for the answer.

You can train the model with your own data.

So the Google Collab optimizing thing is good enough and takes account of my different settings?

Yep, the optimizer will use your entire review logs to generate the personal parameters.

First of all @L.M.Sherlock, thanks for your work!

I’ve just gone through the tutorial and everything looks fine so far.

I have a doubt about using FSRS and doing reviews from AnkiMobile in iOS. I’m using the beta version 20088.5 and I can see the parameters in Advanced > Custom scheduling from my phone.

Are those honored when I review on the phone? Or do I need to use the “Reschedule all cards” action from desktop periodically?

Assuming the custom scheduling code is executing successfully, it should work the same way as the computer version.

I haven’t test AnkiMobile 20088.5 because I am not the member of test team. I will test it when the stable version releases.

1 Like

You’re welcome to join the beta if you’d like to: Beta Testing - AnkiMobile Manual

Thanks! I have submitted the request just now.

I tested it. FSRS works well on AnkiMobile. You can see the differences between pasting the code into custom scheduling and deleting the code. You can also compare the interval given by FSRS on AnkiMobile with the interval given in PC.

5 Likes

I think you should change the comment: // FSRS4Anki v3.9.6 Scheduler Qt6

to // FSRS4Anki v3.9.8 Scheduler Qt6

The 3.9.8 is the version for FSRS4Anki, not for scheduler. The versions for scheduler and optimizer are independent.

2 Likes

Very exciting work! Thank you so much for sharing with us all. It is an incredible effort!

How much variance is there between the optimized parameters for each user? If you take an average of the optimized parameters for each user in the MaiMemo data set, might that be good enough as a default for all users? How important is it for each user to train the optimizer on their own data?