How bert-aiml/evaluating-sentence-embedding-techniques-for-efficient-bert-based-sentiment-classification works
This repository is a reproducible IMDb sentiment-classification research pipeline comparing six BERT pooling and fine-tuning strategies. The main workflow is configured experiment execution: load and split IMDb data, tokenize it, train/select models using validation results, evaluate on test data, and preserve metrics and predictions for analysis. Separate post-hoc tools examine gate weights, sequence lengths, and paired predictions. Sampled excerpts and the README support the principal orchestration; some model and data-loader internals were not sampled, so those links rely on documented capabilities.
Main entry points: run_experiments.py Experiment runner · dataset_loader.py IMDb data prep · evaluate.py Evaluation · main.py CLI entry
Components 23
Experiment workflow
- CLI entry
main.py - Run configuration
config.py - Experiment runner
experiments/run_experiments.py - IMDb data prep
data/dataset_loader.py - Run artifacts
results
Classifier strategies
- Fine-tuned CLS
models/finetuned_bert.py - Frozen CLS
models/frozen_cls.py - Frozen mean
models/frozen_mean_pooling.py - Frozen attention
models/frozen_attention_pooling.py - Static control
models/nonadaptive_control.py - Adaptive pooling
models/adaptive_frozen_bert.py - Pooling utilities
models/pooling.py
Training and evaluation
- Training loop
training/train.py - Evaluation
training/evaluate.py - Classification metrics
utils/metrics.py - Parameter counts
utils/parameter_count.py
Results analysis
- Run summaries
scripts/summarize_results.py - Gate analysis
scripts/analyze_gates.py - Length analysis
scripts/analyze_lengths.py - Prediction comparison
scripts/compare_predictions.py - Bootstrap statistics
utils/statistics.py
Other components
- Researcher
- Hugging Face
Connections 26
- Researcher → CLI entry: runs
README.md - CLI entry → Experiment runner: invokes
main.py - Experiment runner → Run configuration: reads options
experiments/run_experiments.py - Experiment runner → IMDb data prep: loads data
experiments/run_experiments.py - IMDb data prep → Hugging Face: downloads dataset
README.md - IMDb data prep → Hugging Face: downloads tokenizer
README.md - Experiment runner → Fine-tuned CLS: selects model
README.md - Experiment runner → Frozen CLS: selects model
README.md - Experiment runner → Frozen mean: selects model
README.md - Experiment runner → Frozen attention: selects model
README.md - Experiment runner → Static control: selects model
README.md - Experiment runner → Adaptive pooling: searches candidates
README.md - Frozen attention → Pooling utilities: uses mask
models/frozen_attention_pooling.py - Experiment runner → Training loop: trains model
experiments/run_experiments.py - Training loop → Evaluation: validates model
training/train.py - Experiment runner → Evaluation: tests selected model
experiments/run_experiments.py - Evaluation → Classification metrics: computes metrics
training/evaluate.py - Experiment runner → Parameter counts: counts parameters
experiments/run_experiments.py - Experiment runner → Run artifacts: writes run files
README.md - Evaluation → Run artifacts: writes predictions
README.md - Researcher → Run summaries: analyzes results
README.md - Researcher → Gate analysis: analyzes gates
README.md - Researcher → Length analysis: analyzes lengths
README.md - Length analysis → IMDb data prep: loads splits
scripts/analyze_lengths.py - Researcher → Prediction comparison: compares predictions
README.md - Prediction comparison → Bootstrap statistics: bootstraps differences