11# Configuration Files
22
3- ## Structure
3+ NodeLens experiments are driven by YAML configs. The same runner is used for
4+ small examples, vision pruning studies, and LLM supernode/SCAR experiments:
45
6+ ``` bash
7+ python scripts/run_experiment.py --config path/to/config.yaml
58```
9+
10+ The Python package is imported as ` nodelens ` .
11+
12+ ## Directory Map
13+
14+ ``` text
615configs/
7- ├── template.yaml # Complete template with all options
8- ├── unified_template.yaml # Unified format template
9- ├── vision_prune/ # Vision model pruning configs
10- | ├── resnet18_cifar10_full.yaml
11- | ├── resnet18_cifar10_unified.yaml # Unified format version
12- | ├── resnet50_imagenet100.yaml
13- | ├── vgg16_cifar10_full.yaml
14- | └── mobilenetv2_cifar10_full.yaml
15- ├── prune_llm/ # LLM pruning configs
16- | ├── llama3_8b_full.yaml
17- | ├── llama3_8b_unified.yaml # Unified format version
18- | ├── llama2_7b_full.yaml
19- | ├── mistral_7b_full.yaml
20- | └── qwen2_7b_full.yaml
21- └── examples/ # Example configs
22- ├── mnist_basic.yaml
23- ├── resnet_pruning.yaml
24- └── llm_alignment.yaml
16+ |-- template.yaml # Full legacy-format reference
17+ |-- unified_template.yaml # Unified-format reference
18+ |-- examples/ # Small runnable examples and smoke tests
19+ |-- vision_prune/ # Vision clustering, halo, and channel pruning
20+ `-- prune_llm/ # LLM supernode, SCAR, and paper-scale configs
2521```
2622
27- ## Usage
23+ Large private sweep grids are not kept in the public config tree. Public
24+ release material for a paper lives under ` projects/<project_name>/ ` ; reusable
25+ experiment configs live here.
26+
27+ ## Which Config Should I Use?
28+
29+ | Goal | Start with |
30+ | ------| ------------|
31+ | Quick install check on MNIST | ` configs/examples/mnist_basic.yaml ` |
32+ | Small vision pruning example | ` configs/examples/resnet_pruning.yaml ` |
33+ | Vision metric clustering and halo analysis | ` configs/vision_prune/resnet18_cifar10_unified.yaml ` |
34+ | Larger vision pruning benchmark | ` configs/vision_prune/resnet50_imagenet100_unified.yaml ` |
35+ | Minimal LLM supernode example | ` configs/examples/llm_alignment.yaml ` |
36+ | Main 8B LLM SCAR suite | ` configs/prune_llm/llama3_8b_unified.yaml ` |
37+ | Cross-model 7B/8B LLM checks | ` configs/prune_llm/{llama2,mistral,qwen2}_7b_unified.yaml ` |
38+ | 70B mechanism check | ` configs/prune_llm/llama3_70b_scale_mechanism.yaml ` |
39+ | 70B structured pruning curves | ` configs/prune_llm/llama3_70b_scale_pruning_curves.yaml ` |
40+ | OLMo checkpoint trajectory | ` configs/prune_llm/olmo2_7b_ckpt_template.yaml ` |
41+
42+ ## Experiment Types
43+
44+ | Type | Used for | Typical configs |
45+ | ------| ----------| -----------------|
46+ | ` alignment_analysis ` | General activation, alignment, and pruning analysis for small models | ` configs/examples/*.yaml ` |
47+ | ` cluster_analysis ` | Vision channel metrics, metric-space clustering, halo analysis, cascade tests, and structured pruning | ` configs/vision_prune/*.yaml ` |
48+ | ` llm_alignment ` | Hugging Face causal LMs, SCAR loss-proxy metrics, supernodes, halos, perplexity, and LLM structured pruning | ` configs/prune_llm/*.yaml ` |
49+ | ` vision_synergy ` | Older focused vision synergy experiments | ` configs/examples/vision_synergy.yaml ` |
50+
51+ ## Common Commands
2852
2953``` bash
30- python scripts/run_experiment.py --config configs/cluster_analysis/resnet18_cifar10_full.yaml
31- python scripts/run_experiment.py --config configs/paper/llama3_8b_full.yaml
32- python scripts/run_experiment.py --config configs/examples/resnet_pruning.yaml
33- ```
54+ # Quick smoke test
55+ python scripts/run_experiment.py --config configs/examples/mnist_basic.yaml
3456
35- ## Experiment Types
57+ # Vision clustering and pruning
58+ python scripts/run_experiment.py --config configs/vision_prune/resnet18_cifar10_unified.yaml
59+
60+ # LLM supernode and SCAR analysis
61+ python scripts/run_experiment.py --config configs/prune_llm/llama3_8b_unified.yaml
3662
37- | Type | Description |
38- | ------ | ------------- |
39- | ` alignment_analysis ` | General alignment metrics |
40- | ` llm_alignment ` | LLM supernode/SCAR analysis |
41- | ` cluster_analysis ` | Metric-space clustering with halos |
63+ # Override output location without editing the YAML
64+ python scripts/run_experiment.py \
65+ --config configs/prune_llm/llama3_8b_unified.yaml \
66+ --base-output-dir /path/to/results
67+ ```
4268
4369## Configuration Blocks
4470
@@ -55,6 +81,10 @@ python scripts/run_experiment.py --config configs/examples/resnet_pruning.yaml
5581| ` pruning ` | Strategy, sparsity_levels, scoring |
5682| ` llm ` | LLM-specific: scar_metrics, evaluate_perplexity |
5783
84+ Not every block is used by every experiment type. Vision configs usually use
85+ ` clustering ` , ` halo_analysis ` , and ` cascade_analysis ` ; LLM configs usually use
86+ ` supernode ` , ` halo_analysis ` , ` llm ` , and ` pruning ` .
87+
5888## Metrics
5989
6090Available metrics for ` metrics.enabled ` :
@@ -95,24 +125,32 @@ cascade_analysis:
95125 n_remove_per_cluster : 5
96126` ` `
97127
98- ## LLM Configuration
128+ ## Minimal LLM Configuration
99129
100130` ` ` yaml
101- experiment_type : llm_alignment
131+ experiment :
132+ type : " llm_alignment"
102133
103- model_config :
134+ model :
135+ name : " hf_causal_lm"
104136 model_id : " meta-llama/Llama-3.1-8B"
105- torch_dtype : " bfloat16"
137+ dtype : " bfloat16"
106138
107- do_scar_metrics : true
108- scar_num_samples : 100
139+ metrics :
140+ scar :
141+ enabled : true
142+ num_samples : 64
143+ max_length : 512
109144
110145supernode :
111146 enabled : true
112147 core_fraction : 0.01
113148 protect_core : true
114149` ` `
115150
151+ LLM configs require access to the model provider, enough GPU memory, and the
152+ right license acceptance for gated models.
153+
116154## Unified Configuration Format
117155
118156The framework supports a **unified configuration format** that works consistently
@@ -190,7 +228,7 @@ output:
190228# ## Loading Unified Configs
191229
192230` ` ` python
193- from alignment .configs import load_unified_config
231+ from nodelens .configs import load_unified_config
194232
195233# Works with both old and unified formats!
196234config = load_unified_config("configs/vision_prune/resnet18_cifar10_unified.yaml")
0 commit comments