AI Adaptive Quiz Platform
A full-stack adaptive testing platform leveraging Item Response Theory (IRT) and local LLM integration via Ollama for dynamic skill assessment.

Overview
Traditional e-learning platforms rely on linear testing models with a “one-size-fits-all” approach, which often leaves advanced students unchallenged and overwhelms beginners[cite: 1]. This project implements a hybrid adaptive testing system that combines psychometric measurement models with a local generative AI model to personalize evaluations and adjust question difficulty in real time based on the student’s proficiency[cite: 1]. Beyond dynamic scoring, the system acts as a virtual tutor, providing immediate, context-aware feedback when incorrect responses are submitted[cite: 1].
Core Features & Architecture
To ensure scalability, maintainability, and a strict separation of responsibilities, the application follows the MVC (Model-View-Controller) architecture deployed on a Jakarta EE server[cite: 1].
- View Layer (Web Pages): Developed using HTML, CSS, JavaServer Pages (JSP), and JSTL, featuring three primary interfaces[cite: 1]:
index.jsp: The main entry point where users select a quiz[cite: 1].quiz.jsp: The dynamic evaluation interface displaying adaptive questions and AI-driven feedback[cite: 1].result.jsp: The final dashboard displaying overall grades, score statistics, and proficiency levels[cite: 1].
- Controller Layer (
com.mycompany.adaptivetest.servlet): Manages HTTP request routing and workflow orchestration[cite: 1]:HomeServlet: Handles initial user routing and quiz selection[cite: 1].QuizServlet: Coordinates the adaptive testing lifecycle, user state initialization, response processing, and session management[cite: 1].AIStreamingServlet: Implements Server-Sent Events (SSE) to push asynchronous, progressive AI feedback to the frontend in real time[cite: 1].
- Logic Layer (
com.mycompany.adaptivetest.logic): Serves as the computational center for psychometric evaluations and AI interactions[cite: 1]:PsychometricEngine: Implements Item Response Theory (IRT) mathematics, including the 1PL Rasch probability functions and the Newton-Raphson iterative algorithm for real-time ability ($\theta$) recalculation[cite: 1].AnswerValidator: Validates single and multiple-choice answers using a strict “all-or-nothing” rule to preserve dichotomous data ($0$ or $1$) required by the probabilistic assumptions of the IRT model[cite: 1].AIService: Manages communication with the local generative AI model (Gemma 3 via Ollama) to build dynamic prompts and generate concise explanations for errors[cite: 1].
- Data Access Layer (
com.mycompany.adaptivetest.dao): Encapsulates database operations using the DAO pattern and HikariCP connection pooling[cite: 1]:QuestionDAO,QuizDAO,ResponseDAO, andUserDAO: Manage entity CRUD operations[cite: 1].QuestionDAO: Specifically queries questions dynamically based on the user’s current ability parameter[cite: 1].DBUtil: Centralizes SQLite JDBC configuration and HikariCP connection management[cite: 1].
- Domain Models (
com.mycompany.adaptivetest.model): Contains POJO entities (Quiz,Question,Option) alongsideUserState, a session model that tracks response history, traversed difficulties, and real-time $\theta$ ability scoring[cite: 1].
Database Design
The application utilizes SQLite to eliminate dedicated server complexity while supporting adaptive workflows through six interconnected tables[cite: 1]:
users: Stores user profiles and the current latent ability parameter ($\theta$), which is updated at the end of each session[cite: 1].quizzes: Defines test structures, subjects, and minimum question thresholds[cite: 1].questions: Represents the core of the adaptive system, containing item content and the difficulty parameter ($\beta$)[cite: 1].question_options: Holds answer choices associated with questions and explicitly flags correct options[cite: 1].user_responses: Records individual question outcomes and intermediate $\theta$ estimations[cite: 1].
Difficulty Adaptation Algorithm (Item Response Theory)
To avoid the risks of logic errors, latency, and model drift associated with delegating evaluation logic to generative AI, the platform implements a deterministic statistical algorithm based on Item Response Theory (IRT)[cite: 1].
- Probability Function (Item Characteristic Curve - ICC):
Implemented in
PsychometricEngine.calculateProbability, the 1-parameter logistic (1PL) Rasch model calculates the probability $P$ that a student with latent ability $\theta$ answers a question of difficulty $\beta$ correctly[cite: 1]: $$P(\theta, \beta) = \frac{1}{1 + e^{-(\theta - \beta)}}$$[cite: 1] - Ability Update via Newton-Raphson:
To estimate unobservable latent ability via Maximum Likelihood Estimation (MLE), the iterative Newton-Raphson algorithm calculates[cite: 1]:
- First Derivative (Score function): Sum of differences between real responses ($u \in {0, 1}$) and theoretical probabilities ($P$)[cite: 1]: $$L’ = \sum_{j=1}^{N} (u_j - P_j)$$[cite: 1]
- Second Derivative (Fisher Information): Sum of probability variances[cite: 1]: $$L’’ = \sum_{j=1}^{N} P_j(1 - P_j)$$[cite: 1]
- Iterative correction delta $\delta = \frac{L’}{L’’}$ is applied to update $\theta$[cite: 1].
- Algorithmic Optimizations: Iterations are capped at a strict maximum of 10, with early stopping if delta drops below $0.001$[cite: 1]. To prevent divergence for extreme scores, the final Logit scale score is restricted to the interval $[-4.0, 4.0]$[cite: 1].
Virtual AI Assistant
For formative feedback, the system integrates the Gemma 3 generative AI model running locally via Ollama[cite: 1]. When an incorrect answer is detected, AIService constructs a dynamic prompt containing the subject, question statement, student’s incorrect selection, and the correct answer, prompting the model to generate a concise second-person explanation accompanied by relevant bibliographic references[cite: 1].