AQIT 0.1.0
Loading...
Searching...
No Matches
aquin.compute.interp_score Namespace Reference

Functions

dict _generate_sentences (str label, client, int n=N_SAMPLES)
float _get_feature_activation (str sentence, int feature_idx, HookedTransformer model, SparseAutoencoder sae, str model_id="llama-3.2-1b", int|None layer=None)
float _cohen_d_score (list[float] pos_acts, list[float] neg_acts)
float|None _feature_purity_score (list[str] sentences, client)
float|None _finite (float|None x, float|None default=None)
float _kl_div (torch.Tensor p, torch.Tensor q)
float _entropy (torch.Tensor p)
dict run_mui_score (int feature_idx, str prompt, HookedTransformer model, SparseAutoencoder sae, int n_positions=8, str model_id="llama-3.2-1b", int|None layer=None)
dict run_interp_score (int feature_idx, str prompt, HookedTransformer model, SparseAutoencoder sae, client, int n_samples=N_SAMPLES, str model_id="llama-3.2-1b", int|None layer=None)

Variables

 DEVICE = resolve_compute_device()
int N_SAMPLES = 10

Function Documentation

◆ _cohen_d_score()

float _cohen_d_score ( list[float] pos_acts,
list[float] neg_acts )
protected

Definition at line 78 of file interp_score.py.

Referenced by run_interp_score().

◆ _entropy()

float _entropy ( torch.Tensor p)
protected

Definition at line 136 of file interp_score.py.

Referenced by run_mui_score().

◆ _feature_purity_score()

float | None _feature_purity_score ( list[str] sentences,
client )
protected

Definition at line 90 of file interp_score.py.

Referenced by run_interp_score().

◆ _finite()

float | None _finite ( float | None x,
float | None default = None )
protected

Definition at line 116 of file interp_score.py.

Referenced by run_mui_score().

◆ _generate_sentences()

dict _generate_sentences ( str label,
client,
int n = N_SAMPLES )
protected

Definition at line 37 of file interp_score.py.

Referenced by run_interp_score().

◆ _get_feature_activation()

float _get_feature_activation ( str sentence,
int feature_idx,
HookedTransformer model,
SparseAutoencoder sae,
str model_id = "llama-3.2-1b",
int | None layer = None )
protected

Definition at line 63 of file interp_score.py.

Referenced by run_interp_score().

◆ _kl_div()

float _kl_div ( torch.Tensor p,
torch.Tensor q )
protected

Definition at line 130 of file interp_score.py.

Referenced by run_mui_score().

◆ run_interp_score()

dict run_interp_score ( int feature_idx,
str prompt,
HookedTransformer model,
SparseAutoencoder sae,
client,
int n_samples = N_SAMPLES,
str model_id = "llama-3.2-1b",
int | None layer = None )

◆ run_mui_score()

dict run_mui_score ( int feature_idx,
str prompt,
HookedTransformer model,
SparseAutoencoder sae,
int n_positions = 8,
str model_id = "llama-3.2-1b",
int | None layer = None )

Definition at line 141 of file interp_score.py.

References _entropy(), _finite(), and _kl_div().

Referenced by run_interp_score().

Variable Documentation

◆ DEVICE

aquin.compute.interp_score.DEVICE = resolve_compute_device()

Definition at line 33 of file interp_score.py.

◆ N_SAMPLES

int aquin.compute.interp_score.N_SAMPLES = 10

Definition at line 34 of file interp_score.py.