pub struct TaskMask {
pub task_id: u32,
pub name: String,
pub description: Option<String>,
pub sparsity: f32,
pub quality: Option<Quality>,
pub ffn_masks: Vec<Vec<u8>>,
pub head_masks: Vec<Vec<u8>>,
pub layer_gates: Vec<bool>,
pub parent: Option<String>,
pub has_hot_pack: bool,
pub priority: MaskPriority,
}Expand description
A single task mask defining which neurons/heads/layers are active.
Fields§
§task_id: u32Unique task identifier
name: StringHuman-readable task name
description: Option<String>Optional description
sparsity: f32Overall sparsity (0.0 = no pruning, 1.0 = fully pruned)
quality: Option<Quality>Held-out quality (None = not measured)
ffn_masks: Vec<Vec<u8>>Per-layer FFN neuron masks (bitfield: 1 = active)
head_masks: Vec<Vec<u8>>Per-layer attention head masks (bitfield: 1 = active)
layer_gates: Vec<bool>Per-layer alive flags
parent: Option<String>Parent mask name (for delta-coded masks)
has_hot_pack: boolWhether this mask has a precompiled hot-pack
priority: MaskPriorityPriority level for this mask
Implementations§
Source§impl TaskMask
impl TaskMask
Sourcepub fn ffn_active_count(&self, layer_idx: usize) -> usize
pub fn ffn_active_count(&self, layer_idx: usize) -> usize
Count active neurons in a specific layer’s FFN.
Sourcepub fn layer_alive(&self, layer_idx: usize) -> bool
pub fn layer_alive(&self, layer_idx: usize) -> bool
Check if a specific layer is alive (not pruned).
Sourcepub fn active_layer_count(&self) -> usize
pub fn active_layer_count(&self) -> usize
Count total active layers.
Sourcepub fn ffn_active_indices(&self, layer_idx: usize) -> Vec<u16>
pub fn ffn_active_indices(&self, layer_idx: usize) -> Vec<u16>
Get active neuron indices for a layer (for sparse gather).
Sourcepub fn active_head_count(&self, layer_idx: usize) -> usize
pub fn active_head_count(&self, layer_idx: usize) -> usize
Count active attention heads in a layer.
Sourcepub fn head_flags(&self, layer_idx: usize, num_heads: usize) -> Vec<bool>
pub fn head_flags(&self, layer_idx: usize, num_heads: usize) -> Vec<bool>
Active head flags for a layer (true = head is alive).
Sourcepub fn avg_active_neurons(&self) -> f64
pub fn avg_active_neurons(&self) -> f64
Average active neurons across all alive layers.
Sourcepub fn union(&self, other: &TaskMask) -> TaskMask
pub fn union(&self, other: &TaskMask) -> TaskMask
Compute union of two masks (more neurons = higher quality, less speed).
Sourcepub fn diff(&self, other: &TaskMask) -> MaskDiff
pub fn diff(&self, other: &TaskMask) -> MaskDiff
Bitwise diff between current and new mask (for hot-swap). Compares the actual bits (XOR), not per-layer counters: two masks with equal counts but different neurons produce a full delta.
Sourcepub fn normalize_tail_bits(&mut self, arch: &ModelArch)
pub fn normalize_tail_bits(&mut self, arch: &ModelArch)
Zero tail bits beyond the real dimensions (defensive normalization).