How tanaz-i/adaptive-questioning-agent works
Purpose and Entry Points
Adaptive-Questioning-Agent is an intelligent assessment system: it ingests learning documents, derives a semantic topic/knowledge base, generates and evaluates questions, and adapts future questions using reinforcement learning. Likely application entry points are app.py, main.py, and simulation runners run_simulation.py / run_simulation1.py. Browser UI assets are served from templates/index.html, templates/upload.html, templates/report.html, and static/.
Document-to-Knowledge Ingestion
The NLP pipeline transforms uploaded/source material into structured instructional knowledge. NLP/image_processing.py and root Img2Table.py cover image/table extraction boundaries; NLP/topic_extraction.py identifies topics; NLP/enrich_metadata.py augments their metadata. NLP/knowledge_base_construction.py is the central construction stage, with canonical_topics.json providing a persistent canonical topic vocabulary.
Semantic Knowledge and Retrieval
Topic relationships are represented in NLP/concept_graph.py, forming the semantic structure used to guide assessment and recommendations. Retrieval-augmented querying is exposed through NLP/rag_query_engine.py, while question-generation retrieval is localized in NLP/Q_Generator_A_Evaluator/retrieval_engine.py. This boundary separates corpus/graph-derived context selection from LLM-style generation and learner-policy decisions.
Question, Answer, and Reward Pipeline
The assessment layer creates questions in NLP/Q_Generator_A_Evaluator/question_generator.py, scores learner responses in answer_evaluator.py, and converts outcomes into feedback/reward signals in reward_module.py. Embedding-based evaluation is handled by evaluate_embedding.py; metadata validation is in check_metadata.py. llm_as_judge.py indicates an additional external-model judging path. The resulting correctness/mastery signals drive learner-state updates and RL transitions.
Adaptive Learning Policy
Two RL implementations model personalized sequencing. The baseline/adaptation stack contains Adaptation_RL/Agent.py, Adaptation_RL/MDP.py, Adaptation_RL/policy_network.py, and Adaptation_RL/knowledge_state.py. A PPO variant is isolated in PPO_RL/PPOAgent.py, PPO_RL/MDP.py, and PPO_RL/actor_critic_network.py. Both treat topic, difficulty, question type, and estimated learner knowledge as state/action dimensions; PPO introduces actor-critic policy optimization.
Simulation and Evaluation Boundary
Learner behavior is simulated rather than requiring live users through Adaptation_RL/student_simulator.py / Adaptation_RL/Simulator.py and equivalent PPO modules. Adaptation_RL/evaluate.py evaluates adaptation outcomes. Persisted run outputs in simulation_results/strong_session_log.json, simulation_results/weak_session_log.json, and summary files support comparison across modeled learner strengths.
Delivery and External Data
The repository is Python-centric, with a server-rendered web interface implied by app.py, templates/, and static/. Online_Courses.csv is an external learning-material catalog used by recommendation functionality in NLP/recommend_material.py. Embeddings, retrieval, and LLM-as-judge components imply dependencies on model/embedding services, though provider configuration is not present in the supplied tree.
Main entry points: question_generator.py Question generator · reward_module.py Reward module · Agent.py Adaptation RL agent · student_simulator.py Student simulator
Components 20
Delivery
- Web app · Serves the assessment workflow.
app.py - Browser UI
templates/index.html
Knowledge Ingestion
- Learning documents
- Image & table extraction
NLP/image_processing.py - Topic extraction
NLP/topic_extraction.py - Knowledge-base construction · Builds structured instructional knowledge and metadata.
NLP/knowledge_base_construction.py - Canonical topics
canonical_topics.json - Concept graph · Represents topic relationships for assessment guidance.
NLP/concept_graph.py - Course catalog · Recommendation material source.
Online_Courses.csv
Assessment
- RAG query engine
NLP/rag_query_engine.py - Question retrieval
NLP/Q_Generator_A_Evaluator/retrieval_engine.py - Question generator
NLP/Q_Generator_A_Evaluator/question_generator.py - Answer evaluator
NLP/Q_Generator_A_Evaluator/answer_evaluator.py - Reward module · Converts outcomes into correctness and mastery signals.
NLP/Q_Generator_A_Evaluator/reward_module.py
Adaptive Policy
- Adaptation RL agent · Selects topics, difficulty, and question types from learner state.
Adaptation_RL/Agent.py - Learner knowledge state
Adaptation_RL/knowledge_state.py - PPO agent · Alternative policy optimization implementation.
PPO_RL/PPOAgent.py
Simulation & Evaluation
- Student simulator
Adaptation_RL/student_simulator.py - Adaptation evaluation
Adaptation_RL/evaluate.py - Session logs · Stores strong and weak learner simulation outcomes.
simulation_results/strong_session_log.json
Connections 22
- Web app → Browser UI: renders
- Browser UI → Learning documents: submits
- Learning documents → Image & table extraction: extracts content
- Image & table extraction → Topic extraction: provides text
- Topic extraction → Knowledge-base construction: derives topics
- Canonical topics → Knowledge-base construction: normalizes topics
- Knowledge-base construction → Concept graph: builds relationships
- Concept graph → RAG query engine: semantic context
- RAG query engine → Question retrieval: retrieval context
- Question retrieval → Question generator: grounds questions
- Adaptation RL agent → Question generator: selects next question
- PPO agent → Question generator: alternative selection
- Question generator → Answer evaluator: question and response
- Answer evaluator → Reward module: scores
- Reward module → Learner knowledge state: updates mastery
- Learner knowledge state → Adaptation RL agent: policy state
- Reward module → PPO agent: training reward
- Student simulator → Answer evaluator: simulated responses
- Adaptation RL agent → Student simulator: assigned questions
- Adaptation evaluation → Session logs: writes results
- Student simulator → Adaptation evaluation: simulation outcomes
- Course catalog → RAG query engine: recommendation material