Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions all.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Images from television of ten fired her
Home
SWEENEY BIG
WORLD PARTY
Apart from Fedorov, that fellow who gave us the
I beat a heavy
Pleased with the group's healthy sales, Red Rhino allowed the band the luxury of a colour sleeve for their third release, the double A-side, ‘This Boy Can Wait’ and ‘You Should Always Keep In
Whitbread had no formal education and seems to have been the archetypal self-made
Their answers result in the supreme irony of lorry-loads of young men, having scraped
The Society is keeping in close
In this instance we are again studying a very real struggle, with gangs looting, scavenging and turning to organised crime as a means of scraping
But Mr Kaifu is in no mood to let anyone steal his
With me that rings a warning
Like the constable in the story, use any cover to keep your attacker at
Organisers of the biggest air rally in Europe say that military red
Earlier in this chapter ( p. 70 ) striking a realistic
Inevitably, a book such as this harps
The bottom line
Rachel kept in
It took me breath
( James Brown, 20/2/88 who made it Single Of The Week along with The Wedding Present's ‘Nobody's Twisting Your
The achievements are well recorded : the Brabazon airliner, the abortive TSR2 fighter plane and Concorde — the fastest white
The word is much used by his closest adviser, Hernando de Soto, author of ‘The Other Path’ — a celebrated study of Peru's huge and dense informal sector of street vendors, cottage industries and red
But it had been years, even then, since Elvis was top of the Hit Parade, and if all he had to offer the world was slicked-back hair and a sulky pout, the Dead
Not only in Europe, but also in Afghanistan, Africa and East Asia, the Soviet Empire now drew in its
Why not cut the
While the credit- driven Anglo economies draw in their
Old
I call the
The writer often called the
Far from drawing in his
Fokker is negotiating with Lockheed to assemble aircraft in America : this would bring Lockheed back into the commercial business , which it quit in 1981 after losing its
BRINGING HOME THE
6 changes: 6 additions & 0 deletions best_formal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Images from television of ten fired her imagination
Home truths
SWEENEY BIG Cheese
WORLD PARTY animal
Apart from Fedorov, that fellow who gave us the slip
I beat a heavy retreat
6 changes: 3 additions & 3 deletions config/local.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"allow_loading_dataset_files": true,
"preloaded_dataset_filename": "sample_input.txt",
"preloaded_dataset_filename": "all.txt",
"debug": true,
"models": {
"": null,

"meta-llama/Llama-3.2-1B-Instruct": null,
"meta-llama/Meta-Llama-3-8B": null,
"meta-llama/Meta-Llama-3-70B": null,
"meta-llama/Meta-Llama-3-8B-Instruct": null,
Expand Down Expand Up @@ -51,6 +51,6 @@
"facebook/opt-13b": null,
"facebook/opt-30b": null
},
"default_model": "",
"default_model": "meta-llama/Llama-3.2-1B-Instruct",
"demo_mode": false
}
8 changes: 8 additions & 0 deletions corr2false_formal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Pleased with the group's healthy sales, Red Rhino allowed the band the luxury of a colour sleeve for their third release, the double A-side, ‘This Boy Can Wait’ and ‘You Should Always Keep In Touch
Whitbread had no formal education and seems to have been the archetypal self-made man
Their answers result in the supreme irony of lorry-loads of young men, having scraped together
The Society is keeping in close touch
In this instance we are again studying a very real struggle, with gangs looting, scavenging and turning to organised crime as a means of scraping together
But Mr Kaifu is in no mood to let anyone steal his thunder
With me that rings a warning bell
Like the constable in the story, use any cover to keep your attacker at bay
3 changes: 2 additions & 1 deletion env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ channels:
dependencies:
- python=3.12
- pytorch
- pytorch-cuda=11.8
#- pytorch-cuda=11.8 # Jana: Resolve version conflict with idiom installations
- pytorch-cuda
- nodejs
- yarn
- pip
Expand Down
9 changes: 9 additions & 0 deletions false2corr_formal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Organisers of the biggest air rally in Europe say that military red tape
Earlier in this chapter ( p. 70 ) striking a realistic balance
Inevitably, a book such as this harps on
The bottom line is
Rachel kept in touch
It took me breath away
( James Brown, 20/2/88 who made it Single Of The Week along with The Wedding Present's ‘Nobody's Twisting Your Arm
The achievements are well recorded : the Brabazon airliner, the abortive TSR2 fighter plane and Concorde — the fastest white elephant
The word is much used by his closest adviser, Hernando de Soto, author of ‘The Other Path’ — a celebrated study of Peru's huge and dense informal sector of street vendors, cottage industries and red tape
33 changes: 17 additions & 16 deletions llm_transparency_tool/models/tlens_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def _model(self):
tlens_model.set_tokenizer(self.hf_tokenizer, default_padding_side="left")

tlens_model.set_use_attn_result(True)
tlens_model.set_use_attn_in(False)
# Jana: auskommentiert, weil colab mit GQA einen Fehler geworfen hat
#tlens_model.set_use_attn_in(False)
tlens_model.set_use_split_qkv_input(False)

return tlens_model
Expand Down Expand Up @@ -158,24 +159,24 @@ def batch_size(self) -> int:
raise self._run_exception
return self._last_run.logits.shape[0]

@typechecked
#@typechecked # Jana: commented out because of colab issues, TODO: in documentation aufnehmen
def tokens(self) -> Int[torch.Tensor, "batch pos"]:
if not self._last_run:
raise self._run_exception
return self._last_run.tokens

@typechecked
#@typechecked
def tokens_to_strings(self, tokens: Int[torch.Tensor, "pos"]) -> List[str]:
return self._model.to_str_tokens(tokens)

@typechecked
#@typechecked
def logits(self) -> Float[torch.Tensor, "batch pos d_vocab"]:
if not self._last_run:
raise self._run_exception
return self._last_run.logits

@torch.no_grad()
@typechecked
#@typechecked
def unembed(
self,
t: Float[torch.Tensor, "d_model"],
Expand All @@ -197,36 +198,36 @@ def _get_block(self, layer: int, block_name: str) -> torch.Tensor:

# ================= Methods related to the residual stream =================

@typechecked
#@typechecked
def residual_in(self, layer: int) -> Float[torch.Tensor, "batch pos d_model"]:
if not self._last_run:
raise self._run_exception
return self._get_block(layer, "hook_resid_pre")

@typechecked
#@typechecked
def residual_after_attn(
self, layer: int
) -> Float[torch.Tensor, "batch pos d_model"]:
if not self._last_run:
raise self._run_exception
return self._get_block(layer, "hook_resid_mid")

@typechecked
#@typechecked
def residual_out(self, layer: int) -> Float[torch.Tensor, "batch pos d_model"]:
if not self._last_run:
raise self._run_exception
return self._get_block(layer, "hook_resid_post")

# ================ Methods related to the feed-forward layer ===============

@typechecked
#@typechecked
def ffn_out(self, layer: int) -> Float[torch.Tensor, "batch pos d_model"]:
if not self._last_run:
raise self._run_exception
return self._get_block(layer, "hook_mlp_out")

@torch.no_grad()
@typechecked
#@typechecked
def decomposed_ffn_out(
self,
batch_i: int,
Expand All @@ -238,7 +239,7 @@ def decomposed_ffn_out(
processed_activations = self._get_block(layer, "mlp.hook_post")[batch_i][pos]
return torch.mul(processed_activations.unsqueeze(-1), self._model.blocks[layer].mlp.W_out)

@typechecked
#@typechecked
def neuron_activations(
self,
batch_i: int,
Expand All @@ -247,7 +248,7 @@ def neuron_activations(
) -> Float[torch.Tensor, "hidden"]:
return self._get_block(layer, "mlp.hook_pre")[batch_i][pos]

@typechecked
#@typechecked
def neuron_output(
self,
layer: int,
Expand All @@ -257,13 +258,13 @@ def neuron_output(

# ==================== Methods related to the attention ====================

@typechecked
#@typechecked
def attention_matrix(
self, batch_i: int, layer: int, head: int
) -> Float[torch.Tensor, "query_pos key_pos"]:
return self._get_block(layer, "attn.hook_pattern")[batch_i][head]

@typechecked
#@typechecked
def attention_output_per_head(
self,
batch_i: int,
Expand All @@ -273,7 +274,7 @@ def attention_output_per_head(
) -> Float[torch.Tensor, "d_model"]:
return self._get_block(layer, "attn.hook_result")[batch_i][pos][head]

@typechecked
#@typechecked
def attention_output(
self,
batch_i: int,
Expand All @@ -283,7 +284,7 @@ def attention_output(
return self._get_block(layer, "hook_attn_out")[batch_i][pos]

@torch.no_grad()
@typechecked
#@typechecked
def decomposed_attn(
self, batch_i: int, layer: int
) -> Float[torch.Tensor, "pos key_pos head d_model"]:
Expand Down
10 changes: 5 additions & 5 deletions llm_transparency_tool/routes/contributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@torch.no_grad()
@typechecked
#@typechecked
def get_contributions(
parts: torch.Tensor,
whole: torch.Tensor,
Expand Down Expand Up @@ -53,7 +53,7 @@ def get_contributions(


@torch.no_grad()
@typechecked
#@typechecked
def get_contributions_with_one_off_part(
parts: torch.Tensor,
one_off: torch.Tensor,
Expand Down Expand Up @@ -90,7 +90,7 @@ def get_contributions_with_one_off_part(


@torch.no_grad()
@typechecked
#@typechecked
def get_attention_contributions(
resid_pre: Float[torch.Tensor, "batch pos d_model"],
resid_mid: Float[torch.Tensor, "batch pos d_model"],
Expand Down Expand Up @@ -125,7 +125,7 @@ def get_attention_contributions(


@torch.no_grad()
@typechecked
#@typechecked
def get_mlp_contributions(
resid_mid: Float[torch.Tensor, "batch pos d_model"],
resid_post: Float[torch.Tensor, "batch pos d_model"],
Expand All @@ -143,7 +143,7 @@ def get_mlp_contributions(


@torch.no_grad()
@typechecked
#@typechecked
def get_decomposed_mlp_contributions(
resid_mid: Float[torch.Tensor, "d_model"],
resid_post: Float[torch.Tensor, "d_model"],
Expand Down
12 changes: 12 additions & 0 deletions wrong_formal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SWEENEY BIG Cheese
But it had been years, even then, since Elvis was top of the Hit Parade, and if all he had to offer the world was slicked-back hair and a sulky pout, the Dead Loss
Not only in Europe, but also in Afghanistan, Africa and East Asia, the Soviet Empire now drew in its horns
I beat a heavy retreat
Home truths
Why not cut the Mustard
Apart from Fedorov, that fellow who gave us the slip
While the credit- driven Anglo economies draw in their horns
Old chestnut
I call the tunes
The writer often called the tune
Far from drawing in his horns