Loading...
Loading...
Side-by-side pseudocode for mastery update rules, complexities, and design decisions. All five models solve the same core problem: given interaction history, estimate learner knowledge โ but with very different approaches, tradeoffs, and runtime constraints.
## HCIE โ Mastery Update (Online Kalman Filter + Bayesian)// โโ KALMAN FILTER per (learner i, concept k) โโโโโโโโโโโโโโโโโโโโโโโโโ// State: (ฮผ_ik, ฯยฒ_ik) โ ability mean + variance// No offline training needed; updates on every attempt// Predict step (prior):ฮผฬ_t = ฮผ_{t-1} // no drift model in V1ฯฬยฒ_t = ฯยฒ_{t-1} + Q // process noise Q = 0.01 (hyperparameter)// Update step (posterior):K_t = ฯฬยฒ_t / (ฯฬยฒ_t + R) // Kalman gain; R = obs noise โ 0.1ฮผ_t = ฮผฬ_t + K_t ยท (r_t - ฮผฬ_t) // weighted move toward obsฯยฒ_t = (1 - K_t) ยท ฯฬยฒ_t // variance shrinks with each obs// complexity: O(1) โ 5 scalar ops per attempt// space: O(2) per (learner, concept) pair// โโ BAYESIAN BETA POSTERIOR per (learner i, concept k) โโโโโโโโโโโโโโโโ// State: (ฮฑ_ik, ฮฒ_ik) โ Beta distribution over mastery prob// Init: ฮฑ=1, ฮฒ=1 (uniform prior)ฮฑ_t = ฮฑ_{t-1} + r_t // add 1 on correctฮฒ_t = ฮฒ_{t-1} + (1 - r_t) // add 1 on incorrectE[p_mastery] = ฮฑ / (ฮฑ + ฮฒ) // posterior meanVar[p_mastery] = ฮฑยทฮฒ / ((ฮฑ+ฮฒ)ยฒยท(ฮฑ+ฮฒ+1)) // epistemic uncertainty// complexity: O(1) โ 2 scalar increments// space: O(2) per (learner, concept) pair// โโ ENSEMBLE (Exponentiated Gradient) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// 2 learners V2 (Kalman + Bayesian); initialised w = [0.5, 0.5]ลท_t = w_Kalman ยท ฮผ_t + w_Bayes ยท E[p_mastery]loss_l = (ลท_l - r_t)ยฒ // per-learner squared lossw_l โ w_l ยท exp(-ฮท ยท loss_l) then /= ฮฃ // EG update, ฮท=0.1// โโ JT SCORE (recommendation, not prediction) โโโโโโโโโโโโโโโโโโโโโโโโโ// KEY DIFFERENCE: HCIE doesn't just predict โ it scores next conceptsJT(i,k) = ฮฃ_d weight_d ยท signal_d(i,k)// signals drive which concept to serve NEXT (policy, not estimator)
| Model | Per-step update | Training cost | Space | Online? | Graph? | Interpretable? |
|---|---|---|---|---|---|---|
| BKT | O(1) | O(NยทT) EM | O(4ยท|K|) | โ | โ | โ |
| DKT | O(dยฒ) | O(NยทTยทdยฒ) | O(dยฒ) | โ | โ | โ |
| SAKT | O(Mยฒยทd) | O(NยทTยทMยฒยทd) | O(Mยทd)/session | โ | โ | ~ |
| GKT | O(Lยท|E|ยทd) | O(NยทTยทLยท|E|ยทd) | O(|K|ยทd) | โ | โ | ~ |
| HCIE | O(indeg(k)) | none (online) | O(2ยท|learners|ยท|K|) | โ | โ | โ |
// Cold-start: seed state tiap konsep1for c in C: state(u,c) โ (m โ pฬ(c) [def 0,3], ฯยฒ โ ฯโยฒ [def 0,5])2 repr_posterior(u,c) โ prior lemah// --- REKOMENDASI (per permintaan) ---3C_avail โ unlocked_concepts(u, C, dag, ฯ) // gerbang prasyarat4if C_avail = โ : C_avail โ foundation_concepts(C)5for c in C_avail:6 (m, ฯยฒ) โ read_posterior(u, c)7 n โ 1/ฯยฒ; ฮฑ_c โ mยทn; ฮฒ_c โ (1โm)ยทn // ketidakpastian โ kekuatan prior8c* โ bandit.select_arm({Beta(ฮฑ_c, ฮฒ_c)}, context=ฯ) // Thompson: pilih konsep9if c* invalid or c* โ C_avail: c* โ fallback_concept(C_avail)10(task, a*) โ pick_task(u, c*) // bandit representasi: pilih modalitas11J_t(u,c*) โ ฯ(ฮฃ wแตขยทNแตข) atas 6 dimensi // pandangan tata kelola (ADC)12emit RecommendationGenerated(u, c*, a*, J_t) // event-sourcing13serve (c*, a*)// --- PEMBARUAN (saat hasil diamati) ---14observe y โ {0,1} dan sinyal (waktu respons, dst.)15(m, ฯยฒ) โ kalman_update(m, ฯยฒ, y) // Algoritma 3.1, O(1)16repr_posterior(u, a*) โ beta_update(ยท, y) // menutup lingkar bandit modalitas17propagate_transfer(u, c*, dag) // bukti โ konsep turunan18append_event(u, state sebelum/sesudah, aksi, sinyal) // keterlacakan (audit)19return (c*, a*), m
## Full loop: learner i attempts concept k, response r โ {0,1}// โโโ 1. RECEIVE EVENT โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโevent = {learner_id: i, concept_id: k, correct: r, timestamp: t}// โโโ 2. KALMAN UPDATE O(1) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโstate_ik = kf_store[i][k] // (ฮผ, ฯยฒ) loaded from DB / cacheK_t = state_ik.var / (state_ik.var + R)state_ik.mean += K_t * (r - state_ik.mean)state_ik.var *= (1 - K_t)// โโโ 3. BAYESIAN UPDATE O(1) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโbeta_ik = beta_store[i][k] // (ฮฑ, ฮฒ)beta_ik.alpha += rbeta_ik.beta += (1 - r)// โโโ 4. ENSEMBLE PREDICTION O(learners=2) โโโโโโโโโโโโโโโโโโโโโโโโโโโโp_kalman = state_ik.meanp_bayes = beta_ik.alpha / (beta_ik.alpha + beta_ik.beta)p_hat = w_kalman * p_kalman + w_bayes * p_bayes// EG weight update omitted for brevity// โโโ 5. NEXT-CONCEPT SELECTION โ Thompson bandit O(|C_avail|) โโโโโโโโ// Called when system needs to pick NEXT concept for learner iC_avail = prerequisite_gate(i, concept_graph, ฯ) // DAG constrainsfor candidate k' in C_avail: ฮฑ,ฮฒ = beta_prior_from(ฮผ_ik', ฯยฒ_ik') // uncertainty โ prior strength score = thompson_contextual(ฮฑ, ฮฒ, zpd, ฯ) // Algoritma 3.6next_concept = softmax_sample(scores, ฯ=0.2) // the BANDIT selectsJ_t = jt_compute(i, next_concept) // 6-dim governance VIEW โ ADC // (recorded, does NOT select)// โโโ 6. PERSIST โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// experiment_trajectories: jt_delta_m_contribution, jt_challenge_contribution, ...// outbox_events โ Kafka โ projection-consumer โ learner_projections// ADC reads trajectory columns post-hoc for governance audit// โโโ TOTAL PER-EVENT COST โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// Steps 1-4: O(1)// Step 5: O(|C_avail|) selection + O(deg(c)) J_t view โ only on// recommendation request; skipped on pure prediction queries// No batch job needed, no model reload, works from first interaction
## AUC comparison (matched eval, sealed run โ Tabel 4.8, tie-aware rank-AUC)// AUC = P(model ranks a correct attempt above an incorrect attempt)// = area under ROC curve// HCIE AUC=0.6051 โ headline (canonical lagged m_K, single Kalman)// BKT AUC=0.5963 โ best classical baseline; EM-tuned per concept// DKT AUC=0.5892 โ underperforms on Junyi (small dataset; LSTM overfit risk)// SAKT AUC=0.5730 โ attention needs longer sequences than Junyi provides// GKT AUC=0.5711 โ global node states hurt per-learner personalisation here// (the rejected 2-learner deployed readout โ HCIE 0.609 vs BKT 0.612 โ// is disclosed on /review/baselines; it is NOT the headline)// COLD-START delta (โค5 attempts, pooled Junyi):// HCIE - BKT = +0.037 HCIE leads in the sparse-data regime// (reported as a lead, not significance โ the CI crosses 0 at n=10)// Mechanism: KF uncertainty + ZPD โ explore before exploiting// BKT needs several attempts before EM estimate converges// As history grows (โค20, all): delta shrinks โ BKT catches up// This is the expected tradeoff: online priors help cold, EM helps warm// KEY CAVEAT: HCIE is solving a HARDER problem than DKT/SAKT/GKT// Those models are pure predictors evaluated at test time.// HCIE runs the full policy loop (recommend โ observe โ update) at eval time.// It's closer to regret minimisation than AUC maximisation.
## Live decision path (deployed gateway, measured with k6)// p95 โ 24 ms per decision @ 40 req/s per IP โ CPU only, no GPU, no batch queue// per interaction: O(K) scalar ops (constant rolling windows: 10/100/100/20)## Regenerating the thesis evidence (measured wall-clock)// 1) verify Tabel 4.8 from the sealed per-row CSV (10,500 rows ร 5 models):// sklearn roc_auc_score โ 0.6051 / 0.5963 / 0.5892 / 0.5730 / 0.5711// wall-clock โ 2 s (re-measured 2026-07-04 โ exact reproduction)// 2) full 5-model re-score from the DB (dump_matched_eval_perrow.py):// > 10 min (DKT/SAKT torch inference on CPU dominates)// 3) full sealed-run replay through the live runtime (API + outbox + consumers):// โ 7.7 events/s + ~90 s startup (measured 2026-06-25)// โ anchor N=96,727 โ 3.5 h wall-clock## Training cost// HCIE: none โ no offline training, no embeddings, 0 GPU-hours// DKT / SAKT / GKT: require offline training per dataset before any prediction// (that asymmetry is the Pareto argument: competitive AUC at ~zero setup cost)
// Cold-start: seed state tiap konsep 1 for c in C: state(u,c) โ (m โ pฬ(c) [def 0,3], ฯยฒ โ ฯโยฒ [def 0,5]) 2 repr_posterior(u,c) โ prior lemah// --- REKOMENDASI (per permintaan) --- 3 C_avail โ unlocked_concepts(u, C, dag, ฯ) // gerbang prasyarat 4 if C_avail = โ : C_avail โ foundation_concepts(C) 5 for c in C_avail: 6 (m, ฯยฒ) โ read_posterior(u, c) 7 n โ 1/ฯยฒ; ฮฑ_c โ mยทn; ฮฒ_c โ (1โm)ยทn // ketidakpastian โ kekuatan prior 8 c* โ bandit.select_arm({Beta(ฮฑ_c, ฮฒ_c)}, context=ฯ) // Thompson: pilih konsep 9 if c* invalid or c* โ C_avail: c* โ fallback_concept(C_avail)10 (task, a*) โ pick_task(u, c*) // bandit representasi: pilih modalitas11 J_t(u,c*) โ ฯ(ฮฃ wแตขยทNแตข) atas 6 dimensi // pandangan tata kelola (ADC)12 emit RecommendationGenerated(u, c*, a*, J_t) // event-sourcing13 serve (c*, a*)// --- PEMBARUAN (saat hasil diamati) ---14 observe y โ {0,1} dan sinyal (waktu respons, dst.)15 (m, ฯยฒ) โ kalman_update(m, ฯยฒ, y) // Algoritma 3.1, O(1)16 repr_posterior(u, a*) โ beta_update(ยท, y) // menutup lingkar bandit modalitas17 propagate_transfer(u, c*, dag) // bukti โ konsep turunan18 append_event(u, state sebelum/sesudah, aksi, sinyal) // keterlacakan (audit)19 return (c*, a*), m