โ๏ธ Multilingual Exam Review Agent
exam_checker_agent โ Auto question splitting + per-question routed detection + four-stage image-text review + three-way plagiarism + measurable evaluation; production batch-processing rewrite
Overview
A production-grade rewrite of exam_smart_checker, upgrading the single-user Streamlit tool
into a multi-user concurrent web platform with batch task management, a 5-step automated review
pipeline, and result download capabilities.
Tech Stack
Architecture
backend/app/routers/โ FastAPI routing layerbackend/app/services/โ business logic layerbackend/app/repositories/โ data access layer (SQLite)backend/app/domain/โ task state machine definitionbackend/api_server.pyโ legacy Flask service (WSGI in-process)frontend/โ React frontendrun.pyโ unified entry point, port 8777Dockerfile/deploy.sh
Core Algorithms / Key Design
1. Dual Web Framework WSGI In-Process Fusion
FastAPI serves as the primary server. LegacySmartCheckerService.dispatch() routes
/api/v1/* to the Flask WSGI app in-process, achieving a smooth migration that preserves
legacy capabilities with zero extra network hops.
2. 5-Step Task State Machine
Each review task progresses through five serial stages:
parse โ review โ internal_plag โ cross_plag โ history_plag.
Optimistic locking prevents concurrent conflicts. A heartbeat mechanism automatically detects
and recovers stale tasks (running tasks that miss heartbeat deadlines).
3. AppRuntime Dependency Injection Container
A unified AppRuntime singleton manages the lifecycle of all service instances.
FastAPI's DI system retrieves Repositories, Services etc. through it, eliminating global state.
4. X-Client-Id Multi-Tenant Isolation
Every request carries a X-Client-Id header. Task queries and result reads are scoped
to the corresponding client owner, preventing cross-institution data leakage.
5. Dynamic Multilingual Prompt Selection
A language detection module identifies the exam language (zh/ja/de/fr) and dynamically loads the corresponding LLM review prompt, enabling multilingual support within a single system.
Innovations / My Contributions
- Designed the overall batch platform architecture (FastAPI + SQLite + React full-stack)
- Implemented the FastAPI โ Flask WSGI in-process bridge, preserving legacy capabilities at zero migration cost
- Designed the 5-step task state machine with optimistic locking and heartbeat zombie recovery
- Built the
AppRuntimeDI container for unified service lifecycle management - Implemented
X-Client-Idper-client data isolation - Wrote Docker image and one-command deployment scripts
โ Image Review: Four-Stage Multimodal Pipeline
Image-text consistency (a figure whose labels contradict the question, or the wrong figure entirely) is the hardest, highest-value part of review. VLMs often "describe the image fluently yet miss the key anchor". The pipeline:
Agent or Workflow? (an honest take)
It is a deterministic multi-stage pipeline with two constrained LLM decision points:
routing (which checks to run per question; missing key = false, fail-closed) and
error aggregation (keep / merge / delete; error_type locked, failures fall back without dropping errors).
The LLM never drives control flow or self-replans โ the philosophy is "use reproducible rules wherever possible,
reserve the LLM for genuine semantic judgment, and constrain its output space to the minimum". Positioned honestly
as a reliable LLM-in-the-loop workflow, with a clear path toward a more agentic form.
Screenshots