ASIM ANSARI // PROJECTS
PROJECT CASE STUDY // HUMAN-IN-THE-LOOP AI TUTORING

TEACHING LOOP

Human-in-the-loop AI tutoring and automated skill evaluation platform. Solves unchecked LLM hallucinations by placing educators in direct control of curriculum ingestion, concept chunk verification, real-time prompt steering, and student dialogue analysis.

FastAPI Backend ChromaDB MMR RAG PostgreSQL MongoDB Streamlit UI
SIGNAL // CLOUD STAGING
Classroom Cloud Instance In Staging: Hosted cloud deployment for teaching-loop.asimansari.com is currently in active staging. In the meantime, the complete repository, multi-page Streamlit console, and FastAPI backend are 100% functional and reproducible on your local machine today.
[01] THE STORY // BEHIND THE SCENES

HOW TEACHING LOOP WAS BORN & EVOLVED

STAGE 01 // THE CORE IDEA Giving the Teacher Room & The Student a Dedicated Sandbox

Freeing Up the Teacher's Bandwidth

Teaching Loop started with a single clean idea: give the teacher room for more things, while giving the student a dedicated, controlled learning environment.

Teachers are stretched thin across lectures, administrative duties, and grading. They simply don't have the hours to sit one-on-one with every student who needs extra guidance. At the same time, giving students a generic, unmonitored chatbot is risky—it hallucinates, wanders off curriculum, and leaves the teacher completely blind to what the student actually understood.

STAGE 02 // AI IN THE MIDDLE Real-Time Teacher Interruption & Live AI Steering

Putting the Teacher in Direct Control

Instead of replacing the educator, I designed the system so that the AI sits right in between the teacher and the student:

1. Live Interruption: The teacher can monitor the student's conversation with the AI in real time. If the student gets stuck or veers into a misconception, the teacher can actively interrupt the conversation at any second.

2. Directing the AI Live: The teacher can feed new instructions to the AI while the student is having the conversation—telling the AI where to push harder, when to give a hint, or how to simplify an analogy for that specific student.

3. Clear Deficit Reports: The teacher receives an automated summary showing how the student is doing and where they are lacking, making it immediately clear who needs more of the teacher's personal time.

STAGE 03 // CONTINUOUS EVOLUTION From a Simple Prototype to a Controlled Tool

Evolving Step by Step into a Reliable Platform

Teaching Loop started as a humble prototype to see if this three-way interaction loop could genuinely solve classroom bottlenecks.

As I tested and built, it kept evolving into a more controlled and useful agentic platform: adding a verification gate so educators can approve syllabus chunks before they enter ChromaDB vector storage, integrating structured quizzes, and pairing FastAPI with PostgreSQL and MongoDB to keep learning records reliable. It grew from a quick MVP into a practical, teacher-first instrument.

[02] TARGET AUDIENCE

WHO IT'S BUILT FOR

01 // EDUCATORS & PROFESSORS

Instructors who need complete oversight of classroom AI interactions, granular chunk-approval tools, and auto-generated analytical reports on student knowledge deficits.

02 // AUTODIDACTS & STUDENTS

Learners wanting guided Socratic questioning tailored to a verified syllabus, adaptive dynamic quizzes (easy, mid, hard), and zero conversational hallucinations.

03 // ACADEMIC INSTITUTIONS

Schools and coaching academies requiring structured multi-tenant organization models, role-based access control (RBAC), and persistent dialogue audit trails.

[03] SYSTEM PIPELINE

5-STAGE PEDAGOGICAL VERIFICATION FLOW

STAGE 01 INGESTION

Curriculum Ingestion

Upload raw course PDFs or Markdown notes. PyPDF2 extracts text payloads and dispatches them to semantic extraction routines.

INPUT Syllabus PDFs / Markdown
STAGE 02 CHUNKING

Semantic Decomposition

Gemini Flash decomposes raw textbooks into modular pedagogical concept chunks, extracting title, core concept, and prerequisite tags.

TRANSFORM Structured Concept Chunks
STAGE 03 VERIFICATION

Educator Sign-Off

Human-in-the-loop review dashboard. Educators inspect, modify, or approve concept chunks before committing to the vector database.

GATE Teacher Approval Checkpoint
STAGE 04 RAG TUTOR

ChromaDB MMR Retrieval

Active tutoring dialogue queries verified chunks using Maximal Marginal Relevance (MMR), grounding Socratic responses without hallucinations.

INDEX ChromaDB + nomic-embed-text
STAGE 05 EVALUATION

Automated Gap Analysis

Synthesizes full multi-turn MongoDB dialogue trees into structured evaluation reports grading conceptual depth and highlighting remedial areas.

OUTPUT Mastery Report & Action Plan
[04] REPRODUCTION HARNESS

LOCAL DEPLOYMENT & RUNTIME

bash // deployment_harness.sh BASH
# 1. Clone the repository
git clone https://github.com/asimibnakhlaque/teaching-loop.git
cd teaching-loop

# 2. Configure environment variables
cat <<EOF > .env
DATABASE_URL=sqlite:///./teaching_loop.db
MONGODB_URL=mongodb://localhost:27017/teaching_loop
GEMINI_API_KEY=your_gemini_api_key_here
JWT_SECRET_KEY=your_secure_jwt_secret
EOF

# 3. Launch the FastAPI asynchronous backend service (Port 8000)
uvicorn backend.main:app --host 0.0.0.0 --port 8000 --reload

# 4. Launch the Streamlit multi-page interface in a separate shell
streamlit run frontend/app.py --server.port 8501
[05] STATUS & ACTIVE CHALLENGE

CURRENT STAGE & THE HARD PART

STAGE // OPERATIONAL BASELINE CURRENT STAGE

Working Dual-Persistence Local Platform

Teaching Loop runs locally as a complete end-to-end tutoring system. The FastAPI backend handles curriculum ingestion, semantic chunk verification, and MMR vector search in ChromaDB, backed by PostgreSQL for relational models and MongoDB for multi-turn dialogue histories.

Educators can verify concept chunks, trigger automated student deficit evaluations, and review dialogue transcripts through dedicated multi-page Streamlit consoles.

THE HARD PART // ACTIVE CHALLENGE IN PROGRESS

Classroom Validation & Live Educator Steering

The core technical challenge is not just software—it is real-world educator workflow validation. Putting AI directly between teachers and students requires testing whether live prompt steering and real-time interruption feel natural to teachers in actual classroom settings.

I am actively working to get real teachers into the loop to test the live-interruption mechanics, refine the dashboard ergonomics, and verify that automated deficit summaries truly capture student learning gaps without overwhelming the teacher's time.