pub enum InterventionAction {
Zero {
dtype: InterventionDtype,
},
Scale {
dtype: InterventionDtype,
factor: f32,
},
Mask {
dtype: InterventionDtype,
shape: Vec<u64>,
keep: Vec<bool>,
},
Replace {
tensor: InterventionTensor,
},
Add {
tensor: InterventionTensor,
},
MaskLogits {
dtype: InterventionDtype,
token_ids: Vec<u32>,
},
ExcludeExperts {
expert_ids: Vec<u32>,
},
ZeroExpertContribution {
expert_ids: Vec<u32>,
},
BiasRoutingScores {
stage: RoutingScoreStage,
expert_ids: Vec<u32>,
biases: Vec<f32>,
},
ForceExperts {
shape: [u64; 2],
expert_ids: Vec<u32>,
},
}Expand description
One typed mutation. No variant contains native handles or executable code.
Variants§
Zero
Zero selected elements; retains dtype and shape.
Fields
dtype: InterventionDtypeRequired runtime storage dtype.
Scale
Native multiplication; the finite scalar must be representable in the dtype.
Fields
dtype: InterventionDtypeRequired runtime storage dtype.
Mask
False entries become zero; shape must exactly equal the selected region.
Fields
dtype: InterventionDtypeRequired runtime storage dtype.
Replace
Whole-value replacement or patching according to the explicit axis slices.
Fields
tensor: InterventionTensorComplete exact-dtype selected values.
Add
Elementwise addition; supports typed logit bias without a second sampler.
Fields
tensor: InterventionTensorComplete exact-dtype selected values.
MaskLogits
Negative-infinity mask at final logits; selection must retain full vocabulary.
Fields
dtype: InterventionDtypeRequired runtime storage dtype.
ExcludeExperts
Eligibility exclusion before the architecture’s existing selection algorithm. Gathered scores retain ordinary normalization and scaling semantics.
ZeroExpertContribution
Suppress selected contributions without reselection or renormalization. Remaining coefficients retain their original magnitude. Expert computation is not promised to be avoided. Shared experts remain unchanged.
BiasRoutingScores
Per-expert bias replicated explicitly over the selected token rows.
Fields
stage: RoutingScoreStagePrecise scoring boundary.
ForceExperts
Replace selected IDs before dispatch. Scores/weights are gathered from the architecture’s router, preserving its normalization, scaling and learned multipliers. There is no caller coefficient override.
Implementations§
Source§impl InterventionAction
impl InterventionAction
Sourcepub fn validate_activation_region(
&self,
dtype: InterventionDtype,
shape: &[u64],
) -> Result<(), CaptureError>
pub fn validate_activation_region( &self, dtype: InterventionDtype, shape: &[u64], ) -> Result<(), CaptureError>
Revalidates complete host parameters against an exact native selected region.
Sourcepub fn kind(&self) -> InterventionKind
pub fn kind(&self) -> InterventionKind
Exact operation category.
Sourcepub fn dtype(&self) -> Option<InterventionDtype>
pub fn dtype(&self) -> Option<InterventionDtype>
Exact activation dtype, absent for architecture-owned routing arithmetic.
Trait Implementations§
Source§impl Clone for InterventionAction
impl Clone for InterventionAction
Source§fn clone(&self) -> InterventionAction
fn clone(&self) -> InterventionAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more