TracerBackend(model, freeze_attention=False)
Implements the validator’s InterventionBackend over a circuit-tracer ReplacementModel:
logitsusesmodel.feature_intervention;active_featuresusesmodel.get_activations(sparse=True);decoder_normreads the transcoder’s decoder rows.
False lets attention respond to an intervention, as in the real model. True matches circuit-tracer’s default of
direct effects through frozen attention.
register(name, token_ids) uses exact token ids for a prompt; pass name wherever a prompt is expected.
nodes_for_units(backend, prompt, units, positions="all")
FeatureNodes for (layer, feature) units: at every position where they are active ("all"), at the last position
("last"), or at given positions. Position 0 is skipped, since circuit-tracer zeroes it.
reconstruction_error(model, prompts, skip_first=1) -> list[float]
Per-layer FVU of the transcoders’ reconstruction of each MLP’s output over every token of the prompts. Pass the
before and after lists to diff_graphs(fvu_before=..., fvu_after=...).
gpu
top_nodes(graph, n=30) -> list[FeatureNode]
The n most influential feature nodes of a circuit-tracer Graph, with their activation and influence.
TracerLensBackend(model, contexts, r_lens=None, vocab_mask=None, ctx_len=64, skip_first=8, batch_size=8)
Implements circuitcheck.lens.SteeringBackend over a ReplacementModel with per-layer transcoders:
- a feature’s write is its decoder row; a neuron pole’s is
sign * W_out[n]; logitreads a write through the model’s final norm and unembedding;R(whenr_lensis given: a.ptpath,{"J": ...}or a per-layer sequence of matrices) first multiplies it by the layer’s Jacobian;- steering adds the vector to the layer’s MLP output at every position from
skip_firston, in each context cut toctx_lentokens, against an unsteered row in the same batch.
map_features_to_neurons(model, units, k=1) -> (poles, cosines)
For "layer:feature" units, the k MLP neuron poles of the same layer whose writes are closest (by |cosine|) to the
feature’s decoder row, for circuitcheck.lens.edges_agree. Report the cosines with any result built on the map.