How xiaochr/llm-aes works
Project Type and Purpose
• This is a research-oriented Python codebase implementing and evaluating a dual-process Automated Essay Scoring (AES) pipeline.
• It explores both a “fast” scoring module (e.g., BERT or other light models) and a “slow” LLM-based module (GPT-3.5/4, LLaMA3), along with human–AI co-grading experiments.
File-Structure Analysis
• Top-level scripts:
• BERT_baseline.py – baseline fast-module using BERT
• train_fast_module.py – training script for the “fast” scorer
• finetune_slow_module.py – fine-tunes LLaMA3 (self-hosted)
• finetune_gpt.py – fine-tunes or primes GPT-3.5/GPT-4 via API
• inference_slow_module.py – orchestration of retrieval + LLM inference
• gpt_score_asap1.py / gpt_score_student.py – zero/few-shot scoring with GPT on ASAP or private dataset
• retrieval.py – KNN or embedding-based prompt example retrieval
• dataset_info.py – dataset loading, preprocessing, metadata
• Resources and materials:
• img/ – example figure of dual-process framework
• materials/ – IRB paperwork
README Insights
• Architecture revolves around dual-process theory: a fast, lightweight model and a slow, high-quality LLM.
• Uses public ASAP and private Chinese Student English Essay datasets (via HuggingFace).
• Evaluates zero-shot, few-shot, and supervised fine-tuning, plus a human co-grading experiment.
a. Main Components
1) Data Sources
– Public ASAP dataset (HuggingFace)
– Private CSEE dataset
2) Preprocessing Layer
– dataset_info.py
3) Retrieval Service
– retrieval.py (embeddings store, k-NN lookup)
4) Fast Module (Lightweight AES)
– BERT_baseline.py
– train_fast_module.py
5) Slow Module (LLM-based AES)
– finetune_slow_module.py (LLaMA3)
– finetune_gpt.py (GPT-3.5/4 API)
– inference_slow_module.py
6) Evaluation & Scoring Scripts
– gpt_score_asap1.py
– gpt_score_student.py
7) Human–AI Co-Grading Experiment
– Combination of model outputs + human annotators
b. Interactions and Data Flow
• Data Sources → Preprocessing → (1) Fast Module training & inference → Fast Score
• Data Sources → Preprocessing → Retrieval → Slow Module fine-tuning & inference → Slow Score + Explanations + Confidence
• Slow & Fast Scores are compared, aggregated, or presented to human graders for the co-grading study.
• Evaluation scripts consume model outputs and ground-truth labels for metrics.
c. Architectural Patterns
– Pipeline pattern: clear separation of data ingestion, preprocessing, model training, and inference.
– Dual-process/multi-agent: lightweight vs. heavyweight scoring engines.
– Retrieval-augmented generation for few-shot prompts.
– Modular scripts rather than a monolith—each step is a standalone component.
d. Key Technologies
– Python 3.x, PyTorch or HuggingFace Transformers for model training
– OpenAI API for GPT-3.5/GPT-4 calls
– Local LLaMA3 checkpoints for slow-module fine-tuning
– HuggingFace Datasets for data loading
– FAISS or similar for retrieval embeddings