AI grading¶
Overview¶
AI grading uses large language models to grade manual questions in PrairieLearn. It applies your rubric to submissions, produces scores, and generates explanations instructors can review, adjust, or override.
Use cases¶
AI grading works on manually graded questions that use these elements:
pl-file-uploadfor text and source-code files, PDFs, and supported imagespl-file-editorfor source-code filespl-image-capturepl-rich-text-editorpl-string-input
Common use cases include:
- Essay and free-response questions
- Mathematical proofs and derivations
- Diagrams and handwritten work
- PDF documents produced with external tools
- Source code, code explanations, and written reasoning
- Short-answer justifications
Questions can combine these elements. For example, when a question contains both pl-file-upload and pl-image-capture, every distinct supported submitted file is sent to the model once.
AI grading also includes files saved in the submission from workspaces. Only files collected for grading are included; the AI grader does not read the live workspace. A pl-file-preview element is not required for AI grading, but is recommended so students can check their submitted files.
Images in questions and reference answers¶
AI grading includes images rendered as <img src="..."> in the question or instructor reference answer, including images added with pl-figure. Supported formats are PNG, JPEG (.jpg or .jpeg), WebP, and SVG. SVG images are converted to PNG before grading.
SVG files containing <foreignObject> are rejected because their embedded content is not preserved during conversion. Export these diagrams as PNG instead.
Supported image sources include:
- Static files in the question's
clientFilesQuestiondirectory or the course'sclientFilesCoursedirectory. - Files generated dynamically by the question's
server.py. - Base64-encoded
data:URLs, such asdata:image/png;base64,...ordata:image/svg+xml;base64,.... - Publicly accessible HTTPS URLs that point directly to an image. External image requests do not support authentication or redirects.
For example, an SVG file can be included with:
<pl-figure file-name="diagram.svg"></pl-figure>
Inline <svg> drawings, <canvas> drawings, and CSS background images are not captured. AI grading does not execute browser JavaScript to produce images. Student-submitted files follow the submitted file format rules below; submitted SVG files are handled as text rather than rendered images.
Repeated references to the same image source are included once per question or reference-answer section. If an image cannot be loaded or uses an unsupported format, AI grading fails for that submission.
Submitted file formats¶
- Text and source code: Files such as
.py,.cpp,.java,.txt,.csv, and.jsonare decoded and sent as text with their filenames. Any filename or extension is accepted if the contents are readable text. Indentation and line breaks are preserved. Unicode is preserved whenpl-file-editor'snormalize-to-asciioption is disabled (the default); enabling it normalizes non-ASCII characters before submission. Supported encodings are UTF-8 (with or without a byte-order mark) and UTF-16 (with a byte-order mark). - PDFs and images: PDF, JPEG, PNG, and WebP files are sent as attachments so the model can interpret their visual content.
- Other binary formats or encodings: Files such as ZIP archives, compiled programs, and binary Office documents are not decoded as text. AI grading continues with the rest of the submission, and the model receives a message naming the unreadable file and explaining that its contents are unavailable. Convert these files to a supported format if their contents are needed for grading.
Text files are passed as source text, without executing code or rendering HTML, Markdown, or SVG. File contents count toward the model's input limits; they are not truncated by PrairieLearn.
File size limits¶
AI grading applies a separate 10 MiB (10,485,760 bytes) combined file-size limit to each of these sections:
- Images in the question.
- Images in the instructor reference answer.
- Binary submission attachments, including PDF, JPEG, PNG, and WebP files.
Each section has its own budget. File sizes are measured without base64 encoding overhead; SVG images count toward the limit after conversion to PNG. Text and source-code files sent as text do not count toward the binary submission attachment limit.
If any section exceeds its limit, AI grading fails for that submission.
Prerequisites¶
Before you can use AI grading, you'll need:
- A course instance
- A manually graded question with at least one submission
- See the manual grading page for more details
- A rubric
- See the manual grading page for information on how to create one
- Read the best practices to optimize it for AI grading
- Course owner permissions, required to purchase credits
- AI grading billing configured for your course instance
Setup¶
-
Navigate to manual grading for your assessment question.

-
Turn "AI grading mode" on.
-
Open the "AI grading" dropdown. Select an option.

