AI in Education: Building Personalized Learning Systems
Create adaptive learning experiences with AI tutors
AI in Education: Personalized Learning
The Promise of AI in Education
AI can transform education by:Knowledge Tracing
Model what students know using AI:python
import pykt # Knowledge Tracing libraryDeep Knowledge Tracing
model = pykt.models.DKTNet(
num_skills=100,
hidden_size=200,
num_layers=2
)Predict knowledge state
def predict_mastery(student_history: list) -> dict:
"""
student_history: [(skill_id, correct), ...]
returns: {skill_id: mastery_probability}
"""
return model.predict(student_history)
Adaptive Content Delivery
python
def select_next_problem(student_id: str, topic: str) -> dict:
# Get current mastery level
mastery = predict_mastery(get_student_history(student_id))
topic_mastery = mastery.get(topic, 0.5)
# Select problem at appropriate difficulty
if topic_mastery < 0.4:
difficulty = 'easy'
elif topic_mastery < 0.7:
difficulty = 'medium'
else:
difficulty = 'hard'
return get_problem(topic=topic, difficulty=difficulty)
AI Tutoring Chatbot
python
TUTOR_SYSTEM_PROMPT = """You are a patient, encouraging AI tutor.
Rules:
Never give direct answers immediately
Ask guiding questions first
Provide hints before full explanations
Celebrate correct answers and effort
Adapt explanations to student level
Use the Socratic method""" def tutor_session(student_question: str, subject: str, grade_level: int) -> str:
context = f"Subject: {subject}, Grade: {grade_level}"
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": TUTOR_SYSTEM_PROMPT},
{"role": "user", "content": f"{context}\nStudent: {student_question}"}
]
)
return response.choices[0].message.content
Automated Essay Grading
python
def grade_essay(essay: str, rubric: dict) -> dict:
prompt = f"""Grade this essay using the rubric:
Rubric: {json.dumps(rubric)}
Essay: {essay}
Provide:
- Score for each rubric criterion (1-4)
- Specific, actionable feedback
- Overall grade
Return as JSON."""
result = call_llm(prompt)
return json.loads(result)
Privacy and Ethics in EdTech AI
Also available in 中文.