Knowledge Tracing · Constraint-Aware · Open Source

Recommendations that
respect how learning works.

PLRS combines Self-Attentive Knowledge Tracing with a DAG prerequisite constraint layer to generate personalized learning recommendations that are pedagogically sound — not just statistically optimal.

Try the live demo View on GitHub Quickstart
0.0%
Prerequisite violation rate
0.7692
SAKT Val AUC (OULAD)
69
Curriculum topics (2 domains)
52
Tests passing
Architecture

Three layers. One guarantee.

Standard recommendation systems optimise for engagement or accuracy — they will happily recommend Calculus to a student who hasn't mastered Algebra. PLRS adds a constraint layer that makes this structurally impossible.

Student History
SAKT Model
Mastery Vector
DAG Constraints
Multi-Objective Ranker
Recommendations
Approved
All prerequisites met above the mastery threshold. Student is ready to learn this topic now.
⚠️
Challenging
Prerequisites partially met — above the soft threshold but below full mastery. Proceed with awareness.
Vetoed
One or more prerequisites not met. Structurally blocked until foundations are solid.
Evaluation

0% violation rate. Not a tuning choice.

Evaluated on the Open University Learning Analytics Dataset (OULAD) with Nigerian secondary school curriculum knowledge maps. The 0% violation rate is a structural guarantee from the DAG constraint layer — not a hyperparameter.

Model Val AUC Prerequisite Violation Rate Coverage
PLRS (SAKT + DAG) 0.7692 0.0% Full curriculum
Collaborative Filtering 81.3% Partial
Matrix Factorization 83.7% Partial
BKT (baseline) ~0.67 No constraint layer Partial
Quickstart

Plug in your curriculum.

PLRS is curriculum-agnostic. Define your knowledge graph in a simple JSON format and get recommendations immediately. No retraining required for new domains.

PYTHON
from plrs import PLRSPipeline
from plrs.curriculum import load_dag

# Load your curriculum (JSON knowledge graph)
curriculum = load_dag("math_dag.json")

# Create pipeline — no model needed for mastery-dict mode
pipeline = PLRSPipeline(curriculum)

# Get recommendations from student mastery scores
results = pipeline.recommend_from_mastery({
    "whole_numbers":         0.90,
    "algebraic_expressions": 0.75,
    "quadratic_equations":   0.40,
})

for rec in results["approved"]:
    print(f"✅ {rec['topic_label']} (score={rec['score']})")
    print(f"   {rec['reasoning']}")

# What-if: what does mastering this topic unlock?
wi = pipeline.what_if("algebraic_expressions")
print(f"Unlocks {wi['total_unlocked']} downstream topics")
REST API
# Start the server
$ python scripts/serve.py
# → http://127.0.0.1:8000/docs

# Get recommendations
$ curl -X POST http://localhost:8000/recommend \
    -H "Content-Type: application/json" \
    -d '{"domain":"math","mastery_scores":{"whole_numbers":0.9}}'
Features

Built for real deployment.

🔌
Curriculum-agnostic
Define any knowledge graph in a simple JSON format. Ships with Nigerian secondary school Maths and CS Fundamentals (NERDC JSS3–SS2).
FastAPI REST backend
Production-ready API with /recommend, /what-if, and /curriculum endpoints. Auto-generated OpenAPI docs.
🧠
SAKT + Forgetting Curve
Self-Attentive Knowledge Tracing with optional Ebbinghaus decay attention — older interactions contribute less to current mastery estimates.
🔍
What-If Simulator
"If I master Trigonometry now, what unlocks?" — live DAG traversal shows direct and transitive downstream topics.
📦
PyPI-ready package
pip install plrs — modular architecture with clean public API. Full type annotations throughout.
🧪
52 tests, CI on 3 Python versions
Unit tests, API integration tests, and evaluator tests. GitHub Actions runs on Python 3.10, 3.11, and 3.12.
Try it now — no setup required.

The live demo runs the full pipeline in your browser. Adjust mastery sliders, simulate student sequences, explore the curriculum graph.