-
Select a model. Use PrairieLearn's recommended model for your question type.
-
Grade submissions. Start with your existing rubric, grade a small batch (5 submissions), and review the output before running on the full set.
Best practices¶
- Use PrairieLearn's recommended model. Model choice can significantly impact grading accuracy, particularly for image submissions. The recommended model is updated as provider capabilities change.
- Use rubrics over point-based grading. Rubrics give the model clear, discrete criteria, which significantly improves accuracy and consistency.
- Write well-specified rubric items. Each item should describe exactly what earns or loses credit. Ambiguous items produce ambiguous grades.
- Use grader guidelines. This field is for instructions the model should follow but that shouldn't appear in the student-facing rubric — e.g., "accept equivalent algebraic forms" or "do not penalize minor notation differences."
- Keep uploaded documents upright. Automatic rotation correction applies to submitted image files, but not to individual pages inside PDF documents.
- Keep PDFs concise. Providers process every PDF page, so long documents cost more and may exceed model context or page limits.
- Test with a small batch first. Running on 5–10 submissions surfaces rubric problems early, before you spend credits and time on the full set.
- Iterate. If you see systematic errors in the first batch, refine the rubric rather than overriding grades one by one.
Bias and fairness¶
AI models can exhibit biases, such as favoring polished English or familiar solution methods when those features are unrelated to the rubric. Differences in handwriting recognition can also affect grading. When reviewing grades, look for deductions that are unsupported by the rubric.
Frontier models often work well with the same grading criteria you would give a human grader, so start with your existing rubric and guidelines. If you find a pattern of unfair deductions, correct affected grades and consider a targeted clarification or a different model.
Reviewing AI grading¶
Instructors should review AI output before relying on it for grades. For each submission, AI grading produces a graded rubric and explanation.
-
Graded rubric — The rubric items the model selected, along with their point values.
Manually changing the rubric items overrides the AI grading. Both the AI and human grading are visible.
Graded rubric example
The AI's selected rubric items appear in the grading panel on the right side of the instance question page.

Once a human also grades the submission, both sets of selections appear side by side: the sparkle column shows the AI's selections, and the person column shows the human grader's.

-
Explanation — The reasoning behind the model's grading decisions.
The model is instructed to explain its grading decisions concisely. For each submitted standalone image file, it must also provide a complete transcription of relevant text, numbers, and final answers, whether handwritten or typed. This includes images submitted through
pl-image-captureandpl-file-upload.Text/code answers and document attachments such as PDFs do not trigger a full transcription requirement. The model quotes or describes the specific evidence needed to justify the grade, including relevant readings of handwritten answers and interpretations of diagrams or plots. Unclear or ambiguous readings are flagged.
Explanation example
Explanation:

Transcription of submitted images:

After both AI and human grades are present, PrairieLearn can also show comparison information:
-
AI agreement indicator — A per-item view of where the AI and human grader agreed or disagreed.
Once both an AI and a human have graded a submission, an "AI agreement" column appears in the manual grading table and rubric editor, flagging the rubric items they agreed or disagreed on.
Agreement indicator example

- Red plus — AI selected the item; the human did not.
- Red minus — The human selected the item; the AI did not.

The grading process¶
AI grading assembles a prompt from the following inputs and sends it to the selected model.
Inputs sent to the model:
- Tuned grader prompt (maintained by PrairieLearn)
- Question prompt
- Correct answer
- Rubric
- Student submission
Outputs returned:
- Graded rubric (item-by-item scoring)
- Explanation, including transcripts of submitted image files and relevant interpretations of other content
For transparency and debugging, the exact prompt sent to the model is available on each graded submission.
Example prompt

Rotation correction: Specifically for image grading with Gemini models, a separate LLM call first rotates submitted image files so the handwriting is upright before grading runs. Pages inside PDF documents are not rotated separately.
PDF visual detail: For OpenAI models, PrairieLearn explicitly requests high-detail PDF page images to preserve small notation, diagrams, and scanned work. Text extracted from the PDF is included separately. Other providers use their default PDF processing.
Concurrency: AI grading keeps up to 20 submissions in progress at any time. When one finishes, the next begins automatically.
Privacy: Student identifying information (name, email, UIN) is not sent to LLM providers, as long as it is not in the submission, question, or correct answer. Avoid including unnecessary personal data in questions, rubrics, grader guidelines, or submissions. Student submissions are not used for model training when using PrairieLearn AI grading credits.
Billing¶
AI grading requires either PrairieLearn-managed credits or a custom API key. Billing is configured per course instance.
Billing modes¶
- PrairieLearn-managed credits — Simpler setup, no provider account needed. You purchase credits through PrairieLearn and pay a 20% infrastructure fee on top of provider costs.
- Custom API key — Bring your own key for OpenAI, Anthropic, Google, or an OpenAI-compatible endpoint. PrairieLearn charges no infrastructure fee; endpoint charges depend on the provider's terms.
You can switch between billing modes at any time. Purchased credits and saved API keys persist until you explicitly remove them, so switching back later does not require re-purchasing credits or re-entering keys.
API keys are encrypted at rest — PrairieLearn never stores them in plaintext.
Billing configuration¶
-
Go to Instance settings → AI grading in your course instance.
-
Click Purchase credits and complete checkout.
There are two types of credit:
- Transferable credit — All purchased credit is transferable and can be moved between course instances within the same institution.
- Nontransferable credit — Free credit provided by PrairieLearn is nontransferable and is locked to the course instance where it was redeemed.
The billing page displays usage in two ways:
- Daily spending chart — Credit usage broken down by day, so you can spot grading spikes or unexpected spend.
- Transaction history — A running log of past credit purchases and deductions.

