tutordesk-ai / docs /implementation_plan.md
naazimsnh02's picture
HF Space push
c5eb388
|
Raw
History Blame Contribute Delete
5.13 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade

TutorDesk AI β€” Implementation Plan

Build plan for the Build Small Hackathon (deadline June 15, 2026). Track progress in progress.md; product rationale in PRD.md.

Guiding principles

  • Demo-first: every phase should move the end-to-end demo forward.
  • Reuse over build: NCERT_Dataset + pretrained models do most of the work.
  • Narrow scope: Classes 6–10, Math + Science, CBSE/NCERT, English (+ Hindi slice).
  • Badges are cheap multipliers β€” bake them into the architecture, don't bolt on later.

Architecture (decided 2026-06-11)

Laptop can't hold the models β†’ all models self-hosted on Modal as scale-to-zero GPU functions (serving/modal_app.py). The HF Space = thin Gradio UI calling Modal by name. No external APIs. Models: MiniCPM-V 4.5 (8B), fine-tuned Qwen3-4B, Tiny Aya CohereLabs/tiny-aya-fire (3.35B), FLUX.1-schnell β€” total β‰ˆ27B.

Phase 0 β€” Project setup

  • Repo scaffolding per CLAUDE.md structure; requirements.txt; .env.example.
  • HF account + empty Space; Modal account + CLI auth (modal token set).
  • serving/modal_app.py skeleton: one scale-to-zero function per model.

Exit: app.py shows a "hello" Gradio app live on the Space; modal deploy succeeds.


Phase 1 β€” Core text generation (no fine-tune yet)

Get the product working with the base Qwen3-4B so UI/pipelines aren't blocked on training.

  • serving/modal_app.py::Qwen β€” load base Qwen3-4B on Modal; models/qwen.py calls it.
  • agents/ β€” implement the 5 agents (curriculum, question_gen, difficulty, answer, report) as prompt-driven functions over Qwen.
  • pipelines/weekly_pack.py β€” orchestrate the 5 agents β†’ worksheet+homework+quiz+key+note.
  • utils/pdf.py β€” print-ready PDF export.

Exit: Feature 2 (Weekly Teaching Pack) works end-to-end from text inputs β†’ PDF.


Phase 2 β€” Vision (Feature 1)

  • serving/modal_app.py::MiniCPM β€” load MiniCPM-V 4.5 on Modal (4.6 fallback flag).
  • pipelines/worksheet_from_textbook.py β€” image/PDF β†’ extracted topic/concepts β†’ feed Phase 1 pipeline.
  • utils/image.py β€” PDF page rasterization, basic preprocessing.

Exit: Feature 1 works β€” photograph a chapter β†’ worksheet+quiz+key.


Phase 3 β€” Dataset + fine-tune on Modal (Well-Tuned / Tiny Titan / Modal)

  • data/prep_generation.py β€” NCERT_Dataset β†’ ChatML JSONL (objective β‘  generation).
  • data/prep_difficulty.py β€” NCERT Difficulty column β†’ ChatML (objective β‘‘ classify).
  • data/prep_grading.py β€” synthesize marking-scheme + simulated-student-answer + marks triples (objective β‘’ grading); ~1–2k rows.
  • finetune/train_modal.py β€” LoRA SFT of Qwen3-4B on Modal; merge + export GGUF.
  • Publish the fine-tuned model to the HF Hub (claims Well-Tuned).

Exit: Fine-tuned Qwen3-4B published; swapped into the pipelines; ~6–8k training examples.


Phase 4 β€” Photo Auto-Grading (Feature 5)

  • pipelines/auto_grade.py β€” MiniCPM-V reads answer sheet β†’ fine-tuned Qwen3-4B grades against marking scheme β†’ marks + per-step breakdown + auto-drafted parent note.

Exit: Feature 5 works on neat/printed answer sheets.


Phase 5 β€” Multilingual (Cohere) + Diagrams (FLUX)

  • serving/modal_app.py::TinyAya β€” host CohereLabs/tiny-aya-fire; language selector on every output (Feature 3).
  • serving/modal_app.py::Flux β€” host FLUX.1-schnell; diagrams embedded in worksheet PDFs (Feature 4).
  • Graceful fallback when offline (English-only / no images).

Exit: Features 3 & 4 work; sponsor claims for Cohere + BFL satisfied.


Phase 6 β€” Badge layer & polish

  • Off the Grid / Llama Champion: local mode β€” MiniCPM-V + Qwen3-4B via llama.cpp, toggle to disable all cloud calls.
  • Sharing is Caring: traces/ β€” capture agent traces β†’ publish HF dataset.
  • Off-Brand: custom gr.Server frontend, mobile-first polish.
  • Field Notes: build/report blog post.

Exit: all badges claimable; app polished.


Phase 7 β€” Submission

  • Record demo video (90-min β†’ 10-min teacher story).
  • Social post. Final Space deploy + README with sponsor/badge checklist.
  • Submit before June 15, 2026.

Sponsor / award coverage (target)

Claim Phase
OpenBMB ($10k) β€” MiniCPM-V 2, 4
Modal ($20k credits) β€” training job 3
Cohere ($5k) β€” Aya 5
Black Forest Labs ($3k) β€” FLUX 5
Best Agent ($1k) β€” 5-agent pipeline 1
Well-Tuned + Tiny Titan ($1.5k) β€” published 4B fine-tune 3
Sharing is Caring β€” agent traces dataset 6
Off the Grid + Llama Champion β€” local mode 6
Off-Brand ($1.5k) β€” gr.Server 6
Best Demo ($1k) + Field Notes 6, 7

Risks / watch-items

  • Handwriting OCR unreliable β†’ demo with printed answers; roadmap item.
  • Laptop memory for 8B + 4B β†’ use GGUF/quantized; lazy-load models.
  • NCERT subject coverage may skew β†’ verify collection, supplement if thin.
  • Time: if behind, Phases 1–4 are the must-win core; 5–6 are sponsor add-ons.