Building a Duolingo-Style Adaptive Curriculum System
Traditional language learning apps present content linearly. Every user, regardless of skill level, receives identical lesson sequences. A beginner struggles through advanced material while an intermediate learner wastes time on basics they've already mastered. This one-size-fits-all approach leads to frustration, boredom, and ultimately, abandonment.
We built Content Duo to solve this problem—an adaptive curriculum system that personalizes lesson selection based on each learner's history, mastery level, and memory retention patterns. The result: 100% personalized content delivery with zero changes required to our mobile apps.
The Problem: Static Content for Dynamic Learners
Before Content Duo, our platform delivered lessons through manual selection or fixed sequences. Users at different proficiency levels received the same content in the same order. There was no memory science guiding review timing, no adaptation to individual learning speeds, and no intelligent mixing of new material with review content.
Before: Manual Content Selection
User Profile Manual Selection
┌─────────────┐ ┌──────────────────┐
│ User Data │──────────>│ Static Lesson │
│ - Level │ │ Sequence │
│ - Progress │ │ [L1→L2→L3→L4] │
└─────────────┘ └──────────────────┘
│
v
┌──────────────────┐
│ Same Content │
│ For All Users │
└──────────────────┘
The consequences were measurable: users bounced between content that was too easy (wasting time) or too hard (causing frustration). We had no mechanism to surface content at the optimal difficulty level or timing for review.
The Solution: AI-Driven Content Selection
Content Duo implements a multi-layered personalization engine that considers user persona, historical performance, and memory science to select the right content at the right time.
After: Adaptive Content Selection
User Profile AI Selector Personalized Content
┌─────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ User Data │──────────>│ ContentDuo │ │ Adaptive Lessons │
│ - Persona │ │ - HLR Memory │──────>│ - Matched to │
│ - History │ │ - Slot-Based │ │ User Level │
│ - Mastery │ │ - Multi-Strategy │ │ - Spaced Rep │
└─────────────┘ └──────────────────┘ │ - Dynamic Mix │
└──────────────────┘
The system works in three stages:
- Persona Detection - Classify users as beginner, intermediate, or advanced based on accuracy rates, attempt history, and speed metrics
- Slot-Based Selection - Allocate lesson content across three slots: new material (40%), review content (30%), and challenge exercises (30%)
- HLR Scheduling - Apply Half-Life Regression to determine optimal review timing based on individual retention curves
Implementation Architecture
The Content Duo system comprises several core components:
Curriculum Models
Located in src/models/curriculum/, these models define the database schema for concepts, sessions, attempts, and configuration. Each learning concept is tracked individually with its own retention metrics and mastery score.
Personalization Service
The heart of the system lives in src/services/personalization/, particularly the HLR (Half-Life Regression) implementation. This service calculates retention probability using the formula:
Retention = exp(-t / hlr)
where:
t = time since last exposure
hlr = half-life of recall (learned from attempts)
Every time a user attempts a concept, the system updates the half-life based on whether the attempt was correct or incorrect, creating a personalized memory model for each concept.
Content Selection Strategy
The selector uses a multi-strategy approach:
- Filter available content by user persona (difficulty matching)
- Calculate retention scores for all previously-seen concepts
- Allocate slots: 40% new concepts, 30% due-for-review concepts, 30% challenging concepts
- Randomize within each slot to prevent predictable patterns
- Assemble final lesson with target size (typically 5-7 items)
Virtual Subject Integration
One of the most elegant design decisions was using virtual subject IDs to integrate with existing mobile app infrastructure. By injecting a virtual subject (ID: -6) into the subject tree API, we enabled adaptive curriculum delivery through existing lesson endpoints with zero mobile app changes.
Key Technical Decisions
1. Slot-Based Content Mixing
Rather than purely algorithm-driven selection, we implemented slot-based allocation to ensure balanced lesson composition. Every lesson contains new material (to maintain engagement), review content (to prevent forgetting), and challenge exercises (to push skill boundaries).
2. HLR Spaced Repetition
We chose Duolingo's proven Half-Life Regression algorithm over simpler spaced repetition models (SM-2, Leitner). HLR adapts to individual learner patterns and handles irregular study schedules gracefully.
3. Persona-Based Difficulty Matching
Content difficulty is matched to user capability through persona classification:
- Beginner: accuracy < 60% OR < 10 total attempts
- Intermediate: 60% ≤ accuracy < 85%
- Advanced: accuracy ≥ 85% AND high completion speed
This prevents overwhelming beginners with advanced concepts while keeping experienced learners engaged.
4. Virtual Subject ID Injection
Instead of rebuilding mobile app UI to support adaptive learning, we created a virtual subject that appears in the existing subject tree. The backend dynamically generates lesson content through the same endpoints that serve static curriculum.
Implementation Scope
The Content Duo rollout involved substantial engineering work:
- Lines Changed: ~2,500 lines of production code
- Test Coverage: 58 unit tests + 15 integration tests
- Commits: 7d558b2, c4519b9, 4315731, 21d478e (and 12 more)
- Files Created: 15 new modules across models, services, and resources
Results: From Static to Adaptive
The impact was immediate and measurable:
- Personalization: 0% → 100% of content personalized to individual users
- API Endpoints: 4 new RESTful endpoints (sessions, attempts, progress, next-lesson)
- Mobile App Changes: Zero (seamless integration via virtual subjects)
- Adaptive Progression: Per-user mastery tracking with dynamic difficulty adjustment
Every user now receives a unique learning path tailored to their current skill level and optimized for long-term retention. The system continuously learns from each attempt, refining its understanding of what each learner knows and when they're likely to forget it.
What's Next
This foundation enables several future enhancements:
- Cross-app learning transfer - Apply mastery from one app to inform content selection in another
- A/B testing of slot distributions - Experiment with different new/review/challenge ratios
- Multi-skill curricula - Extend beyond vocabulary to grammar, pronunciation, and cultural concepts
- Predictive difficulty adjustment - Use ML to predict concept difficulty before users encounter it
Content Duo transforms language learning from a fixed curriculum into a dynamic, personalized experience. By combining memory science, persona classification, and intelligent content selection, we deliver the right lesson at the right time to every learner.
Implementation Files: src/models/curriculum/, src/services/personalization/
Commits: 7d558b2, c4519b9, 4315731, 21d478e
Test Coverage: 58 unit + 15 integration tests