Skip to content

Simulation of student responses to exam questions based on EMNLP 2024 paper using local LLMs.

Notifications You must be signed in to change notification settings

qmakescl/llm_based_simulation

Repository files navigation

LLM-Based Student Exam Response Simulation

이 프로젝트는 EMNLP 2024 Findings 논문 "Using LLMs to Simulate Students' Responses to Exam Questions"의 방법론을 로컬 LLM 환경에서 재현하는 파이프라인입니다.

LLM이 다양한 학습 수준(Level 1~5)의 학생을 모방하여 객관식 문제(ARC, RACE 등)에 답변하도록 시뮬레이션하고, 그 결과가 교육학적 이론(예: 학생 수준에 따른 정답률의 단조 증가)에 부합하는지 분석합니다.

🚀 주요 기능

  • 다양한 데이터셋 지원: ARC-Challenge, RACE (Middle/High) 데이터셋 자동 로드 및 정규화
  • 로컬 LLM 시뮬레이션: Ollama를 이용해 phi4-mini, olmo-3 등 로컬 모델 활용
  • 분석 및 시각화:
    • 레벨별 정확도 및 M-Score(단조성 점수) 계산
    • 문제 난이도별 정답률 분석
    • 생성된 답변(Explanation) 기반의 학생 레벨 역추적 분석
  • 파일럿 실험 자동화: 한 번의 명령으로 데이터 로드, 시뮬레이션, 분석, 보고서 생성 수행

🛠️ 설치 및 설정 가이드

1. 전제 조건 (Prerequisites)

본 프로젝트는 uv 패키지 관리자와 Ollama 로컬 LLM 서버를 사용합니다.

uv 설치 (패키지 및 가상환경 관리)

uv는 빠르고 효율적인 Python 패키지 관리 도구입니다.

  • macOS/Linux:
    curl -LsSf https://astral.sh/uv/install.sh | sh
  • Windows:
    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Ollama 설치 및 모델 준비

로컬에서 LLM을 실행하기 위해 Ollama를 설치합니다.

  1. Ollama 공식 홈페이지에서 다운로드 및 설치
  2. 본 실험에 필요한 모델 다운로드:
    ollama pull phi4-mini:3.8b
    ollama pull olmo-3:7b-think

2. 프로젝트 설정

이 저장소를 클론한 후 uv를 사용해 가상환경을 생성하고 의존성을 설치합니다.

# 가상환경 생성 및 활성화
uv venv
source .venv/bin/activate  # macOS/Linux
# .venv\Scripts\activate   # Windows

# 의존성 패키지 설치
uv pip install -r pyproject.toml  # 또는 개별 설치
# uv pip install datasets ollama pandas matplotlib seaborn scikit-learn numpy scipy tqdm

🏃 실행 방법

파일럿 실험 실행 (전체 과정)

데이터 로드부터 결과 분석까지 모든 과정을 자동으로 수행합니다.

python run_pilot.py

주요 옵션

필요에 따라 특정 데이터셋이나 모델만 테스트할 수 있습니다.

# 특정 모델만 사용
python run_pilot.py --model phi4-mini:3.8b

# 특정 데이터셋만 사용 (arc 또는 race)
python run_pilot.py --dataset arc

# 문항 수 조절 (파일럿 모드)
python run_pilot.py --arc-n 30 --race-n 30

# 시뮬레이션 없이 기존 결과로 분석만 수행
python run_pilot.py --analyze-only

📈 분석 결과물

실행이 완료되면 다음 위치에서 결과를 확인할 수 있습니다.

  • outputs/results/: 시뮬레이션 원본 데이터 (CSV)
  • outputs/figures/: 분석 그래프 (PNG)
  • reports/pilot_report.md: 실험 요약 보고서

📝 라이선스 및 참조

About

Simulation of student responses to exam questions based on EMNLP 2024 paper using local LLMs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages