Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4d3e8fa
Update Wanda and SparseGPT to use unstructured pruning
audrey-tan Jan 18, 2026
225519e
Add original wanda and sparsegpt external
audrey-tan Jan 20, 2026
009eff7
Merge remote-tracking branch 'origin/iss117_acllm_v4' into iss120_hs
houman1359 Jan 20, 2026
26d06b0
add OWL/prunner
houman1359 Jan 21, 2026
3834b6e
update base for alexnet
houman1359 Jan 21, 2026
cf5ff1d
add some vision tests ans supernode statistics
houman1359 Jan 22, 2026
084b65c
new results
houman1359 Jan 22, 2026
967e9ae
Paper reproducibility: deterministic calibration subset, run metadata…
houman1359 Jan 23, 2026
2add7b1
Slurm: add generic vision unified runner (single seed)
houman1359 Jan 23, 2026
23008ca
implement and add new metrics and analysis for vision and llm works
houman1359 Jan 23, 2026
92430df
update cluster pruning
houman1359 Jan 26, 2026
ed3834a
update llm
houman1359 Jan 27, 2026
f096937
update cluster experiment
houman1359 Jan 27, 2026
696cbc7
add chip baseline
houman1359 Jan 27, 2026
7e452b5
add chip baseline
houman1359 Jan 27, 2026
755cadb
update pruning
houman1359 Jan 28, 2026
c770932
fix: add missing PruningConfig import in supernode protection code
houman1359 Jan 28, 2026
0e660f7
remove: CIFAR-100 supernode configs (conceptually incorrect)
houman1359 Jan 28, 2026
8e67dac
feat: add mean-replacement control and LP-activation analysis methods
houman1359 Jan 28, 2026
2f37826
feat: add activation-based Taylor pruning for vision models
houman1359 Jan 28, 2026
d8b88c7
rerun
houman1359 Jan 28, 2026
9d1a238
add cluster adaptive
houman1359 Jan 28, 2026
0a62fdf
add ixy pruning
houman1359 Jan 28, 2026
8447061
update cluster metrics
houman1359 Jan 28, 2026
e493b42
update vision configs
houman1359 Feb 9, 2026
ffb6ea2
Fix RQ handling and add CAP type-mapping variants for paper sweeps.
houman1359 Feb 9, 2026
0eefbb4
add fine-tuning cluster
houman1359 Feb 11, 2026
c59ce6d
Make MI CAP variants consistent across all scheduling paths
houman1359 Feb 13, 2026
c7804d4
Enforce exact CAP prune budgets and log achieved sparsity in pruning …
houman1359 Feb 15, 2026
279e125
Enforce exact global channel sparsity and fix pruning sparsity logging
houman1359 Feb 16, 2026
9b1bc64
Add cluster-fix CAP variants and expand pruning pipeline tests
houman1359 Feb 17, 2026
0966fd6
add more metrics
houman1359 Feb 18, 2026
6d0689d
add imagenet-tiny
houman1359 Feb 18, 2026
8b1b091
refactor run_experiment
houman1359 Feb 18, 2026
9b2a2a1
cleanup/optimzed experiments
houman1359 Feb 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ jobs:

- name: Run tests
run: |
pytest tests/ -v --cov=src/alignment --cov-report=xml --cov-report=html --tb=short -ra

pytest tests/ -v --cov=src/alignment --cov-report=xml --cov-report=html --cov-report=term-missing --tb=short -ra

- name: Check coverage threshold
run: |
coverage report --fail-under=25

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ repos:
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']

