# TutorDesk AI โ€” Progress Tracker Update this as work completes. Status: โฌœ not started ยท ๐ŸŸจ in progress ยท โœ… done ยท โ›” blocked Last updated: 2026-06-14 (Phases 4 + 5 + 6 complete + UI redesign) --- ## Phase 0 โ€” Project setup - โœ… Repo scaffolding (folders per CLAUDE.md), `requirements.txt`, `.env.example` (stubs compile clean) - โœ… Architecture decided: all models self-hosted on Modal; Space = thin Gradio client - โœ… `serving/modal_app.py` skeleton (one scale-to-zero fn per model) - โฌœ HF account + empty Space live - โœ… Modal account + CLI auth (`modal token set`) - โœ… `modal deploy serving/modal_app.py` succeeds - โฌœ **Exit:** "hello" Gradio app live on the Space ## Phase 1 โ€” Core text generation (base Qwen3-4B) - โœ… `serving/modal_app.py::Qwen` โ€” Qwen3-4B on Modal (A10G, scale-to-zero) - โœ… `models/qwen.py` โ€” Modal client (+ offline stub) - โœ… `agents/` โ€” curriculum, question_gen, difficulty, answer, report, grader (all wired) - โœ… `pipelines/weekly_pack.py` โ€” 5-agent orchestration + localization + PDF export - โœ… `utils/pdf.py` โ€” print-ready A4 PDF (reportlab) - โœ… `app.py` โ€” Weekly Teaching Pack tab wired; other features show "Coming soon" - โœ… Deploy: `modal deploy serving/modal_app.py` and smoke-test the pack - โœ… **Exit:** Feature 2 end-to-end live (Modal โ†’ Gradio โ†’ PDF download) ## Phase 2 โ€” Vision (Feature 1) - โœ… `models/minicpm.py` โ€” MiniCPM-V 4.5 Modal client (+ offline guard) - โœ… `pipelines/worksheet_from_textbook.py` โ€” photo/PDF โ†’ MiniCPM extract โ†’ weekly_pack - โœ… `utils/image.py` โ€” PDF rasterization via PyMuPDF - โœ… `serving/modal_app.py::MiniCPM` โ€” load + read_image implemented (A10G, trust_remote_code) - โœ… `app.py` โ€” Worksheet-from-Textbook tab fully wired (photo + PDF upload) - โœ… Deploy: `modal deploy serving/modal_app.py` and smoke-test with a textbook photo - โœ… **Exit:** Feature 1 โ€” chapter photo โ†’ worksheet+quiz+key ## Phase 3 โ€” Dataset + fine-tune on Modal - โœ… `data/prep_generation.py` โ€” NCERT โ†’ ChatML (objective โ‘ , ~3k examples) - โœ… `data/prep_difficulty.py` โ€” difficulty labels (objective โ‘ก, ~1k examples) - โœ… `data/prep_grading.py` โ€” grading triples via Qwen starmap (objective โ‘ข, ~600 examples) - โœ… `finetune/train_modal.py` โ€” LoRA SFT on Modal A10G, push to HF Hub - โœ… `serving/modal_app.py` โ€” reads QWEN_FINETUNED_MODEL env var to swap fine-tune in - โœ… Run data prep: 3k generation + 1k difficulty + 600 grading examples - โœ… Run training: `modal run finetune/train_modal.py` (A10G, 3 epochs, ~4.6k examples) - โœ… Publish fine-tuned Qwen3-4B to HF Hub (**Well-Tuned**) โ†’ naazimsnh02/tutordesk-qwen3-4b - โœ… Professional model card pushed to HF Hub - โœ… Set QWEN_FINETUNED_MODEL=naazimsnh02/tutordesk-qwen3-4b in .env + redeploy Modal - โœ… **Exit:** model live in serving pipeline ## Phase 4 โ€” Photo Auto-Grading (Feature 5) - โœ… `agents/grader.py` โ€” structured MARKS: X/Y output contract, `extract_score()`, `parse_scheme()` (regex + Qwen fallback) - โœ… `pipelines/auto_grade.py` โ€” multi-question loop: MiniCPM-V extract โ†’ per-Q Qwen grading โ†’ `GradeResult` with summary, markdown table, PDF - โœ… `app.py` โ€” Photo Auto-Grading tab fully wired (photo upload, marking scheme textbox, student name, grade/subject selectors, PDF download) - โœ… **Exit:** Feature 5 works on neat/printed sheets ## Phase 5 โ€” Multilingual + Diagrams - โœ… `serving/modal_app.py::TinyAya` โ€” load + localize implemented (L4, CohereLabs/tiny-aya-fire) - โœ… `serving/modal_app.py::Flux` โ€” load + generate_diagram implemented (A100, FLUX.1-schnell, bfloat16, 4 steps) - โœ… `models/aya.py` โ€” Modal client wired; English pass-through + offline no-op - โœ… `models/flux.py` โ€” Modal client wired; None fallback on offline/error - โœ… `pipelines/illustrated_worksheet.py` โ€” Qwen extracts โ‰ค3 diagram prompts โ†’ FLUX generates โ†’ embedded in PDF; graceful text-only fallback - โœ… `utils/i18n.py` โ€” UI label dictionary for English / Hindi / Tamil - โœ… `app.py` โ€” Regional Language tab (Tiny Aya translator) + Illustrated Worksheets tab (FLUX pack) fully wired - โœ… Offline graceful fallback โ€” Aya returns English; FLUX returns None โ†’ text-only PDF - โœ… **Exit:** Features 3 & 4 โ€” Cohere + BFL claims satisfied ## Phase 6 โ€” Badge layer & polish - โœ… Local mode via llama.cpp (**Off the Grid + Llama Champion**) โ€” `models/qwen.py` `_local_llm()`, `QWEN_GGUF_PATH` + `GGUF_N_GPU_LAYERS` in config; `llama-cpp-python>=0.3` added to requirements; offline path calls `create_chat_completion` with chatml format - โœ… `traces/` capture + publish HF dataset (**Sharing is Caring**) โ€” `data/export_traces.py` reads `traces/raw/agent_traces.jsonl` and pushes to `naazimsnh02/tutordesk-agent-traces` - โœ… Fully custom frontend (**Off-Brand**) โ€” `app.py` now uses `gr.Server` (FastAPI) serving a hand-written single-page UI `static/index.html`; each of the 5 features posts to its own JSON/multipart endpoint, PDFs served via `/api/download/`; `@app.api("health_check")` kept for gradio-client compat. Replaces the old `gr.Blocks` + `frontend/theme.py` approach (deleted). Pins `gradio==6.16.0`. - โœ… Full UI redesign โ€” saffron/green design-token CSS carried over from the old theme; gradient header w/ badges, JS feature-nav + output sub-tabs, pill radios, drag-drop dropzones w/ image preview, animated orbit loading card, marked.js markdown rendering, green-accented grade/PDF panels, footer with model badges - โœ… Field Notes blog post โ€” `field_notes.md` (submit to HF Field Notes) - โœ… **Exit:** all badges claimable, app polished ## Phase 7 โ€” Submission - โฌœ Demo video (90-min โ†’ 10-min story) - โฌœ Social post - โฌœ Final Space deploy + README w/ sponsor/badge checklist - โฌœ **Submit before June 15, 2026** --- ## Feature status (at a glance) | # | Feature | Status | |---|---|---| | 1 | Worksheet-from-Textbook (OpenBMB) | โœ… | | 2 | Weekly Teaching Pack (Best Agent) | โœ… | | 3 | Regional-language (Cohere) | โœ… | | 4 | Illustrated worksheets (BFL/FLUX) | โœ… | | 5 | Photo Auto-Grading (OpenBMB + Well-Tuned) | โœ… | ## Badge status | Badge / Award | Status | Notes | |---|---|---| | OpenBMB | โœ… ready | MiniCPM-V 4.5 in Features 1 + 5 | | Modal (training) | โœ… ready | `finetune/train_modal.py` on A10G | | Cohere | โœ… ready | Tiny Aya self-hosted on Modal | | Black Forest Labs | โœ… ready | FLUX.1-schnell self-hosted on Modal | | Best Agent | โœ… ready | 5-agent weekly pack pipeline | | Well-Tuned | โœ… ready | `naazimsnh02/tutordesk-qwen3-4b` on HF Hub | | Tiny Titan (โ‰ค4B) | โœ… ready | Qwen3-4B (4B params) | | Sharing is Caring | โœ… ready | `data/export_traces.py` โ†’ push to HF dataset | | Off the Grid | โœ… ready | `TUTORDESK_OFFLINE=1` + `QWEN_GGUF_PATH` โ†’ llama.cpp | | Llama Champion | โœ… ready | Qwen3-4B via llama.cpp GGUF | | Off-Brand | โœ… ready | `gr.Server` (FastAPI) + custom `static/index.html` single-page frontend | | Best Demo | โฌœ | Demo video needed (Phase 7) | | Field Notes | โœ… ready | `field_notes.md` โ€” submit to HF Field Notes | --- ## Decision log - 2026-06-11 โ€” Track: **Backyard AI**. Skipped OpenAI/NVIDIA/JetBrains. - 2026-06-11 โ€” Feature 5 changed from manual Parent Report โ†’ **Photo Auto-Grading**. - 2026-06-11 โ€” Vision: **MiniCPM-V 4.5 (8B)** default; 4.6 (1.3B) offline fallback. - 2026-06-11 โ€” Text model: **fine-tuned Qwen3-4B** (chosen for Tiny Titan โ‰ค4B). - 2026-06-11 โ€” Scope narrowed: **Classes 6โ€“10, Math + Science, CBSE/NCERT, English + Hindi**. - 2026-06-11 โ€” Base dataset: **ParthKadam2003/NCERT_Dataset** (MIT). - 2026-06-11 โ€” **Hosting: all models self-hosted on Modal** (laptop can't hold them); Space = thin Gradio client; no external APIs. - 2026-06-11 โ€” Multilingual model: **Tiny Aya `CohereLabs/tiny-aya-fire` (3.35B)**, South-Asian tuned. Total stack โ‰ˆ27B (< 32B). ## Open questions โ€” resolved - โœ… Cohere award accepts self-hosted Aya (confirmed 2026-06-11) - โœ… 32B cap is **per-model** (each model individually) โ€” all ours are well under ## Notes / blockers - (none yet)