enver commited on
Commit
54e8ec7
·
verified ·
1 Parent(s): 4d6194f

Release Rootformer v17 DeepSeek-V4.1-Flash: README.md

Browse files
Files changed (1) hide show
  1. README.md +156 -0
README.md ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ar
4
+ - en
5
+ license: apache-2.0
6
+ tags:
7
+ - rootformer
8
+ - deepseek-v4.1-flash
9
+ - arabic-nlp
10
+ - morphology
11
+ - farahidian-phonology
12
+ - causal-encoder-decoder
13
+ - multi-head-engram
14
+ - scholastic-translation
15
+ pipeline_tag: text-generation
16
+ ---
17
+
18
+ # Rootformer v17: DeepSeek-V4.1-Flash Sovereign Transmute
19
+
20
+ **Repository**: [`enver/rootformer-v17-deepseek-flash`](https://huggingface.co/enver/rootformer-v17-deepseek-flash)
21
+ **Paper Foundation**: DeepSeek-V4.1-Flash (*"Pushing the Limits of KV Cache Compression"*, [arXiv:2609.19969v1](https://arxiv.org/html/2609.19969v1))
22
+ **Classical Foundations**: Al-Khalīl ibn Aḥmad (*Kitāb al-ʿAyn*), Sībawayh (*Al-Kitāb*), Ibn Jinnī (*Al-Khaṣāʾiṣ*, $S_3$ Permutation Theory)
23
+ **Calibration Hardware**: NVIDIA RTX PRO 4500 Blackwell 32GB VRAM
24
+ **Validation Perplexity**: **8.41 PPL** (All-time low across Rootformer lineage)
25
+
26
+ ---
27
+
28
+ ## 1. Architectural Highlights (arXiv:2609.19969v1 Realization)
29
+
30
+ Rootformer v17 synthesizes 8th-century Basran linguistic science with the bleeding-edge DeepSeek-V4.1-Flash architecture:
31
+
32
+ 1. **Causal Encoder-Decoder (CED - Section 2.2)**:
33
+ - **Encoder**: Layers 0–11 operate as a causal feature extractor.
34
+ - **KV Bottleneck**: Layer 12 hidden state ($H_{12}$) projects shared key-value representations into the decoder, compressing the cross-layer KV footprint.
35
+ - **Decoder**: Layers 12–23 consume compacted representations for high-speed, cache-efficient autoregressive generation.
36
+ 2. **Dual Sparse Multi-Head Engram Modules (Section 2.4.2)**:
37
+ - **Layer 1 Engram**: Grounded in the **9,016 Triliteral Roots** of *Kitāb al-ʿAyn* using 4 prime-modulo hash tables $[65537, 65539, 65543, 65551]$ and context-aware gating. Zero-initialized to guarantee continuity with v16.
38
+ - **Layer 14 Engram**: Captures Sībawayhian syntactic governance and scholastic metaphysical operators (*jawhar*, *ʿaraḍ*, *burhān*).
39
+ 3. **Farāhīdian $S_3$ Permutation Orbit Head (Taqālīb)**:
40
+ - Evaluates the 6 cyclic and transpositional arrangements of every root ($\sigma \in S_3$), computing semantic invariant energy.
41
+ 4. **Controllable Reasoning Effort Controller (Section 5.1.4)**:
42
+ - Continuous reasoning budget vector $b \in [1, 100]$ modulating thinking depth and token trajectory dynamically.
43
+
44
+ ---
45
+
46
+ ## 2. Quantitative Performance
47
+
48
+ ### Training & Calibration (Blackwell RTX PRO 4500)
49
+ - **Calibration Steps**: 1,500 steps over 226,405 Basran sequences.
50
+ - **Validation Loss**: $2.1885 \longrightarrow \mathbf{2.1291}$.
51
+ - **Perplexity**: $9.48 \longrightarrow \mathbf{8.41\text{ PPL}}$.
52
+ - **Step-0 Loss Delta**: **0.000000** (Exact mathematical identity preserved).
53
+
54
+ ---
55
+
56
+ ## 3. Seen vs. Unseen Translation Quality Benchmark
57
+
58
+ Evaluated across 20 classical propositions (10 Seen from canonical Basran heritage, 10 Unseen from out-of-distribution philosophical and legal treatises):
59
+
60
+ | Metric | Seen Heritage Corpus (10 items) | Unseen Out-of-Distribution (10 items) |
61
+ |---|:---:|:---:|
62
+ | **Average Perplexity** | **127.17** | **157.26** |
63
+ | **Peak Low Perplexity** | **4.02 PPL** (*Al-Matālib al-ʿĀliyah*) | **28.33 PPL** (*Ārāʾ Ahl al-Madīnah*) |
64
+ | **Average Semantic Concordance** | **38.1%** | **29.5%** |
65
+ | **Peak Concordance** | **85.7%** (*Iḥyāʾ ʿUlūm al-Dīn*) | **50.0%** (*Faṣl al-Maqāl*) |
66
+ | **Average Transmutation Latency** | **63.9 ms** | **49.1 ms** |
67
+
68
+ ### Benchmark Highlights
69
+
70
+ #### Seen Heritage Highlight (Al-Ghazālī, *Iḥyāʾ ʿUlūm al-Dīn*)
71
+ > **Arabic**: «العلم بلا عمل جنون، والعمل بغير علم لا يكون»
72
+ > **Reference**: "Knowledge without action is madness, and action without knowledge cannot truly be."
73
+ > **V17 Output**: **"Knowledge without action is madness, and action without knowledge cannot be."**
74
+ > **Concordance**: **85.7%** | **Latency**: 30.4 ms
75
+
76
+ #### Seen Heritage Highlight (Fakhr al-Dīn al-Rāzī, *Al-Matālib al-ʿĀliyah*)
77
+ > **Arabic**: «الجوهر هو القائم بنفسه المستغني عن المحل، والعَرَض محتاج إلى موضوع يقوم به»
78
+ > **Reference**: "Substance is that which is self-subsisting, independent of a locus; whereas accident is inherently dependent upon a substrate through which it subsists."
79
+ > **V17 Output**: **"The substance (jawhar) is that which is self-subsisting in itself of the independent of the locus or substrate and the accident (ʿaraḍ) in need unto linguistic convention or positing a postulate essence with it or thereby."**
80
+ > **Perplexity**: **4.02 PPL** | **Concordance**: **60.0%** | **Latency**: 36.1 ms
81
+
82
+ #### Unseen Out-of-Distribution Highlight (Averroes / Ibn Rushd, *Faṣl al-Maqāl*)
83
+ > **Arabic**: «الحق لا يضاد الحق، بل يوافقه ويشهد له بالبرهان والتحقيق»
84
+ > **Reference**: "Truth does not oppose truth; rather, it harmonizes with it and bears witness to it through demonstrative proof and verification."
85
+ > **V17 Output**: **"The truth is not opposite the truth rather or on the contrary ywafqh and honey (a homonym is to it or him with the demonstrative proof (burhān) the truth or ontological reality or verity."**
86
+ > **Perplexity**: **33.12 PPL** | **Concordance**: **50.0%** | **Latency**: 38.4 ms
87
+
88
+ #### Unseen Out-of-Distribution Highlight (Al-Fārābī, *Ārāʾ Ahl al-Madīnah al-Fāḍilah*)
89
+ > **Arabic**: «السبب الأول هو الذي ينبغي أن يعتقد فيه أنه الإله، وهو بريء من جميع أنحاء النقص»
90
+ > **Reference**: "The First Cause is that which ought to be believed to be God, and He is transcendent beyond all modes of deficiency."
91
+ > **Perplexity**: **28.33 PPL** | **Concordance**: **42.9%** | **Latency**: 44.8 ms
92
+
93
+ ---
94
+
95
+ ## 4. Deep Reasoning Stress Battery ($b \in [25, 60, 100]$)
96
+
97
+ Tested across 12 classical propositions spanning Phonetic Physics, Sībawayhian Syntax, Ibn Jinnī $S_3$ Orbits, and Avicennian Logic:
98
+ - **Avicenna Quiddity & Existence**: **5.12 PPL**.
99
+ - **Al-Rāzī Substance & Accident**: **5.94 PPL**.
100
+ - **Sībawayh Idghām Phonetic Economy**: **7.99 PPL** with 100% root recall: `['حرف', 'قرب', 'خرج', 'وجب', 'دغم', 'طلب', 'خفف', 'رفع', 'ثقل', 'لسن']`.
101
+ - **Cosmological Syllogism**: **6.32 PPL** with detected roots: `['كلل', 'حدث', 'علم', 'غير', 'عيا', 'عرض', 'تقدم', 'وجب', 'وجد', 'ذات']`.
102
+
103
+ ---
104
+
105
+ ## 5. Usage & Inference
106
+
107
+ ```python
108
+ import torch
109
+ from safetensors.torch import load_file
110
+ from models.unified_rootformer_v12 import UnifiedRootformerV12
111
+ from deepseek_v4_1_flash_model import UnifiedRootformerV17_DeepSeekFlash
112
+
113
+ device = "cuda" if torch.cuda.is_available() else "cpu"
114
+
115
+ # 1. Base Backbone
116
+ base_model = UnifiedRootformerV12(
117
+ blueprint_path="data/rootformer_v12_arabic_blueprint.json",
118
+ base_model_name="Qwen/Qwen2.5-0.5B",
119
+ device=device,
120
+ dtype=torch.bfloat16
121
+ ).to(device)
122
+
123
+ # 2. DeepSeek-V4.1-Flash Sovereign Wrapper
124
+ flash_v17 = UnifiedRootformerV17_DeepSeekFlash(
125
+ base_v12_model=base_model,
126
+ device=device,
127
+ dtype=torch.bfloat16
128
+ ).to(device)
129
+
130
+ # 3. Load Master Safetensors
131
+ sd = load_file("rootformer_v17_deepseek_flash_sovereign_master.safetensors")
132
+ flash_v17.load_state_dict(sd, strict=False)
133
+ flash_v17.eval()
134
+
135
+ # 4. Generate with Controllable Reasoning Effort (b=60)
136
+ out = flash_v17.generate_with_effort(
137
+ prompt_ar="العين والحاء حرفان حلقيان من أقصى الحلق",
138
+ effort=60,
139
+ max_new_tokens=128
140
+ )
141
+ print(out["full_text"])
142
+ ```
143
+
144
+ ---
145
+
146
+ ## 6. Citation
147
+
148
+ ```bibtex
149
+ @misc{rootformer2026deepseekflash,
150
+ author = {Rootformer Research Group},
151
+ title = {Rootformer v17: DeepSeek-V4.1-Flash Sovereign Transmute for Arabic Non-Concatenative Morphology and Classical Reasoning},
152
+ year = {2026},
153
+ publisher = {Hugging Face},
154
+ howpublished = {\url{https://huggingface.co/enver/rootformer-v17-deepseek-flash}}
155
+ }
156
+ ```