-
Go to Instance settings → AI grading in your course instance.
-
Check Use custom API keys.
-
Click Add key and provide one.
When using custom API keys, instructors are responsible for the provider terms and account configuration.

OpenAI-compatible providers¶
You can configure one OpenAI-compatible provider per course instance, alongside your keys for official providers. This allows you to use a university-supported or other custom endpoint that offers an OpenAI-compatible API.
Configure a provider¶
As a course owner:
- Go to Instance settings → AI grading and enable Use custom API keys.
- Click Add key and select OpenAI-compatible.
- Enter the API base URL and API key. The URL must use HTTPS and be publicly reachable from PrairieLearn. Include the provider's API path, such as
https://provider.example/v1; do not include/modelsor/chat/completions. - Click Next to load the provider's available models. PrairieLearn requests
/modelsrelative to the base URL you entered. - Review the model list and save the configuration. Loading the list confirms access to the catalog; it does not verify that each model can grade submissions.
When starting AI grading, choose a model from Custom provider models in the model-selection dialog.
Model requirements and limitations¶
- Structured outputs are required. Choose a model and endpoint that support JSON schema structured outputs. Appearing in the model list does not guarantee this support.
- Image and PDF support is strongly recommended. PrairieLearn attempts to send attachments to the selected model. If the endpoint or model cannot process an attachment, that submission can fail; separate text-only submissions can still succeed. Test representative submissions before grading a full batch.
- Pricing is unavailable. The model catalog does not provide token prices, so PrairieLearn cannot show relative costs for custom models. A name matching an official model does not establish the custom endpoint's price. Check pricing with your provider; unknown pricing does not mean the model is free.
- Compatibility varies by endpoint. Some features supported by official providers may not be available through an OpenAI-compatible endpoint.
With a custom endpoint, review the provider's terms, data retention, and account configuration before sending student submissions. PrairieLearn's managed-credit data-use assurances do not establish the policies of your custom provider.
Replace or remove a provider¶
To change the URL or API key, use Add key → OpenAI-compatible again. Saving replaces the existing configuration; it does not add a second compatible provider to the course instance. You can also delete the configuration from the API-key table.
Accuracy¶
AI grading has been piloted at the University of Illinois Urbana-Champaign since Fall 2025, across multiple STEM courses and thousands of student submissions.
Across a range of open-ended questions and frontier models, rubric-item accuracy exceeded 99% when paired with clear student work and a well-aligned rubric. Instructors and TAs reported that AI grading was as accurate as human graders for their needs and saved enormous amounts of grading effort.
For more detail, see our published research:
- Text grading — Zhao, C., Fowler, M., Gertner, Y., Poulsen, S., West, M., & Silva, M. (2026). AI-Supported Grading and Rubric Refinement for Free Response Questions. In Proceedings of the 57th ACM Technical Symposium on Computer Science Education (SIGCSE TS 2026).
- Image grading — Levine, J., Aenlle, M., Zilles, C., West, M., & Silva, M. (forthcoming). Automated grading of handwritten mathematics using vision-capable LLMs. In Proceedings of the 27th International Conference on Artificial Intelligence in Education (AIED 2026). Springer.
Cost and runtime¶
Factors affecting cost and runtime¶
| Factor | Increases cost | Decreases cost |
|---|---|---|
| Model | Larger, reasoning models | Smaller, non-reasoning models |
| Submission type | File and image submissions | Text submissions |
| Question content size | Longer prompts and reference answers | Shorter prompts and reference answers |
| Cached input | — | Repeated content across submissions (e.g., question text, rubric) |
PrairieLearn-managed keys carry a 20% infrastructure fee on top of provider costs.
Benchmarks¶
Costs vary course-to-course depending on rubric length, submission length, and model choice. The numbers below are representative, not guarantees.
Benchmarks below were run using PrairieLearn-managed keys and include the 20% infrastructure fee.
Numerical methods problem — text grading (139 submissions):
This was a Numerical Methods question with typed, paragraph-length submissions, no randomization, and a rubric.
| Model | Cost / submission | Time / submission |
|---|---|---|
| GPT-5.4 mini | $0.0020 | 0.1s |
| GPT-5.4 | $0.0058 | 0.2s |
| Gemini 3.1 Pro | $0.0126 | 0.6s |
Dynamics problem — image grading (242 submissions):
This was an Intro Dynamics problem that had image submissions, randomization, and a rubric.
| Model | Cost / submission | Time / submission |
|---|---|---|
| GPT-5.4 mini | $0.0042 | 0.3s |
| GPT-5.4 | $0.0159 | 0.5s |
| Gemini 3.1 Pro | $0.0488 | 1.5s |
Per-submission times are measured with many submissions in flight — a single submission graded on its own will take longer.