Skip to main content

A collection of autograders for the grading of Explain in Plain Language (EiPL) questions.

Project description

EiplGrader

Explain in Plain Language Autograder

An automatic grading suite for "Explain in Plain Language" questions

Version License Supported Python versions

⚠️ Research Tool Notice: This is a research tool. Breaking changes between versions are expected.

EiplGrader automatically grades programming assignments where students explain algorithms in natural language. It uses large language models to generate code from student explanations and tests that code against predefined test cases.

Quick Start

pip install eiplgrader

Set up your API keys:

Option 1: Environment Variables

export OPENAI_API_KEY="your-api-key-here"    # For OpenAI models
export META_API_KEY="your-api-key-here"      # For Meta/Llama models
# export ANTHROPIC_API_KEY="your-api-key-here" # Coming soon

Option 2: Using .env file

cp .env.example .env
# Edit .env and add your API keys

Example: Code Generation Based Grading (CGBG)

from eiplgrader.codegen import CodeGenerator
from eiplgrader.tester import CodeTester
import os

# Choose your provider and get the appropriate API key
client_type = "openai"  # or "meta" for Llama, "ollama" for local models
api_key = os.getenv("OPENAI_API_KEY")  # or META_API_KEY for Llama

# Generate code from natural language description
code_generator = CodeGenerator(api_key, client_type=client_type, language="python")
result = code_generator.generate_code(
    student_response="that adds two numbers and returns the result",
    model="gpt-4o",  # or "Llama-4-Maverick-17B-128E-Instruct-FP8" for Llama
    function_name="add_numbers",
    gen_type="cgbg"
)

# Test the generated code
test_cases = [
    {"parameters": {"a": 1, "b": 2}, "expected": 3},
    {"parameters": {"a": -1, "b": 1}, "expected": 0},
    {"parameters": {"a": 0, "b": 0}, "expected": 0}
]

code_tester = CodeTester(
    code=result["code"][0],
    test_cases=test_cases,
    function_name="add_numbers",
    language="python"
)

test_result = code_tester.run_tests()
print(f"Tests passed: {test_result.successes}/{test_result.testsRun}")

Features

  • Multi-language Support: Python, JavaScript, Java, C++, C, Go, Haskell
  • LLM Providers: OpenAI (GPT models), Meta (Llama models), Ollama (local models)
  • Type Inference: Automatic type detection for Python and JavaScript
  • Multiple Generation Modes: CGBG (Code Generation), Function Redefinition, Segmentation
  • Comprehensive Testing: Built-in test runner with detailed results
  • Research-backed: Based on peer-reviewed educational research

Resources

Language Support

Language Type Inference Type Annotations Required
Python ✅ Automatic Optional
JavaScript ✅ Automatic Optional
Java Required
C++ Required
C Required
Go Required
Haskell Required

Supported LLM Providers

Provider Models Status Environment Variable
OpenAI GPT-4o, GPT-4, GPT-4.5, GPT-4.1 ✅ Fully Supported OPENAI_API_KEY
Meta Llama-4-Maverick-17B-128E-Instruct-FP8, Llama-4-Scout-17B-16E-Instruct-FP8, Llama-3.3-70B-Instruct, Llama-3.3-8B-Instruct ✅ Fully Supported META_API_KEY
Ollama codellama:instruct, stable-code:instruct ✅ Fully Supported N/A (local)
Anthropic Claude models 🚧 Coming Soon ANTHROPIC_API_KEY

Planned Features

The following features are planned for future releases:

  • Additional LLM Providers: Anthropic (Claude) support
  • Enhanced Segmentation: Improved mapping between explanations and code
  • Performance Optimizations: Faster test execution and parallel processing
  • Extended Language Support: Rust, TypeScript, and more

Citation

When using this tool, please cite:

@inproceedings{smith2024code,
    author = {Smith IV, David H. and Zilles, Craig},
    title = {Code Generation Based Grading: Evaluating an Auto-grading Mechanism for "Explain-in-Plain-English" Questions},
    year = {2024},
    isbn = {9798400706004},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    url = {https://doi.org/10.1145/3649217.3653582},
    doi = {10.1145/3649217.3653582},
    booktitle = {Proceedings of the 2024 on Innovation and Technology in Computer Science Education V. 1},
    pages = {171–177},
    numpages = {7},
    keywords = {auto-grading, eipe, gpt-4, large language models},
    location = {Milan, Italy},
    series = {ITiCSE 2024}
}

Related Research

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eiplgrader-1.0.0.tar.gz (4.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eiplgrader-1.0.0-py3-none-any.whl (9.1 MB view details)

Uploaded Python 3

File details

Details for the file eiplgrader-1.0.0.tar.gz.

File metadata

  • Download URL: eiplgrader-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.5 Linux/6.15.2-arch1-1

File hashes

Hashes for eiplgrader-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d8231140833536add67a9af2d1d80d975603c69f399215315e58e6d49f06bd7c
MD5 c0adee45b0503a7b9b4c220279eb98a2
BLAKE2b-256 7436e1f58bff32c7769752b70aa233c0f24090140f4d1ef73f7eddca7bd2529c

See more details on using hashes here.

File details

Details for the file eiplgrader-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: eiplgrader-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.5 Linux/6.15.2-arch1-1

File hashes

Hashes for eiplgrader-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7309f679fceec1f5ad58e72d7a46bd301d8b996196d3698965a8fc8b83ee7b8c
MD5 994c5b004a87891c81cbf836825e86d1
BLAKE2b-256 0583f0579bd604929c84123337eee8c0651f969963077ddb7d99630c017621ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page