Skip to content

nohairblingbling/student-sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Struggling Student Simulation - Fine-tuning Experiment

Note: This is an experimental fine-tuning attempt for research purposes. The dataset and model are designed to simulate students with mathematical misconceptions.

Overview

This project fine-tunes Qwen3-8B using LoRA to simulate struggling students in mathematics. Based on the methodology from:

  • Sonkar et al. (2024): "LLM-based Cognitive Models of Students with Misconceptions"
  • MisstepMath dataset from Hugging Face

Project Structure

student_simulation_dataset/
├── scripts/                    # Data processing scripts
│   ├── 01_data_acquisition.py  # Download MisstepMath
│   ├── 02_data_filtering.py    # Filter K6-K8 samples
│   ├── 03_llm_augmentation.py  # Two-stage LLM generation
│   ├── 04_build_final_dataset.py
│   ├── 05_convert_to_mlx_format.py
│   └── 06_adjust_ratio.py      # Adjust misconception ratio
├── data/
│   ├── final/                  # Alpaca format dataset
│   └── mlx/                    # MLX training format
├── models/
│   └── Qwen3-8B/              # Base model (downloaded)
├── adapters/
│   └── qwen3-student/         # Trained LoRA adapters
├── train.sh                   # Training script
├── test_model.sh              # Single test
└── compare_models.sh          # Compare base vs fine-tuned

Quick Start

1. Training

./train.sh

This will:

  • Download Qwen3-8B if not present (~16GB)
  • Fine-tune using LoRA (600 iterations)
  • Save adapters to ./adapters/qwen3-student/

2. Testing

# Single test
./test_model.sh "Calculate: 1/2 + 1/3 = ?"

# Compare base vs fine-tuned
./compare_models.sh

Dataset Statistics

Metric Value
Total Samples 1,069
Training Set 1,069
Validation Set 149
Test Set 151
Misconception Ratio 85%

Training Configuration

Parameter Value
Base Model Qwen3-8B
Method LoRA
Framework MLX-LM
Iterations 600
Batch Size 1
LoRA Layers 8
Learning Rate 1e-5
Max Seq Length 1280

Results Summary

The fine-tuned model successfully learned:

  • ✅ Overconfidence (refuses to check answers)
  • ✅ Natural spoken language style
  • ✅ Shorter, more direct responses
  • ⚠️ Calculation errors (~37% of tests)
  • ⚠️ Conceptual confusions (~25% of tests)

Best checkpoint: Iteration 400 (Val Loss: 1.174)

Data Format

MLX Training Format

{"text": "<|im_start|>system\nYou are a student with difficulties...<|im_end|>\n<|im_start|>user\nMath problem<|im_end|>\n<|im_start|>assistant\nStudent response<|im_end|>"}

Alpaca Format

{
  "instruction": "You are a 6th grade student with procedural difficulties...",
  "input": "Solve: x + 5 = 10",
  "output": "Hmm, let me think... (shows error patterns)"
}

Requirements

  • macOS with Apple Silicon (M1/M2/M3)
  • Python 3.10+
  • 32GB+ RAM recommended
  • MLX-LM (pip install mlx-lm)

License

MIT License

References

@article{sonkar2024llm,
  title={LLM-based Cognitive Models of Students with Misconceptions},
  author={Sonkar, Shashank and others},
  year={2024}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors