Building Personalized Worked Example Generators with AI

Demonstrating Cognitive Load Theory Principles through Structured AI Outputs

Workshop Overview

Welcome to this 3-hour workshop on building AI-powered educational tools grounded in Cognitive Load Theory. You’ll learn a pattern for creating personalized worked examples by modifying a working template.

What You’ll Do

  1. See a complete demo: Experience the full complex application (3 domains, 16 concepts)
  2. Study the code: Understand how Pydantic and Marimo create structured AI outputs
  3. Modify a template: Add concepts to a simplified version (1 domain, 3 concepts)
  4. Design extensions: Plan how to apply this to YOUR teaching

What You’ll Build

You’ll modify a working Personalised Worked Example Generator (in your browser) that:

  • Collects learner profile information (name, domain, interests, hobbies, goals, skill level)
  • Generates customised worked examples in ONE domain (Programming)
  • Weaves learner interests naturally into educational content
  • Provides step-by-step solutions with personal relevance
  • Runs in your browser (no installation required)

Note: The demo shows all 3 domains with 16 concepts. You’ll work with a SIMPLIFIED version (1 domain, 3 concepts) and add 1-2 more concepts to learn the pattern.

Learning Objectives

By the end of this workshop, you will:

  1. Understand the worked example effect and personalisation principle from Cognitive Load Theory
  2. Modify a working template to add your own concepts (in your browser)
  3. See how Pydantic ensures structured outputs from AI
  4. Recognise the pattern for building educational AI tools
  5. Design extensions for your own teaching context

Pedagogical Foundation

This workshop is grounded in Cognitive Load Theory (Sweller 1988), specifically:

The Worked Example Effect:

“A ‘worked example’ is a problem that has already been solved for the learner, with every step fully explained and clearly shown. The ‘worked example effect’ is the widely replicated finding that novice learners who are given worked examples to study perform better on subsequent tests than learners who are required to solve the equivalent problems themselves.”

Centre for Education Statistics and Evaluation (2023)

Why It Works:

  • Unguided problem-solving overloads working memory
  • Studying worked examples reduces cognitive load
  • More working memory capacity available for schema construction
  • Better learning outcomes for novices

Our Addition - Personalization:

  • Familiar contexts reduce extraneous cognitive load
  • Personal relevance increases germane load (motivation)
  • Better schema formation and transfer

Workshop Schedule

3-Hour Schedule

Time Duration Section Activity
9:00-0:10 10 min Opening Think-pair-share: Learning from examples
9:10-9:40 30 min Theory Cognitive Load Theory principles
9:40-10:00 20 min Demo See the complete application (all 3 domains)
10:00-11:30 90 min Build Hands-on: Modify starter template, add concepts
11:30-11:50 15-20 min Extend Choose: Discussion or Gallery Walk

Prerequisites

Required Knowledge

  • Basic Python: lists, dictionaries, functions (reading code, not writing from scratch)
  • No statistics background required
  • No prior AI/ML experience needed

Materials Required

Setup Required Before Workshop

That’s it. No installation needed.

What you need:

  1. Laptop with modern browser
  2. Internet connection (workshop uses HuggingFace Spaces)
  3. Optional: Notebook for reflecting on how you’d apply this to your teaching

No Python installation. No API keys. No troubleshooting.

Everything runs in your browser via an interactive web application.

Workshop Structure: A Worked Example Approach

ImportantThis Workshop IS a Worked Example

This workshop demonstrates the principle it teaches by being structured as a worked example itself.

Traditional approach (problem-solving):

Give you requirements → You struggle to build → Instructor helps when stuck

High cognitive load, potential frustration, pattern harder to see

This approach (worked example):

Show complete solution → Study each component → Explain design choices → Apply to your domain

Lower cognitive load, clearer pattern, better transfer

Why? Most of you are novices at building educational AI tools. Research shows studying worked examples is more effective than unguided problem-solving for novices.

The Worked Example Approach

This workshop follows the worked example pattern:

  1. ACTIVATE (Opening): Prior knowledge activation
  2. PRESENT (Theory + Demo): See the complete solution
  3. STUDY (Build): Examine and modify the code
  4. UNDERSTAND (Extend): Connect to pedagogical applications
  5. TRANSFER (Resources): Apply to your own teaching

Fading Scaffolding

Notice how support gradually decreases:

  • Theory/Demo: Full explanation, complete working application shown
  • Build: Scaffolded practice—modify template, add concepts
  • Extend: Independent design—plan your own extensions
  • After workshop: Transfer to new domains on your own
TipMeta-Learning Moment

As you progress through today, notice:

  • When does studying the complete solution help vs. confuse?
  • When do you want to start experimenting on your own?
  • How does seeing the “big picture” first affect your understanding?

These insights will inform how you design worked examples for your students.

Technical Stack

Core Technologies

  • OpenAI GPT-5.1: Latest language model with structured outputs
  • Pydantic: Data validation using Python type hints
  • Gradio: Web interface for the production tool
  • Marimo: Reactive Python notebooks for interactive exploration
  • HuggingFace Spaces: Free deployment platform

Two Applications in This Workshop

This workshop uses two different applications with distinct purposes:

1. Interactive Exploration App (Marimo)

  • 5 hands-on labs for exploring concepts
  • Embedded throughout this website
  • Experiment with prompt design, personalization, data models
  • Learn by doing, no installation required

2. Production Tool (Gradio)

  • Complete deployable worked example generator
  • Deployed to HuggingFace Spaces

Connection to Learning Science

This workshop demonstrates several evidence-based learning principles:

NoteMake It Stick Connections

This tool addresses multiple strategies from Make It Stick (Brown, III, and McDaniel 2014):

  1. Worked Examples: Reduce cognitive load for novices
  2. Variation: Practice in different personal contexts
  3. Understanding vs. Familiarity: Personalisation helps distinguish the two
  4. Application: Real-world contexts for transfer

See the ki-lehre-intermediate workshop for deeper exploration of learning science principles.

Get Started

Ready to begin? Start with the opening activity!

Back to top

References

Brown, Peter C., Henry L. Roediger III, and Mark A. McDaniel. 2014. Make It Stick: The Science of Successful Learning. Cambridge, Massachusetts: Belknap Press: An Imprint of Harvard University Press.
Centre for Education Statistics and Evaluation. 2023. “Cognitive Load Theory: Research That Teachers Really Need to Understand.” NSW Department of Education. June 13, 2023. https://education.nsw.gov.au/about-us/education-data-and-research/cese/publications/literature-reviews/cognitive-load-theory.html.
Sweller, John. 1988. “Cognitive Load During Problem Solving: Effects on Learning.” Cognitive Science 12 (2): 257–85. https://doi.org/10.1016/0364-0213(88)90023-7.

Reuse