Skip to content

The Algorithm

Jarrett Ye edited this page Jul 21, 2023 · 28 revisions

Symbol

  • $R$: Retrievability (probability of recall)
  • $S$: Stability (interval when R=90%)
    • $S^\prime_r$: new stability after recall
    • $S^\prime_f$: new stability after forgetting
  • $D$: Difficulty ( $D \in [1, 10]$ )
  • $G$: Grade (rating at Anki):
    • $1$: again
    • $2$: hard
    • $3$: good
    • $4$: easy

FSRS v4

Default Parameters

[1, 2, 3, 4, 5, 0.5, 0.5, 0.2, 1.4, 0.2, 0.8, 2, 0.2, 0.2, 1, 0.5, 2]

Formula

The $w_i$ denotes w[i].

The initial stability after the first rating:

$$S_0(G) = w_{G-1}.$$

For example, $S_0(1)=w_0$ is the initial stability when the first rating is again. When the first rating is easy, the initial stability is $S_0(4)=w_3$.


The initial difficulty after the first rating:

$$D_0(G) = w_4 - (G-3) \cdot w_5,$$

where the $D_0(3)=w_4$ when the first rating is good.


The new difficulty after review:

$$D^\prime(D,G) = w_7 \cdot D_0(3) +(1 - w_7) \cdot (D - w_6 \cdot (G - 3)).$$

It will calculate the new difficulty with $D^\prime = D - w_4 \cdot (G - 3)$, and then apply the mean reversion $w_7 \cdot D_0(3) + (1 - w_7) \cdot D^\prime$ to avoid "ease hell".


The retrievability after $t$ days since the last review:

$$R(t,S) = \left(1 + \cfrac{t}{9 \cdot S}\right)^{-1},$$

where $R(t,S)=0.9$ when $t=S$.

The next interval can be calculated by solving for t in the above equation after putting the request retention in place of R:

$$I(r,S) = 9 \cdot S \cdot \left(\cfrac{1}{r} - 1\right),$$

where $I(r,S)=S$ when $r=0.9$.


The new stability after a successful review (the user pressed "Hard", "Good" or "Easy"):

$$S^\prime_r(D,S,R,G) = S\cdot(e^{w_8} \cdot (11-D) \cdot S^{-w_9} \cdot (e^{w_{10}\cdot(1-R)}-1) \cdot w_{15}(\textrm{if G = 2}) \cdot w_{16}(\textrm{if G = 4}) + 1).$$

Let $SInc$ (the increase in stability) denotes $\cfrac{S^\prime_r(D,S,R,G)}{S}$, which is equivalent to Anki's factor.

  1. The larger the value of D, the smaller the $SInc$, which means that for difficult material, the increase in memory stability is smaller than for easy material.
  2. The larger the value of S, the smaller the $SInc$, which means that memory saturates. The more stable your memory is, the harder it is to make it even more stable.
  3. The smaller the value of R, the larger the $SInc$, which means that the best time to review your material is when you almost forgot it.
  4. The value of $SInc$ is always greater than or equal to 1 if the review was successful.

According to 3, the "delay" will affect the next interval via these formulas:

$$R(t,S) = \left(1 + \cfrac{t}{9 \cdot S}\right)^{-1},$$

$$S^\prime_r(D,S,R,G) = S\cdot(e^{w_8} \cdot (11-D) \cdot S^{-w_9} \cdot (e^{w_{10}\cdot(1-R)}-1) \cdot w_{15}(\textrm{if G = 2}) \cdot w_{16}(\textrm{if G = 4}) + 1).$$

With the increment of the "delay", retention decays. Then the new stability after the recall will increase. Instead of linear increasing like the sm-2/Anki algorithm, it will converge to an upper limit, which depends on your parameters of FSRS:

image

You can modify them in this playground: https://www.geogebra.org/calculator/ahqmqjvx.


The stability after forgetting (i.e., post-lapse stability):

$$S^\prime_f(D,S,R) = w_{11}\cdot D^{-w_{12}}\cdot ((S+1)^{w_{13}} - 1)\cdot e^{w_{14}\cdot(1-R)}.$$

For example, if $D=2$ and $R=0.9$, with default parameters, $S^\prime_f(S=100) = 2\cdot 2^{-0.2} \cdot ((100+1)^{0.2}-1) \cdot e^{1(1-0.9)} \approx 3$ and $S^\prime_f(S=1) \approx 0.3$.

FSRS v3

Default Parameters

var w = [1, 1, 5, -1, -1, 0.1, 1.5, -0.2, 0.8, 2, -0.2, 0.2, 1];

Formula

The $w_i$ denotes w[i].

The initial stability after the first rating:

$$S_0(G) = w_0 + (G-1) \cdot w_1,$$

where the $S_0(1)=w_0$ is the initial stability when the first rating is again. When the first rating is easy, the initial stability is $S_0(4)=w_0 + 3 \cdot w_1$.


The initial difficulty after the first rating:

$$D_0(G) = w_2 + (G-3) \cdot w_3,$$

where the $D_0(3)=w_2$ when the first rating is good.


The new difficulty after review:

$$D^\prime(D,G) = w_5 \cdot D_0(3) +(1 - w_5) \cdot (D + w_4 \cdot (G - 3)).$$

It will calculate the new difficulty with $D^\prime = D + w_4 \cdot (G - 3)$, and then apply the mean reversion $w_5 \cdot D_0(3) + (1 - w_5) \cdot D^\prime$ to avoid "ease hell".


The retrievability of $t$ days since the last review:

$$R(t,S) = 0.9^{\frac{t}{S}},$$

where $R(t,S)=0.9$ when $t=S$.

The next interval can be calculated by solving for t in the above equation after putting the request retention in place of R.

$$I(r,S) = S \cdot \cfrac{\ln(r)}{\ln(0.9)},$$

where $I(r,S)=S$ when $r=0.9$.


The new stability after recall:

$$S^\prime_r(D,S,R) = S\cdot(e^{w_6}\cdot (11-D)\cdot S^{w_7}\cdot(e^{w_8\cdot(1-R)}-1)+1).$$

Let $SInc$ (the increase in stability) denotes $\cfrac{S^\prime_r(D,S,R)}{S}$, which is equivalent to Anki's factor..

  1. The larger the value of D, the smaller is the value of SInc. This means that the increase in memory stability for difficult material is smaller than that for easy material.
  2. The larger the value of S, the smaller is the value of SInc. This means that higher the stability of the memory, the harder it becomes to make the memory even more stable.
  3. The smaller the value of R, the larger is the value of SInc. This means that the best time to review your material is when you almost forgot it (provided that you are successful in recalling it).
  4. The value of $SInc$ is always greater than or equal to 1 if the review was successful.

The following 3D visualization could help understand.

image


The stability after forgetting (i.e., post-lapse stability):

$$S^\prime_f(D,S,R) = w_9\cdot D^{w_{10}}\cdot S^{w_{11}}\cdot e^{w_{12}\cdot(1-R)}.$$

For example, if $D=2$ and $R=0.9$, with default parameters, $S^\prime_f(S=100) = 2\cdot 2^{-0.2} \cdot 100^{0.2} \cdot e^{1(1-0.9)} \approx 5$ and $S^\prime_f(S=1) \approx 2$.

You can play the function in post-lapse stability - GeoGebra.

image