Feat: Add Evaluation Metrics, W&B Logging, and Interleaved Evaluation#15
Open
psycoplankton wants to merge 3 commits into
Open
Feat: Add Evaluation Metrics, W&B Logging, and Interleaved Evaluation#15psycoplankton wants to merge 3 commits into
psycoplankton wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces comprehensive evaluation metrics for CLT training and integrates them with Weights & Biases (W&B) logging. It also enables interleaved evaluation and validation during the training process.
Key Changes:
📊 Evaluation Metrics (
eval_metrics.py)CLTEvaluatorclass utilizingtransformer_lens.HookedTransformer.evaluate_replacement_and_kl()to calculate Replacement Score and KL Divergence by running clean, ablated (zeroed), and transcoder replaced passes.evaluate_sparsity_and_l0()to calculate L0 norm, training/pruning sparsity, and pruned L0 norm based on a threshold (tau).evaluate_activation_density()to calculate mean activation density and dead feature tracking.📈 W&B Logging Integration (
clt_trainer.py)_evaluate_and_log_metrics).replacement_score,kl_divergence,l0_norm,mean_activation_density, anddead_features_ratio.tauvalues.⚙️ Trainer & Config Updates
CLTTrainingRunnerConfig:eval_step_size,val_step_size, andtau_sweep_steps.CLTTrainerandCLTTrainingRunnerto accept a separateval_activations_storefor validation evaluations.🧪 Testing (
tests/test_eval_metrics.py)evaluate_replacement_and_kl,evaluate_sparsity_and_l0,evaluate_activation_density) to ensure stability.