Data Science Capstone Project 2025
Author: David Haberlah
Data Source: Sample from an Australian Department of Education de-identified and developed for educational research purposes
Uncertainty-aware automated essay scoring system matching commercial accuracy benchmarks (r=0.868, QWK=0.861) while adding transparent confidence intervals and intelligent deferral capabilities. Achieves 6/8 NAPLAN component deployment thresholds at 21.5% deferral rate with edge-deployable architecture.
- Key Innovation
- Performance Summary
- Quick Start
- Project Structure
- Methodology
- Results
- Deployment Architecture
- Limitations & Future Work
- Citation
- License & Acknowledgements
Commercial automated essay scoring (AES) systems achieve competitive accuracy but operate as "black boxes" — teachers cannot distinguish borderline cases from clear-cut scores, leading to either blind acceptance or complete manual review.
This system addresses the black box problem through feature-based difficulty prediction enabling intelligent deferral:
| Capability | Commercial Systems | This System |
|---|---|---|
| Accuracy | QWK 0.75-0.82 | QWK 0.861 (Total), 6/8 components meet thresholds |
| Uncertainty | ❌ No confidence estimates | ✅ Calibrated deferral (21.5%) |
| Transparency | ❌ "8/8 claimed, black box" | ✅ "6/8 guaranteed + 2/8 documented" |
| Interpretability | ❌ Thousands of n-grams | ✅ 25 NAPLAN-aligned features |
| Deployment | ☁️ Cloud-only | 💻 Edge-compatible (M2/M3 Mac) |
| Curriculum | ❌ Generic feedback | ✅ ACARA-aligned (ACELA1504/1505/1508) |
Core Innovation: After hyperparameter tuning yielded zero improvement (+0.0000 average QWK), we pivoted to intelligent deferral via feature-based difficulty prediction achieving r=0.731 correlation with actual scoring errors — enabling 6/8 threshold compliance at 78.5% automation rate.
- Size: 15,479 expert-marked essays
- Task: NAPLAN persuasive writing assessment(Year 5, ages 10-11)
- Scoring: Total score 0-32, plus 8 component traits 0-4 each
- Components: TextStructure, Ideas, Paragraphs, Vocabulary, Cohesion, SentenceStructure, Punctuation, Spelling
| Component | Category | Baseline QWK | Retained QWK (21.5% deferred) | Threshold | Status |
|---|---|---|---|---|---|
| Ideas | Discourse | 0.644 | 0.670 | ≥0.55 | ✅ |
| Paragraphs | Discourse | 0.693 | 0.709 | ≥0.55 | ✅ |
| Cohesion | Discourse | 0.578 | 0.582 | ≥0.55 | ✅ |
| TextStructure | Discourse | 0.533 | 0.553 | ≥0.55 | ✅ (narrow) |
| Spelling | Lexical | 0.716 | 0.723 | ≥0.70 | ✅ |
| Punctuation | Lexical | 0.658 | 0.713 | ≥0.70 | ✅ |
| Vocabulary | Lexical | 0.625 | 0.651 | ≥0.70 | |
| SentenceStructure | Syntactic | 0.586 | 0.596 | ≥0.65 |
Achievement: 6/8 components meet deployment thresholds on 78.5% of essays (1,823/2,322 retained after 21.5% deferral)
Total Score Performance:
- This system: r=0.868, QWK=0.861 (LightGBM baseline)
- Deployment threshold: QWK ≥0.75 (Williamson et al., 2012)
- Human inter-rater: QWK 0.745 (Ormerod et al., 2025)
- Commercial range: QWK 0.75-0.82 (Chen, 2016; Rudner et al., 2006)
- Academic SOTA: QWK 0.941 (Iqbal et al., 2024)
Component Performance (vs Human Baselines):
- Paragraphs: 81% of human inter-rater reliability (0.709 vs 0.88, Su et al., 2025)
- Punctuation: 83% of human ceiling (0.713 vs 0.86, Su et al., 2025)
- Spelling: 78% of human ceiling (0.723 vs 0.93, Su et al., 2025)
- Average: 82% of human inter-rater agreement across 7 components
- Python: 3.11.14 (tested environment)
- Platform: macOS with Apple Silicon (M1/M2/M3/M4) for full functionality
- RAM: 16GB minimum, 32GB+ recommended for feedback generation
- Storage: ~620MB for complete repository (database 159MB, models 3.5MB, outputs 28MB)
# 1. Clone repository
git clone https://github.com/haberlah/automated-essay-scoring.git
cd automated-essay-scoring
# 2. Create conda environment
conda create -n aes python=3.11.14
conda activate aes
# 3. Install dependencies
pip install -r requirements.txt
# 4. Download spaCy language model (150 MB)
python -m spacy download en_core_web_md
# 5. Download NLTK corpora
python -m nltk.downloader punkt words
# 6. Verify installation
python -c "import lightgbm, mlx_lm, spacy; nlp = spacy.load('en_core_web_md'); print('✓ Installation successful')"Platform Notes:
- MLX-LM (feedback generation): Requires Apple Silicon. Linux/Windows users see Alternative Deployment
- LightGBM models (scoring): Cross-platform compatible
# Launch Jupyter from notebook directory
cd notebook
jupyter notebook aes_uts_capstone_haberlah.ipynbView online (no installation):
Open in NBViewer - Better rendering than GitHub
import sqlite3
import pickle
import pandas as pd
from pathlib import Path
# Load trained model
with open('models/Ideas_model.pkl', 'rb') as f:
ideas_model = pickle.load(f)
# Load features for sample essay
with sqlite3.connect('data/aes_uts_capstone_haberlah.db') as conn:
features = pd.read_sql_query(
"SELECT * FROM val_features LIMIT 1",
conn
)
# Predict score (0-4)
score = ideas_model.predict(features[feature_columns])[0]
print(f"Ideas score: {score:.2f}")automated-essay-scoring/
├── README.md # Project documentation (this file)
├── requirements.txt # Python dependencies (14 packages, verified)
├── .gitignore # Git exclusions (temp files, caches)
├── .gitattributes # Git LFS configuration (for large files)
├── LICENSE # MIT License
│
├── data/ # Dataset & database (Git LFS tracked)
│ └── aes_uts_capstone_haberlah.db # 159 MB SQLite (15,479 essays)
│
├── models/ # Trained models (13 files, 3.5 MB total)
│ ├── Ideas_model.pkl # Component model (LightGBM)
│ ├── Paragraphs_model.pkl
│ ├── Vocabulary_model.pkl
│ ├── Cohesion_model.pkl
│ ├── TextStructure_model.pkl
│ ├── SentenceStructure_model.pkl
│ ├── Punctuation_model.pkl
│ ├── Spelling_model.pkl
│ ├── Punctuation_difficulty_predictor.pkl # Meta-model for deferral
│ ├── SentenceStructure_difficulty_predictor.pkl
│ ├── TextStructure_difficulty_predictor.pkl
│ └── Vocabulary_difficulty_predictor.pkl
│
├── notebook/ # Jupyter analysis (production-ready)
│ └── aes_uts_capstone_haberlah.ipynb # 2.3 MB notebook
│
└── outputs/ # Generated artefacts (Git LFS tracked)
├── feedback_complete.csv # 2,322 validation essays + feedback
├── feedback_diagnostic.csv # Sample outputs for testing
└── [13 performance visualisations] # Section 5-6 analysis plots
Core tables (4):
essays_raw(15,479 records: essay_id, text, Total + 8 component scores)train_split(10,023 essays: 65% stratified by Total score)val_split(2,322 essays: 15%, model development/tuning)holdout_split(3,134 essays: 20%, ONE-TIME final evaluation)
Feature tables (3, engineered linguistics):
5. train_features (10,023 records: 25 features per essay)
6. val_features (2,322 records: 25 features per essay)
7. holdout_features (3,134 records: protected, unused in notebook)
Model artefacts (3, trained results):
8. component_models (8 records: LightGBM hyperparameters, QWK scores)
9. difficulty_predictors (4 records: Punctuation, SentenceStructure, TextStructure, Vocabulary)
10. literature_benchmarks (61 records: academic + commercial reference performance)
Feedback outputs (2, production):
11. validation_feedback (2,322 records: scores, evidence, student/teacher feedback)
12. feedback_errors (error logging table)
Utility tables (5):
13. section_flags (completion tracking)
14. training_session_metadata (timestamps, hyperparameters)
15-17. Intermediate analysis tables
Dataset: 15,479 NAPLAN Year 5 persuasive essays
Cleaning pipeline:
- Null handling: 0 missing scores (complete dataset)
- Text normalisation: whitespace, Unicode standardisation
- Length filtering: 7-word minimum (99.9% retention)
- No content modification: Preserve original spelling/grammar for assessment
Stratified splitting:
- Train: 65% (N=10,023) - model training
- Validation: 15% (N=2,322) - hyperparameter tuning, deferral threshold optimisation
- Holdout: 20% (N=3,134) - ONE-TIME evaluation (protected via database flags)
Stratification: Proportional sampling across 5 Total score bands (0-7, 8-15, 16-23, 24-32) to maintain class balance
Philosophy: NAPLAN-aligned interpretable features (not n-grams)
25 features across 7 categories:
| Category | Features (n) | Examples |
|---|---|---|
| Lexical | 4 | Type-token ratio, long words (≥7 letters), academic word density |
| Readability | 5 | Flesch Reading Ease, Flesch-Kincaid Grade, Gunning Fog |
| Syntactic | 6 | Sentence length stats, comma density, parse tree depth |
| Semantic | 3 | Embedding coherence (spaCy en_core_web_md) |
| Cohesion | 3 | Transition word density, discourse markers, pronoun reference |
| Paragraph | 3 | Paragraph count, length mean/std |
| Mechanical | 1 | Spelling error rate (NLTK words corpus + Australian dictionary) |
Critical implementation:
- Fit on training only: StandardScaler fitted exclusively on 10,023 training essays
- Transform separately: Validation and holdout transformed using training statistics
- Zero data leakage: No holdout information in any preprocessing step
spaCy pipeline:
- Model:
en_core_web_md(685k keys, 20k vectors) - Loaded on-demand in Section 4 (avoids startup overhead)
- Batch processing: 256 essays per iteration for memory efficiency
Algorithm selection: LightGBM via systematic comparison
Evaluation criteria:
- Accuracy: Quadratic Weighted Kappa (primary), Pearson r (secondary)
- Consistency: Performance across all 8 components + Total
- Efficiency: Training time, prediction latency
- Tabular suitability: Performance on structured features
Why LightGBM?
- QWK 0.8541 (Total), 6/8 components ≥0.55-0.70 thresholds
- Gradient boosting optimal for tabular data (Grinsztajn et al., 2022; McElfresh et al., 2023)
- Fast inference: <10ms per essay on M3 Max (vs 44.5s for LLM feedback)
- Established in AES literature: e-rater (ETS), IntelliMetric (Pearson)
Training configuration:
- 8 independent component models (no multi-output stacking)
- Stratified 5-fold cross-validation on training set (10,023 essays)
- Objective:
regressionwith L2 loss (ordinal scores 0-4) - Evaluation metric: Custom QWK calculation (sklearn.metrics.cohen_kappa_score)
Tuned components: TextStructure, Vocabulary, SentenceStructure, Punctuation (underperformers)
Search space:
num_leaves: [20, 31, 50]learning_rate: [0.01, 0.05, 0.1]n_estimators: [100, 200, 300]min_child_samples: [10, 20, 30]
Result: +0.0000 average QWK improvement across 30 iterations × 4 components
Strategic pivot: Rather than chase marginal model gains, focus on intelligent deferral to achieve deployment thresholds
Core hypothesis: Essays with high prediction error are learnable via feature patterns
Methodology:
-
Train difficulty predictors on training set errors
- Target: Absolute error |predicted - actual| for each component
- Features: Same 25 linguistic features used in scoring models
- Model: LightGBM regressor (difficulty as continuous variable)
- Critical: Fit difficulty predictor on training set errors ONLY (no validation leakage)
-
Validate on held-out set
- Predict difficulty scores for validation set (2,322 essays)
- Measure correlation: r=0.731 (Punctuation), 0.704-0.754 (other components)
- Visualise: Scatterplots showing difficulty prediction vs actual error
-
Set deferral thresholds
- Sweep threshold from 0-1 (predicted difficulty)
- Calculate QWK on retained essays at each threshold
- Select threshold maximising QWK while minimising deferral rate
Deferral strategies tested:
| Strategy | Correlation (r) | Complexity | Selected |
|---|---|---|---|
| Feature-based | 0.731-0.754 | 1 model per component | ✅ |
| Ensemble variance | 0.142 | 5-fold ensemble per component | ❌ |
| Boundary proximity | -0.249 | Score-based heuristic | ❌ |
Deferral policy: Union approach
- If any component triggers difficulty threshold → defer entire essay
- Rationale: Teachers review complete assessments holistically (operational reality)
- Rate: 21.5% (499/2,322 essays) → 6/8 components meet thresholds on retained set
LLM architecture: Qwen3-8B-4bit (4.3GB quantised model)
Why Qwen3 over SmolLM3?
- Reasoning quality: Superior evidence extraction and rubric alignment
- Cost: Latency (35 vs 67 tokens/s) acceptable for overnight batch processing
- Edge deployment: Runs on M2/M3 with 16-32GB RAM
Prompt engineering:
- Evidence extraction: Identify specific text supporting each component score
- ACARA alignment: Map scores to 40 rubric descriptors (8 components × 5 levels)
- Structured output: JSON with student feedback (80-150 words), teacher feedback (100-180 words)
Critical bug fix:
- Problem: 8B parameter AI model praised misspelled words (hallucination)
- Solution: Compute evidence fresh from essay text
- Result: 100% data-driven feedback aligned with actual essay content
Validation:
- 2,322 validation essays processed
- Average latency: 44.5s per essay (36 hours total batch)
- Quality: Manual review of 50 random essays → 94% accuracy in evidence attribution
| Metric | Value | Benchmark | Status |
|---|---|---|---|
| Pearson r | 0.868 | ≥0.80 (academic) | ✅ Exceeds |
| QWK | 0.861 | ≥0.75 (deployment) | ✅ Exceeds |
| MAE | 2.37 | <3.0 (operational) | ✅ Meets |
Comparison to literature:
- Commercial systems: QWK 0.75-0.82 (Chen, 2016; Rudner et al., 2006)
- Human inter-rater: QWK 0.745 (Ormerod et al., 2025)
- This system: QWK 0.861 (exceeds commercial + human baselines)
Deployment thresholds (Williamson et al., 2012; Wilson, 2013; Cozby, 2021):
- Discourse components (Ideas, Paragraphs, Cohesion, TextStructure): QWK ≥0.55
- Lexical components (Vocabulary, Punctuation, Spelling): QWK ≥0.70
- Syntactic components (SentenceStructure): QWK ≥0.65
| Component | Category | Baseline QWK | Deferral QWK | Threshold | Gap | Status |
|---|---|---|---|---|---|---|
| Ideas | Discourse | 0.644 | 0.670 | ≥0.55 | +0.120 | ✅ |
| Paragraphs | Discourse | 0.693 | 0.709 | ≥0.55 | +0.159 | ✅ |
| Cohesion | Discourse | 0.578 | 0.582 | ≥0.55 | +0.032 | ✅ |
| TextStructure | Discourse | 0.533 | 0.553 | ≥0.55 | +0.003 | ✅ Narrow |
| Spelling | Lexical | 0.716 | 0.723 | ≥0.70 | +0.023 | ✅ |
| Punctuation | Lexical | 0.658 | 0.713 | ≥0.70 | +0.013 | ✅ |
| Vocabulary | Lexical | 0.625 | 0.651 | ≥0.70 | -0.049 | |
| SentenceStructure | Syntactic | 0.586 | 0.596 | ≥0.65 | -0.054 |
Key findings:
- 6/8 components meet deployment thresholds on 78.5% of essays (1,823/2,322 retained)
- Punctuation shows largest gain: +0.055 QWK improvement via intelligent deferral
- Vocabulary and SentenceStructure gaps documented: Feature limitations acknowledged
Finding: Prediction difficulty is largely component-independent (mean r=0.086)
Implications:
- Deferral decisions must be component-specific (no global "hard essay" indicator)
- Union policy appropriate: Each component evaluated independently
- Supports modular deployment: Schools can adopt subset of components
Test: Compare difficulty predictions on validation (N=2,322) vs holdout (N=3,134)
Result:
- Validation r=0.731, Holdout r=0.723 (Punctuation difficulty)
- Δ=-0.008 (negligible difference)
- Conclusion: Difficulty predictors generalise reliably to unseen data
Hardware:
- Apple Silicon (M3/M4)
- RAM: 16-32GB
- Storage: 8GB (Qwen3-8B-4bit model + dependencies)
- Latency: 44.5s per essay (current), <10s optimised
For non-Apple Silicon platforms (Linux/Windows):
-
Scoring only (cross-platform):
- Use LightGBM models directly (no MLX-LM dependency)
- Deploy via Flask/FastAPI REST API
- Docker container with
python:3.11-slimbase
-
Feedback generation alternatives:
- llama.cpp: GGUF quantised models (Qwen3-8B-Q4_K_M)
- Transformers + CUDA: Hugging Face pipeline with GPU
- Cloud API: OpenAI GPT-4, Anthropic Claude (requires data transmission)
-
Example Docker deployment:
FROM python:3.11-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN python -m spacy download en_core_web_md COPY models/ ./models/ COPY app.py . CMD ["python", "app.py"]
Why edge deployment matters:
- FERPA/GDPR compliance: Student essays never leave institutional infrastructure
- Australian DoEs requirements: Data localisation mandates (no third-party transmission)
- Privacy protection: Essay text could contain personally identifiable information (writing style, experiences)
- Institutional control: Schools maintain complete data custody
Cloud alternatives (GPT-4, Claude) require:
- ❌ Third-party data transmission
- ❌ Explicit parental consent for each student
- ❌ Additional contractual safeguards
- ❌ Potential regulatory barriers
Edge deployment advantages:
- ✅ Complete data custody
- ✅ No external API dependencies
- ✅ Predictable latency (no network variability)
- ✅ Cost-effective at scale (no per-request API fees)
-
Platform dependency: Feedback generation requires Apple Silicon (M3/M4)
- Mitigation: Scoring models are cross-platform
- Future: Port to llama.cpp for broader compatibility
-
Component gaps (2/8):
- Vocabulary: -0.049 below threshold (missing academic word sophistication features)
- SentenceStructure: -0.054 below threshold (missing syntactic depth features)
- Mitigation: Intelligent deferral ensures these essays reviewed by humans
-
Feedback latency: 44.5s per essay (unoptimised)
- Target: <10s via prompt caching and quantisation optimisation
- Current throughput: 81 essays/hour (acceptable for overnight batches)
-
Australian English specific: Spelling validation tuned for Australian conventions
- Future: Configurable dictionaries for UK/US English variants
Phase 1:
- Implement prompt caching for feedback generation (10× latency reduction)
- Add batch processing API for school deployment
- Create web app for teacher review workflow
Phase 2:
- Port feedback generation to llama.cpp (cross-platform compatibility)
- Enhance Vocabulary features (add academic word sophistication metrics)
- Enhance SentenceStructure features (add parse tree depth analysis)
- Implement SHAP value explanations for interpretability
Phase 3:
- Multi-prompt generalisation testing (beyond NAPLAN persuasive writing)
- Longitudinal student progress tracking
- Integration with DoE assessment workflows
- Publication of academic findings
Research opportunities:
- Conformal prediction for educational assessment (novelty)
- Edge-deployed quantised LLMs for privacy-preserving assessment (novelty)
- Meta-model data leakage in uncertainty quantification (methodological contribution)
If you use this work in your research, please cite:
@misc{haberlah2025aes,
title={Automated Essay Scoring with Uncertainty Quantification:
Intelligent Deferral for Trustworthy Educational AI},
author={Haberlah, David},
year={2025},
note={Data Science Capstone Project},
url={https://github.com/haberlah/automated-essay-scoring}
}APA 7th Edition:
Haberlah, D. (2025). Automated essay scoring with uncertainty quantification: Intelligent deferral for trustworthy educational AI [Data science capstone project]. GitHub. https://github.com/haberlah/automated-essay-scoring
Australian Curriculum, Assessment and Reporting Authority. (2015). NAPLAN online pilot study: Technical report. ACARA.
Chen, H. (2016). Automated scoring of writing. In F. Drasgow (Ed.), Technology and testing: Improving educational and psychological measurement (pp. 199–219). Routledge.
Grinsztajn, L., Oyallon, E., & Varoquaux, G. (2022). Why do tree-based models still outperform deep learning on typical tabular data? Advances in Neural Information Processing Systems, 35, 507–520. https://doi.org/10.48550/arXiv.2207.08815
Iqbal, M., Mushtaq, M. F., Ahmad, S., & Mehmood, W. (2024). Advancing automated essay scoring with hybrid models: A comprehensive study. Proceedings of the ACM Conference on Learning @ Scale, 234–243. https://doi.org/10.1145/3613904.3642345
McElfresh, D., Khandagale, S., Valverde, J., Ramakrishnan, G., Goldblum, M., White, C., & Feamster, N. (2023). When do neural nets outperform boosted trees on tabular data? Advances in Neural Information Processing Systems, 36, 52867–52892.
Ormerod, C. M., Malhotra, A., & Jafari, A. (2025). Automated essay scoring: A comprehensive review of approaches and challenges. Journal of Educational Measurement, 62(1), 1–28. https://doi.org/10.1111/jedm.12389
Rudner, L. M., Garcia, V., & Welch, C. (2006). An evaluation of IntelliMetric essay scoring system. Journal of Technology, Learning, and Assessment, 4(4), 1–22.
Su, T., Li, Z., Chen, W., Zhang, R., & Liu, Q. (2025). EssayJudge: Multi-trait essay assessment using large language models. Educational Technology Research and Development, 73(2), 445–467. https://doi.org/10.1007/s11423-024-10389-2
Williamson, D. M., Xi, X., & Breyer, F. J. (2012). A framework for evaluation and use of automated scoring. Educational Measurement: Issues and Practice, 31(1), 2–13. https://doi.org/10.1111/j.1745-3992.2011.00223.x
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License Summary:
- ✅ Commercial use
- ✅ Modification
- ✅ Distribution
- ✅ Private use
⚠️ Liability waiver⚠️ No warranty
Technical Acknowledgements:
- Australian Curriculum, Assessment and Reporting Authority (ACARA): NAPLAN rubric framework and assessment guidelines (publicly available standards: ACELA1504, ACELA1505, ACELA1508)
- spaCy/Explosion: NLP pipeline (
en_core_web_mdmodel) - LightGBM/Microsoft: Gradient boosting framework
- MLX-LM/Apple: Edge-deployable LLM inference on Apple Silicon
- Alibaba Cloud: Qwen3-8B base model
Dataset:
- NAPLAN writing assessment sample data (15,479 expert-marked essays, Year 5 persuasive writing)
- All essays de-identified, developed for educational research purposes
Important Note: This is a research prototype demonstrating uncertainty quantification in automated essay scoring. Operational deployment in educational settings requires additional validation, stakeholder consultation, and appropriate governance frameworks.
- Notebook (NBViewer): View rendered notebook
- GitHub Repository: Source code
Contact: David Haberlah | LinkedIn
Last Updated: November 2025
Version: 1.0.0 (UTS | Institute of Data Capstone Project Submission)