π₯ Watch Video Demo β’ π Quick Start β’ π Empirical Benchmarks β’ ποΈ Architecture β’ π Emotion Taxonomy β’ π» Python SDK
Traditional e-learning platforms treat every student query as a dry, factual database search. When a student is stuck and says "I've spent 4 hours on this recursion bug and nothing works!", traditional search engines respond with technical documentationβcompletely missing the student's affective learning friction.
MindLearn AI (v2.0) bridges the gap between Natural Language Understanding (NLU) and Empathetic Pedagogical Support:
| Capability | Traditional E-Learning / Search | π§ MindLearn AI (v2.0) |
|---|---|---|
| Affective Understanding | β None (ignores tone & sentiment) | β Real-time 5-Class Emotion Classification |
| Mixed Emotions | β Flat single-intent lookup | β
Flags secondary emotions with |
| Inference Efficiency | β Heavy cloud models ( |
β
Fine-Tuned Compact Transformer ( |
| Pedagogical Strategy | β Generic answer dumping | β 3-Part empathetic coaching via Google Gemini 2.5 Flash |
| Resilience & Offline | β Hard crash on API disconnect | β Graceful degradation to offline pedagogical matrix |
| Benchmarking & Audit | β Black-box guessing | β Built-in evaluation lab with Radar & Confusion heatmaps |
MindLearn AI features a modular 3-Tier Model Zoo managed via a decoupled ModelRegistry pattern:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π§ UNIFIED MODEL REGISTRY β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ
β β‘ COMPACT TRANSFORMER v2 β β π§ BERT-BASE BASELINE β β β±οΈ BiLSTM BASELINE β
β (DistilBERT / MiniLM) β β (Contextual Baseline) β β (Keras + RNN Tier) β
β β’ 66.9M Parameters β β β’ 109.5M Parameters β β β’ 3.92M Parameters β
β β’ 255 MB Disk Footprint β β β’ 438 MB Disk Footprint β β β’ 4.2 MB Disk Footprint β
β β’ ~58.5 ms Latency (p50) β β β’ ~126.9 ms Latency (p50) β β β’ ~100.9 ms Latency (p50) β
β β’ 17.0 Req / Sec β β β’ 7.9 Req / Sec β β β’ 9.3 Req / Sec β
βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ
Evaluated over a curated 50-sample multi-domain gold evaluation dataset on single-core CPU hardware:
| Model Tier | Architecture | Accuracy | Macro F1 | Latency ( |
Throughput | Model Size | Speedup vs BERT |
|---|---|---|---|---|---|---|---|
| Baseline 1 (RNN) | BiLSTM + Focal Loss | 40.0% | 0.380 | 100.9 ms | 9.3 req/s | 4.2 MB | 1.3Γ |
| Baseline 2 (Transformer) | bert-base-uncased |
64.0% | 0.587 | 126.9 ms | 7.9 req/s | 438.0 MB | 1.0Γ (Baseline) |
| MindLearn v2 (Compact) | DistilBERT v2 | 52.0% | 0.536 | 58.5 ms | 17.0 req/s | 255.0 MB | β‘ 2.2Γ Faster |
Latency Comparison (Median p50):
ββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β Model Tier β Latency (ms) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β BERT-Base Baseline (v1) β ββββββββββββββββββββ 126.9 ms β
β BiLSTM Student Adaptive β βββββββββββββββ 100.9 ms β
β MindLearn Compact Transformer (v2) β βββββββββ 58.5 ms β‘ (2.2x Fast) β
ββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ
Tip
Key Architectural Takeaway: The fine-tuned Compact Transformer v2 achieves a 2.2Γ reduction in latency and 42% smaller memory footprint with 2.15Γ higher throughput, eliminating memory-exhaustion SIGKILL risks on cost-efficient cloud instances.
graph TD
User([π¨βπ Student Input]) --> UI[Streamlit Multi-Page Web App]
UI --> Prep[Text Sanitization & Soft Bayesian Keyword Fusion]
Prep --> Reg[Unified Model Registry]
subgraph Model_Zoo ["Multi-Tier Model Zoo"]
Reg --> Distil["β‘ MindLearn Compact v2 (67M Params)"]
Reg --> BERT["π§ BERT-Base Baseline (110M Params)"]
Reg --> BiLSTM["β±οΈ BiLSTM RNN Baseline (3.9M Params)"]
end
Distil --> LatencyEngine[Live Microsecond Latency Profiler]
BERT --> LatencyEngine
BiLSTM --> LatencyEngine
LatencyEngine --> MixedCheck{Probability >= 15%?}
MixedCheck -->|Primary & Secondary Emotions| GenAI[Google Gemini 2.5 Flash API]
MixedCheck -->|Offline / API Fallback| Fallback[Static Pedagogical Templates]
GenAI --> Output[Empathy Banner + Action Cards + Model Scores]
Fallback --> Output
Output --> DB[(SQLite app.db - WAL Mode)]
Output --> CSV[CSV Audit Log]
subgraph Benchmarking ["Model Benchmark & Evaluation Lab"]
BenchEngine[Benchmark Engine & Gold Test Suite] --> Radar[Radar Charts & Confusion Matrices]
Radar --> BenchUI[4_Model_Benchmark.py Page]
end
MindLearn AI maps student emotional friction into 5 actionable learning states:
| Emotion | Sentiment | Key Linguistic Cues | AI Pedagogical Intervention Strategy |
|---|---|---|---|
| Confused π | Negative Friction | "don't understand", "lost", "puzzled", "unclear" | Deconstructs the concept into first-principles analogies & step-by-step visual models. |
| Frustrated π€ | High Friction | "impossible", "stuck", "bug keeps failing", "annoying" | Validates frustration, recommends stepping away, and suggests a simplified baseline challenge. |
| Bored π | Low Arousal | "dry", "monotonous", "repetitive", "too simple" | Introduces gamified learning techniques, competitive challenges, and real-world applications. |
| Curious π€© | High Engagement | "why does", "how to connect", "fascinated", "wonder" | Provides deep-dive research links, architectural insights, and exploratory challenge questions. |
| Confident π | Mastery | "easy", "mastered", "solved", "crystal clear" | Suggests peer-teaching exercises, advanced edge-case problems, and synthesis challenges. |
pages/
βββ 1_Home.py π Interactive emotion analysis & real-time AI guidance
βββ 2_Analytics.py π Longitudinal affective analytics & progress charts
βββ 3_History.py π Searchable, filterable SQL audit log with CSV export
βββ 4_π¬_Model_Benchmark.py π¬ Empirical evaluation lab (Radar charts & Confusion heatmaps)
-
π Home (Emotion Analysis):
- Empathy-first hero banner with dynamic color-coding.
- 1-Click quick examples for rapid testing.
- Live latency metering badging forward-pass execution time.
- Step-by-step AI coaching plan powered by Google Gemini 2.5 Flash.
-
π Analytics (Learning Insights):
- Multi-metric summary cards (Total sessions, Avg confidence, Top emotion).
- Interactive Plotly emotional distribution over time.
- Discipline-specific breakdown across fields of study.
-
π History (Interaction Log):
- Full database audit trail backed by SQLite (
app.db). - Multi-filter search (by keyword, emotion, academic discipline, date range).
- One-click CSV export.
- Full database audit trail backed by SQLite (
-
π¬ Model Benchmark Lab:
- Interactive 5-axis Plotly Radar Chart.
- Normalized Confusion Matrix heatmaps for error analysis.
- Live Head-to-Head Model Arena for side-by-side comparative inference.
emotionDetectionLearningSupportEngine/
βββ HLD.md β High-Level Design Document (v2.0)
βββ LLD.md β Low-Level Design Document (v2.0)
βββ PRD.md β Product Requirements Document (v2.0)
βββ README.md β Main Project Showcase & Documentation
βββ requirements.txt β Global Python dependencies
βββ documentation/ β 8-Phase Engineering Process Documentation
β βββ 1. Brainstorming & Ideation/
β βββ 2. Requirement Analysis/
β βββ 3. Project Design Phase/
β βββ 4. Project Planning Phase/
β βββ 5. Project Development Phase/
β βββ 6. Project Testing/
β βββ 7. Project Documentation/
β βββ 8. Project Demonstration/
βββ project_files/
βββ app.py β Main Streamlit application entry point
βββ benchmark.py β CLI benchmark runner & latency profiler
βββ benchmark_results.json β Cached empirical benchmark metrics
βββ performance_test.py β Concurrency & stress testing script
βββ emotion_response_examples.csv β Dataset audit log
βββ data/
β βββ app.db β SQLite database (WAL mode enabled)
βββ models/
β βββ bltsm/ β BiLSTM weights (.keras) & tokenizer
β βββ bert_emotion_model_final/ β Fine-tuned BERT-Base weights & configs
βββ notebooks/
β βββ kaggle_training.ipynb β Kaggle GPU training pipeline (v1)
β βββ v2_compact_transformer_training.ipynb β Compact Transformer distillation (v2)
βββ pages/ β Streamlit multi-page interface
βββ src/ β Core engine modules
β βββ compact_transformer.py β Compact Transformer loader & calibration
β βββ registry.py β Unified ModelRegistry & BaseClassifier
β βββ benchmark_engine.py β Benchmark suite & latency profiler
β βββ bert_model.py β BERT-Base inference engine
β βββ model.py β BiLSTM RNN inference engine
β βββ preprocessing.py β Text sanitization & keyword fusion
β βββ predict.py β Prediction coordinator (v1 & v2)
β βββ database.py β SQLAlchemy persistence & ORM models
β βββ gamification.py β XP, streaks & achievement engine
β βββ components.py β UI primitives & empathy banners
β βββ styles.py β Glassmorphic dark CSS design system
βββ tests/ β Automated Pytest test suite
βββ test_engine.py β Unit & regression tests
βββ test_v2_engine.py β v2 Model registry & benchmark tests
# Clone the repository
git clone https://github.com/UdeepChowdary/emotionDetectionLearningSupportEngine.git
cd emotionDetectionLearningSupportEngine/project_files
# Create and activate a virtual environment
python -m venv .venv
.venv\Scripts\activate # On Windows
# source .venv/bin/activate # On Linux / macOS
# Install dependencies
pip install -r requirements.txt
python -c "import nltk; nltk.download('stopwords'); nltk.download('punkt'); nltk.download('punkt_tab')"Create a .env file in project_files/:
GEMINI_API_KEY=your_gemini_api_key_here(If no API key is provided, MindLearn AI automatically engages its offline pedagogical fallback matrix!)
streamlit run app.pyOpen http://localhost:8501 in your browser.
# Execute standalone CLI benchmark
python benchmark.py
# Run the complete test suite
pytest -v tests/You can easily integrate MindLearn AI into any existing learning platform or backend service:
from src.registry import model_registry
from src.predict import run_v2_prediction
# Run inference with Compact Transformer (v2)
response = run_v2_prediction(
"I don't understand how Dijkstra's priority queue prevents cycles, I am totally confused.",
selected_model="compact_transformer"
)
primary = response["primary_result"]
print(f"π― Emotion: {primary['emotion']}") # Confused
print(f"π Confidence: {primary['confidence']:.1%}") # 91.2%
print(f"β‘ Latency: {primary['latency_ms']:.1f} ms") # 58.5 ms
print(f"π Mixed: {response['primary_mixed']}") # [('Confused', 0.91), ('Frustrated', 0.18)]This project is licensed under the MIT License β see the LICENSE file for details.