Inspiration

Students today are overwhelmed. Course material is scattered across thick PDF textbooks, fragmented PowerPoint slides, and hours of lecture video transcripts. While general AI chatbots exist, they introduce a critical flaw: they frequently hallucinate or provide explanations that aren't aligned with a professor's specific syllabus. We wanted to build a study companion that is 100% trustworthy—an AI that only knows what is in the course material, cites its sources exactly, and adapts to a student's unique knowledge gaps just like a human tutor.

What it does

LearnWise AI is a fully local, privacy-first multimodal study companion. It ingests diverse course materials without manual preprocessing and builds a source-cited knowledge base.

Source-Grounded Tutor: Answers questions using only the uploaded material, providing inline citations that link back to the exact page, slide, or video timestamp.

Adversarial Refusal: Strictly declines to answer off-topic queries to prevent hallucinations.

Adaptive Assessments: Generates bespoke MCQs, short-answer, and numerical questions targeting the student's weakest topics.

Learner Dashboard: Tracks topic mastery in real-time using a probabilistic learner model.

How we built it

We architected LearnWise AI with a focus on local execution, modularity, and strict grounding.Frontend: Built with Streamlit for a highly responsive, stateful, multi-tab user interface.Multimodal Ingestion Pipeline: We used PyMuPDF to parse textbooks and extract diagrams, python-pptx to extract slide text and tables, and custom regex to map video transcripts (.srt/.vtt) to precise timestamps.Retrieval & Grounding: Instead of a heavy vector database, we optimized a lightweight scikit-learn TF-IDF vectorizer combined with Cosine Similarity and lexical overlap algorithms to ensure hyper-precise academic text matching.Local LLM Engine: All generative tasks (explanations, JSON-formatted quiz generation, semantic grading) are powered by Ollama (llama3.2), ensuring zero-latency, offline capability, and complete data privacy.The Math: Bayesian Knowledge Tracing (BKT)To model the student's learning, we implemented Bayesian Knowledge Tracing from scratch. The system updates the probability that a student has mastered a topic ($P(L)$) after every quiz attempt.When a student answers correctly, the posterior probability of mastery is calculated as:$$P(L_t \mid \text{Correct}) = \frac{P(L_t)(1 - P(S))}{P(L_t)(1 - P(S)) + (1 - P(L_t))P(G)}$$Then, we factor in the probability that they learned the concept during the practice opportunity (Transition, $P(T)$) to estimate their future mastery:$$P(L_{t+1}) = P(L_t \mid \text{Obs}) + (1 - P(L_t \mid \text{Obs})) \cdot P(T)$$(Where $P(S)$ is the Slip rate, and $P(G)$ is the Guess rate, dynamically adjusted for MCQ vs. Open-Ended questions).

Challenges we ran into

Taming LLM Hallucinations: Large Language Models naturally want to be helpful, which means they often pull in outside knowledge. We had to engineer a strict "threshold-based refusal" mechanism that forcefully blocks the LLM if the retrieved context similarity drops below 0.08, ensuring strict academic integrity.

Quiz Question Exhaustion: Generating 100% novel questions from sparse PowerPoint slides was difficult. Short bullet points often lack enough context for an LLM to generate a valid 4-option MCQ. We implemented an anti-repetition cache (used_quiz_sentences) and an emergency regex-based fallback generator to ensure the UI never hangs if the LLM struggles to parse fragmented slide text.

Local Processing Constraints: Running llama3.2 locally meant we had to rigorously optimize our prompt lengths and context windows (4096 tokens) to prevent timeouts and system crashes.

Accomplishments that we're proud of

Zero-Hallucination Grounding: We are incredibly proud of achieving 100% refusal accuracy on off-topic queries, successfully forcing the LLM to rely strictly on the retrieved syllabus context rather than its own pre-trained weights.

Fully Local & Private Architecture: Successfully running a complex RAG pipeline and dynamic JSON quiz generator entirely locally using Ollama (llama3.2) without relying on expensive, privacy-invasive external APIs.

Real-Time BKT Integration: Taking the abstract math of Bayesian Knowledge Tracing and successfully coding it into a real-time Python state manager that dynamically updates the student's dashboard and directs their learning path.

Robust UI Failsafes: Building a highly resilient app that gracefully handles edge cases (like sparse PPTX slides) with emergency regex-based fallbacks, ensuring the user experience never breaks.

What we learned

Advanced RAG Evaluation: We learned how to mathematically evaluate RAG pipelines using standard frameworks, ultimately testing our system for Faithfulness, Context Precision, and Refusal Accuracy.

Probabilistic Learner Modeling: Translating academic BKT formulas into functional Python state management to dynamically drive UI recommendations.

Prompt Engineering for JSON: Forcing a local LLM to consistently output structured, parsable JSON for adaptive assessments requires incredibly specific system prompts and error-handling loops

What's next for LearnWise AI

We plan to integrate Whisper AI for automated, real-time transcription of raw audio/video files, implement spaced-repetition flashcards directly tied to the BKT forgetting curve, and package the entire stack into an easily deployable Docker container for university self-hosting.

Built With

Share this project:

Updates

Submission history