Bayesian Knowledge Tracing (BKT), introduced by Corbett & Anderson (1995), models a student’s mastery of a skill as a hidden binary state — either the student knows the skill or they don’t. At each practice opportunity the model updates the probability of mastery using Bayes’ rule applied to whether the student answered correctly or incorrectly. Innova’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vruizz22/innova-ai-engine/llms.txt
Use this file to discover all available pages before exploring further.
nightlyBkt Lambda (cron 0 7 * * ? *) reads up to 30 days of attempt history per skill, runs a brute-force grid search to find the four BKT parameters that maximise log-likelihood over all students’ attempt sequences, and writes the results back to the skill_bkt_params table in Postgres. The online per-attempt update itself runs in the TypeScript backend in real time; this engine owns only the nightly recalibration.
The Four BKT Parameters
Every skill carries exactly four real-valued parameters that together define how students learn and how errors are distributed:p_l0 — Prior Knowledge
Probability that a student already knows the skill before their first attempt. Range
[0, 1]. A topic that is entirely new to 3rd-graders has a low p_l0; revision material has a higher value.p_transit — Learning Rate
Probability of transitioning from unknown to known on a single practice opportunity. Range
[0, 1]. A skill that clicks quickly (e.g. carry addition) has a higher p_transit than one requiring many repetitions.p_slip — Slip Probability
Probability that a student who does know the skill answers incorrectly anyway (e.g. a careless mistake). Range
[0, 0.5]. High slip signals noisy or ambiguous items.p_guess — Guess Probability
Probability that a student who does not know the skill answers correctly anyway (e.g. lucky guess or process of elimination). Range
[0, 0.5]. High guess inflates apparent mastery.Prediction Formula
Given the current probability of masteryp_known, the probability that the student answers the next item correctly is:
Online Update Formula
After observing whether the student answered correctly or incorrectly, the backend updatesp_known using the closed-form BKT update implemented in update.py:
evidence), then applies the transition rate to account for the possibility that the student learned during this attempt regardless of outcome.
This Python implementation is the reference version used for testing and calibration. The production per-attempt update runs in a TypeScript port inside the backend Lambda for sub-5ms latency.
Nightly Calibration: Grid Search
Because BKT has only four parameters with bounded ranges, Innova uses brute-force grid search rather than gradient-based optimisation. This avoids local minima, is trivially parallelisable, and produces reproducible results without initialisation sensitivity.Filter attempts
Load all
AttemptObservation records for the skill from the last 30 days. If fewer than 50 attempts exist across all students, calibration is skipped and the existing parameters remain unchanged.Group by student
Group observations by
student_id and sort each group by timestamp ascending so the sequential structure of each student’s practice session is preserved.Grid search
Iterate over every combination of
(p_l0, p_transit, p_slip, p_guess) from the grid [0.05, 0.10, …, 0.95] (step 0.05, 19 values per parameter). Combinations where p_slip + p_guess ≥ 1.0 are skipped. For each valid combination, compute the total log-likelihood over all students’ sequences.Select best params
Return the combination with the highest (least-negative) log-likelihood as the new
BktParams.The calibrate_skill Function
The BktParams Schema
Prior probability that the student already knows the skill. Bounded
[0.0, 1.0].Per-opportunity learning rate — probability of transitioning from unknown to known. Bounded
[0.0, 1.0].Probability of a slip error when the skill is known. Bounded
[0.0, 0.5]. The 0.5 ceiling is part of the identifiability constraint alongside p_guess.Probability of a correct answer when the skill is unknown. Bounded
[0.0, 0.5].The log-likelihood score achieved by this parameter combination during grid search.
None for manually seeded or default parameter sets.The AttemptObservation Schema
Identifies which student produced this attempt. Observations are grouped by this field before computing per-student log-likelihood sequences.
The skill being traced. All observations passed to
calibrate_skill must belong to the same skill.Whether the student answered correctly on this attempt.
Unix epoch timestamp. Used to sort observations within a student’s sequence chronologically and to apply the 30-day data window.
Division of Responsibility
Backend (TypeScript Lambda) — runs
bkt_update in real time after every student attempt, updating the stored p_known per student per skill. Latency target: < 5 ms.AI Engine (this repo) — runs calibrate_skill nightly via the nightlyBkt EventBridge cron at 07:00 UTC. It reads the last 30 days of attempts from Postgres, searches for optimal parameters, and upserts results to skill_bkt_params. The backend picks up new parameters on its next cold start or config refresh.