AI System Design

Design an Adaptive AI Tutor

Step 1 / 9

Learn AI system design by building an adaptive tutoring system like Khanmigo or Duolingo's AI tutor step by step.

The numbers to beatper-skillnot one global levelupdatesafter every attempttargetszone of proximal difficulty

In the interview room

How you’d open this design in an interview

Before any boxes: agree what it must do, pin the qualities that shape everything, then build — naming each trade-off as you make it. The walkthrough above is that exact order.

Functional requirements

What it must do — agree on these before drawing a single box.

  • Pick the next problem: choose what to ask next for this student’s current level, not a fixed order.
  • Grade: check structured answers exactly and route only open-ended ones to the LLM.
  • Explain: generate hints and explanations tailored to the student’s specific mistake.
  • Gate hints: escalate through Socratic hints instead of handing over the answer.
  • Remember: track weak spots and forgetting curves across sessions for spaced repetition.

Non-functional requirements

The qualities that shape the whole design — each one names the mechanism that buys it.

Personalize what to teach next
A per-skill Mastery Model (Bayesian-Knowledge-Tracing-style) updates after every attempt and targets the zone of proximal difficulty.
Grade cheaply, correctly, consistently
A Hybrid Grader routes structured answers to a deterministic symbolic checker and reserves the LLM only for open-ended judgment.
Adaptivity that actually adapts over time
Every graded attempt feeds back into the mastery model, closing the grade → mastery → selection loop.
No confidently-wrong teaching
Explanations are grounded in a vetted Curriculum KB (RAG); the LLM tailors delivery but the facts come from vetted source material.
Durable learning, not just comfort
A Socratic hint ladder escalates to the direct answer only after genuine attempts — a deliberate pedagogical gate.
Learning that spans months
A long-term Learner Profile, separate from session state, drives spaced repetition of skills predicted to be forgotten.

The trade-offs you say out loud

Senior signal isn’t the boxes — it’s naming what you gave up and why it was the right price.

A per-skill mastery modelover a single fixed problem order

One fixed order is simultaneously too slow for students who’ve mastered a skill and too fast for those missing a prerequisite. You can’t personalize without tracking what this student knows.

A symbolic checker firstover grading everything with the LLM

LLM grading is slower, costlier and inconsistent run-to-run for something with one exactly-correct answer. Reserve the LLM for cases that genuinely need judgment.

Grounded explanations (RAG)over free LLM generation

A confidently wrong hint taught as fact is worse than a slow one, and curriculum-specific conventions aren’t reliably in the model’s general training.

A Socratic hint ladderover giving the answer immediately

Handing over the answer optimizes for the student’s immediate comfort at the cost of learning; the productive struggle of almost-getting-there is where understanding forms.

A separate long-term profileover session state alone

Session state is short-lived working memory. The durable learner profile is what makes the tutor smarter about this individual over weeks, enabling spaced repetition.

What this teaches

Learn AI system design by building an adaptive tutoring system like Khanmigo or Duolingo's AI tutor step by step. An interactive guide covering why a fixed question order fails every learner, a per-skill mastery model that picks the next problem, hybrid grading (symbolic checkers for structured answers, an LLM only for open-ended ones), closing the mastery feedback loop, grounding explanations in a curriculum knowledge base to prevent hallucinated facts, Socratic hint-gating instead of giving away answers, and a long-term learner profile for spaced repetition.

Key takeaways

  • A fixed problem order can't be right for every learner — real adaptivity requires tracking a per-skill mastery estimate per student.
  • The mastery model targets each student's zone of proximal difficulty, and alone (even without an LLM) is already a legitimate adaptive tutor.
  • Grading routes structured answers to a deterministic symbolic checker and reserves the LLM only for genuinely open-ended judgment calls.
  • Every graded attempt feeds back into the mastery model, closing the loop that actually makes selection adaptive over time.
  • Explanations are grounded in a vetted curriculum knowledge base (RAG), not freely generated — a confidently wrong hint is worse than a slow one.
  • Hints escalate through a Socratic ladder instead of immediately giving the direct answer — a deliberate pedagogical gate, not a limitation.
  • A long-term learner profile, separate from session state, drives spaced repetition of skills predicted to be forgotten.
  • Latency-sensitive hint generation and latency-tolerant mastery/profile updates are split, and tutoring-specific guardrails keep the LLM on-curriculum.

Concepts covered

  • What makes a tutor "adaptive"?
  • A fixed list of problems
  • Track what this student actually knows
  • Don't use an LLM to check 2+2
  • Every grade updates the mastery model
  • Don't let the LLM freely teach facts
  • The Socratic gate
  • Learning happens over months, not one sitting
  • Cost, latency, and staying on-curriculum

Design an Adaptive AI Tutor — read the full walkthrough as text

the same steps, decisions & trade-offs, for reading, reference & search

The big idea

What makes a tutor "adaptive"?

Bolt an LLM onto a fixed list of practice problems and you've built a chatbot with homework attached — every student gets the same order, the same explanations, no matter what they already know or what specifically confused them. What actually makes a tutor adaptive isn't the LLM at all — it's a model of what this learner knows, driving what to ask next and how to explain it.

