Skip to main content

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

Release files for eiplgrader 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eiplgrader 1.0.0
File Size Uploaded
eiplgrader-1.0.0.tar.gz 4.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for eiplgrader 1.0.0
File Interpreter ABI Platform
eiplgrader-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 MB

Release files / eiplgrader-1.0.0.tar.gz

Download URL eiplgrader-1.0.0.tar.gz
Size 4.9 MB
Tags Source
SHA-256 checksum
How to use checksums
d8231140833536add67a9af2d1d80d975603c69f399215315e58e6d49f06bd7c
BLAKE2b-256 checksum
How to use checksums
7436e1f58bff32c7769752b70aa233c0f24090140f4d1ef73f7eddca7bd2529c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.0 CPython/3.13.5 Linux/6.15.2-arch1-1

Release files / eiplgrader-1.0.0-py3-none-any.whl

Download URL eiplgrader-1.0.0-py3-none-any.whl
Size 9.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7309f679fceec1f5ad58e72d7a46bd301d8b996196d3698965a8fc8b83ee7b8c
BLAKE2b-256 checksum
How to use checksums
0583f0579bd604929c84123337eee8c0651f969963077ddb7d99630c017621ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.0 CPython/3.13.5 Linux/6.15.2-arch1-1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page