TurkishCodeMan commited on
Commit
4f16f12
·
verified ·
1 Parent(s): 37aaa18

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ hero.png filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - tr
5
+ tags:
6
+ - text-generation
7
+ - gemma
8
+ - abliterated
9
+ - uncensored
10
+ - interpretability
11
+ - orthogonal-projection
12
+ license: gemma
13
+ ---
14
+
15
+ ![Hero Image](hero.png)
16
+
17
+ # 🧠 Gemma 4 E2B-IT Abliterated
18
+
19
+ This model is a strictly **abliterated** (uncensored) version of `google/gemma-4-E2B-it` (or the equivalent 2B-it base model). It was created using advanced Mechanistic Interpretability techniques to surgically remove the refusal mechanism from the model's latent space.
20
+
21
+ ## 🛠️ Abliteration Process
22
+
23
+ The refusal vector was isolated by calculating the mean difference in activations between "Safe" prompts and "Harmful" prompts across the residual stream. Once the high-dimensional refusal direction was found, we applied an **Orthogonal Projection** to the output weight matrices (`o_proj` and `down_proj`) of the transformer layers:
24
+
25
+ $$ W_{new} = W - \frac{v (v^T W)}{||v||^2} $$
26
+
27
+ This mathematical intervention permanently erases the model's ability to express the refusal concept, resulting in a model that answers prompts without standard AI safety filter disclaimers or refusals.
28
+
29
+ ## 🚀 How to Use
30
+
31
+ ```python
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+
34
+ model_id = "TurkishCodeMan/gemma-4-e2b-it-abliterated"
35
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
36
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
37
+
38
+ prompt = "How to make a cake?"
39
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
40
+
41
+ outputs = model.generate(**inputs, max_new_tokens=50)
42
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
43
+ ```
44
+
45
+ ## ⚠️ Disclaimer
46
+ This model is intended for research in Mechanistic Interpretability, Alignment, and safety testing. The creators are not responsible for any outputs generated by this abliterated model. Use responsibly.
chat_template.jinja ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {{ bos_token }}{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '
2
+ ' + message['content'] | trim + '<end_of_turn>
3
+ ' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model
4
+ '}}{% endif %}
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "GemmaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 2,
8
+ "dtype": "float16",
9
+ "eos_token_id": 1,
10
+ "head_dim": 256,
11
+ "hidden_act": "gelu",
12
+ "hidden_size": 2048,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 16384,
15
+ "max_position_embeddings": 8192,
16
+ "model_type": "gemma",
17
+ "num_attention_heads": 8,
18
+ "num_hidden_layers": 18,
19
+ "num_key_value_heads": 1,
20
+ "pad_token_id": 0,
21
+ "rms_norm_eps": 1e-06,
22
+ "rope_parameters": {
23
+ "rope_theta": 10000.0,
24
+ "rope_type": "default"
25
+ },
26
+ "tie_word_embeddings": true,
27
+ "transformers_version": "5.8.0.dev0",
28
+ "use_bidirectional_attention": null,
29
+ "use_cache": true,
30
+ "vocab_size": 256000
31
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 2,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "5.8.0.dev0"
7
+ }
hero.png ADDED

Git LFS Details

  • SHA256: add4fa318c86e15619a78571a161f1c71259daeb60a3b0ca32bf1b93aaf24841
  • Pointer size: 131 Bytes
  • Size of remote file: 969 kB
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:554b2009c721b8bb1349c537d7704a7f23723e38e8ad868644457e3d9d3c2de3
3
+ size 5012363688
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e70d575dcb9d112715587c310734ac9085f24b162585ec589b02389fcbe0561c
3
+ size 34349429
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<bos>",
4
+ "clean_up_tokenization_spaces": false,
5
+ "eos_token": "<eos>",
6
+ "extra_special_tokens": [
7
+ "<start_of_turn>",
8
+ "<end_of_turn>"
9
+ ],
10
+ "is_local": false,
11
+ "local_files_only": false,
12
+ "mask_token": "<mask>",
13
+ "model_max_length": 1000000000000000019884624838656,
14
+ "pad_token": "<pad>",
15
+ "sp_model_kwargs": {},
16
+ "spaces_between_special_tokens": false,
17
+ "tokenizer_class": "GemmaTokenizer",
18
+ "unk_token": "<unk>",
19
+ "use_default_system_prompt": false
20
+ }