We'll build the pieces most "AI tutor" demos skip: a per-skill mastery model, a grading path that reaches for an exact checker before it ever reaches for an LLM, explanations grounded in a vetted curriculum instead of free generation, and hints that deliberately don't just hand over the answer.

How to read this: Each step opens with a real design decision — make the call before I show you what ships. Watch the diagram grow, hover the boxes, and at the end wipe the mastery model and cut curriculum grounding to see what degrades and what breaks. Hit Begin.

Step 1 · The baseline

A fixed list of problems

Simplest version: every student gets problems in the same fixed order, chapter by chapter. What actually goes wrong with this for real learners?

Design decision: Every student sees the same fixed problem order. What's the core failure?

The call: It ignores what each individual student already knows and where they're actually struggling, so it's simultaneously too slow for some students and too fast for others. — A fixed order treats every learner identically regardless of their actual knowledge state. A student who has already mastered a skill is bored repeating it; a student who hasn't mastered a prerequisite is pushed forward into material built on a foundation they don't have yet.

A fixed order can't be right for every learner at once — it's simultaneously too slow for students who've already mastered a skill and too fast for students missing a prerequisite. Real personalization needs the system to actually know what this specific student knows.

Adaptivity requires state: You cannot personalize what to teach next without tracking, per skill, per student, some estimate of current mastery. Everything that follows in this design exists to build, use, and update that estimate.

Step 2 · The mastery model

Track what this student actually knows

You need to pick the next problem to be neither trivially easy nor hopelessly hard for THIS student, on THIS skill, right now. What decides that?

Design decision: How does the system decide the right next problem for a specific student's current level?

The call: Maintain a per-skill mastery estimate (e.g. a Bayesian Knowledge Tracing-style probability) updated after every attempt, and select the next problem to sit in the student's "zone of proximal difficulty" — challenging but achievable given their current estimate. — A mastery model accumulates evidence over many attempts into a probabilistic estimate per skill, and problem selection targets difficulty just above what the student can already reliably do — hard enough to stretch them, not so hard it's just frustration, and not so easy it wastes their time.

Maintain a per-skill mastery model — a probabilistic estimate (Bayesian Knowledge Tracing or similar) that updates after every attempt. The Problem Selector uses it to target each student's zone of proximal difficulty: challenging enough to be worth doing, achievable enough not to be discouraging.

