Skip to content

amritanshuroy28/gradeops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GRADEOPS - AI-Powered Exam Grading System

A production-ready Human-in-the-Loop (HITL) grading pipeline using Vision-Language Models (VLMs) and Agentic LLMs to evaluate scanned exams against strict rubrics, with Teaching Assistant (TA) review dashboards for rapid approval or override.

Deployed Links

Features

  • AI-Powered Grading: Vision models extract handwritten text, LLM agents grade against rubrics
  • Role-Based Access: Instructors upload exams, TAs review AI grades, Admins monitor systems
  • Partial Credit Support: Structured rubrics with configurable criteria and point allocation
  • Plagiarism Detection: Semantic similarity checking across exam responses
  • Real-Time Dashboard: TAs rapidly review AI grades with keyboard shortcuts
  • Comprehensive Logging: Full system observability with logs and monitoring endpoints
  • Scalable Architecture: Docker-ready with PostgreSQL backend and async processing

Quick Start

Prerequisites

  • Docker & Docker Compose (recommended)
  • Python 3.11+ (for local development)
  • Node.js 20+ (for frontend development)

Using Docker (Recommended)

docker-compose up --build

Access:

Local Development Setup

Backend:

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload

Frontend:

cd frontend
npm install
npm run dev

Architecture

Backend Stack

  • FastAPI: Modern async Python web framework
  • SQLAlchemy: ORM for database management
  • Pydantic: Data validation and settings
  • PyMuPDF: PDF processing and image extraction
  • NVIDIA NIM: Cloud-based VLM and LLM inference
  • Sentence-Transformers: Semantic similarity for plagiarism detection

Frontend Stack

  • React 19: Modern UI framework
  • TypeScript: Type-safe development
  • Tailwind CSS: Utility-first styling
  • Vite: Fast build tool and dev server

Database

  • SQLite (development): Embedded database for quick iteration
  • PostgreSQL (production): Scalable relational database

API Endpoints

Authentication

  • POST /auth/login - Mock login endpoint

Configuration

  • POST /config/course/ - Create course
  • GET /config/course/ - List courses
  • POST /config/exam/ - Create exam
  • GET /config/exam/ - List exams
  • POST /config/rubric/ - Create grading rubric
  • GET /config/rubric/exam/{exam_id} - Get exam rubrics
  • PUT /config/rubric/{rubric_id} - Update rubric
  • DELETE /config/rubric/{rubric_id} - Delete rubric

Upload

  • POST /upload/submission/ - Upload exam PDF (auto-triggers grading)
  • GET /upload/submission/{submission_id} - Get submission details
  • GET /upload/exam/{exam_id}/submissions - List exam submissions

Grading

  • POST /grade/{answer_id}/trigger - Manually trigger grading
  • GET /grade/status/{answer_id} - Check grading status
  • POST /grade/batch/trigger - Batch grading trigger

Review

  • GET /review/pending - Get pending answers for TA review
  • GET /review/pending-count - Count pending reviews
  • POST /review/{answer_id}/approve - Approve AI grade
  • POST /review/{answer_id}/override - Override AI grade with comments
  • GET /review/plagiarism-check/{exam_id} - Check plagiarism across exam
  • GET /review/{answer_id}/details - Get full answer details

Monitoring

  • GET /health - Health check with storage stats
  • GET /monitor/stats - System statistics
  • GET /monitor/submissions-by-status - Status breakdown
  • GET /monitor/exam-summary/{exam_id} - Exam analytics

Configuration

Environment Variables

Create .env in the backend directory:

DATABASE_URL=sqlite:///./gradeops.db
DEBUG=true
API_TITLE=GRADEOPS API

# NVIDIA NIM Configuration
NVIDIA_NIM_API_KEY=your-api-key-here
VLM_MODEL=nvidia/llama-32-vision
LLM_MODEL=nvidia/llama-3.1-70b-instruct

