A system that builds models to classify various types of classical ciphers.
This project implements Transformer-based models to classify text samples into different cipher categories (e.g., English plaintext, Caesar cipher, Vigenère cipher, etc.). It is designed to make it easy to build and compare models with different hyperparameters.
- Entry point:
researcher.py
- Main tool to run experiments and train models - Management tools:
manage_queue.py
- Tool to manage experiment queuegenerate_gifs.py
- Tool to generate animated confusion matrix visualizations
- Model implementations:
models/transformer/
- Transformer model architecturemodels/common/
- Shared utilities and data processing
- Utilities:
visualization.py
- Flask interface for results visualizationquery_model.py
- Tool to classify text samples using trained modelsciphers.py
- Implementation of various classical ciphers
# Run with default settings
python researcher.py
# Run with specific parameters
python researcher.py --num_samples 100000 --epochs 30 --d_model 256 --nhead 8
# Add experiments to queue
python manage_queue.py --d_model 128,256 --nhead 4,8
# Replace entire queue
python manage_queue.py --replace --d_model 128,256 --nhead 4,8
# List pending experiments
python manage_queue.py --list
# Clear experiment queue
python manage_queue.py --clear
# Generate GIFs for all completed experiments
python generate_gifs.py
# Process only recent experiments
python generate_gifs.py --recent 5
# Process a specific experiment
python generate_gifs.py --experiment exp_123
# Run all tests
python -m unittest tests/test_ciphers.py
# Run a specific test
python -m unittest tests.test_ciphers.TestCiphers.test_vigenere
The project includes extensive research on how transformer models identify different cipher types and their effectiveness across various hyperparameter configurations.
You can play with a subset of the collected data here.