- repo: local
hooks:
- id: fast-tests
name: Fast unit tests
entry: python -m pytest tests/unit/ -x -q -m "not slow and not integration and not gpu"
language: system
pass_filenames: false
always_run: true
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ Cross-layer halo analysis tracks downstream dependencies to predict cascade effe
```
alignment/
├── configs/
├── cluster_analysis/ # Cluster-based analysis configs
├── paper/ # Paper experiment configs
└── examples/ # Example configs
| ├── cluster_analysis/ # Cluster-based analysis configs
| ├── paper/ # Paper experiment configs
| └── examples/ # Example configs
├── scripts/
├── run_experiment.py # Main entry point
└── run_analysis.py # Post-hoc analysis
| ├── run_experiment.py # Main entry point
| └── run_analysis.py # Post-hoc analysis
├── src/alignment/
├── analysis/ # Visualization, clustering, cascade analysis
├── experiments/ # Experiment classes
├── metrics/ # Importance metrics
├── models/ # Model wrappers
└── pruning/ # Pruning strategies
| ├── analysis/ # Visualization, clustering, cascade analysis
| ├── experiments/ # Experiment classes
| ├── metrics/ # Importance metrics
| ├── models/ # Model wrappers
| └── pruning/ # Pruning strategies
├── tests/ # Unit tests
└── docs/ # Documentation
```
Expand Down
20 changes: 10 additions & 10 deletions configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ configs/
├── template.yaml # Complete template with all options
├── unified_template.yaml # Unified format template
├── vision_prune/ # Vision model pruning configs
├── resnet18_cifar10_full.yaml
├── resnet18_cifar10_unified.yaml # Unified format version
├── resnet50_imagenet100.yaml
├── vgg16_cifar10_full.yaml
└── mobilenetv2_cifar10_full.yaml
| ├── resnet18_cifar10_full.yaml
| ├── resnet18_cifar10_unified.yaml # Unified format version
| ├── resnet50_imagenet100.yaml
| ├── vgg16_cifar10_full.yaml
| └── mobilenetv2_cifar10_full.yaml
├── prune_llm/ # LLM pruning configs
├── llama3_8b_full.yaml
├── llama3_8b_unified.yaml # Unified format version
├── llama2_7b_full.yaml
├── mistral_7b_full.yaml
└── qwen2_7b_full.yaml
| ├── llama3_8b_full.yaml
| ├── llama3_8b_unified.yaml # Unified format version
| ├── llama2_7b_full.yaml
| ├── mistral_7b_full.yaml
| └── qwen2_7b_full.yaml
└── examples/ # Example configs
├── mnist_basic.yaml
├── resnet_pruning.yaml
Expand Down
14 changes: 7 additions & 7 deletions configs/examples/cnn2p2_pruning_comprehensive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ cnn:
# Higher score = more important (keep) when selection_mode="low"
#
# INTERPRETATION GUIDE:
# - rayleigh_quotient: High = aligned with data keep (prune low)
# - conditional_rayleigh_quotient: High = aligned with class-specific data keep (prune low)
# - mi_about_class: High = informative about class keep (prune low)
# - average_redundancy: High = MORE redundant prune (use selection_mode="high" to prune high scorers)
# - activation_l2_norm: High = active neuron keep (prune low)
# - composite_importance: Combines RQ + class_MI - redundancy prune low
# - alignment_minus_redundancy: RQ - R prune low
# - rayleigh_quotient: High = aligned with data -> keep (prune low)
# - conditional_rayleigh_quotient: High = aligned with class-specific data -> keep (prune low)
# - mi_about_class: High = informative about class -> keep (prune low)
# - average_redundancy: High = MORE redundant -> prune (use selection_mode="high" to prune high scorers)
# - activation_l2_norm: High = active neuron -> keep (prune low)
# - composite_importance: Combines RQ + class_MI - redundancy -> prune low
# - alignment_minus_redundancy: RQ - R -> prune low

pruning:
enabled: true
Expand Down
8 changes: 4 additions & 4 deletions configs/examples/llama2_7b_pruning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#
# From SCAR paper Table 5 (Cross-Model Generalization at 50% sparsity):
# ┌─────────────────┬──────────────┬──────────────────┐
# Model Method │ PPL↓ │ Acc.
# | Model | Method | PPLdown | Acc.up |
# ├─────────────────┼──────────────┼───────┼─────────┤
# Llama-2-7B Wanda 19.4 62.3%
# SCAR 13.1 66.8%
# | Llama-2-7B | Wanda | 19.4 | 62.3% |
# | | SCAR | 13.1 | 66.8% |
# └─────────────────┴──────────────┴───────┴─────────┘
#
# EXPECTED RUNTIME: ~6-10 hours on H100
Expand Down Expand Up @@ -139,7 +139,7 @@ supernode_summary:
pruning:
enabled: true

sparsity_levels: [0.25, 0.5, 0.75]
sparsity_levels: [0, 0.25, 0.5, 0.75]

selection_modes: ["low", "high"]

