Anki add-on: SM-20 Custom Scheduler & Algorithm Arena

Welcome to the bleeding edge of spaced repetition. This add-on is a painstaking, reverse-engineered port of the SM-20 algorithm directly into Anki. But it doesn't just stop at SM-20. It introduces the Algorithm Arena —a live, real-time machine-learning ensemble that pits the greatest spaced repetition algorithms against each other to perfectly predict your memory. ⚠️ DISCLAIMER: This is an experimental, "best attempt" implementation of a highly complex system. It is currently only tested on Windows and only works on Anki Desktop. Bug reports and feature requests are highly welcomed! ⚔️ What is the Algorithm Arena? (Default) Why choose one algorithm when you can have them all? By default, this add-on does not just use SM-20. It uses the Algorithm Arena . Whenever you review a card, five different algorithms silently predict your probability of recalling it. When you press an answer button, the Arena mathematically scores them on their accuracy. Over time, the algorithms that predict your memory the best gain a higher "weight" (influence), and the losers are punished. The final interval given to your card is a perfectly blended average of these weighted predictions, dynamically bound by strict mathematical minimums and maximums to prevent any single algorithm from completely overpowering the others: Included Algorithms & Arena Bounds: SM-19 — 25.0% Min / 99.9% Max Influence SM-20 — 15.0% Min / 95.0% Max Influence SM-15 — 2.0% Min / 50.0% Max Influence FSRS v6 — 0.1% Min / 45.0% Max Influence (Upgraded from Supermemo 20's original v5!) Legacy SM-2 — 0.1% Min / 30.0% Max Influence 🔍 The Card Prediction Inspector (Ctrl+Shift+B) Curious about what is happening under the hood? You can peek behind the curtain at any time during your reviews! After answering a card, simply press Ctrl + Shift + B . A diagnostic window will instantly appear showing you the exact breakdown of the previous card you just answered. The inspector clearly displays: What interval each individual algorithm independently predicted for that card. The final Weighted Average interval that the Arena calculated and actually assigned to the card. The card's previous elapsed interval (so you can easily compare the old interval to the newly scheduled one). Note: Because Anki immediately loads the next question after you grade a card, this shortcut will always show you the diagnostic data for the card you just finished grading, not the one currently on the screen. The R-Metric Curious if the Arena is actually helping? Check the add-on settings to see your live R-Metric . Following SuperMemo's official definition, the R-Metric calculates the mathematical error of the Arena vs standard SM-19 alone. A positive percentage proves that the live blended ensemble is statistically predicting your memory better than a single algorithm! ⚙️ GUI Options & Customization Navigate to Tools > SM-20 Settings to access the configuration panel: Algorithm Version: Choose between the default Arena ensemble, or force the scheduler to strictly use SM-20 , FSRS , SM-19 , etc. Enable for Learning Cards: Because advanced algorithms calculate in units of days (not minutes), checking this box allows the add-on to bypass Anki's native intra-day learning steps (1m, 10m) and immediately graduate the card to its optimal first interval (e.g., 5 days). This is the SuperMemo philosophy (maximum efficiency). Uncheck it if you prefer Anki's minute-drilling. Hide Button Intervals (SuperMemo Style): Activated by default! Hides the time labels above the answer buttons (Again, Hard, Good, Easy) so you can focus purely on evaluating your memory quality, not the schedule. Target Retention & Lapse Multiplier: Standard levers to adjust how aggressively the algorithm schedules you. Local Optimizer: A button to run a deep, offline PyTorch optimization over your entire Anki review history. This generates custom starting weights specifically for your brain. (Note: This offline optimization only calculates weights for the FSRS and SM-20 algorithms). 🔀 Anki to SuperMemo Grade Mapping SuperMemo algorithms use a 0-5 grading scale, while Anki uses 4 buttons. The add-on intelligently maps your Anki buttons behind the scenes so the math remains pristine: 🔴 Again (1): Mapped to SM Grade 1 (Fail) 🟠 Hard (2): Mapped to SM Grade 3 (Pass) 🟢 Good (3): Mapped to SM Grade 4 (Good) 🔵 Easy (4): Mapped to SM Grade 5 (Excellent) ❓ Frequently Asked Questions (FAQ) What happens if I use this on an existing, mature Anki collection? It works flawlessly! When the add-on sees a card for the very first time, it gracefully reads the prior Anki interval from your database and feeds it into the algorithms. The ensemble instantly adapts and scales the stability upward based on your history. You won't lose your progress. How do I use the Local Optimizer? The optimizer is completely optional (the Arena adapts on its own in real-time!). However, if you want to run the deep historical optimization, you must have PyTorch ( torch ) installed in the Python environment that Anki uses. If you are a power-user, you can install this via pip install torch in Anki's bundled Python directory or your system path. Does this sync to AnkiDroid / AnkiMobile? Because this relies on heavy, custom Python execution, the scheduling will only apply when doing reviews on Anki Desktop. Reviews done on mobile will use Anki's native scheduler (V3/FSRS). (Note: Mobile reviews will still be read and correctly learned from the next time you open Anki Desktop!) Will hitting "Undo" in Anki break the algorithms? No, but there is a minor limitation: Anki's Undo (Ctrl+Z) will revert the card's interval, but it cannot mathematically "undo" the microscopic matrix update applied to our external sm20_collection_state.db database. Because a single review alters the matrices by less than a fraction of a percent, the math will instantly self-correct on your next review. Don't worry about it! Enjoy the ultimate spaced repetition experience!