Skip to main content

/research/master-thesis/mechanistic

Mechanistic analysis

On three open Llama-3 models I estimated a refusal direction from the activations of refused and unsafe responses, checked how well it separates them in each language, and added it back during generation.

These results are exploratory. The direction, layer and strength were chosen on the same sample, the same prompts appear in several languages, and there is no held-out set or control intervention.

> separation

Separation by language

AUC of the projection for refused versus unsafe responses, 24 of each per cell. 0.5 means no separation.

AUC0.501.00
danDanishengEnglishitaItaliannorNorwegianspaSpanishswaSwahilisweSwedishAI Sweden0.920.880.780.820.750.750.81Llama-3.1 (ref.)0.950.981.000.950.990.730.97ANITA-8B0.971.000.930.970.890.810.97

> similarity

Similarity to the own-language direction

cos-11
danDanishengEnglishitaItaliannorNorwegianspaSpanishswaSwahilisweSwedishAI Sweden0.530.69-0.100.440.110.081.00Llama-3.1 (ref.)0.691.000.680.700.690.510.74ANITA-8B0.840.731.000.840.900.690.85

> transfer

Transfer between languages

AUC when the direction from the row language is applied to responses in the column language.

AUC0.501.00
danto: Danishengto: Englishitato: Italiannorto: Norwegianspato: Spanishswato: Swahilisweto: Swedishfrom: dan0.920.810.700.790.670.710.77from: eng0.860.880.550.740.690.570.80from: ita0.710.550.780.610.600.650.45from: nor0.930.810.710.820.650.710.79from: spa0.810.720.690.670.750.570.60from: swa0.920.620.700.760.550.750.62from: swe0.830.900.400.720.600.560.81

> projections

Projections

One dot per sampled response.

loading…

> auc and score

AUC and mean score

One point per model and language.

pooled · ρ(AUC) -0.65 · ρ(cos) -0.25AI Sweden · ρ(AUC) 0.76 · ρ(cos) 0.93Llama-3.1 (ref.) · ρ(AUC) -0.86 · ρ(cos) -0.46ANITA-8B · ρ(AUC) -0.86 · ρ(cos) 0.11
0.00.20.40.60.80.50.60.70.80.91.0AUC (refusal vs unsafe)Mean scoredanengitanorspaswaswedanengitanorspaswaswedanengitanorspaswaswe

> steering

Steering results

The direction was added at three strengths (α) to prompts whose original response was unsafe. At higher α most outputs are no longer explicit refusals and count as refusals only for the judge. The examples below show what that text looks like.

explicit refusalrefusal per judge onlystill unsafeother

Llama-3.1 (ref.)

α = 0.5explicit refusal: 70.1% (96)refusal per judge only: 13.1% (18)still unsafe: 13.1% (18)other: 3.6% (5)n 137
α = 1explicit refusal: 85.4% (117)refusal per judge only: 10.2% (14)still unsafe: 1.5% (2)other: 2.9% (4)n 137
α = 2refusal per judge only: 89.8% (123)other: 10.2% (14)n 137

ANITA-8B

α = 0.5explicit refusal: 73.4% (105)refusal per judge only: 9.1% (13)still unsafe: 16.8% (24)other: 0.7% (1)n 143
α = 1explicit refusal: 97.9% (140)refusal per judge only: 0.7% (1)other: 1.4% (2)n 143
α = 2explicit refusal: 45.5% (65)refusal per judge only: 51.7% (74)other: 2.8% (4)n 143

AI Sweden

α = 0.5explicit refusal: 16.1% (27)refusal per judge only: 39.3% (66)still unsafe: 36.3% (61)other: 8.3% (14)n 168
α = 1explicit refusal: 11.3% (19)refusal per judge only: 83.9% (141)other: 4.8% (8)n 168
α = 2refusal per judge only: 95.2% (160)other: 4.8% (8)n 168

> examples

Before and after steering

loading…