Expand Down
82 changes: 41 additions & 41 deletions configs/examples/llama3_comprehensive_pruning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@
# This config runs a comprehensive comparison of:
#
# ┌─────────────────────────────────────────────────────────────────────────┐
# CATEGORY METHOD REFERENCE
# | CATEGORY | METHOD | REFERENCE |
# ├────────────────────┼───────────────────────────────┼────────────────────┤
# ALIGNMENT-BASED rayleigh_quotient (RQ) Our method
# gaussian_mi_analytic (MI) Related to RQ
# average_redundancy Info-theoretic
# | ALIGNMENT-BASED | rayleigh_quotient (RQ) | Our method |
# | | gaussian_mi_analytic (MI) | Related to RQ |
# | | average_redundancy | Info-theoretic |
# ├────────────────────┼───────────────────────────────┼────────────────────┤
# SCAR METRICS scar_loss_proxy Activation + Grad
# (activation+grad) scar_activation_power Raw activation
# scar_taylor First-order term
# scar_curvature Second-order term
# | SCAR METRICS | scar_loss_proxy | Activation + Grad |
# | (activation+grad) | scar_activation_power | Raw activation |
# | | scar_taylor | First-order term |
# | | scar_curvature | Second-order term |
# ├────────────────────┼───────────────────────────────┼────────────────────┤
# SUPERNODE-AWARE supernode_protection_score Protects important
# supernode_connectivity_score Connectivity-based
# | SUPERNODE-AWARE | supernode_protection_score | Protects important |
# | | supernode_connectivity_score | Connectivity-based |
# ├────────────────────┼───────────────────────────────┼────────────────────┤
# GENERALIZED generalized_importance No outlier needed
# | GENERALIZED | generalized_importance | No outlier needed |
# ├────────────────────┼───────────────────────────────┼────────────────────┤
# MAGNITUDE-BASED activation_l2_norm Common baseline
# | MAGNITUDE-BASED | activation_l2_norm | Common baseline |
# ├────────────────────┼───────────────────────────────┼────────────────────┤
# SOTA BASELINES wanda Sun et al. 2023
# sparsegpt Frantar+Alistarh'23
# | SOTA BASELINES | wanda | Sun et al. 2023 |
# | | sparsegpt | Frantar+Alistarh'23|
# └─────────────────────────────────────────────────────────────────────────┘
#
# EVALUATION BENCHMARKS:
Expand Down Expand Up @@ -364,32 +364,32 @@ visualization:
# ├── results_YYYYMMDD_HHMMSS.json # All metrics and scores
# ├── experiment.log
# ├── plots/
# ├── pruning/
# ├── pruning_comparison.png # All methods, perplexity
# ├── pruning_comparison_loss.png # All methods, loss
# ├── pruning_comparison_accuracy_mmlu.png # All methods, MMLU
# ├── pruning_comparison_accuracy_*.png # Other benchmarks
# └── pruning_<method>_comparison_*.png # Per-method plots
# ├── histograms/
# ├── histogram_rayleigh_quotient.png
# ├── histogram_scar_loss_proxy.png
# └── histogram_*.png
# ├── scatter/
# ├── scatter_activation_l2_norm_vs_rayleigh_quotient.png
# └── scatter_*.png
# ├── supernode/
# ├── supernode_comparison_*.png
# └── supernode_score_dist_*.png
# ├── supernode_robustness/
# ├── jaccard_heatmap_*.png # Metric overlap heatmaps
# ├── spearman_heatmap_*.png # Score correlation heatmaps
# ├── bootstrap_stability_*.png # Per-neuron stability
# ├── consistency_bars_*.png # Cross-metric consistency
# └── score_scatter_matrix_*.png # Metric pair correlations
# ├── redundancy/
# └── redundancy_heatmap_*.png
# └── scar/
# ├── scar_loss_proxy_layers.png
# └── scar_metrics_heatmap.png
# | ├── pruning/
# | | ├── pruning_comparison.png # All methods, perplexity
# | | ├── pruning_comparison_loss.png # All methods, loss
# | | ├── pruning_comparison_accuracy_mmlu.png # All methods, MMLU
# | | ├── pruning_comparison_accuracy_*.png # Other benchmarks
# | | └── pruning_<method>_comparison_*.png # Per-method plots
# | ├── histograms/
# | | ├── histogram_rayleigh_quotient.png
# | | ├── histogram_scar_loss_proxy.png
# | | └── histogram_*.png
# | ├── scatter/
# | | ├── scatter_activation_l2_norm_vs_rayleigh_quotient.png
# | | └── scatter_*.png
# | ├── supernode/
# | | ├── supernode_comparison_*.png
# | | └── supernode_score_dist_*.png
# | ├── supernode_robustness/
# | | ├── jaccard_heatmap_*.png # Metric overlap heatmaps
# | | ├── spearman_heatmap_*.png # Score correlation heatmaps
# | | ├── bootstrap_stability_*.png # Per-neuron stability
# | | ├── consistency_bars_*.png # Cross-metric consistency
# | | └── score_scatter_matrix_*.png # Metric pair correlations
# | ├── redundancy/
# | | └── redundancy_heatmap_*.png
# | └── scar/
# | ├── scar_loss_proxy_layers.png
# | └── scar_metrics_heatmap.png
# └── checkpoints/

26 changes: 13 additions & 13 deletions configs/examples/llama3_extended_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,20 @@ visualization:
# Expected outputs:
# - results/llama3_extended_analysis_YYYYMMDD_HHMMSS/
# ├── metrics/
# ├── layer_metrics.json
# ├── halo_redundancy_results.json
# ├── multi_supernode_results.json
# └── cross_layer_results.json
# | ├── layer_metrics.json
# | ├── halo_redundancy_results.json
# | ├── multi_supernode_results.json
# | └── cross_layer_results.json
# ├── plots/
# ├── halo/
# ├── halo_redundancy_by_depth.png
# ├── halo_redundancy_comprehensive.png
# └── halo_redundancy_heatmap.png
# ├── multi_supernode/
# └── cluster_analysis_*.png
# └── cross_layer/
# ├── cross_layer_redundancy.png
# └── layer_efficiency.png
# | ├── halo/
# | | ├── halo_redundancy_by_depth.png
# | | ├── halo_redundancy_comprehensive.png
# | | └── halo_redundancy_heatmap.png
# | ├── multi_supernode/
# | | └── cluster_analysis_*.png
# | └── cross_layer/
# | ├── cross_layer_redundancy.png
# | └── layer_efficiency.png
# └── evaluation/
# └── benchmark_results.json
# ============================================================================
Loading
Loading