SIMILARITY_THRESHOLD=0.85
LOG_LEVEL=INFO

Getting NVIDIA NIM API Key

  1. Visit NVIDIA Cloud Console
  2. Create or sign in to your account
  3. Navigate to API Keys section
  4. Generate a new API key for NVIDIA NIM
  5. Add it to your .env file as NVIDIA_NIM_API_KEY

Available NVIDIA NIM Models

  • VLM Models (Vision-Language for text extraction):

    • nvidia/llama-32-vision - Recommended for exam document analysis
  • LLM Models (Language models for grading logic):

    • nvidia/llama-3.1-70b-instruct - Recommended for exam grading
    • nvidia/mistral-large - Alternative option
    • nvidia/nemotron-4-340b-instruct - High accuracy option

Database Schema

  • User: Instructors and TAs
  • Course: Manages exams
  • Exam: Container for submissions and rubrics
  • Rubric: Grading criteria per question
  • Submission: Student exam submission
  • Answer: Individual question response with AI grade
  • Review: TA review record with overrides

Workflow

  1. Instructor: Uploads exam PDF + defines rubric criteria
  2. System: Extracts images, triggers AI grading pipeline
  3. AI Engine: Extracts text with VLM, grades with LLM agent
  4. TA Dashboard: Reviews AI grades with extracted text and justification
  5. TA Actions: Approve grade or override with comments
  6. Admin: Monitor progress via analytics dashboard

Keyboard Shortcuts (TA Dashboard)

  • Enter - Approve current answer and move to next
  • / - Navigate between answers
  • Auto-refresh polls every 5 seconds

Performance

  • Handle 100+ exam uploads per session
  • Process 500+ pages through OCR
  • Grade 1000+ answers in batch mode
  • Real-time TA dashboard with <1s response times

Deployment

Docker Compose (Local/Dev)

docker-compose up

Production Considerations

  • Use PostgreSQL instead of SQLite
  • Set DEBUG=false and LOG_LEVEL=WARN
  • Configure reverse proxy (nginx) for CORS
  • Add authentication (JWT tokens)
  • Enable HTTPS
  • Set up proper logging aggregation
  • Configure resource limits for GPU models

Development

Running Tests

cd backend
pytest

Code Structure

gradeops/
├── backend/
│   ├── main.py              # FastAPI app
│   ├── models.py            # SQLAlchemy ORM models
│   ├── schemas.py           # Pydantic schemas
│   ├── database.py          # DB configuration
│   ├── config.py            # Settings management
│   ├── logger.py            # Logging setup
│   ├── ai_engine.py         # VLM + LLM grading logic
│   ├── utils.py             # PDF processing utilities
│   └── routers/
│       ├── upload.py        # File upload endpoints
│       ├── grade.py         # Grading endpoints
│       ├── review.py        # TA review endpoints
│       ├── config.py        # Configuration endpoints
│       └── monitor.py       # Admin monitoring
├── frontend/
│   ├── src/
│   │   ├── App.tsx          # Main app
│   │   ├── components/
│   │   │   ├── UploadPortal.tsx      # Instructor interface
│   │   │   ├── ReviewDashboard.tsx   # TA dashboard
│   │   │   └── AdminDashboard.tsx    # Admin dashboard
│   │   └── main.tsx
│   └── index.html
├── docker-compose.yml
└── README.md

Future Enhancements

  • Real VLM integration (Qwen-VL 7B, Claude Vision)
  • Actual LLM grading with function calling
  • Semantic plagiarism detection with threshold tuning
  • Batch processing with Celery + Redis
  • Email notifications for instructors
  • Export grades to CSV/LMS integration
  • Student appeal workflow
  • Mobile app for TA reviews
  • Advanced analytics and fairness metrics
  • Multi-language support

License

MIT License

Support

For issues or questions, please refer to the API documentation at /docs

About

AI exam grading system with VLM/LLM

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors