AI Batch Inference · Async Pipeline

Answer Sheet Management
AI evaluation pipeline

End-to-end orchestration: ZIP upload → JSONL batching → Gemini/OpenAI → human validation → publish. Enterprise-grade accuracy.

ZIP
Pages
JSONL
AI Batch
Grades
async polling · human review state machine

Why institutions switch to AI batch grading

Time‑consuming manual work

Teachers spend weeks evaluating thousands of answer sheets → delayed results & burnout.

High cost per exam

Hiring extra evaluators, overtime payments, logistics — up to 73% savings with AI.

Unconscious bias & errors

Human fatigue leads to inconsistent marks. AI applies the same rubric to every sheet.

Our solution: AI Batch Pipeline

Upload ZIP → AI processes in background → results ready for teacher review in 24–48h.

System architecture

Next.js 16 · Frontend

  • Role-aware dashboard
  • ZIP upload wizard + mapping UI
  • Real-time batch status

FastAPI · Backend

  • Auth, RBAC middleware
  • JSONL builder / pdf_service
  • Batch poller (async + provider adapters)

MongoDB + S3-like storage

  • answer_sheets, batch_jobs, gradings
  • Raw PDFs + page PNGs + JSONL artifacts
  • audit logs, override history
JWT REST / WebSocket GridFS + local
core pipeline

End-to-end workflow

Scroll to activate — 10 stages from class setup to student results

1
Setup phase

Admin creates classes, subjects, CSV import students. RBAC enforced.

2
Answer key + samples

Manual entry or AI extraction from PDF. Sample sheets (full/partial marks) embedded in each JSONL.

3
ZIP upload

Bulk PDF upload, auto-extract, rasterize pages (150DPI), store page-by-page.

4
Mapping UI

Teacher reviews pages, fixes student metadata, deletes wrong pages → status mapped.

5
JSONL generation

Build batch with system prompt + answer key + student images + sample sheets → ready for AI.

6
Submit to batch API

Provider: Gemini or OpenAI. Batch job status → submitted → in_progress.

7
Async polling (24-48h)

Background poller checks every 5 min. UI notifications, no email spam.

8
Ingestion & validation

Parse output.jsonl, jsonSchema validate, upsert gradings. Failed items marked.

9
Teacher review / override

Dynamic form from result schema, adjust marks, log override trail. Status → reviewed/overridden.

10
Publish to students

One-click bulk publish → students see detailed marks & feedback (read-only).

How the AI batch engine works

From paper stacks to final marks — fully automated, teacher in the loop.

1
Setup exam & answer key

Teacher creates exam, uploads answer key PDF (or uses AI extraction). Attaches marking schema.

2
Bulk upload answer sheets

Zip all scanned answer sheets (PDF/JPEG) and upload. System pages are automatically processed.

3
AI batch evaluation (async)

System builds a batch and sends to Gemini/OpenAI. Background processing, no manual intervention.

4
Teacher review & override

Human‑in‑the‑loop: verify AI scores, adjust marks (audit logged), approve final grades.

5
Publish & student access

One click publish — students instantly see detailed marks, feedback and question analysis.

ZIP → pages
JSONL batch
AI processing
results ready

From weeks → hours

AI batch processes 5000 answer sheets in under 48 hours – teacher reviews only 10% of them.

73% lower cost

No extra examiners, no overtime, no paper shuffling – automated evaluation saves budgets.

Fair & consistent

Same rubric applied to every answer. No fatigue, no unconscious bias, full audit trail.

Asynchronous batch intelligence

Submit thousands of answer sheets once — AI processes in background. Poller fetches results, ingests, validates against dynamic JSON schema.

Provider agnostic
Auto-retry & failure handling
batch processing
submitted → in_progress completed failed (schema mismatch)

Batch job & sheet lifecycle

Batch_jobs status

draft review submitted in_progress
completed failed

Answer sheet state flow

pending_mappingmappedjsonl_readyin_batchgradedreviewed/overriddenpublished
* transitional exceptions: skipped / failed

Human-in-the-loop grading UI

sheet preview
Student: Riya Mehta Roll: 24AI graded
Q1 (5 marks)
4/5
Q2 (10 marks)
8.5/10
Total awarded12.5 / 15

* Override logs stored with diff, full audit trail

Role-based access control

Admin

Full system control, manage all teachers, classes, global schemas

Teacher

Create exams, upload sheets, grade reviews, publish results for own classes

Student

View published results, per-question breakdown & feedback

JSONL construction & validation

{"custom_id": "sheet_742", "request": {
  "system_instruction": "Handwritten grading...",
  "contents": ["base64: page1.png", "sample_refs"],
  "response_schema": { "$ref": "result-schema.json" }
}}

AI output validated against dynamic JSON schema; per-question awarded marks & feedback extracted.

Hybrid intelligence layer

  • Gemini 2.5 Flash / GPT-4.1 Mini batch endpoints
  • Schema validation & automatic retry on malformed JSON
  • Incremental ingestion with batch_items status tracked

Trust by design

Full audit trail (override_log)
Human review required before publish
Schema validation rejection
Manual rollback ready
99.2%

grading consistency after teacher fine-tuning (internal benchmarks)

Automate evaluation at scale

From ZIP to published results, reduce manual correction by 90%.

⚡ No credit card required · Full API access for batch AI workflows