A comprehensive toolkit for evaluating Large Language Models (LLMs) on supply chain and operations management knowledge using questions extracted from university textbook test banks.
This project provides an automated pipeline to:
- Extract thousands of test questions from supply chain textbook test banks
- Create standardized benchmark datasets from these questions
- Evaluate any LLM (local or API-based) against this knowledge base
- Generate detailed performance reports with accuracy metrics
sc-knowledge-benchmark/
├── sc-question-extraction/ # Step 1: Extract questions from textbooks
│ ├── textbooks/ # Place .doc/.docx test banks here
│ ├── extract_questions.py # Main extraction script
│ └── run_extraction_pipeline.py # Complete pipeline runner
│
└── sc-llm-benchmark/ # Step 2: Benchmark LLMs
├── data/ # Test questions go here
├── run_benchmark.py # Main benchmarking script
├── results/ # Raw model outputs
└── reports/ # Performance reports
First, extract test questions from your textbook test banks:
cd sc-question-extraction
# Install dependencies
pip install -r requirements.txt
# Add textbook test banks (.doc/.docx files) to textbooks/ directory
# Then run the extraction pipeline
python run_extraction_pipeline.pyThis will generate:
test_questions_for_models.json- Questions for testing (no answers)test_questions_for_models_answers.json- Answer key for grading
Next, evaluate LLMs against the extracted questions:
cd ../sc-llm-benchmark
# Install dependencies
pip install -r requirements.txt
# Copy test files from extraction project
cp ../sc-question-extraction/test_questions_for_models*.json data/
# Configure API keys (if using API-based models)
cp .env.example .env
# Edit .env with your API keys
# Run benchmarks
python run_benchmark.py ollama/llama3.1:8b # Local model via Ollama (recommended)
python run_benchmark.py ollama/tinyllama:latest # Another Ollama example
python run_benchmark.py openai/gpt-4o # OpenAI API
python run_benchmark.py anthropic/claude-3-haiku # Anthropic APIAfter running a benchmark, you'll find:
- Results:
results/{model}_results.json- Raw model responses - Report:
reports/{model}_report.md- Detailed accuracy report with:- Overall accuracy percentage
- Breakdown of incorrect answers
- Install Ollama and pull models locally
- Run:
python run_benchmark.py ollama/model:tag - Examples:
python run_benchmark.py ollama/llama3.1:8bpython run_benchmark.py ollama/tinyllama:latestpython run_benchmark.py ollama/mixtral:8x7b- Models with slashes:
python run_benchmark.py ollama/chenzo/SCB_llama3_1_q8_3eps:latest
Configure your API keys in .env file:
- OpenAI:
openai/gpt-4o,openai/gpt-3.5-turbo - Anthropic:
anthropic/claude-3-opus,anthropic/claude-3-sonnet - Azure OpenAI:
azure/your-deployment-name - OpenRouter:
openrouter/meta-llama/llama-3-70b - AWS Bedrock:
bedrock/anthropic.claude-3-sonnet - Groq:
groq/mixtral-8x7b-32768 - Together AI:
together/meta-llama/Llama-3-70b-chat-hf
Testing for this project used test banks from major supply chain textbooks. The test banks are not shared on this repo. Replace with your own test banks.
- Place
.docor.docxtest bank files insc-question-extraction/textbooks/ - Run the extraction pipeline
- Copy generated files to benchmarking project
Edit sc-question-extraction/filter_questions.py to customize which question types to include:
desired_types = ['multiple_choice', 'true_false'] # Modify as neededCreate a script to test multiple models:
#!/bin/bash
for model in ollama/tinyllama:latest ollama/gemma:2b ollama/phi3:mini; do
python run_benchmark.py $model
doneSample benchmark output:
Model: gpt-3.5-turbo
Total Questions: 2,561
Correct Answers: 2,187
Accuracy: 85.40%
- Ensure
.docfiles haveantiwordinstalled:brew install antiword(macOS) - Check that test banks follow standard Q&A formatting
- Increase timeout in
run_benchmark.pyif models take longer to respond - Some complex questions may cause smaller models to timeout
- Verify API keys are correctly set in
.envfile - Check API rate limits and quotas
- Ensure sufficient API credits
MIT License - See individual project directories for details
Note: This project is for educational and research purposes. Ensure you have appropriate permissions to use any textbook materials.