====== SuperMemo 2 算法 ======
**SuperMemo 2(简称 SM-2)**是 Piotr Woźniak 于 1987 年发表的间隔重复算法,是现代电子记忆卡软件(如 Anki、Mnemosyne)的理论基础。它是 SuperMemo 系列的首次计算机化实现,也是目前应用最广泛的间隔重复算法之一(([[https://super-memory.com/english/ol/sm2.htm|Piotr Woźniak, Application of a computer to improve the results obtained in working with the SuperMemo method, Master's Thesis, 1990]]))。
===== 算法背景 =====
Piotr Woźniak 在 1985 年提出了纸笔版的 SM-0 算法,通过手动管理复习间隔来对抗艾宾浩斯遗忘曲线(([[https://en.wikipedia.org/wiki/SuperMemo|Wikipedia: SuperMemo]]))。但手工计算的效率极低,难以推广。1987 年 12 月,Woźniak 用 Turbo Pascal 3.0 编写了第一个计算机版 SuperMemo 程序,将间隔计算自动化,这就是 SM-2 算法(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]]))。它的核心理念是:
如果在遗忘临界点之前安排复习,就能以最少的时间维持长期记忆
这一原则与更早的心理学研究一致,间隔重复本身自 1930 年代以来就已被多位心理学家提出推荐(([[https://en.wikipedia.org/wiki/Spaced_repetition|Wikipedia: Spaced repetition]]))。
===== 核心变量 =====
每张卡片维护三个属性,每次复习后更新(([[https://super-memory.com/english/ol/sm2.htm|SM-2 Algorithm, Woźniak 1990]])):
^ 变量 ^ 含义 ^ 初始值 ^
| **n** | 连续正确回忆次数 | 0 |
| **EF(Easiness Factor)** | 难度系数(范围 1.3~2.5) | 2.5 |
| **I** | 距下次复习的天数(间隔) | 0 |
每次复习时,用户需对回忆质量进行 0-5 级自评(([[https://en.wikipedia.org/wiki/SuperMemo#Software_implementation|Wikipedia: SuperMemo — Software implementation]])):
^ 评分 ^ 含义 ^
| 0 | 完全忘记——完全不能回忆 |
| 1 | 错误——看到答案后觉得熟悉 |
| 2 | 错误——看到答案后觉得很容易 |
| 3 | **正确**——但回忆十分困难 |
| 4 | **正确**——有些犹豫 |
| 5 | **正确**——完美回忆,毫不费力 |
评分 3 及以上视为"正确",0-2 视为"错误"。Woźniak 在设计 0-5 评分尺度时充分考虑了数字键盘的布局便利性——操作者可以在一秒内完成评分(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]]))。
===== 算法流程 =====
SM-2 每次复习执行两步更新:先确定新间隔,再调整难度系数(([[https://super-memory.com/english/ol/sm2.htm|SM-2 Algorithm Specification]]))。
**步骤 1:计算新的间隔 I**
如果评分 >= 3(回答正确):
- 如果 n == 0:I = 1 天
- 如果 n == 1:I = 6 天
- 如果 n >= 2:I = I × EF
- n = n + 1
如果评分 < 3(回答错误):
- n = 0(重置连续正确计数)
- I = 1 天(明天再次复习)
初始间隔 1 天和 6 天源自 Woźniak 在 SM-0 算法(纸笔版)中的观察——后续间隔呈近似常数倍数增长(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]]))。
**步骤 2:更新难度系数 EF**
EF 根据评分动态调整,Woźniak 通过启发式方法构造了以下公式,该公式在后续 3.5 年的计算机化使用中几乎没有变化(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]])):
EF = EF + (0.1 - (5 - q) × (0.08 + (5 - q) × 0.02))
其中 q 为用户评分(0-5)。注意当 q=4 时,EF 不变(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]]))。计算后确保:
如果 EF < 1.3:EF = 1.3
EF 的下限 1.3 有特殊的实践意义:Woźniak 发现 EF 低于 1.3 的卡片复习过于频繁,且通常存在表述上的缺陷(未遵循最小信息原则)。将 EF 下限设为 1.3 后,学习效率显著提升,同时也提供了一个识别需要重新表述的卡片的指标(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]]))。
===== 算法流程图 =====
SM-2 的完整决策路径:
digraph SM2 {
rankdir=TD;
node [fontname="sans-serif", fontsize=11];
edge [fontname="sans-serif", fontsize=10];
start [label="复习卡片", shape=egg, fillcolor="#e8f5e9", style=filled];
show [label="展示问题", shape=box, fillcolor="#bbdefb", style=filled];
recall [label="能回忆起来吗?", shape=diamond, fillcolor="#fff9c4", style=filled];
correct [label="自评 3-5 分(正确)", shape=box, fillcolor="#c8e6c9", style=filled];
wrong [label="自评 0-2 分(错误)", shape=box, fillcolor="#ffcdd2", style=filled];
check_n [label="连续正确次数 n?", shape=diamond, fillcolor="#fff9c4", style=filled];
n0 [label="n = 0\nI = 1 天", shape=box, fillcolor="#e1f5fe", style=filled];
n1 [label="n = 1\nI = 6 天", shape=box, fillcolor="#e1f5fe", style=filled];
n2 [label="n >= 2\nI = I × EF", shape=box, fillcolor="#e1f5fe", style=filled];
reset [label="n = 0\nI = 1 天(重置)", shape=box, fillcolor="#ffcdd2", style=filled];
update_n [label="n = n + 1", shape=box, fillcolor="#e1f5fe", style=filled];
update_ef [label="更新 EF", shape=box, fillcolor="#f3e5f5", style=filled];
ef_calc [label="EF = EF + (0.1 - (5-q)×(0.08 + (5-q)×0.02))", shape=box, fillcolor="#e1bee7", style=filled];
ef_min [label="EF < 1.3?", shape=diamond, fillcolor="#fff9c4", style=filled];
ef_clamp [label="EF = 1.3", shape=box, fillcolor="#f8bbd0", style=filled];
done [label="下次复习 = 今天 + I", shape=egg, fillcolor="#e8f5e9", style=filled];
reinforce [label="补强复习:\n本次会话内再展示", shape=box, fillcolor="#fff3e0", style=filled];
start -> show;
show -> recall;
recall -> correct [label="是", fontcolor="green"];
recall -> wrong [label="否", fontcolor="red"];
correct -> check_n;
correct -> reinforce [label="评分 = 3", style=dashed, fontcolor="orange"];
reinforce -> show;
wrong -> reset;
check_n -> n0 [label="0"];
check_n -> n1 [label="1"];
check_n -> n2 [label=">=2"];
n0 -> update_n;
n1 -> update_n;
n2 -> update_n;
reset -> update_ef;
update_n -> update_ef;
update_ef -> ef_calc;
ef_calc -> ef_min;
ef_min -> ef_clamp [label="是", fontcolor="red"];
ef_min -> done [label="否", fontcolor="green"];
ef_clamp -> done;
}
===== 算法示例 =====
假设一张新卡片的初始状态:n=0, EF=2.5, I=0
**第一次复习:** 用户评分 5(完美回忆)
- n=0 → I = 1 天
- n → 1
- EF = 2.5 + (0.1 - (5-5) × (0.08 + (5-5) × 0.02)) = 2.5 + 0.1 = **2.6**
- 结果:1 天后复习,EF=2.6
**第二次复习(第 2 天):** 用户评分 4
- n=1 → I = 6 天
- n → 2
- EF = 2.6 + (0.1 - (5-4) × (0.08 + (5-4) × 0.02)) = 2.6 + (0.1 - 0.10) = **2.6**
- 结果:6 天后复习
**第三次复习(第 8 天):** 用户评分 5
- n>=2 → I = 6 × 2.6 = 15.6 ≈ **16 天**
- n → 3
- EF = 2.6 + 0.1 = **2.7**
- 结果:16 天后复习
随着正确次数增加,间隔呈指数增长:1 → 6 → ~16 → ~43 → ~116 天……
如果某次回答错误(评分 0-2),n 归零、I 重置为 1 天,从第一天重新开始。
===== 补强复习 =====
所有评分低于 4 的卡片,在本次复习结束后会被再次展示,直到评分达到 4 或 5。这意味着"勉强正确"(评分 3)也会在同一次会话中再看一遍。这一机制源自 Woźniak 的观察:评分 3 的卡片回忆十分困难,不做即时补强则极易在下一次间隔后彻底遗忘(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]]))。
===== 与其他算法的关系 =====
SM-2 是后续算法家族中的基础版本(([[https://en.wikipedia.org/wiki/SuperMemo#Algorithms|Wikipedia: SuperMemo — Algorithms]])):
^ 算法 ^ 年份 ^ 主要改进 ^
| SM-0 | 1985 | 纸笔计算,人工管理复习间隔 |
| **SM-2** | 1987 | 首次计算机实现,引入 EF 动态调整 |
| SM-4 | 1989 | 优化 OF 矩阵(最优间隔矩阵) |
| SM-5 | 1990 | 引入遗忘指数概念 |
| SM-8 | 1995 | 利用用户数据加速间隔适应 |
| SM-11 | 2002 | 抵抗复习延迟/提前干扰 |
| SM-17 | 2016 | 引入双成分记忆模型 |
SM-2 虽已诞生近 40 年,但仍是应用最广泛的间隔重复算法。**Anki** 的默认算法基于 SM-2 改进而来,其评分按钮(Again/Hard/Good/Easy)同样源自 SM-2 的 0-5 评分体系(([[https://docs.ankiweb.net/studying.html|Anki Manual: Studying]]))。**Mnemosyne** 也使用类似的 SM-2 变体。
===== 优缺点的对照 =====
**优势:**
- 简单透明:仅需三个变量和两条公式,易于实现和理解(([[https://super-memory.com/english/ol/sm2.htm|Woźniak, 1990]]))
- 自适应:EF 自动调整,难卡片复习更频繁,易卡片间隔增长更快
- 经过验证:数十年间全球数千万用户使用基于 SM-2 的软件,大量学术研究证实了间隔重复的有效性(([[https://en.wikipedia.org/wiki/Spaced_repetition|Wikipedia: Spaced repetition]]))
- 每条卡片的收益比得以优化:好卡片少出现,差卡片多出现,整体效率高于传统集中复习
**局限:**
- EF 调整粗粒度:仅依赖单次 0-5 评分,评分的主观性波动可能影响间隔计算
- 无遗忘模型:不直接追踪记忆强度或可提取性,而是通过历史表现间接推断
- 首次间隔固定:1 天和 6 天是硬编码经验值,并非对所有内容类型最优
- 补强复习机制可能导致同一次会话中重复展示多次,对低质量卡片用户容易被"堵车"
===== 伪代码实现 =====
初始化:
n = 0
EF = 2.5
I = 0
每次复习(用户评分 q):
// 计算新间隔
if q >= 3:
if n == 0: I = 1
elif n == 1: I = 6
else: I = round(I * EF)
n = n + 1
else:
n = 0
I = 1
// 更新难度系数
EF = EF + (0.1 - (5 - q) * (0.08 + (5 - q) * 0.02))
if EF < 1.3: EF = 1.3
// 返回下次复习日期
return today + I
===== 总结 =====
SM-2 用极简的数学规则捕捉了人类记忆的规律——刚学完的东西复习最频繁,掌握后间隔自然拉长。自 1987 年问世以来,它已被无数学子、语言学习者和专业人员所验证,至今仍是理解和实现间隔重复的绝佳起点。如果希望深入了解更现代的间隔重复算法,SuperMemo 团队持续发布的后续版本(SM-4 至 SM-20)和学术论文值得关注(([[https://en.wikipedia.org/wiki/SuperMemo#Algorithms|Wikipedia: SuperMemo — Algorithm versions]]))。
{{tag>SM-2 SuperMemo 间隔重复 算法 Anki}}