Anonymous code release for the NeurIPS 2026 submission "Layer-wise Representation Dynamics".
This repository contains the measurement, model-selection, and
layer-pruning pipeline used in the paper. All identifying paths have
been replaced; the placeholder <USER> may appear in comments.
code/
pooling_utils.py Encoder/decoder pooling resolver
llm_models.py Base LLM panel + MMLU scores
bidir_models.py Bidirectional embedder helpers
frenet_curvature.py Frenet (Grassmann speed + Menger curvature)
nrs_profile.py NRS (Jaccard retention)
gfmi_all_layers.py GFMI (per-percentile MI + AUC)
compute_family_derived_metrics.py Section 4 family-level summaries
compute_clean31_selection_correlations.py Section 5 model selection
build_pruning_scores.py Section 6 per-layer pruning scores
select_pruned_layers.py Section 6 layer selection
eval_pruned_embedder.py Section 6 inference-time block skipping
run_pruning_case_study.sh Section 6 driver script
Each of frenet_curvature.py, nrs_profile.py, and gfmi_all_layers.py
is self-contained: it loads the model, extracts per-layer hidden states,
and computes its primitive in a single command.
Python 3.9+ with the packages in requirements.txt. A single GPU is
required for forward passes; the rest of the pipeline runs on CPU.
pip install -r requirements.txt
The scripts assume that the repository root is the current working
directory. Each script writes outputs under ./outputs/<subdir>/.
python code/frenet_curvature.py --models e5_large_v2 --datasets mteb_banking77
python code/nrs_profile.py --models e5_large_v2 --datasets mteb_banking77
python code/gfmi_all_layers.py --models e5_large_v2 --datasets mteb_banking77
python code/compute_family_derived_metrics.py
python code/compute_clean31_selection_correlations.py
bash code/run_pruning_case_study.sh
The implementation follows the conventions reported in Appendix A of the paper:
r is the smallest rank whose cumulative
explained variance of the final-layer representation reaches 95%, and
the same r is used for all layers. Speed is forward-indexed:
s_l = d_Gr(Q_l, Q_{l+1}). Menger curvature is assigned to the
middle layer of each consecutive triple. Degenerate triples receive
zero curvature.min(500, N) random
anchors sampled once per (model, task) pair (seed 42) with
k_NRS = 20. Adjacent layers l and l+1 are compared.k_GFMI = 30 graph that is
symmetrized before connected components are computed. Per-percentile
mutual information is integrated by trapezoidal rule on the grid
linspace(5, 95, 20), with no further normalization.All experiments use publicly available datasets and model checkpoints from the Hugging Face Hub. No new data is released.
MIT.
1 commits
1 commits
Python
99.3%
Anonymous code release for the NeurIPS 2026 submission "Layer-wise Representation Dynamics".
This repository contains the measurement, model-selection, and
layer-pruning pipeline used in the paper. All identifying paths have
been replaced; the placeholder <USER> may appear in comments.
code/
pooling_utils.py Encoder/decoder pooling resolver
llm_models.py Base LLM panel + MMLU scores
bidir_models.py Bidirectional embedder helpers
frenet_curvature.py Frenet (Grassmann speed + Menger curvature)
nrs_profile.py NRS (Jaccard retention)
gfmi_all_layers.py GFMI (per-percentile MI + AUC)
compute_family_derived_metrics.py Section 4 family-level summaries
compute_clean31_selection_correlations.py Section 5 model selection
build_pruning_scores.py Section 6 per-layer pruning scores
select_pruned_layers.py Section 6 layer selection
eval_pruned_embedder.py Section 6 inference-time block skipping
run_pruning_case_study.sh Section 6 driver script
Each of frenet_curvature.py, nrs_profile.py, and gfmi_all_layers.py
is self-contained: it loads the model, extracts per-layer hidden states,
and computes its primitive in a single command.
Python 3.9+ with the packages in requirements.txt. A single GPU is
required for forward passes; the rest of the pipeline runs on CPU.
pip install -r requirements.txt
The scripts assume that the repository root is the current working
directory. Each script writes outputs under ./outputs/<subdir>/.
python code/frenet_curvature.py --models e5_large_v2 --datasets mteb_banking77
python code/nrs_profile.py --models e5_large_v2 --datasets mteb_banking77
python code/gfmi_all_layers.py --models e5_large_v2 --datasets mteb_banking77
python code/compute_family_derived_metrics.py
python code/compute_clean31_selection_correlations.py
bash code/run_pruning_case_study.sh
The implementation follows the conventions reported in Appendix A of the paper:
r is the smallest rank whose cumulative
explained variance of the final-layer representation reaches 95%, and
the same r is used for all layers. Speed is forward-indexed:
s_l = d_Gr(Q_l, Q_{l+1}). Menger curvature is assigned to the
middle layer of each consecutive triple. Degenerate triples receive
zero curvature.min(500, N) random
anchors sampled once per (model, task) pair (seed 42) with
k_NRS = 20. Adjacent layers l and l+1 are compared.k_GFMI = 30 graph that is
symmetrized before connected components are computed. Per-percentile
mutual information is integrated by trapezoidal rule on the grid
linspace(5, 95, 20), with no further normalization.All experiments use publicly available datasets and model checkpoints from the Hugging Face Hub. No new data is released.
MIT.
1 commits
1 commits
Python
99.3%