Framework for testing how individual transformer layers affect model performance by systematically zeroing out layers and measuring accuracy drops.
pip install torch transformers vllm func-timeout datasets
# Basic usage
python main.py --model qwen-instruct --dataset math --num_problems 50
# With filtering
python main.py --model llama-instruct --dataset math500 --math500_categories Algebra Geometry --num_problems 100
qwen-base, qwen-instruct - Qwen 2.5 7Bllama-base, llama-instruct - Llama 3.1 8Bdeepseek-distilled, llama-distilled - DeepSeek R1 distilled modelsopen-reasoner, llama-rl - Specialized reasoning modelsmath - GSM8K math problemsmath500 - Competition math (filter: --math500_categories Algebra Geometry)trivia - TriviaQA factual questions--model - Model to test (required)--dataset - Dataset to use (required)--num_problems - Number of problems (default: 50)--batch_size - Batch size (default: 16)Results saved to results/model-dataset-timestamp/ containing:
layer_X_results.json - Per-layer performancebaseline_results.json - Original model performanceexperiment_summary.json - Accuracy comparison across layers7 commits
Python
100.0%
Framework for testing how individual transformer layers affect model performance by systematically zeroing out layers and measuring accuracy drops.
pip install torch transformers vllm func-timeout datasets
# Basic usage
python main.py --model qwen-instruct --dataset math --num_problems 50
# With filtering
python main.py --model llama-instruct --dataset math500 --math500_categories Algebra Geometry --num_problems 100
qwen-base, qwen-instruct - Qwen 2.5 7Bllama-base, llama-instruct - Llama 3.1 8Bdeepseek-distilled, llama-distilled - DeepSeek R1 distilled modelsopen-reasoner, llama-rl - Specialized reasoning modelsmath - GSM8K math problemsmath500 - Competition math (filter: --math500_categories Algebra Geometry)trivia - TriviaQA factual questions--model - Model to test (required)--dataset - Dataset to use (required)--num_problems - Number of problems (default: 50)--batch_size - Batch size (default: 16)Results saved to results/model-dataset-timestamp/ containing:
layer_X_results.json - Per-layer performancebaseline_results.json - Original model performanceexperiment_summary.json - Accuracy comparison across layers7 commits
Python
100.0%