An AI-powered system that automatically grades multi-step handwritten math solutions with step-by-step feedback. Combines OCR, symbolic reasoning, and a fine-tuned LLM to evaluate algebraic problems like a human instructor.
Best Major Project Award - IOE Thapathali Campus (2025)
Recognized as one of the best major projects among 12 project in BCT batch 078
![]() |
![]() |
![]() |
![]() |
![]() |
|
Video.Project.4.mp4
- Project Showcase
- Project Recognition
- What It Does
- Key Features
- Dataset
- System Architecture
- Tech Stack
- Training
- Results Showcase
- Quick Start
- Documentation
- Team
- πΈ Reads handwritten math β Converts to digital format using OCR
- β Validates each step β Checks mathematical correctness symbolically
- π Detects errors β Identifies arithmetic mistakes and invalid transformations
- π Awards partial marks β Gives credit for correct steps, even if final answer is wrong
- π¬ Generates feedback β Explains why answers are right or wrong
β¨ Step-by-step validation using symbolic reasoning (SymPy)
β¨ Partial marking algorithm based on solution quality
β¨ Error propagation detection
β¨ Mathematically equivalent answer recognition
β¨ Natural language feedback generation
β¨ Web-based interface for easy image upload
β¨ Supports algebraic simplification, equations, and logarithms
Total Samples: 2,797 question-rubric pairs (after augmentation)
*Bar chart showing distribution across Simplification, Equations, and Logarithms*| Topic | Samples | % | Difficulty |
|---|---|---|---|
| Algebraic Simplification (SIM) | 735 | 26% | Easy, Medium, Hard |
| Algebraic Equations (EQ) | 1286 | 46% | Easy, Medium, Hard |
| Logarithmic Expressions (LOG) | 776 | 28% | Easy, Medium, Hard |

Distribution across difficulty levels within each topic
- Easy (1 mark): ~33% of samples
- Medium (2 marks): ~33% of samples
- Hard (>2 marks): ~34% of samples
| Source | Samples | Type |
|---|---|---|
| NEB Official Exam Papers | 89 | Real exams (2080-2082) |
| Curriculum Development Center (CDC) | 45 | Official guidelines |
| Class 7-10 Textbooks | 78 | Educational materials |
| Reference Problem Sets | 67 | Competitive math resources |
| Original Collected | 219 | Manually verified |
| Augmented via | ||
| - Variable substitution | +450 | x, y, a, b β different vars |
| - Coefficient scaling | +380 | Numeric manipulation |
| - Structural variations | +340 | Reordered polynomials |
| - Factorization templates | +468 | Standard patterns |
| - Exponent law templates | +340 | Power rules |
Data Pipeline: Collection β OCR Extraction β Manual Verification β Cleaning β Augmentation β 2,797 final samples
*Complete system architecture showing data flow from input image to final output*What to show here:
- Block diagram from your Project Report (Figure 4-1)
- Shows: Image β OCR β Parser β Validation β LLM β Output
- Visual representation of how all components connect
Handwritten Image
β
[Mathpix OCR] βββ LaTeX Format
β
[Regex Preprocessing] βββ Clean Steps
β
[SymPy Parser] βββ Symbolic Objects
β
[Symbolic Reasoning Engine] βββ Step Validation
β
[DeepSeekMath-7B] βββ Rubric Generation
β
[LLM Marking Engine] βββ Score + Feedback
Key Components:
- Symbolic Engine: Ensures mathematical correctness
- LLM: Generates human-like explanations & rubrics
- Partial Marking: Rewards partial progress algorithmically
| Layer | Technology |
|---|---|
| Backend | Python, Flask, SymPy, DeepSeekMath-7B |
| Frontend | React, Tailwind CSS |
| ML/AI | PyTorch, Hugging Face, LoRA fine-tuning |
| OCR | Mathpix API |
| Infrastructure | Google Colab |
Training Configuration:
- Model: DeepSeekMath-7B with LoRA (rank 32)
- Dataset: 2,237 training samples (80%)
- Epochs: 5 with early stopping
- Optimizer: AdamW (lr=0.0005)
- Batch Size: 32

Training and validation loss convergence over 5 epochs
| Metric | Score | Details |
|---|---|---|
| OCR Accuracy | 95% | Character error rate on clear handwriting |
| Symbolic Validation | 100% | Step-by-step mathematical correctness |
| Partial Marking Accuracy | 90% | Alignment with human rubrics |
| Parse Success Rate | 98% | Valid JSON output generation |
| Model Convergence | β | Stable training with minimal overfitting |
These are actual output examples from the system when grading different solutions:

Perfect solution (3/3 marks) - All steps correct, full feedback provided
What's shown: Input math image β Output: Full marks, positive feedback, congratulatory message

Partial credit (3.25/4 marks) - Some steps correct, some wrong, detailed error analysis
What's shown: Input math image β Output: Partial marks, error highlighting, which step went wrong

Error detection (0/2 marks) - Critical error caught, learning feedback provided
What's shown: Input math image β Output: zero marks, explanation of where calculation failed, suggestions
Key Achievements:
- β Detects arithmetic errors in intermediate steps
- β Recognizes mathematically equivalent forms
- β Provides step-specific feedback and error propagation analysis
- β Maintains consistency in grading
- Python 3.8+
- Node.js 14+
- Mathpix API key (get one here)
# Clone repository
git clone https://github.com/yourusername/math-autograder.git
cd math-autograder
# Backend setup
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
# Set environment variables
cp .env.example .env
# Edit .env with your Mathpix credentials
# Run backend
flask --app run run
# In another terminal: Frontend setup
cd frontend
npm install
npm startOpen http://localhost:3000 β Upload image β Get instant marks + feedback
π Full Technical Details: See Project_Report.pdf
- Complete methodology & algorithm details
- Dataset construction (2,797 NEB exam samples)
- Model fine-tuning process (LoRA)
- Comprehensive evaluation metrics
- Implementation code snippets
- Detailed results analysis
- Future improvements roadmap
| Name | Roll |
|---|---|
| Prajwal Chaudary | THA078BCT028 |
| Jesis Upadhayaya | THA078BCT017 |
| Purushottam Gajurel | THA078BCT032 |
| Sagar Bikram Adhikari | THA078BCT037 |
Supervisor: Asst. Prof. Suwarna Lingden
Institution: Institute of Engineering, Tribhuvan University (2025)
MIT License - see LICENSE file
β If this project helped you, please star it on GitHub!






