pruning

Modules

modelopt.torch.puzzletron.pruning.attention_ffn_surgery

Model-agnostic surgery primitives for FFN-channel and attention-head pruning.

modelopt.torch.puzzletron.pruning.compact_runtime

Reversible compact forwards for physically sliced attention and GDN candidates.

modelopt.torch.puzzletron.pruning.dynamic_block_prune

Generic (AnyModel) dynamic single-block pruning — no realized weights.

modelopt.torch.puzzletron.pruning.elastic_sampling

Prefix-size sampling for nested (Matryoshka) elastic bypass distillation.

modelopt.torch.puzzletron.pruning.embedding_pruning

Descriptor-owned residual hidden-width ranking, sorting, and slicing.

modelopt.torch.puzzletron.pruning.expert_removal_pruning_mixin

modelopt.torch.puzzletron.pruning.ffn_intermediate_pruning_mixin

modelopt.torch.puzzletron.pruning.gated_delta_net

Qwen GatedDeltaNet geometry and coupled permutation helpers.

modelopt.torch.puzzletron.pruning.gated_delta_net_pruning_mixin

modelopt.torch.puzzletron.pruning.kv_heads_pruning_mixin

modelopt.torch.puzzletron.pruning.latent_moe_surgery

Weight-only surgery for latent-projected mixture-of-experts layers.

modelopt.torch.puzzletron.pruning.mamba2_surgery

Generic packed-tensor surgery for Mamba2-style mixers.

modelopt.torch.puzzletron.pruning.materialize

Materialize a pruned variant from the sorted teacher — slice/merge, no realized checkpoints.

modelopt.torch.puzzletron.pruning.moe_mamba_pruning_mixin

modelopt.torch.puzzletron.pruning.ple_pruning

Global per-layer-embedding (PLE) channel ranking and tensor surgery.

modelopt.torch.puzzletron.pruning.pruning_mixin

modelopt.torch.puzzletron.pruning.pruning_utils

modelopt.torch.puzzletron.pruning.runtime_candidate

Shared reversible application of one complete typed block candidate.

modelopt.torch.puzzletron.pruning.runtime_hidden_width

Differentiable full-envelope execution for a nested residual width.

modelopt.torch.puzzletron.pruning.runtime_ple

Static-envelope runtime slicing for descriptor-owned PLE channels.

modelopt.torch.puzzletron.pruning.sorted_teacher

Build a "sorted teacher": the teacher with each layer's FFN channels and attention heads reordered by importance (from activation scoring).

Structured pruning mixins and checkpoint utilities for Puzzletron.