The mastery model is the product: Strip away the LLM entirely and a working mastery model plus a good problem bank is already a legitimate adaptive tutor (this is roughly how Duolingo's core loop and classic Intelligent Tutoring Systems work) — the LLM, added later, makes it better at EXPLAINING, not at knowing what to ask.

Step 3 · Grading: symbolic first, LLM second

Don't use an LLM to check 2+2

A student submits an answer — sometimes a number, sometimes code, sometimes a written explanation. Should everything route through the LLM for grading?

Design decision: Answers range from "42" to a paragraph explaining a concept. Should an LLM grade all of it?

The call: Route structured answers (a number, an equation, code with test cases) to a deterministic symbolic/exact checker, and reserve the LLM only for genuinely open-ended answers (a written explanation, a proof sketch) where no exact-match check is possible. — A symbolic checker for "does this equal 42" or "do these unit tests pass" is instant, deterministic, and free of any grading-inconsistency risk. The LLM is reserved for exactly the cases that NEED judgment — evaluating whether a written explanation demonstrates real understanding — where no exact check exists.

Build a hybrid grader: structured answers (numeric, symbolic math, code with test cases) go to a deterministic exact checker — fast, free, perfectly consistent. Only genuinely open-ended answers (written explanations, proofs, reasoning) are routed to the LLM, which is the one grading tool actually suited to judgment calls.

Use the cheapest tool that's actually correct: This mirrors a broader systems principle: reach for a deterministic, symbolic solution whenever one exists, and reserve the expensive, probabilistic model for the cases that genuinely require judgment. It's faster, cheaper, and more trustworthy than routing everything through an LLM by default.

Step 4 · Close the loop

Every grade updates the mastery model

A grading result — right, wrong, partially right — is only useful if it actually changes what happens next.

Every graded attempt feeds back into the mastery model immediately: a correct answer nudges that skill's estimate up, an incorrect one nudges it down (and, ideally, flags a related prerequisite skill to revisit). The next problem the Selector picks reflects the updated estimate — this closes the loop between "how did the student just do" and "what should they see next," which is the actual mechanism of adaptivity, not a one-time setup step.

A loop, not a pipeline: It's tempting to think of tutoring as a one-way pipeline: select → grade → done. The real system is a closed loop — grade feeds mastery, mastery feeds selection, selection produces the next attempt to grade — running continuously for the length of the session and beyond.

Step 5 · Ground the explanations

Don't let the LLM freely teach facts

When a student gets something wrong, they need an explanation — and ideally one tailored to their specific misconception. Should the LLM generate that explanation purely from its own training?

Design decision: The LLM explains a concept the student got wrong. Generate freely, or ground it in something?

The call: Retrieve the relevant explanation from a vetted Curriculum Knowledge Base (RAG) and have the LLM tailor its delivery to the student's specific mistake, grounded in that retrieved, syllabus-accurate content. — Grounding constrains what the LLM is allowed to assert as fact to vetted, curriculum-accurate source material, while still letting it do what LLMs are genuinely good at: adapting HOW the explanation is delivered to this student's specific error, in natural, conversational language.

Retrieve relevant content from a vetted Curriculum Knowledge Base (RAG) before generating an explanation, and constrain the LLM to ground its answer in that retrieved material — it can still tailor the phrasing, examples, and framing to the student's specific mistake, but the underlying facts come from vetted source material, not free generation.

Grounding is a correctness feature, not a nice-to-have: A wrong hint taught confidently is worse than a slow one — it actively teaches misinformation to someone who trusts the system to know better. RAG-style grounding is how you get the LLM's language flexibility without inheriting its raw hallucination risk on factual content.

Step 6 · Hints, not answers

The Socratic gate

A stuck student asks "just tell me the answer." Should the tutor comply immediately?

Design decision: A struggling student directly asks for the answer. What should the tutor do?

The call: Escalate through a series of increasingly specific Socratic hints first — pointing at the relevant concept, then the specific step, then (only if still stuck after genuine attempts) the direct answer with a full explanation. — A hint ladder gives the student every chance to have the "aha" themselves first, which is where durable learning happens, while still guaranteeing they're never permanently stuck — the direct answer remains available as the last rung, not the first response.

Build a hint ladder: the first response to "I'm stuck" is a pointer toward the relevant concept, not the answer. Further requests escalate — a more specific hint, then the exact next step — and only after genuine attempts have been made does the tutor give the full direct answer with explanation. This is a deliberate pedagogical gate, not a capability limitation.

Pedagogy is a product requirement, not a prompt-engineering afterthought: "Don't just answer" has to be an explicit, designed system behavior — left to its own devices, an LLM optimized to be maximally helpful will happily just give the answer, which is the wrong optimization target for a tutor whose actual job is durable learning, not task completion.

Step 7 · Remember across sessions

Learning happens over months, not one sitting

A student logs back in three weeks later. Should the tutor start from scratch, or remember that they were shaky on fractions and haven't practiced since?

Maintain a long-term Learner Profile, separate from any single session's working state — persistent mastery trends, known weak spots, and a forgetting-curve estimate per skill (skills genuinely decay without practice). The Problem Selector consults this profile to bring back a skill for review right around when it's predicted to be forgotten — spaced repetition — rather than only reacting to what happens inside today's session.

Session memory vs. learner memory: This mirrors the short-term/long-term memory split in any conversational agent system, applied to pedagogy specifically: the working session needs fast, in-context state, while the durable learner profile is what makes the system actually get smarter about this individual over weeks and months, not just within one sitting.

Step 8 · The sharp edges

Cost, latency, and staying on-curriculum

Hint generation is on the interactive path — a student waiting 8 seconds for a hint is a bad experience. Mastery-model and profile updates don't need to be instant. And an LLM asked an off-topic or inappropriate question needs to stay in its lane.

Split by latency requirement: hint/explanation generation uses a fast, cheap model tuned for low latency, since it's directly in the student's interactive loop; mastery-model recomputation and profile updates can run slightly deferred/batched, since a few seconds of lag there is invisible to the student. Layer guardrails on the LLM path specifically for the tutoring context: refuse to just do the student's homework verbatim, redirect off-curriculum or inappropriate requests, and never let a jailbreak attempt bypass the hint-ladder's "don't just give the answer" gate.

Design for the unhappy path: Mastery store down → degrade to a sane default curriculum, don't hard-fail. Grounding cut → risk of confidently wrong teaching, which is why it's never optional. Slow hints → split latency-sensitive from latency-tolerant work. A tutor that only works for a cooperative student asking on-topic questions in perfect conditions is a demo.

You did it

You just designed an adaptive AI tutor.

  • A fixed problem order can't be right for every learner — real adaptivity requires tracking a per-skill mastery estimate per student.
  • The mastery model targets each student's zone of proximal difficulty, and alone (even without an LLM) is already a legitimate adaptive tutor.
  • Grading routes structured answers to a deterministic symbolic checker and reserves the LLM only for genuinely open-ended judgment calls.
  • Every graded attempt feeds back into the mastery model, closing the loop that actually makes selection adaptive over time.
  • Explanations are grounded in a vetted curriculum knowledge base (RAG), not freely generated — a confidently wrong hint is worse than a slow one.
  • Hints escalate through a Socratic ladder instead of immediately giving the direct answer — a deliberate pedagogical gate, not a limitation.
  • A long-term learner profile, separate from session state, drives spaced repetition of skills predicted to be forgotten.
  • Latency-sensitive hint generation and latency-tolerant mastery/profile updates are split, and tutoring-specific guardrails keep the LLM on-curriculum.
built to teach the next-right thing, not the next thing in a fixed list — make the calls, cut grounding, run the gauntlet.
Finished this one? 0 / 61 AI System Designs done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More AI System Designs