> For AI agents: the complete documentation index is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/llms.txt, the full documentation bundle is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/llms-full.txt.

# FSRS-4

FSRS-4 有 17 个可训练权重，并使用幂函数遗忘曲线取代 FSRS-3 的指数曲线。

公共符号和 Model 契约见[模型概览](https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/guide/model.md)。

:::info 公式来源
已依据 [awesome-fsrs Wiki — FSRS-4](https://github.com/open-spaced-repetition/awesome-fsrs/wiki/The-Algorithm#fsrs-v4) 核对。
:::

## 遗忘曲线与间隔

```math
R(t,S)=\left(1+\frac{t}{9S}\right)^{-1}
```

```math
I(r,S)=9S\left(\frac{1}{r}-1\right)
```

## 初始记忆

```math
S_0(G)=\operatorname{clamp}\left(w_{G-1},S_{min},S_{max}\right)
```

```math
D_0(G)=\operatorname{clamp}\left(w_4-(G-3)w_5,D_{min},D_{max}\right)
```

## 难度

```math
D^*=D-w_6(G-3)
```

```math
D'=\operatorname{clamp}\left(w_7w_4+(1-w_7)D^*,D_{min},D_{max}\right)
```

## 复习后的稳定性

Hard 时 `math:H_G = w_{15}`，否则为 `math:1`；Easy 时 `math:E_G = w_{16}`，否则为 `math:1`。

```math
S_f=w_{11}D^{-w_{12}}\left((S+1)^{w_{13}}-1\right)e^{w_{14}(1-R)}
```

```math
S_r=S\left[1+e^{w_8}(11-D)S^{-w_9}\left(e^{w_{10}(1-R)}-1\right)H_GE_G\right]
```

```math
S'_{raw}(G)=
\begin{cases}
S_f,&G=1\\
S_r,&G\in\{2,3,4\}
\end{cases}
```

最后，模型通过 `clamp` 将 `math:S'_{\mathrm{raw}}` 限制在 `math:S_{\min}` 到 `math:S_{\max}` 之间。
