Spaces:
Sleeping
Sleeping
Precalculus Studio: placement, worked examples, retrieval quizzes, peer instruction
18efdcb verified |
Download ARCHITECTURE.md from BenjaminKaindu0506/ed-tech-studio: direct link, hf CLI and curl.
- Browser
- Download file 11.9 kB
-
https://huggingface.co/spaces/BenjaminKaindu0506/ed-tech-studio/resolve/main/ARCHITECTURE.md
- Command line
-
hf download hf://spaces/BenjaminKaindu0506/ed-tech-studio/ARCHITECTURE.md
-
curl -L -o ARCHITECTURE.md https://huggingface.co/spaces/BenjaminKaindu0506/ed-tech-studio/resolve/main/ARCHITECTURE.md
11.9 kB
| # Precalculus EdTech Agent — Architecture (v3, 2026-11-19) | |
| **Supersedes v2 (PLM Factory for MATH 223 / CHEM 241A / ARH 201-202).** The system is now a | |
| general **educational-technology agent** for one course, **Precalculus**, built around | |
| evidence-based learning techniques instead of perceptual drills alone. The v2 courses, | |
| generators and data were removed. They're still in git history on `main`. | |
| ## 1. What "EdTech" means here | |
| AECT defines educational technology as the ethical study and application of theory, | |
| research and practice to improve learning and performance through strategic design, | |
| management, implementation and evaluation of processes and resources. "EdTech" also names | |
| the industry that builds those resources. The pieces this project uses: | |
| | EdTech component | In this project | | |
| |---|---| | |
| | Content / OER | OpenStax *Precalculus 2e* (RAG corpus) | | |
| | Item bank & assessment | U-MATH precalculus + MathCanvas analytic geometry, keyed by the datasets | | |
| | Learner model | `learner_model.py`: coverage + per-topic successive-relearning schedule | | |
| | Adaptive sequencing | Quiz engine (macro-adaptivity: *what* to practice next); ARTS for PLM drills | | |
| | Intelligent tutoring feedback | Immediate answer key, worked solution, textbook section to restudy | | |
| | AI agents | smolagents CodeAgents for orchestration, research and grounding, never answer keys | | |
| Adaptive-learning systems are usually split into domain / learner / pedagogical models. | |
| Here those are `curriculum.py` (domain), `learner_model.py` (learner), and `quiz.py` + | |
| `arts.py` (pedagogy). | |
| ## 2. Course: Precalculus | |
| Topic map in `src/edtech_core/curriculum.py` follows OpenStax Precalculus 2e: functions → | |
| linear → polynomial/rational → exponential/log → trig (unit circle, graphs, identities, | |
| non-right triangles, polar/parametric, vectors) → systems/matrices → analytic geometry | |
| (circles, ellipse, hyperbola, parabola, rotation/polar conics) → sequences/probability → | |
| intro to calculus. That's 28 topics, each with textbook sections, tagging keywords, and | |
| **confusable** topics (ellipse↔hyperbola, exponential↔logarithmic, quadratic↔parabola …). | |
| ## 3. Data (all previous data removed) | |
| | Source | Filter | Use | | |
| |---|---|---| | |
| | `precalculus-2e_-_WEB.pdf` | pages 17–1250 (no answer key/index) | Chroma `precalc_textbook`, chunks tagged chapter/section/topic from PDF bookmarks | | |
| | `toloka/u-math` | `subject == precalculus_review` (160 of 1,100) | problem bank; golden answers | | |
| | `shiwk24/MathCanvas-Instruct` | config `Analytic_Geometry`, precalculus `subknowledge` only (drops Linear Programming, Dilation, Others) | problem bank; answers, options, worked solutions; question images capped per sub-topic (`MATHCANVAS_IMAGES_PER_SUBTOPIC`) | | |
| Normalized bank: `data/problems/problem_bank.jsonl` (+ `images/`), embedded into Chroma | |
| `precalc_problems`. A problem whose statement needs a figure that wasn't downloaded stays | |
| searchable but is excluded from quizzes. | |
| ## 4. Agents | |
| 1. **Retrieval Agent** (`retrieval.py`). New task: **retrieval-practice quiz generation**. | |
| Tools: `list_precalc_topics`, `get_learner_progress`, `build_retrieval_quiz` (the only | |
| way to make a quiz), `retrieve_textbook_context` (topic-filtered, distance-thresholded), | |
| and `search_problem_bank`. The agent never sees answer keys. It passes `quiz_id` around, | |
| and keys stay in `data/learners/<id>/quizzes/<quiz_id>.json`. | |
| 2. **Research Agent** (`research.py`). Fixed: `ddgs` dependency, schema enforced through | |
| `final_answer_checks`, textbook passages supplied so disagreements can actually be | |
| flagged, and absolute cache paths. New second job: cached **learning-science evidence | |
| briefs** (`get_learning_science_brief`) used to revisit the quiz policy. They never | |
| change it automatically. | |
| 3. **PLM Agent** (`plm_agent.py`). Precalculus perceptual items: **GraphSense** (graph → | |
| function family) and **ConicSense** (general-form equation → conic type), sympy-keyed, | |
| guarded by `guard_ground_truth`. | |
| **Hard rule (kept from v2):** answer keys come only from datasets or code oracles, never | |
| from LLM assertion. | |
| ## 4b. v3.1 features (2026-11-19) | |
| **Learner journey:** Placement → (Research Agent plan) → Worked examples → Transfer quiz → | |
| Retrieval quizzes, with peer instruction available any time. | |
| - **Placement assessment first** (`assessment.py`). `build_quiz` raises `AssessmentRequired` until it's | |
| done, and the Retrieval Agent's instructions say to check this first. The assessment has one | |
| constructed-response problem per assessable topic (topics with ≥10 short-answer items, at most 10, | |
| spread across the textbook). Every answer must show its reasoning. Levels: solid / partial / gap. | |
| "I don't know yet" maps to gap. | |
| → `research.receive_assessment` (the hand-off) builds the **learning plan**: | |
| - gap → full worked example; | |
| - partial → faded example (the expertise-reversal effect, Kalyuga 2007); | |
| - solid → straight into interleaved retrieval review. | |
| - **Handwritten-first** (`llm.py`): every answer box accepts a photo of paper work. Qwen3-VL-30B | |
| transcribes it verbatim and never corrects the student; with a lax prompt the 235B model silently | |
| fixed student arithmetic, so the prompt matters. Quizzes cap multiple choice at 25%. | |
| - **Judge** (`judge.py`, gpt-oss-120b, reasoning_effort=low): the final answer is graded by the | |
| deterministic oracle when possible, otherwise compared against the dataset key, which is | |
| authoritative. The LLM evaluates the *reasoning*: steps, gaps, the faulty inference, why it's right. | |
| When the learner is wrong it won't hand over the fix. | |
| - **Worked examples: the Research Agent's tutor role** (`worked_examples.py`). | |
| - explain (textbook-grounded concept + a worked example whose steps come from the dataset, each | |
| annotated with the idea it uses) | |
| - → "I understand" → **faded** (backward fading: first half shown; the learner completes the rest | |
| and explains each step; wrong → targeted feedback and retry; after 3 misses → reveal and start a | |
| fresh example) | |
| - → **full problem** with per-step reasoning (2 misses → back to a faded example) | |
| - → all concepts right → the Research Agent **asks the Retrieval Agent** (`request_transfer_quiz`, | |
| logged in `handoffs.jsonl`) for 2–3 questions on the same topic, chosen for maximal surface | |
| difference and applied contexts (low word overlap, different sub-type, context cues). | |
| - Passing ≥ ⅔ → mastered and added to the retrieval rotation. Failing → flagged as an | |
| **illusion of fluency** → a new worked example with a different setup. | |
| - If a topic has no dataset solutions, tutor-written steps are used only when their final answer | |
| matches the dataset key. | |
| - **Human-to-Agent peer instruction** (`peer_instruction.py`), after Mazur: commit an answer with | |
| reasoning and a 1–5 confidence → the agent replies as a peer (correct → *why*; wrong → gaps and the | |
| exact faulty step, no answer) → one revision (the "re-vote") → reveal (the "instructor explains" | |
| phase). Confident-and-wrong is flagged as possible illusion of fluency. The *initial* answer feeds | |
| the spacing schedule. | |
| - **Agentic hand-off:** `build_research_coordinator()` is a Research CodeAgent with the Retrieval | |
| Agent as a smolagents managed agent, so it can request the transfer quiz in natural language | |
| (Agent debug tab). The interactive tutor calls the same tool directly, for latency. | |
| | Added evidence | Used for | | |
| |---|---| | |
| | Worked-example effect (Sweller; Atkinson et al. 2000): studying worked examples lowers extraneous load for novices | Explain stage | | |
| | Faded examples / backward fading (Renkl et al. 2002; Renkl & Atkinson 2003): improve near transfer and reduce errors vs. unfaded | Faded stage (second half removed) | | |
| | Self-explanation prompts (Chi; Renkl): add germane processing | "Explain the concept behind each step" in every stage | | |
| | Expertise reversal (Kalyuga 2007; Salden et al. 2010: adaptive fading > fixed fading > problem solving) | Placement decides the start stage | | |
| | Illusion of fluency (Bjork 1999; Benjamin, Bjork & Schwartz 1998; Koriat & Bjork 2006): ease while studying inflates judgments of learning | Transfer quiz in new contexts; confidence calibration in peer instruction | | |
| | Peer Instruction (Mazur; Crouch & Mazur 2001: normalized gain 0.25 → 0.49; Smith et al. 2011: discussion + explanation is best) | Commit → peer feedback → re-vote → explanation | | |
| ## 5. Learning science → design rules | |
| | Principle & evidence | Implementation | | |
| |---|---| | |
| | **Retrieval practice / testing effect.** Practice tests beat restudy; Adesope et al. 2017 meta-analysis (217 studies). Dunlosky et al. 2013 rate practice testing "high utility". | Every session is a quiz, not a reading. | | |
| | **Free recall is effortful, potent retrieval.** Karpicke & Blunt 2011 (*Science*): retrieval beat concept mapping on inference questions. | Each quiz opens with a free-recall prompt on the current topic. | | |
| | **Hybrid formats.** Adesope et al.: mixed MC + constructed-response practice tests show the largest effects. | Format-balancing in `_pick_problem`; multi-part items down-weighted. | | |
| | **Feedback.** Butler & Roediger 2008: feedback after MC testing removes the false-knowledge cost of lures and enhances benefits. | Immediate key + worked solution + textbook §. | | |
| | **Interleaving.** Rohrer, Dedrick & Stershic 2015: d = 0.42 immediate, 0.79 at 30 days. Rohrer et al. 2020 RCT (54 classes): 61% vs 38%, d = 0.83. Brunmair & Richter 2019 meta-analysis: g = 0.42 overall, larger when categories are *similar*. | Review share grows with coverage (0 → 25% → 40% → 50% → max 67%). Adjacent items never share a topic when avoidable. | | |
| | **Discriminative contrast.** The interleaving benefit is largest for similar-looking categories (Brunmair & Richter 2019). | One review slot is reserved for a topic *confusable* with the current one. | | |
| | **Spacing.** Cepeda et al. 2008: the optimal gap grows with the retention interval (~20–40% of it at 1 week, ~5–10% at 1 year). Dunlosky 2013: distributed practice "high utility". | Expanding intervals 1, 3, 7, 21, 60 days; overdue topics get priority. | | |
| | **Successive relearning.** Rawson & Dunlosky: one correct recall in each of 3 spaced sessions → 68% vs 26% at 1 week, versus 3 recalls in one session. About 3 sessions captures most of the benefit. | A topic advances one interval step per session in which every item on it is correct. After 3 spaced successes it's "durable" (maintenance weight 0.4). A miss resets it to 1 day. | | |
| | **Variability.** Retrieve the concept, not a memorized item. | Review uses problems unseen by the learner when available. | | |
| | **Perceptual learning** (Kellman, Massey & Son 2010). | PLM drill tab with ARTS sequencing (accuracy + RT, retire at 4). | | |
| Open questions for the Research Agent: the best review share for precalculus (the 67% cap | |
| is borrowed from grade-7 trials); whether to add Bayesian knowledge tracing (P(L0), P(T), | |
| slip, guess; mastery at P ≥ 0.95, a threshold Pelánek critiques); and auto-grading for | |
| free-form LaTeX answers (currently string or sympy equivalence, otherwise self-check). | |
| ## 6. Delivery | |
| Gradio (`app.py`): **Retrieval Practice** (no LLM in the loop), **PLM Drill**, and | |
| **Agent Debug** (fixed dropdowns only, so there is no free-text prompt-injection surface | |
| into code-executing agents). | |
| ## 7. Build / run | |
| ```bash | |
| python -m src.edtech_core.ingest_textbook # textbook → Chroma (resumable) | |
| python -m src.edtech_core.ingest_datasets --embed # HF datasets → bank → Chroma (resumable) | |
| python app.py | |
| ``` | |
| Models: bge-m3 embeddings and Qwen2.5-Coder-32B-Instruct, both via the HF Inference API. | |
| Requires `hf auth login`. Observability: Arize Phoenix + `openinference-instrumentation-smolagents` | |
| (not yet wired). | |