pub struct InterpretabilityEngine {
pub model_info: ModelInfo,
/* private fields */
}Expand description
The main interpretability engine
Fields§
§model_info: ModelInfoModel dimensions
Implementations§
Source§impl InterpretabilityEngine
impl InterpretabilityEngine
Sourcepub fn record_activations(
&mut self,
input: &str,
layer_activations: HashMap<usize, Vec<f32>>,
attention_patterns: HashMap<(usize, usize), Vec<f32>>,
)
pub fn record_activations( &mut self, input: &str, layer_activations: HashMap<usize, Vec<f32>>, attention_patterns: HashMap<(usize, usize), Vec<f32>>, )
Record activations for analysis
Sourcepub fn analyze_attention_head(
&self,
layer: usize,
head: usize,
) -> Option<AttentionHead>
pub fn analyze_attention_head( &self, layer: usize, head: usize, ) -> Option<AttentionHead>
Analyze attention head patterns
Sourcepub fn discover_circuits(&mut self) -> Vec<Circuit>
pub fn discover_circuits(&mut self) -> Vec<Circuit>
Discover computational circuits
Sourcepub fn attribute_features(&self, tokens: Vec<String>) -> FeatureAttribution
pub fn attribute_features(&self, tokens: Vec<String>) -> FeatureAttribution
Perform feature attribution for a decision
Sourcepub fn patch_activation(
&mut self,
layer: usize,
position: usize,
new_value: f32,
) -> ActivationPatch
pub fn patch_activation( &mut self, layer: usize, position: usize, new_value: f32, ) -> ActivationPatch
Apply activation patching
Sourcepub fn probe_for_concept(&mut self, layer: usize, concept: &str) -> ProbeResult
pub fn probe_for_concept(&mut self, layer: usize, concept: &str) -> ProbeResult
Run probing classifier
Sourcepub fn analyze_safety(&mut self, input: &str) -> SafetyAnalysis
pub fn analyze_safety(&mut self, input: &str) -> SafetyAnalysis
Perform comprehensive safety analysis
Sourcepub fn get_stats(&self) -> &InterpretabilityStats
pub fn get_stats(&self) -> &InterpretabilityStats
Get engine statistics
Sourcepub fn get_circuits(&self) -> &[Circuit]
pub fn get_circuits(&self) -> &[Circuit]
Get all discovered circuits
Sourcepub fn label_neuron(
&mut self,
layer: usize,
position: usize,
features: Vec<String>,
)
pub fn label_neuron( &mut self, layer: usize, position: usize, features: Vec<String>, )
Label a neuron with detected features
Sourcepub fn find_concept_neurons(&self, concept: &str) -> Vec<(usize, usize)>
pub fn find_concept_neurons(&self, concept: &str) -> Vec<(usize, usize)>
Find neurons that respond to a specific concept
Sourcepub fn export_report(&self) -> InterpretabilityReport
pub fn export_report(&self) -> InterpretabilityReport
Export interpretability report
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InterpretabilityEngine
impl RefUnwindSafe for InterpretabilityEngine
impl Send for InterpretabilityEngine
impl Sync for InterpretabilityEngine
impl Unpin for InterpretabilityEngine
impl UnwindSafe for InterpretabilityEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more