Cognis: Finding the Real Reason Students Get Stuck
Inspiration
Students often struggle with advanced topics like Eigenvalues, Dynamic Programming, or Balanced Search Trees. They ask an AI chatbot for help, receive a detailed explanation, feel like they understand it—and then fail the next problem anyway.
The real issue is rarely the topic they're asking about. More often, they're missing a prerequisite concept learned weeks or even months earlier. A weak understanding of determinants can make Eigenvalues confusing. Poor pointer fundamentals can make trees seem impossible.
Current AI tutors answer the question that was asked. Cognis instead asks why that question exists in the first place.
Rather than treating symptoms, Cognis diagnoses the student's underlying knowledge gap and guides them back to the exact prerequisite they need to relearn.
How We Built It
Cognis combines semantic search, graph algorithms, and generative AI into a diagnostic tutoring system.
Student Query
│
▼
Gemini Embeddings
│
▼
Semantic Concept Matching
│
▼
Prerequisite DAG Traversal
│
▼
Adaptive Diagnostic Questions
│
▼
Root Cause Detection
│
▼
Personalized AI Remediation
1. Semantic Concept Matching
Instead of relying on keyword matching, Cognis converts a student's natural language question into a vector embedding using Google's Gemini embedding model.
Each concept in the curriculum is also represented by an embedding.
The system computes cosine similarity
to identify the curriculum concept most closely related to the student's question.
This mapped concept becomes the starting point for diagnosis.
2. Prerequisite Graph Traversal
Course knowledge is represented as a Directed Acyclic Graph (DAG).
- Nodes represent concepts.
- Directed edges represent prerequisite relationships.
For the matched concept, Cognis traverses upstream through all prerequisite nodes using graph traversal.
Instead of checking the entire curriculum, only concepts that could realistically explain the student's misunderstanding are examined.
This dramatically reduces unnecessary questioning.
3. Adaptive Root Cause Diagnosis
Rather than immediately explaining the requested topic, Cognis evaluates prerequisite concepts through short diagnostic questions.
For each concept, the student's mastery score
is compared against a mastery threshold.
If mastery is sufficient, Cognis moves forward.
If not, the system continues tracing backward until it identifies the earliest prerequisite that explains the downstream failures.
That concept is treated as the student's root learning gap, and further diagnostic probing stops.
This makes the tutoring process focused instead of repetitive.
4. AI-Powered Remediation
Once the root concept has been identified, Cognis generates personalized learning material instead of generic explanations.
The AI provides:
- concise conceptual explanations
- worked examples
- progressively harder practice questions
- contextual follow-up tutoring
Students rebuild the missing foundation before returning to the original topic.
Technical Architecture
- Backend: FastAPI (Python 3.10) with Uvicorn
- Knowledge Representation: Directed Acyclic Graph (DAG)
- Vector Search: Google Gemini Embeddings with cosine similarity
- Generative AI: Google Gemini for explanations, question generation, and tutoring
- Database: SQLite
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Visualization: vis-network interactive graph
Challenges We Faced
Preventing Cycles
AI-generated prerequisite graphs occasionally contained dependency cycles.
We validate every generated graph using Kahn's Topological Sort Algorithm. If a cycle is detected, the offending dependency is removed before the graph is used.
Reducing Diagnostic Fatigue
Testing every prerequisite would overwhelm students.
We implemented adaptive pruning. When a student demonstrates strong mastery of a prerequisite, Cognis skips testing deeper ancestors, reducing the average number of diagnostic questions while maintaining accuracy.
State Management
Keeping the graph visualization, diagnostic session, and AI tutor synchronized required lightweight state management.
A REST API backed by SQLite maintains session progress without introducing a heavy frontend framework.
What We Learned
- Asking targeted questions is often more effective than immediately giving answers.
- Knowledge graphs make prerequisite relationships intuitive and easy to explore.
- Combining deterministic graph algorithms with generative AI creates a tutoring system that is both reliable and flexible.
Future Work
We plan to expand Cognis with:
- automated curriculum graph generation
- spaced repetition for long-term retention
- instructor analytics dashboards
- LMS integration
- support for multiple academic disciplines
Our goal is to help students learn more efficiently by identifying and repairing the exact concept that prevents deeper understanding.

Log in or sign up for Devpost to join the conversation.