A system for evaluating LLM performance on MIT OpenCourseWare materials using both direct answering and Retrieval-Augmented Generation (RAG) approaches.
- Centralized Configuration: All parameters controlled via
.envfile - RAG Integration: Pinecone-powered document retrieval
- Multi-Model Evaluation: 5+ LLM support
- Automated Processing: From PDF conversion to answer generation
- Clone repository:
git clone https://github.com/VeiledTee/LectureLanguageModels.git
cd LectureLanguageModels- Install dependencies:
pip install -r requirements.txt- Create
.envfile:
# Core Configuration
GENERATION_MODELS=phi4,llama3.2,mistral,qwen2.5,deepseek-r1
EMBEDDING_MODEL=nomic-embed-text
EVALUATION_MODEL=deepseek-r1
# RAG Parameters
RAG_CHUNK_SIZE=512
RAG_TOP_K=5
RAG_EMBEDDING_DIM=768
RAG_INDEX_NAME=ai-course-rag
# Generation Parameters
GENERATION_TEMPERATURE=0.3
MAX_TOKENS=2048
TOP_P=0.9
# Evaluation
BLEU_SMOOTHING=meth1
ROUGE_METRICS=rouge-1,rouge-l
JACCARD_THRESHOLD=0.25
# Pinecone
PINECONE_API_KEY=your_api_key
PINECONE_ENV=us-east1-aws
# Paths
EXAM_DIR=AI_Course/Exams
KNOWLEDGE_DIR=AI_Course/Lecture_Notes├── AI_Course/
│ ├── Exams/
│ └── Lecture_Notes/
├── .env # All configuration parameters
├── chunking.py
├── evaluation.py
├── pinecone_rag.py
├── preprocessing.py
└── run_exam.py
Download Ollama. Within project venv run the following to install models used by default in the project.
ollama pull nomic-embed-text
ollama pull phi4
ollama pull llama3.2:3b
ollama pull mistral
ollama pull qwen2.5:7b
ollama pull deepseek-r1:7b
GENERATION_MODELS=phi4,llama3.2,mistral,qwen2.5,deepseek-r1
EMBEDDING_MODEL=nomic-embed-textRAG_CHUNK_SIZE=512 # Context chunk size (characters)
RAG_TOP_K=5 # Retrieved contexts per query
RAG_EMBEDDING_DIM=768 # Vector dimension sizeGENERATION_TEMPERATURE=0.3 # 0.0-1.0 (lower = more factual)
MAX_TOKENS=2048 # Maximum response length
TOP_P=0.9 # Nucleus sampling thresholdEVALUATION_MODEL=deepseek-r1 # Model for rubric scoring
JACCARD_THRESHOLD=0.25 # Similarity cutoff- Generate answers (direct):
python run_exam.py- Generate answers (RAG):
python pinecone_rag.py- Evaluate results:
python evaluation.pyEdit the .env file for any configuration changes:
- Add/remove models from
GENERATION_MODELS - Adjust RAG performance with
RAG_CHUNK_SIZEandRAG_TOP_K - Control answer creativity with
GENERATION_TEMPERATURE - Modify evaluation thresholds
CORRELATION BETWEEN SCORES