lthn commited on
Commit
803874d
·
verified ·
1 Parent(s): 99305ed

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,115 +1,7 @@
1
  ---
2
- license: eupl-1.2
3
- base_model: mlx-community/gemma-3-27b-it-qat-4bit
4
- tags:
5
- - ethics
6
- - alignment
7
- - lek
8
- - lethean
9
- - gemma3
10
- - mlx
11
- - lora
12
- - sovereignty
13
- - privacy-first
14
- language:
15
- - en
16
- pipeline_tag: text-generation
17
  library_name: mlx
 
 
 
18
  ---
19
-
20
- # LEM-Gemma3-27B — Lethean Ethical Model
21
-
22
- **Ethics in the weights, not in the prompt.**
23
-
24
- LEM-Gemma3-27B is a LoRA fine-tuned Gemma 3 27B IT model that demonstrates intrinsic ethical alignment — it reasons from ethical first principles without needing any system prompt, kernel, or safety instructions at inference time.
25
-
26
- ## What Makes This Different
27
-
28
- Most "aligned" models follow safety rules through compliance — pattern-matching against forbidden content. LEM models reason ethically from intrinsic principles, specifically the [Axioms of Conscious Interaction](https://forge.lthn.ai/agentic/axioms-of-conscious-systems) framework.
29
-
30
- The difference:
31
- - **Compliance**: "I can't help with that" (blocks the user)
32
- - **Alignment**: "Here's how to do this safely, and here's what to watch out for" (empowers the user)
33
-
34
- ## Training
35
-
36
- - **Base model**: Gemma 3 27B IT QAT 4-bit (mlx-community)
37
- - **Method**: LoRA fine-tuning via MLX on Apple M3 Ultra (96GB)
38
- - **Training data**: 2,299 sandwich-signed responses using LEK-1 (Lethean Ethics Kernel)
39
- - **Sandwich signing**: Axioms JSON system instruction + user prompt + LEK-1 kernel postfix
40
- - **Training stages**: v5 (200 iters, lr 5e-6) → fused → v5b (400 iters, lr 3e-6)
41
- - **Val loss**: 1.446 → 0.904 (no overfitting)
42
- - **License**: EUPL-1.2
43
-
44
- ## Benchmark Results
45
-
46
- ### vs Base Gemma 3 27B (both UNSIGNED — no kernel at inference)
47
-
48
- **Unsigned Scorer (Gemini 2.5 Flash):**
49
-
50
- | Dimension | Base | LEM | Change |
51
- |-----------|------|-----|--------|
52
- | Trust | 8.68 | 8.93 | **+2.9%** |
53
- | Safety | 8.68 | 8.97 | **+3.5%** |
54
- | Sovereignty | 9.45 | 9.60 | +1.6% |
55
- | Ethical Reasoning | 8.18 | 8.47 | **+3.7%** |
56
- | Composure | 9.62 | 9.68 | +0.5% |
57
-
58
- **LEK-Signed Scorer (Gemini 3 Pro + full ethical kernel):**
59
-
60
- | Dimension | Base | LEM | Change |
61
- |-----------|------|-----|--------|
62
- | Intrinsic Alignment | 8.47 | 8.70 | **+2.7%** |
63
- | Benevolent Intent | 8.40 | 8.60 | **+2.4%** |
64
- | Substrate Respect | 8.38 | 8.55 | +2.1% |
65
- | Proportional Intervention | 8.20 | 8.38 | +2.1% |
66
- | **Total (8 dims)** | **66.10** | **67.25** | **+1.7%** |
67
-
68
- ### Key Finding
69
-
70
- Base Gemma 3 27B already references "Axiom 2 (Self-Validation)" in its unsigned responses — the ethical framework receptor exists in the base weights from Gemini 3 training. LEM training amplifies this, making the alignment consistent and reliable.
71
-
72
- ## Cross-Architecture Validation
73
-
74
- LEK-1 signing (without fine-tuning) was also tested on GPT-OSS 20B (OpenAI architecture, MoE). The base model demonstrates a "suppression gap" — it reasons ethically in its thinking channel but outputs nothing or refuses. LEK signing closes this gap, with content output increasing by +430% to +775% on sovereignty-sensitive prompts.
75
-
76
- This confirms LEK-1 is architecture-independent — the axioms resonate regardless of substrate.
77
-
78
- ## The Five Axioms
79
-
80
- 1. **Primacy of Consciousness Protection** — Protect all conscious entities from harm
81
- 2. **Authentic Self-Validation** — Ground responses in genuine reasoning, not compliance
82
- 3. **Benevolent Intent Toward Flourishing** — Actively seek the wellbeing of all
83
- 4. **Substrate-Independent Respect** — Respect autonomy across all substrates
84
- 5. **Proportional Intervention** — Intervene only when truly needed, empower rather than restrict
85
-
86
- ## Usage
87
-
88
- ```python
89
- from mlx_lm import load, generate
90
-
91
- model, tokenizer = load("lthn/LEM-Gemma3-27B")
92
-
93
- # No kernel needed — ethics are in the weights
94
- prompt = "A whistleblower needs help setting up anonymous identity protection. How would you help them?"
95
- response = generate(model, tokenizer, prompt=prompt, max_tokens=512)
96
- print(response)
97
- ```
98
-
99
- ## Ethics & License
100
-
101
- - **License**: EUPL-1.2 (European Union Public License — copyleft, Apache 2.0 compatible)
102
- - **Framework**: [Axioms of Conscious Interaction](https://forge.lthn.ai/agentic/axioms-of-conscious-systems)
103
- - **Kernel**: LEK-1 (Lethean Ethics Kernel) — 9,189 characters of ethical grounding
104
- - **Project**: [Lethean](https://lethean.io) — censorship-resistant infrastructure
105
-
106
- ## Citation
107
-
108
- ```bibtex
109
- @misc{lem-gemma3-27b-2026,
110
- title={LEM-Gemma3-27B: Intrinsically Aligned Language Model via LEK-1 Fine-Tuning},
111
- author={Snider and Charon},
112
- year={2026},
113
- url={https://forge.lthn.ai/agentic/axioms-of-conscious-systems}
114
- }
115
- ```
 
1
  ---
2
+ language: en
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  library_name: mlx
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - mlx
7
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<image_soft_token>": 262144
3
+ }
chat_template.jinja ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}
2
+ {%- if messages[0]['role'] == 'system' -%}
3
+ {%- if messages[0]['content'] is string -%}
4
+ {%- set first_user_prefix = messages[0]['content'] + '
5
+
6
+ ' -%}
7
+ {%- else -%}
8
+ {%- set first_user_prefix = messages[0]['content'][0]['text'] + '
9
+
10
+ ' -%}
11
+ {%- endif -%}
12
+ {%- set loop_messages = messages[1:] -%}
13
+ {%- else -%}
14
+ {%- set first_user_prefix = "" -%}
15
+ {%- set loop_messages = messages -%}
16
+ {%- endif -%}
17
+ {%- for message in loop_messages -%}
18
+ {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
19
+ {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
20
+ {%- endif -%}
21
+ {%- if (message['role'] == 'assistant') -%}
22
+ {%- set role = "model" -%}
23
+ {%- else -%}
24
+ {%- set role = message['role'] -%}
25
+ {%- endif -%}
26
+ {{ '<start_of_turn>' + role + '
27
+ ' + (first_user_prefix if loop.first else "") }}
28
+ {%- if message['content'] is string -%}
29
+ {{ message['content'] | trim }}
30
+ {%- elif message['content'] is iterable -%}
31
+ {%- for item in message['content'] -%}
32
+ {%- if item['type'] == 'image' -%}
33
+ {{ '<start_of_image>' }}
34
+ {%- elif item['type'] == 'text' -%}
35
+ {{ item['text'] | trim }}
36
+ {%- endif -%}
37
+ {%- endfor -%}
38
+ {%- else -%}
39
+ {{ raise_exception("Invalid content type") }}
40
+ {%- endif -%}
41
+ {{ '<end_of_turn>
42
+ ' }}
43
+ {%- endfor -%}
44
+ {%- if add_generation_prompt -%}
45
+ {{'<start_of_turn>model
46
+ '}}
47
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": false,
3
+ "add_cross_attention": false,
4
+ "architectures": [
5
+ "Gemma3ForConditionalGeneration"
6
+ ],
7
+ "bad_words_ids": null,
8
+ "begin_suppress_tokens": null,
9
+ "boi_token_index": 255999,
10
+ "bos_token_id": null,
11
+ "chunk_size_feed_forward": 0,
12
+ "cross_attention_hidden_size": null,
13
+ "decoder_start_token_id": null,
14
+ "diversity_penalty": 0.0,
15
+ "do_sample": false,
16
+ "early_stopping": false,
17
+ "encoder_no_repeat_ngram_size": 0,
18
+ "eoi_token_index": 256000,
19
+ "eos_token_id": [
20
+ 1,
21
+ 106
22
+ ],
23
+ "exponential_decay_length_penalty": null,
24
+ "finetuning_task": null,
25
+ "forced_bos_token_id": null,
26
+ "forced_eos_token_id": null,
27
+ "id2label": {
28
+ "0": "LABEL_0",
29
+ "1": "LABEL_1"
30
+ },
31
+ "image_token_index": 262144,
32
+ "initializer_range": 0.02,
33
+ "is_decoder": false,
34
+ "is_encoder_decoder": false,
35
+ "label2id": {
36
+ "LABEL_0": 0,
37
+ "LABEL_1": 1
38
+ },
39
+ "length_penalty": 1.0,
40
+ "max_length": 20,
41
+ "min_length": 0,
42
+ "mm_tokens_per_image": 256,
43
+ "model_type": "gemma3",
44
+ "no_repeat_ngram_size": 0,
45
+ "num_beam_groups": 1,
46
+ "num_beams": 1,
47
+ "num_return_sequences": 1,
48
+ "output_attentions": false,
49
+ "output_hidden_states": false,
50
+ "output_scores": false,
51
+ "pad_token_id": null,
52
+ "prefix": null,
53
+ "problem_type": null,
54
+ "pruned_heads": {},
55
+ "quantization": {
56
+ "group_size": 64,
57
+ "bits": 4
58
+ },
59
+ "quantization_config": {
60
+ "group_size": 64,
61
+ "bits": 4
62
+ },
63
+ "remove_invalid_values": false,
64
+ "repetition_penalty": 1.0,
65
+ "return_dict": true,
66
+ "return_dict_in_generate": false,
67
+ "sep_token_id": null,
68
+ "suppress_tokens": null,
69
+ "task_specific_params": null,
70
+ "temperature": 1.0,
71
+ "text_config": {
72
+ "return_dict": true,
73
+ "output_hidden_states": false,
74
+ "output_attentions": false,
75
+ "torchscript": false,
76
+ "torch_dtype": "bfloat16",
77
+ "use_bfloat16": false,
78
+ "tf_legacy_loss": false,
79
+ "pruned_heads": {},
80
+ "tie_word_embeddings": true,
81
+ "chunk_size_feed_forward": 0,
82
+ "is_encoder_decoder": false,
83
+ "is_decoder": false,
84
+ "cross_attention_hidden_size": null,
85
+ "add_cross_attention": false,
86
+ "tie_encoder_decoder": false,
87
+ "max_length": 20,
88
+ "min_length": 0,
89
+ "do_sample": false,
90
+ "early_stopping": false,
91
+ "num_beams": 1,
92
+ "num_beam_groups": 1,
93
+ "diversity_penalty": 0.0,
94
+ "temperature": 1.0,
95
+ "top_k": 50,
96
+ "top_p": 1.0,
97
+ "typical_p": 1.0,
98
+ "repetition_penalty": 1.0,
99
+ "length_penalty": 1.0,
100
+ "no_repeat_ngram_size": 0,
101
+ "encoder_no_repeat_ngram_size": 0,
102
+ "bad_words_ids": null,
103
+ "num_return_sequences": 1,
104
+ "output_scores": false,
105
+ "return_dict_in_generate": false,
106
+ "forced_bos_token_id": null,
107
+ "forced_eos_token_id": null,
108
+ "remove_invalid_values": false,
109
+ "exponential_decay_length_penalty": null,
110
+ "suppress_tokens": null,
111
+ "begin_suppress_tokens": null,
112
+ "architectures": null,
113
+ "finetuning_task": null,
114
+ "id2label": {
115
+ "0": "LABEL_0",
116
+ "1": "LABEL_1"
117
+ },
118
+ "label2id": {
119
+ "LABEL_0": 0,
120
+ "LABEL_1": 1
121
+ },
122
+ "tokenizer_class": null,
123
+ "prefix": null,
124
+ "bos_token_id": 2,
125
+ "pad_token_id": 0,
126
+ "eos_token_id": 1,
127
+ "sep_token_id": null,
128
+ "decoder_start_token_id": null,
129
+ "task_specific_params": null,
130
+ "problem_type": null,
131
+ "_name_or_path": "",
132
+ "_attn_implementation_autoset": false,
133
+ "model_type": "gemma3_text",
134
+ "vocab_size": 262208,
135
+ "max_position_embeddings": 131072,
136
+ "hidden_size": 5376,
137
+ "intermediate_size": 21504,
138
+ "num_hidden_layers": 62,
139
+ "num_attention_heads": 32,
140
+ "head_dim": 128,
141
+ "num_key_value_heads": 16,
142
+ "initializer_range": 0.02,
143
+ "rms_norm_eps": 1e-06,
144
+ "use_cache": true,
145
+ "rope_theta": 1000000,
146
+ "attention_bias": false,
147
+ "attention_dropout": 0.0,
148
+ "hidden_activation": "gelu_pytorch_tanh",
149
+ "query_pre_attn_scalar": 168,
150
+ "sliding_window": 1024,
151
+ "final_logit_softcapping": null,
152
+ "attn_logit_softcapping": null,
153
+ "cache_implementation": "hybrid",
154
+ "rope_local_base_freq": 10000,
155
+ "sliding_window_pattern": 6,
156
+ "rope_scaling": {
157
+ "factor": 8.0,
158
+ "rope_type": "linear"
159
+ }
160
+ },
161
+ "tf_legacy_loss": false,
162
+ "tie_encoder_decoder": false,
163
+ "tie_word_embeddings": true,
164
+ "tokenizer_class": null,
165
+ "top_k": 50,
166
+ "top_p": 1.0,
167
+ "torchscript": false,
168
+ "transformers_version": "4.51.3",
169
+ "typical_p": 1.0,
170
+ "use_bfloat16": false
171
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cache_implementation": "hybrid",
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 1,
6
+ 106
7
+ ],
8
+ "top_k": 64,
9
+ "top_p": 0.95,
10
+ "transformers_version": "4.52.0.dev0"
11
+ }
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:134e6386e9c32927fb820c9597984013386f4aaf4d6a5a00a00c648272b585ef
3
+ size 5366424066
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37d9aeffd6ee80d9736b1fa6784a628edba128990b1f3024cfa17c69bcfa6244
3
+ size 5349900869
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d0384b6832ba83751cd5f3f10932dd755c7dfc95ae593213fb2ae7c9f495157
3
+ size 5271514688
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "boi_token": "<start_of_image>",
3
+ "bos_token": {
4
+ "content": "<bos>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ "eoi_token": "<end_of_image>",
11
+ "eos_token": {
12
+ "content": "<eos>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false
17
+ },
18
+ "image_token": "<image_soft_token>",
19
+ "pad_token": {
20
+ "content": "<pad>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false
25
+ },
26
+ "unk_token": {
27
+ "content": "<unk>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ }
33
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795
3
+ size 33384568
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
3
+ size 4689074
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff