Why Recommendation Systems Fail in Education (And What I Built Instead)
While most learning platforms recommend what students are likely to succeed at, I wanted to build one that recommends what they need to learn—with respect to how human memory actually works.
The Problem Nobody Talks About
Recommendation systems are one of the most mature technologies in machine learning. Big companies use some variant of collaborative filtering or matrix factorization that works remarkably well.
But education is a different domain entirely. Applying the same approaches without modification produces results that are not just suboptimal—they are educationally harmful.
The core problem: in entertainment, a wrong recommendation costs a user two hours. In learning, a wrong recommendation can cost a student weeks of confusion and lost confidence—because they were sent to study something they were not yet ready to understand. [1]
To quantify exactly how bad this problem is, I ran a baseline experiment before building anything: I trained standard Collaborative Filtering (CF) and Matrix Factorization (MF) models on the Open University Learning Analytics Dataset (OULAD) [2] and evaluated their recommendations against a real curriculum graph—a directed acyclic graph encoding prerequisite relationships in Nigerian secondary school Mathematics and CS Fundamentals.
Over 81% of CF recommendations and 83% of MF recommendations violated at least one prerequisite relationship. More than four in five suggestions were, in a meaningful educational sense, wrong. These models had no idea how knowledge is actually structured.
That baseline became the motivation for PLRS: the Personalized Learning Recommendation System.
What Makes Education Different
Standard recommendation systems are built on one assumption: patterns in the past predict useful items in the future. This works because in entertainment, there are no hard dependencies between items. You could watch a sequel without seeing the original.
Knowledge does not work this way. Curriculum structure is not a preference graph—it is a dependency graph. You cannot learn calculus before algebra. You cannot understand recursion without understanding functions. These are hard constraints, not soft signals.
There are three specific ways standard approaches fail in educational settings:
No prerequisite awareness. CF and MF learn from interaction patterns but have no concept of curriculum structure. They cannot distinguish a sequence that respects learning order from one that violates it.
Optimising for engagement, not learning. These models recommend content a student is likely to succeed at—not what they most need. Recommending easy material stalls genuine knowledge growth.
No model of forgetting. A student who mastered a topic three months ago is treated identically to one who studied it yesterday. Human memory decays [3], and ignoring this consistently overestimates current mastery.
Solving all three requires a system that actually models how students learn, forget, and progress through structured knowledge.
The Architecture: Four Components, One Pipeline
System Architecture Diagram -- full pipeline from student interaction logs to ranked recommendations. Generated by ChatGPT. Image by author
PLRS is built around four tightly integrated components, each addressing a specific failure mode of standard approaches.
Component 1: Knowledge Tracing with SAKTWithDecay
The foundation is a knowledge tracing model that estimates a student's current mastery across all concepts based on their interaction history. The baseline is SAKT (Self-Attentive Knowledge Tracing), introduced by Pandey and Karypis (2019) [4]. SAKT uses multi-head self-attention over interaction sequences to capture cross-concept dependencies.
But SAKT treats all past interactions equally regardless of when they occurred. This ignores a fundamental property of human memory: forgetting.
PLRS v2 introduces SAKTWithDecay -- a modified architecture where the decay is applied directly inside the attention mechanism rather than as a pre-processing step. Instead of weighting embeddings before attention, a custom DecayAttention module penalises attention scores by a learned, per-head log function of positional distance—approximating the Ebbinghaus forgetting curve [3] within the attention computation itself. The decay rates are learned parameters, constrained positive via softplus.
Ebbinghaus Forgetting Curve—retention decays as a function of elapsed time. PLRS approximates this via learned attention score penalties. Image by author
class DecayAttention(nn.Module):
"""
Multi-head attention with Ebbinghaus forgetting curve decay.
Decay penalty: rate_h * log(1 + |i - j|) -- learned per head.
"""
def __init__(self, embed_dim, num_heads, dropout=0.2, decay_init=1.0):
super().__init__()
self.embed_dim = embed_dim
self.num_heads = num_heads
self.head_dim = embed_dim // num_heads
self.q_proj = nn.Linear(embed_dim, embed_dim)
self.k_proj = nn.Linear(embed_dim, embed_dim)
self.v_proj = nn.Linear(embed_dim, embed_dim)
self.out_proj = nn.Linear(embed_dim, embed_dim)
self.dropout = nn.Dropout(dropout)
# Learned decay rate per head -- constrained positive via softplus
self.decay_logit = nn.Parameter(
torch.full((num_heads,), math.log(math.exp(decay_init) - 1))
)
def forward(self, x, causal_mask, key_padding_mask):
B, L, D = x.shape
H, Hd = self.num_heads, self.head_dim
Q = self.q_proj(x).view(B, L, H, Hd).transpose(1, 2)
K = self.k_proj(x).view(B, L, H, Hd).transpose(1, 2)
V = self.v_proj(x).view(B, L, H, Hd).transpose(1, 2)
scores = torch.matmul(Q, K.transpose(-2, -1)) / math.sqrt(Hd)
# Ebbinghaus decay: penalise distant past interactions
positions = torch.arange(L, device=x.device)
dist = (positions.unsqueeze(0) - positions.unsqueeze(1)).abs().float()
decay_rate = F.softplus(self.decay_logit) # (H,)
decay_penalty = decay_rate.view(H, 1, 1) * torch.log1p(dist).unsqueeze(0)
scores = scores - decay_penalty.unsqueeze(0)
scores = scores.masked_fill(causal_mask.unsqueeze(0).unsqueeze(0), -1e9)
if key_padding_mask is not None:
scores = scores.masked_fill(
key_padding_mask.unsqueeze(1).unsqueeze(2), -1e9
)
attn = self.dropout(F.softmax(scores, dim=-1))
out = torch.matmul(attn, V).transpose(1, 2).contiguous().view(B, L, D)
return self.out_proj(out)
The key line is scores = scores - decay_penalty. Before softmax, each attention score is penalised in proportion to the log-distance between positions, scaled by a learned head-specific rate. Interactions that are positionally distant—a proxy for temporally distant—are attended to less. Each attention head learns its own decay rate, allowing the model to capture both fast-decaying and slow-decaying knowledge patterns simultaneously.
Component 2: The Prerequisite Knowledge Graph
The second component eliminates the 81% violation rate: a directed acyclic graph (DAG) encoding prerequisite relationships between knowledge concepts.
Prerequisite DAG—Secondary School Mathematics curriculum (38 nodes, 45 edges). Arrows indicate required prerequisite direction. Generated by ChatGPT, Image by author
An edge from concept A to concept B means a student must achieve sufficient mastery of A before being recommended B. This is enforced as a hard constraint—a candidate concept is never scored by the ranking function unless its full prerequisite chain is satisfied.
I built two domain-specific graphs from the Nigerian NERDC secondary school curriculum: Secondary School Mathematics (38 nodes, 45 edges, JSS3-SS2) and CS Fundamentals (31 nodes, 39 edges).
def get_next_learnable(
dag: nx.DiGraph,
mastery_vector: dict,
threshold: float = 0.7
) -> list:
"""
Return concepts whose full prerequisite chain is satisfied.
Hard filter: concept is learnable only if ALL prerequisites
meet the mastery threshold.
"""
mastered = {c for c, m in mastery_vector.items() if m >= threshold}
learnable = []
for concept in dag.nodes():
if concept in mastered:
continue
prereqs = nx.ancestors(dag, concept)
if all(mastery_vector.get(p, 0.0) >= threshold for p in prereqs):
learnable.append(concept)
return learnable
The 0.0% prerequisite violation rate is not a model output—it is a structural guarantee. No concept that fails the prerequisite check ever reaches the scoring stage.
Component 3: Multi-Objective Ranking with SuperMemo-2
Given a set of learnable candidates, the ranking function scores each concept across three objectives:
Predicted performance (alpha = 0.40): Mastery probability from SAKTWithDecay.
Knowledge gain (beta = 0.40): Concepts just beyond current mastery score highest—operationalising Vygotsky's Zone of Proximal Development [5].
Spaced repetition urgency (gamma = 0.20): SuperMemo-2 [6] computes the optimal next review interval per concept. Overdue concepts receive an urgency boost even when current mastery appears adequate.
The spaced repetition component closes the loop between learning new material and retaining what was already studied —a property purely forward-looking recommenders lack entirely.
Component 4: The FastAPI Backend
All four ranking signals are integrated into a production FastAPI backend with four endpoints: /recommend, /what-if, /curriculum, /health. The package ships with API key authentication across four tiers, sliding window rate limiting, and a CI pipeline with 109 tests passing across Python 3.10-3.12 via GitHub Actions.
Results
| Method | Prereq. Violation Rate | Val AUC |
|---|---|---|
| Collaborative Filtering | 81.3% | 0.71 |
| Matrix Factorization | 83.7% | 0.69 |
| PLRS v1 (SAKT baseline) | 0.0% | 0.7692 |
| PLRS v2 (SAKTWithDecay) | 0.0% | 0.8613 |
The headline result is the 0.0% prerequisite violation rate across all PLRS versions. Standard approaches violate prerequisite structure more than 80% of the time—not as an edge case, but as default behaviour.
SAKTWithDecay achieves a validation AUC of 0.8613 versus 0.7692 for the vanilla SAKT baseline—a meaningful improvement reflecting the additional signal provided by learned forgetting curve decay. Full training was performed on a corrected OULAD preprocessing pipeline: time-aware, four-table join, leakage-free.
Beyond the numbers: the system produces pedagogically coherent recommendation sequences. A student beginning Secondary School Mathematics is routed through number theory -> basic algebra -> linear equations -> quadratic equations, in the correct dependency order, with spaced repetition surfacing earlier concepts for revision as the student advances.
The Open Research Problem: Learning the Graph
The most significant limitation is one every constraint-aware recommender shares: the prerequisite graph has to be built by hand. Building curriculum graphs for every subject, grade level, and educational system is not a viable path to a general-purpose system.
The direction I am pursuing next is automated prerequisite discovery from student interaction data using Bayesian network structure learning [7]. The core idea: if students who master concept A consistently perform better on concept B shortly afterward, there is statistical evidence for a prerequisite relationship—without any curriculum expert specifying it explicitly.
DAG discovery methods like the PC algorithm [8] and GES have been explored in smaller educational settings. Applying them to large-scale interaction datasets like OULAD, combining structure learning with knowledge tracing, and validating discovered graphs against expert-annotated curricula.
Closing Thoughts
The 81% prerequisite violation rate is not a failure of implementation —it is a failure of problem framing. Collaborative filtering was designed for a world where items are independent. Knowledge is not independent.
Building PLRS taught me that the interesting ML problems in education are not about achieving higher AUC on interaction prediction benchmarks. They are about what constraints the model should respect, what cognitive properties it should encode, and what it means for a recommendation to be right in a domain where wrong has real consequences.
The 0.0% prerequisite violation rate is the difference between a system that recommends and a system that teaches. The forgetting curve decay is the difference between a system that models performance and one that models memory. SuperMemo-2 is the difference between a scheduler and a tutor.
References
[1] Corbett, A. T., & Anderson, J. R. (1994). Knowledge tracing: Modeling the acquisition of procedural knowledge. User Modeling and User-Adapted Interaction, 4(4), 253-278.
[2] Kuzilek, J., Hlosta, M., & Zdrahal, Z. (2017). Open University Learning Analytics dataset. Scientific Data, 4, 170171.
[3] Ebbinghaus, H. (1885). Uber das Gedachtnis. Duncker & Humblot. English translation: Memory: A Contribution to Experimental Psychology, 1913.
[4] Pandey, S., & Karypis, G. (2019). A self-attentive model for knowledge tracing. Proceedings of the 12th International Conference on Educational Data Mining (EDM 2019).
[5] Vygotsky, L. S. (1978). Mind in society: The development of higher psychological processes. Harvard University Press.
[6] Wozniak, P. A., Gorzelanczyk, E. J., & Murakowski, J. A. (1995). Two components of long-term memory. Acta Neurobiologiae Experimentalis, 55(4), 301-305.
[7] Heckerman, D., Geiger, D., & Chickering, D. M. (1995). Learning Bayesian networks: The combination of knowledge and statistical data. Machine Learning, 20(3), 197-243.
[8] Spirtes, P., Glymour, C., & Scheines, R. (2000). Causation, Prediction, and Search (2nd ed.). MIT Press.
Resources
GitHub: clementina-tom/PLRS
HuggingFace: Clementio/PLRS
Live Demo: PLRS on HuggingFace Spaces
Part 1: The Logic Engine: Building a Constraint-Aware AI Recommendation System for Personalized Learning
Clementina Tom is an ML engineer specialising in recommendation systems, knowledge tracing, and production MLOps. She builds open-source tools at the intersection of machine learning and education.
GitHub: github.com/clementina-tom
About the author
- An ML engineer building in public. Looking at the intersection of AI/Ml use in real life. Currently, i write about production MLOps. and AI/ml systems i education. I am the open-source ML.Author of PLRS -- a personalized learning recommendation system
Comments
Join the discussionThis is one of the more interesting education-AI projects I've read lately because it challenges a core assumption from traditional recommender systems: maximizing engagement isn't the same as maximizing learning.
The prerequisite graph + forgetting curve combination makes a lot of sense. In most real-world learning environments, recommending the "next likely click" can actually push students into topics they're not ready for, which creates confusion rather than progress.
The 0% prerequisite violation result is impressive, but what stood out most was the shift in problem framing. Instead of asking "What content will the student consume?", you're asking "What concept should the student learn next?" Those are fundamentally different optimization goals.
I also think the future direction is fascinating. If prerequisite graphs can eventually be discovered automatically from learner behavior rather than manually curated, that could make personalized learning systems far more scalable across subjects and curricula.


