How bhanavikochhar/llm-based-math-tutor works
TinyThinker is a Streamlit NCERT mathematics tutor: a student submits a question, the app resolves and checks it, retrieves curriculum context, computes trusted answers, chooses a tutoring action, generates and checks a reply, then records progress and renders the result. Separate evaluation tools score tutor and baseline transcripts. The main turn sequence is documented in the README; source excerpts confirm selected wiring. Evaluation relationships are limited to those shown in the SOURCE INDEX.
Main entry points: pipeline.py Turn pipeline · main_page.py Chat interface · episode.py Episode handler · baseline_runner.py Baseline runner
Components 24
Student experience
- App router
frontend/app.py - Session and profile
frontend/state.py - Chat interface
frontend/views/main_page.py
Turn orchestration
- Episode handler
frontend/episode.py - Turn pipeline
scripts/llm/pipeline.py - Input and output safety
scripts/llm/safety.py - Syllabus scope gate
scripts/llm/scope.py - Conversation resolver
scripts/llm/conversation_resolver.py - Intent classifier
scripts/llm/intent.py - Tutoring state machine
scripts/llm/controller.py - Learner progress tracker
scripts/llm/student_tracker.py - Interaction telemetry
scripts/llm/telemetry.py
Math and curriculum grounding
- Hybrid curriculum retrieval
scripts/retrieval.py - Math verifier
scripts/llm/verifier.py
Reply generation
- Prompt assembly
scripts/llm/prompt_registry.py - Streaming LLM client
scripts/llm/llm_client.py - Response parser
scripts/llm/response_parser.py
Evaluation tools
- Baseline runner
eval/baseline_runner.py - Answer extraction
eval/answer_extraction.py - Transcript scorer
eval/score_transcripts.py - Rating agreement
eval/rating_agreement.py - Evaluation artifacts
eval/component_eval/results.py
Other components
- Student
- Groq and HF providers
Connections 27
- Student → Chat interface: submits question
- App router → Chat interface: routes to
frontend/app.py - App router → Session and profile: initializes
frontend/app.py - Chat interface → Episode handler: queues turn
frontend/views/main_page.py - Episode handler → Turn pipeline: processes turn
frontend/episode.py - Turn pipeline → Input and output safety: checks input
- Turn pipeline → Syllabus scope gate: checks scope
- Turn pipeline → Conversation resolver: resolves question
scripts/llm/pipeline.py - Turn pipeline → Hybrid curriculum retrieval: retrieves context
scripts/llm/pipeline.py - Turn pipeline → Math verifier: computes answer
scripts/llm/pipeline.py - Turn pipeline → Intent classifier: classifies intent
- Turn pipeline → Tutoring state machine: selects action
scripts/llm/pipeline.py - Turn pipeline → Prompt assembly: builds prompt
scripts/llm/pipeline.py - Turn pipeline → Streaming LLM client: requests generation
scripts/llm/pipeline.py - Streaming LLM client → Groq and HF providers: streams from
scripts/llm/llm_client.py - Turn pipeline → Response parser: cleans response
scripts/llm/pipeline.py - Turn pipeline → Math verifier: checks response
scripts/llm/pipeline.py - Turn pipeline → Learner progress tracker: records attempts
scripts/llm/pipeline.py - Turn pipeline → Interaction telemetry: logs interaction
- Episode handler → Chat interface: returns reply
frontend/views/main_page.py - Session and profile → Learner progress tracker: reads learner profile
frontend/state.py - Baseline runner → Streaming LLM client: requests generation
eval/baseline_runner.py - Baseline runner → Response parser: parses response
eval/baseline_runner.py - Transcript scorer → Answer extraction: extracts answers
eval/score_transcripts.py - Transcript scorer → Baseline runner: scores checkpoints
eval/score_transcripts.py - Rating agreement → Answer extraction: uses extraction
eval/rating_agreement.py - Rating agreement → Transcript scorer: uses scores
eval/rating_agreement.py