File size: 6,488 Bytes
5570082
3ba5007
3803aef
 
 
3ba5007
 
 
3803aef
 
 
 
 
 
 
 
 
3ba5007
 
 
5570082
3ba5007
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
---
language:
  - hbo  # Ancient Hebrew
  - grc  # Ancient Greek (Koine)
  - la   # Latin
library_name: peft
base_model: Qwen/Qwen2.5-0.5B-Instruct
tags:
  - lora
  - peft
  - geometric-ai
  - biblical-hebrew
  - koine-greek
  - latin-vulgate
  - e8-lattice
  - hallucination-reduction
  - sovereign-engine
license: other
license_name: sectl-1.0
license_link: https://github.com/JLeeV/sovereign-engine/blob/main/LICENSE
---

# Titulus_E8 — Geometric LoRA Adapter

**Titulus_E8** is a LoRA fine-tuning adapter for causal language models, trained on the trilingual Biblical corpus
(Hebrew Tanakh · Koine Greek NT/LXX · Latin Vulgate) with a **Topological Coherence Loss** that anchors the
model's embedding space to the [E8 lattice](https://en.wikipedia.org/wiki/E8_lattice).

The adapter is part of the **Sovereign Geometric Model (SGM)** architecture from
[Sovereign Engine](https://github.com/JLeeV/sovereign-engine), a distributed geometric AI system that uses
discrete lattice mathematics to eliminate LLM hallucinations by construction.

---

## The Name

The *Titulus Crucis* — the inscription nailed above the cross — was written in three languages: Hebrew, Latin,
and Greek (John 19:20). It is one of the most historically significant trilingual documents in existence and the
conceptual anchor for this system. The trilingual structure mirrors the three corpus languages exactly.

---

## Architecture

```
Base Model  (Qwen2.5-0.5B-Instruct)

    ├── LoRA Adapter  ← Titulus_E8
    │     rank=32, alpha=64
    │     target: q_proj, v_proj

    └── E8 Logit Mask  (inference-time geometric constraint)
          - every vocabulary token → 8D IPA phonetic coordinate
          - coordinate snapped to nearest of 240 E8 roots (Babai CVP)
          - logits attenuated for tokens that drift beyond geodesic radius
```

### Training Objective

The adapter is trained with a **dual loss**:

```
L = λ_lm · CE_loss + λ_topo · TopologicalCoherenceLoss

TopologicalCoherenceLoss = mean( min_j ||h_i - e8_root_j||² )
```

Where `h_i` are the final hidden-state vectors and `e8_root_j` are the 240 roots of the E8 lattice,
projected into the model's hidden dimension. This forces semantically related embeddings to cluster
near valid lattice coordinates — making hallucination geometrically costly rather than just statistically
unlikely.

---

## Training Data

| Language | Corpus | Source |
|---|---|---|
| **Biblical Hebrew** | Westminster Leningrad Codex (Masoretic Text) | `christos-c/bible-corpus` |
| **Koine Greek** | Nestle-Aland NT + Septuagint (LXX) | `christos-c/bible-corpus` |
| **Latin** | Clementine Vulgate | `christos-c/bible-corpus` |

Each training sample interleaves all three translations of a canonical verse:

```
[HE] בְּרֵאשִׁית בָּרָא אֱלֹהִים אֵת הַשָּׁמַיִם וְאֵת הָאָרֶץ
[GR] Ἐν ἀρχῇ ἐποίησεν ὁ θεὸς τὸν οὐρανὸν καὶ τὴν γῆν
[LA] In principio creavit Deus caelum et terram
```

The model learns to associate semantically equivalent expressions across three typologically distinct
language families — forcing its latent space to develop representations that are stable across linguistic
surface variation.

---

## Usage

### As a standard PEFT adapter

```python
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

base_model_id = "Qwen/Qwen2.5-0.5B-Instruct"
adapter_id    = "JLeeV/Titulus_E8"

tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model     = AutoModelForCausalLM.from_pretrained(base_model_id)
model     = PeftModel.from_pretrained(model, adapter_id)

inputs = tokenizer("In the beginning", return_tensors="pt")
output = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(output[0]))
```

### With Geometric Logit Mask (full SGM pipeline)

```python
from transformers import AutoTokenizer, AutoModelForCausalLM, LogitsProcessorList
from peft import PeftModel
from sov_heart.logit import GeometricLogitMask

base_model_id = "Qwen/Qwen2.5-0.5B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model     = PeftModel.from_pretrained(
    AutoModelForCausalLM.from_pretrained(base_model_id),
    "JLeeV/Titulus_E8"
)

# Build geometric constraint interceptor
processor = GeometricLogitMask.as_logits_processor(
    tokenizer,
    radius=3.0,        # geodesic tolerance (tighter = stricter)
    soft_mask=True,    # Gaussian attenuation vs hard zeroing
    cache_path="/tmp/titulus_token_coords.npy",  # cache for fast reload
)

inputs = tokenizer("Explain the concept of logos", return_tensors="pt")
output = model.generate(
    **inputs,
    max_new_tokens=200,
    logits_processor=LogitsProcessorList([processor]),
)
print(tokenizer.decode(output[0]))
```

---

## Installation

```bash
pip install peft transformers torch

# For the full SGM geometric constraint system:
git clone https://github.com/JLeeV/sovereign-engine
cd sovereign-engine && pip install -e .
```

---

## Geometric Coordinate Mapping

Each token in the vocabulary is mapped to an **8-dimensional E8 coordinate** using IPA phonetic features:

| Dimension | Feature |
|---|---|
| 0 | Stop consonant ratio (p, b, t, d, k, g, q) |
| 1 | Fricative ratio (s, z, v, ʃ, ħ, θ, f, x) |
| 2 | Nasal ratio (m, n) |
| 3 | Vowel ratio (a, e, i, o, u, y) |
| 4 | Liquid ratio (r, l) |
| 5 | Mean Unicode codepoint (normalised to Hebrew range) |
| 6 | Script class (0=Latin, 0.5=Greek, 1.0=Hebrew/Semitic) |
| 7 | Syllable density (syllables per character) |

The raw 8D vector is then snapped to the nearest of the **240 roots of the E8 lattice** using Babai's
Closest Vector Problem (CVP) algorithm — guaranteeing all token coordinates are valid lattice points.

---

## License

This adapter is released under the **Sovereign Engine Cooperative and Topological License (SECTL) v1.0**.
See [LICENSE](https://github.com/JLeeV/sovereign-engine/blob/main/LICENSE) for full terms.

The training corpus texts (Westminster Leningrad Codex, NA28, Clementine Vulgate) are in the public domain.

---

## Citation

```bibtex
@misc{titulus_e8_2026,
  author       = {JLeeV},
  title        = {Titulus\_E8: A Geometric LoRA Adapter Anchored to the E8 Lattice},
  year         = {2026},
  publisher    = {HuggingFace},
  howpublished = {\url{https://huggingface.co/JLeeV/Titulus_E8}},
  note         = {Part of the Sovereign Engine geometric AI architecture}
}
```