CoolFace
Apppublic

Natarajan-Networks/grading-env

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes
App README

EduEval โ€” Automated Answer Sheet Grading Environment

An OpenEnv-compatible reinforcement learning environment for training and evaluating AI agents on automated answer sheet grading tasks.

๐ŸŽฏ Motivation

Manual grading of student answer sheets is time-consuming, inconsistent, and does not scale. EduEval provides a structured RL environment where an AI agent learns to grade three distinct types of student answers โ€” factual, conceptual, and essay โ€” matching human expert graders across varying complexity levels.

๐ŸŒ Environment Description

EduEval simulates a real-world educational grading pipeline with 3 distinct grading tasks. Each task requires a different grading strategy:

  • โ€”Task 1 (Factual): Objective questions with clear right/wrong answers
  • โ€”Task 2 (Conceptual): Questions requiring partial credit based on concept coverage
  • โ€”Task 3 (Essay): Complex descriptive answers requiring holistic evaluation

Each episode randomly selects 3 questions from a pool of 10, making every episode unique and preventing overfitting.

๐Ÿ“ Action Space

FieldTypeRangeDescription
marks_awardedfloat0.0 โ€“ 1.0Marks given to the student answer

๐Ÿ‘๏ธ Observation Space

FieldTypeDescription
question_textstringThe exam question being graded
student_answerstringThe student's response
answer_keystringThe correct reference answer
answer_summarystringSummary of student answer quality
semantic_similarityfloatKeyword-based similarity score (0.0-1.0)
concept_coveragefloatHow well key concepts are covered (0.0-1.0)
question_numberintCurrent question number in episode
total_questionsintTotal questions in episode (always 3)
max_marksfloatMaximum marks for this question
task_idintTask type (1=factual, 2=conceptual, 3=essay)
doneboolWhether episode is complete

๐Ÿ“‹ Tasks

Task 1 โ€” Factual Grading (Easy)

Grade objective factual questions with clear right or wrong answers. The agent must identify whether the student answer matches the correct answer and award full or zero marks with strict accuracy.

Example:

  • โ€”Question: "What is the chemical formula for water?"
  • โ€”Student Answer: "H2O"
  • โ€”Expected Mark: 1.0

Task 2 โ€” Conceptual Grading (Medium)

Grade concept-based answers requiring partial credit scoring. The agent must evaluate how well the student covers key concepts and award graduated marks based on concept coverage.

Example:

  • โ€”Question: "Explain how vaccines work."
  • โ€”Student Answer: "Vaccines introduce weak viruses so the immune system learns to fight them."
  • โ€”Expected Mark: 0.8 (covers main idea but misses immunological memory)

Task 3 โ€” Essay Grading (Hard)

Grade complex descriptive essays requiring holistic evaluation of content accuracy, concept coverage, and critical analysis depth.

Example:

  • โ€”Question: "Critically analyze the impact of the Industrial Revolution."
  • โ€”Student Answer: "The Industrial Revolution changed working conditions and urbanization..."
  • โ€”Expected Mark: 0.65 (partial coverage, lacks critical analysis depth)

๐Ÿ† Reward Functions

Task 1 โ€” Factual (Strict)

AccuracyReward
Exact match1.0
diff โ‰ค 0.10.7
diff โ‰ค 0.20.4
diff โ‰ค 0.30.2
diff > 0.30.0

Task 2 โ€” Conceptual (Graduated)

AccuracyReward
Exact match1.0
diff โ‰ค 0.10.85
diff โ‰ค 0.20.6
diff โ‰ค 0.30.4
diff > 0.40.0

Task 3 โ€” Essay (Holistic)

AccuracyReward
Exact match1.0
diff โ‰ค 0.10.8
diff โ‰ค 0.20.6
diff โ‰ค 0.30.4
diff > 0.40.0

All tasks include:

  • โ€”Penalty of -0.4 for extreme over-grading
  • โ€”Penalty of -0.4 for extreme under-grading
  • โ€”Bonus of up to +0.1 for semantic signal alignment
  • โ€”Bonus of +0.05 for consecutive accurate gradings

๐Ÿš€ Setup & Usage

Run locally

bash
git clone https://github.com/natarajannetworks/edueval-grading-env
cd edueval-grading-env
pip install -r requirements.txt
set PYTHONPATH=src  # Windows
# export PYTHONPATH=src  # Linux/Mac
uvicorn src.envs.grading_env.server.app:app --reload

Run inference

bash
export HF_TOKEN=your_huggingface_token
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
python inference.py

Run with Docker

bash
docker build -t edueval .
docker run -p 7860:7860 -e HF_TOKEN=your_token edueval

๐Ÿ“Š Baseline Scores

Scores from running inference.py with Qwen/Qwen2.5-72B-Instruct:

TaskTypeAvg RewardStepsSuccess
Task 1Factual0.973โœ… true
Task 2Conceptual0.883โœ… true
Task 3Essay0.773โœ… true

๐Ÿ”— API Endpoints

EndpointMethodDescription
/reset?task_id=1POSTStart new episode
/step?task_id=1POSTSubmit grading action
/state?task_id=1GETGet current state
/healthGETHealth check
/docsGETInteractive API docs

๐Ÿ—๏ธ Project Structure

edueval-grading-env/
โ”œโ”€โ”€ inference.py              # Baseline inference script
โ”œโ”€โ”€ Dockerfile                # Container configuration
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ”œโ”€โ”€ openenv.yaml             # OpenEnv metadata
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ data/sample_papers/  # Question banks (10 questions each)
    โ”‚   โ”œโ”€โ”€ task1_easy.json  # Factual questions
    โ”‚   โ”œโ”€โ”€ task2_medium.json # Conceptual questions
    โ”‚   โ””โ”€โ”€ task3_hard.json  # Essay questions
    โ””โ”€โ”€ envs/grading_env/
        โ”œโ”€โ”€ models.py        # Pydantic models
        โ””โ”€โ”€ server/
            โ”œโ”€โ”€ app.py       # FastAPI application
            โ””โ”€โ”€ environment.py # Core RL environment