pulsatrix 1.1.0
Loading...
Searching...
No Matches
pulsatrix::CircuitTrace Struct Reference

An attribution graph before pruning: every active feature, error and token, the explained logits, and the full adjacency. More...

#include <circuit_tracing.hpp>

Classes

struct  Feature
 

Public Member Functions

int64_t num_nodes () const
 
int64_t error_node (int64_t layer, int64_t position) const
 
int64_t token_node (int64_t position) const
 
int64_t logit_node (int64_t k) const
 

Public Attributes

std::vector< Feature > features
 
int64_t num_layers = 0
 
int64_t num_positions = 0
 
std::vector< int64_t > tokens
 
std::vector< int64_t > logit_tokens
 The explained logits' token ids and probabilities.
 
std::vector< double > logit_probabilities
 
std::vector< double > target_values
 Each target's value with the frozen model: the pre-activation without b_enc, or the logit minus the mean logit. One per node (0 for errors and tokens).
 
std::vector< double > adjacency
 

Detailed Description

An attribution graph before pruning: every active feature, error and token, the explained logits, and the full adjacency.

Node order (circuit-tracer's): features, then errors (layer-major, one per layer and position), then token embeddings, then logits. adjacency[t * n + s] is the attribution of source s to target t: s's output vector, through the frozen model, dotted with t's input vector. A feature's input vector is its encoder row (pre-activation without b_enc); a logit's is its unembedding minus the mean unembedding, at the final norm's output.

Member Function Documentation

◆ error_node()

int64_t pulsatrix::CircuitTrace::error_node ( int64_t  layer,
int64_t  position 
) const

◆ logit_node()

int64_t pulsatrix::CircuitTrace::logit_node ( int64_t  k) const

◆ num_nodes()

int64_t pulsatrix::CircuitTrace::num_nodes ( ) const

◆ token_node()

int64_t pulsatrix::CircuitTrace::token_node ( int64_t  position) const

Member Data Documentation

◆ adjacency

std::vector<double> pulsatrix::CircuitTrace::adjacency

◆ features

std::vector<Feature> pulsatrix::CircuitTrace::features

◆ logit_probabilities

std::vector<double> pulsatrix::CircuitTrace::logit_probabilities

◆ logit_tokens

std::vector<int64_t> pulsatrix::CircuitTrace::logit_tokens

The explained logits' token ids and probabilities.

◆ num_layers

int64_t pulsatrix::CircuitTrace::num_layers = 0

◆ num_positions

int64_t pulsatrix::CircuitTrace::num_positions = 0

◆ target_values

std::vector<double> pulsatrix::CircuitTrace::target_values

Each target's value with the frozen model: the pre-activation without b_enc, or the logit minus the mean logit. One per node (0 for errors and tokens).

◆ tokens

std::vector<int64_t> pulsatrix::CircuitTrace::tokens

The documentation for this struct was generated from the following file: