New Features
Layer Importance Analysis
- Added
analyze_layer_importance()
function for analyzing transformer layer importance using cosine similarity
- Multi-architecture support: automatic detection of layer paths for LLaMA, Qwen, Mistral, GPT-2, and other architectures
- Integration with depth pruning workflows to inform layer removal decisions
- Progress tracking and robust error handling
Improvements
- Enhanced documentation with layer analysis examples
- Updated API reference with new functionality
Usage Example
from optipfair import analyze_layer_importance
importance_scores = analyze_layer_importance(model, dataloader)