Optimizer overview
FSRS ships default model weights, but you can retrain them from your own review logs so the intervals match the people you serve. The Optimizer runs on @open-spaced-repetition/binding, which converts review-log CSV into training items, estimates parameters, and reports how well the result predicts held-out reviews. The trained weights plug straight back into DefaultScheduler or a custom defineScheduler through weights. See Model for what weights mean and Scheduler for where they are applied.
Use the same modelVersion ('FSRS-7' by default, or 'FSRS-6') for CSV conversion, training, evaluation, and scheduling. Pass it as the fourth argument to convertCsvToFsrsItems and in the training/evaluation options, then call DefaultScheduler({ version: modelVersion, weights }). FSRS-7 produces 34 weights and preserves fractional and same-day intervals normalized by the actual local study-day duration; FSRS-6 produces 21 weights and uses whole study days. Same-day follow-up reviews can therefore contribute to FSRS-7 training.
The Optimizer is currently in beta, and its API methods may change at any time.
Copy this prompt to keep an AI agent inside the Optimizer contract: review-log CSV in, trained weights out, through the shared binding.
One package, two runtimes
The binding ships one API, and loading resolves the build for your environment automatically: it searches for an available native package and, in a browser or Worker, falls back to a WebAssembly build. Install the package your environment needs:
Native module (Node, servers, and CLIs):
WASI Preview 1 (wasip1) WebAssembly:
wasm32-wasi WebAssembly:
Your environment resolves the matching build: a server or CLI uses the native module, and a browser or Web Worker uses a wasm build.
WebAssembly runs threadless or threaded. Threadless wasm needs no Cross-Origin-Opener-Policy or Cross-Origin-Embedder-Policy headers and reports progress through Worker messages rather than shared memory. A threaded build requires the page to be crossOriginIsolated, that is, served with COOP and COEP headers.
The review-log pipeline
Training follows a short pipeline, each step a binding call:
convertCsvToFsrsItemsturns review-log CSV into a list ofFSRSItems.computeParameterstrains weights from those items and returns the weight array.evaluateWithTimeSeriesSplitsmeasures how well the parameters predict held-out reviews.
You can also ask the binding to recommend learning and relearning steps with computeOptimalSteps. Walk through each call in Train and evaluate, or run a real training in the trainer on the Playground page.