107 const std::string& scan);
Versioned JSON documents (pulsatrix.<kind>.v1) that every renderer reads.
Definition acquisition_functions.hpp:16
void PruneLinks(AttributionGraph &graph, double edge_threshold)
Keeps the fewest links, largest |weight| first, whose |weight| sums to at least edge_threshold of the...
std::string ToNeuronpediaJson(const AttributionGraph &graph)
The graph as Neuronpedia/circuit-tracer JSON, including circuit-tracer's optional node fields (token_...
AttributionGraph ParseNeuronpediaGraph(std::string_view json)
Reads a graph written by ToNeuronpediaJson, circuit-tracer or Neuronpedia. Unknown fields are ignored...
AttributionGraph FromCircuitGraph(const CircuitGraphDocument &doc, const std::string &slug, const std::string &scan)
A circuit graph (a chain of operations scored by ablation) for the viewer: two columns,...
void ComputeInfluence(AttributionGraph &graph, const std::vector< double > &scores)
Sets each node's influence the way circuit-tracer's pruning does: nodes other than embeddings and log...
Definition attribution_graph.hpp:48
std::string target
Definition attribution_graph.hpp:50
double weight
Definition attribution_graph.hpp:51
std::string source
Definition attribution_graph.hpp:49
Definition attribution_graph.hpp:27
double token_prob
Definition attribution_graph.hpp:45
std::optional< int64_t > feature
The feature's index; the viewer groups nodes with the same layer and feature.
Definition attribution_graph.hpp:31
bool is_target_logit
Definition attribution_graph.hpp:46
std::string feature_type
"embedding" and "logit" are special; a type containing "error" is drawn as an error node; anything el...
Definition attribution_graph.hpp:37
std::optional< double > influence
Cumulative influence (0 to 1); the viewer hides nodes above its pruning threshold.
Definition attribution_graph.hpp:43
std::string node_id
Unique id, for example "3_17_5" (layer, feature, position). Links refer to it.
Definition attribution_graph.hpp:29
int64_t ctx_idx
Definition attribution_graph.hpp:34
std::string js_node_id
The viewer's id for hover state across prompts.
Definition attribution_graph.hpp:39
std::string layer
"E" for an embedding, a layer number, or the logit layer.
Definition attribution_graph.hpp:33
std::optional< double > activation
Definition attribution_graph.hpp:44
std::string clerp
The node's label. A logit's must hold (p=PROBABILITY): the viewer reads it.
Definition attribution_graph.hpp:41
An attribution graph as Neuronpedia's schema (graph-schema.json) and circuit-tracer's create_graph_fi...
Definition attribution_graph.hpp:26
std::string description
Optional metadata.info text.
Definition attribution_graph.hpp:62
std::string prompt
Definition attribution_graph.hpp:57
std::string scan
The model id, for example "gemma-2-2b"; Neuronpedia uses it to find the model.
Definition attribution_graph.hpp:56
std::vector< std::string > prompt_tokens
Definition attribution_graph.hpp:58
std::string slug
Definition attribution_graph.hpp:54
std::vector< Link > links
Definition attribution_graph.hpp:64
std::vector< Node > nodes
Definition attribution_graph.hpp:63
std::optional< double > node_threshold
The viewer's default pruning threshold (circuit-tracer uses 0.8).
Definition attribution_graph.hpp:60
pulsatrix.circuit_graph.v1: a CircuitGraph's scored nodes and weighted edges.
Definition document.hpp:135