Prateek-Dhar-Dwivedi/AM-RAG-ASAE-Grading
AM-RAG-ASAE: Adaptive Multilingual RAG-Based Explainable Automatic Short Answer Evaluation for Personalized Learning
   
π 1. Project Overview & Research Contribution
AM-RAG-ASAE (Adaptive Multilingual RAG-Based Explainable Automatic Short Answer Evaluation for Personalized Learning) is an advanced NLP and retrieval-augmented assessment framework designed for automated short-answer evaluation (ASAG).
Unlike conventional semantic-similarity or naive LLM-prompting techniques, AM-RAG-ASAE incorporates:
- Multi-Signal Two-Stage Retrieval: FAISS Top-50 candidate retrieval followed by a 5-signal reranker optimizing answer semantic similarity ($S{\text{ans}}$), question relevance ($S{\text{q}}$), concept coverage ($S{\text{concept}}$), reference-answer similarity ($S{\text{ref}}$), and lexical overlap ($S_{\text{lex}}$).
- Three Isolated Vector Collections:
- Collection A: Expert-Graded Training Exemplars (zero test-set leakage).
- Collection B: Educational Knowledge Textbook Passages.
- Collection C: Diagnostic Scientific Misconceptions Catalog.
- Misconception-Aware Diagnostic Grading: Rigorous separation between Missing Concepts (omitted facts) and Alternative Misconceptions (flawed mental models).
- Pedagogical Explainability & Personalized Remediation: Actionable formative feedback citing exact textual evidence and generating 4-part personalized study modules (Topic, Conceptual Review, Worked Exemplar, Formative Practice Question).
- Cross-Lingual Multilingual Extension: Native support for English, Hindi, and Punjabi.
[!NOTE] Architecture Clarification: This framework strictly employs Vector RAG (Sentence Embeddings + FAISS Flat Inner-Product Indexing + Multi-Signal Reranking + LLM Synthesis). It does NOT use GraphRAG or Knowledge Graphs.
ποΈ 2. Overall Architecture
USER (Student / Educator)
β
βΌ
βββββββββββββββββββββββββ
β Question + Answer β
βββββββββββββ¬ββββββββββββ
β
βΌ
LANGUAGE DETECTION
(EN / HI / PA Detection)
β
βΌ
TEXT PREPROCESSING
(Unicode, Whitespace, Punct)
β
ββββββββββββββββ΄βββββββββββββββ
βΌ βΌ
QUESTION ANALYSIS ANSWER ANALYSIS
β β
βΌ βΌ
Question Embedding Answer Embedding
β β
β Concept Extraction
β (spaCy / Keyphrase)
β β
ββββββββββββββββ¬βββββββββββββββ
βΌ
FAISS VECTOR SEARCH
(Candidate Top-50 Retrieval)
β
βΌ
MULTI-SIGNAL RERANKER
ββββββββββββββββββββββββΌβββββββββββββββββββββββ
βΌ βΌ βΌ
Answer Similarity Question Relevance Concept Coverage
(S_answer) (S_question) (S_concept)
β β β
ββββββββββββββββββββββββΌβββββββββββββββββββββββ€
βΌ βΌ
Reference Similarity Lexical Similarity
(S_reference) (S_lexical)
β β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββ
βΌ
TOP-K
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββ
βΌ βΌ βΌ
Knowledge Passages Expert Exemplars Misconceptions
(Collection B) (Collection A) (Collection C)
β β β
ββββββββββββββββββββββββΌβββββββββββββββββββββββ
βΌ
EVIDENCE BUILDER
β
βΌ
LLM GRADER
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββ
βΌ βΌ βΌ
Score / Grade Concept Analysis Misconceptions
β β β
ββββββββββββββββββββββββΌβββββββββββββββββββββββ
βΌ
MISSING CONCEPTS
β
βΌ
EXPLAINABLE FEEDBACK
β
βΌ
PERSONALIZED RECOMMENDER
(Topic, Review, Example, Practice)
β
βΌ
FINAL STRUCTURED JSONπ 3. Empirical Research Results & Baseline Comparison
All experiments were evaluated on an unseen, stratified 15% test set of the SciEntsBank benchmark. To ensure complete integrity, the test set was never indexed in FAISS or used for hyperparameter tuning.
Experiment 1: Baseline Comparison Table
Experiment 4: Top-K Sensitivity Curve
Experiment 6: Component Ablation Study
Experiment 9: Multilingual Evaluation (English / Hindi / Punjabi)
π» 4. Installation & Environment Setup
All files, caches, and models reside strictly in E:\NLP_Paper_Imple.
1. Clone or Navigate to Project Directory
cd E:\NLP_Paper_Imple\AM-RAG-ASAE2. Activate Virtual Environment
E:\NLP_Paper_Imple\venv\Scripts\Activate.ps13. Verify Dependencies
Dependencies installed in requirements.txt:
torch,transformers,sentence-transformers,faiss-cpu,spacy,nltk,scikit-learn,fastapi,uvicorn,streamlit,langdetect,rank-bm25,matplotlib,seaborn.
π 5. Command-Line Interface (CLI) Usage
The unified CLI run.py supports all lifecycle operations:
Data Preparation & Preprocessing
python run.py --mode prepare-dataFAISS Vector Indexing (Zero Leakage)
python run.py --mode build-indexValidation Weight Optimization
python run.py --mode trainRun Full Research Experiments Suite (Exp 1 - 9)
python run.py --mode experimentsEvaluate a Single Input Response
python run.py --mode evaluate --question "Explain how plants make their own food through photosynthesis." --student_answer "Plants absorb sunlight using chlorophyll and combine carbon dioxide and water to produce glucose sugar while releasing oxygen."Run Automated Unit Tests
python run.py --mode testπ 6. REST API & Web Dashboard
1. Launch FastAPI Backend
python run.py --mode apiAccess interactive OpenAPI documentation at: http://127.0.0.1:8000/docs
Core Endpoints:
GET /health: Service status and collection telemetry.POST /evaluate: Full multi-signal grading, misconception analysis, and recommendations.POST /retrieve: Top-K evidence retrieval with individual signal breakdowns.POST /feedback: Formative pedagogical feedback generation.POST /recommend: 4-part personalized study modules.
2. Launch Interactive Streamlit UI
streamlit run frontend/app.pyUI Features (4 Pages):
- Student Evaluation: Interactive input form with benchmark presets and real-time grading.
- Evaluation Results: Visual score dials, present vs. missing concept tags ($\checkmark / \triangle$), misconception diagnostic alerts ($\times$), and personalized study cards.
- Retrieval Explainability: 5-signal breakdown table ($S{\text{ans}}, S{\text{q}}, S{\text{concept}}, S{\text{ref}}, S_{\text{lex}}$) and interactive composite score chart.
- Research Dashboard: Publication-ready benchmark tables, Top-K sensitivity curves, ablation bar charts, and multilingual cross-lingual metrics.
π 7. Project File Structure
E:\NLP_Paper_Imple\AM-RAG-ASAE\
βββ api\
β βββ main.py # FastAPI REST server
βββ baselines\
β βββ baseline.py # 6 Benchmark Baselines (TF-IDF, SBERT, LLM, Standard RAG)
βββ configs\
β βββ config.yaml # System configurations, models, weights, paths
βββ data\
β βββ data_loader.py # SciEntsBank dataset builder & 70/15/15 stratified splitter
β βββ domains.py # Domain taxonomies, Knowledge & Misconceptions corpus
β βββ train\train.json # Training split (Indexed in FAISS)
β βββ validation\val.json # Validation split (Used for weight tuning)
β βββ test\test.json # Unseen Test split (Strictly evaluated once)
β βββ knowledge\ # Educational knowledge and misconception catalogs
βββ evaluation\
β βββ metrics.py # Classification, Continuous, Retrieval metrics
β βββ leakage_check.py # Zero data leakage assertion suite
β βββ experiments.py # Experiments 1-9 runner
β βββ ablation.py # Component ablation runner
βββ frontend\
β βββ app.py # Streamlit 4-page interactive UI
βββ grading\
β βββ llm_grader.py # Multi-signal evidence builder & structured LLM grader
β βββ feedback.py # Formative feedback generator
β βββ scoring.py # Score normalization & threshold calibrations
βββ nlp\
β βββ preprocessing.py # Unicode NFKC, whitespace, sentence tokenization
β βββ embeddings.py # Sentence-Transformers manager
β βββ concept_extraction.py # spaCy noun chunking & soft semantic coverage
β βββ misconception.py # Diagnostic misconception detector
β βββ language_detection.py # Multilingual detector (EN, HI, PA)
βββ recommendation\
β βββ recommender.py # 4-part personalized learning path recommender
βββ results\
β βββ metrics\ # JSON metric summaries for all experiments
β βββ tables\ # CSV experiment tables for publication
β βββ plots\ # Publication-ready PNG plots
βββ tests\
β βββ test_pipeline.py # 10 automated unit & regression tests
βββ requirements.txt # Package dependencies
βββ .env.example # Environment variable template
βββ README.md # Comprehensive documentation
βββ run.py # Master CLI entrypointπ 8. Citation & Academic Reference
@article{am_rag_asae_2026,
title={Adaptive Multilingual RAG-Based Explainable Automatic Short Answer Evaluation for Personalized Learning},
author={Prateek Dhar Dwivedi},
year={2026},
journal={arXiv preprint},
note={Experimental ASAG Framework with Multi-Signal Reranking and Misconception Diagnosis}
}