enver commited on
Commit
91f0108
·
verified ·
1 Parent(s): 2ad255d

docs: add comprehensive Model Card for AynCoding-Gemma2

Browse files
Files changed (1) hide show
  1. README.md +144 -0
README.md ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - ar
5
+ license: gemma
6
+ tags:
7
+ - code
8
+ - gemma2
9
+ - google
10
+ - gguf
11
+ - mantiq
12
+ - logic
13
+ - arabic
14
+ - epistemology
15
+ - reasoning
16
+ - chain-of-thought
17
+ - aynengine
18
+ base_model: google/gemma-2-2b-it
19
+ pipeline_tag: text-generation
20
+ ---
21
+
22
+ # 🏛️ AynCoding-Gemma2: Sovereign Epistemic Classical Arabic Logic (Manṭiq) 2.6B
23
+
24
+ **AynCoding-Gemma2** (`ayncoding-gemma2-2b`) is a sovereign, epistemic code synthesis and architectural refactoring model based on **Google's flagship Gemma 2 2B** architecture (`google/gemma-2-2b-it`), aligned and conditioned with **Classical Arabic Logic (*Manṭiq*)** and **Morphological Root Lexicography (*Ishtiqāq*)**.
25
+
26
+ Built upon Google DeepMind's distilled Gemma 2 architecture, **AynCoding-Gemma2** marries cutting-edge model distillation with 1,200 years of classical Arabic epistemological rigor. It natively engages a structured **Chain-of-Thought reasoning block (`<ayn_mantiq> ... </ayn_mantiq>`)** prior to code generation, analyzing software specifications through real essential definitions (*Al-Ḥadd bi al-Dhātiyyāt*), eliminating logical fallacies (*Dafʿ al-Dawr*, *Dafʿ al-Tasalsul*, *ʿAdam al-Tanāquḍ*), and mapping domain concepts to authentic tri-consonantal roots.
27
+
28
+ ---
29
+
30
+ ## 🌟 The 5 Classical Arabic Epistemic Pillars
31
+
32
+ AynCoding-Gemma2 is strictly governed by the foundational canons of classical Arabic scholarship:
33
+
34
+ 1. **Abū Ḥāmid al-Ghazālī** (*Miʿyār al-ʿIlm fī Fann al-Manṭiq* & *Miḥakk al-Naẓar*):
35
+ - **Al-Ḥadd bi al-Dhātiyyāt (Real Definition by Essence)**: Entities are defined by their constitutive essential attributes, never accidental symptoms.
36
+ - **Dafʿ al-Dawr (Elimination of Circularity)**: Zero circular dependencies, cyclic callbacks, or self-referential ungrounded types.
37
+ - **Dafʿ al-Tasalsul (Elimination of Infinite Regress)**: Strictly bounded recursion, guaranteed loop termination, and timeout bounds.
38
+ - **ʿAdam al-Tanāquḍ (Law of Non-Contradiction)**: Mutually exclusive states are unrepresentable simultaneously.
39
+ 2. **Al-Khalīl ibn Aḥmad al-Farāhīdī** (*Kitāb al-ʿAyn*) & **Ibn Manẓūr** (*Lisān al-ʿArab*):
40
+ - **Tri-Consonantal Root Decomposition & Combinatorial Safety**: Complex systems are decomposed into orthogonal, irreducible primitives anchored in authentic semantic roots (`قفل`, `حفظ`, `نقل`, `عقد`, `حسب`, `رتب`, `سلم`, `حكم`).
41
+ - **Exhaustive State-Space Coverage**: Zero unhandled match arms and zero silent exception swallowing (`except Exception: pass` is prohibited).
42
+ 3. **Al-Rāghib al-Iṣfahānī** (*Al-Mufradāt fī Gharīb al-Qurʾān*):
43
+ - **Ontological Domain Modeling & Teleology (*Ghāyah*)**: Absolute ban on amorphous, vague identifiers (`data`, `temp`, `val`, `mgr`, `helper`). Every symbol reflects its distinct teleological purpose.
44
+ 4. **Al-Zamakhsharī** (*Asās al-Balāghah*):
45
+ - **Abstraction Integrity & Rhetorical Eloquence (*Ḥaqīqah* vs *Majāz*)**: Delineating physical machine reality (memory, CPU caches, IO) from software abstractions. Zero leaky abstractions.
46
+ 5. **Sībawayh** (*Al-Kitāb*):
47
+ - **Syntactic Governance (*Al-ʿĀmil wa al-Maʿmūl*)**: Strict caller-callee hierarchy, rigorous static typing, and guaranteed AST integrity.
48
+
49
+ ---
50
+
51
+ ## 🧠 Cognitive Chain-of-Thought Protocol (`<ayn_mantiq>`)
52
+
53
+ Before emitting production code, AynCoding-Gemma2 executes its epistemic reasoning:
54
+
55
+ ```xml
56
+ <ayn_mantiq>
57
+ 🏛️ AYN-ENGINE EPISTEMIC LOGIC & MORPHOLOGY REASONING:
58
+ - Classical Root & Morphology (الجذر والتصريف): [Root e.g. ق-ف-ل, linguistic significance]
59
+ - Real Definition & Essence (الحد بالذاتيات - معيار العلم للغزالي): [Essential attributes and invariants]
60
+ - Epistemic Fallacy Invariants (دفع الدور والتسلسل ونفي التناقض): [Circularity, regress, and contradiction guards]
61
+ - Lexicographical Teleology (الغاية وبلاغة التجريد - المفردات والأساس): [Pure purpose, zero vague abstractions]
62
+ - Syntactic Governance (العامل والمعمول - كتاب سيبويه): [Strict type contracts, caller-callee hierarchy]
63
+ </ayn_mantiq>
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 🧪 Benchmark & Dynamic Evaluation
69
+
70
+ In live benchmark evaluations using the **5-Pillar Static Epistemic Auditor**:
71
+
72
+ * **Sliding Window Rate Limiter:**
73
+ * **Overall Epistemic Score:** **87.8% (Grade: B+)**
74
+ * **AST Syntax Integrity:** 100% Valid ✅
75
+ * **Banned Placeholders:** 0 (Zero-Loss Complete) ✅
76
+ * **Asās al-Balāghah (Eloquence):** **10.0 / 10**
77
+ * **Kitāb al-ʿAyn (Decomposition):** **10.0 / 10**
78
+ * **Sībawayh (Governance):** **10.0 / 10**
79
+ * **Dynamic Execution:** Automatically evicted oldest items in $O(1)$ under real multi-threaded execution!
80
+
81
+ ---
82
+
83
+ ## 🚀 Quickstart: Running with Ollama
84
+
85
+ 1. **Download the GGUF model and Modelfile:**
86
+ ```bash
87
+ huggingface-cli download enver/ayncoding-gemma2-2b ayncoding-gemma2-2b.gguf Modelfile --local-dir ./ayncoding-gemma2
88
+ cd ayncoding-gemma2
89
+ ```
90
+
91
+ 2. **Register with Ollama:**
92
+ ```bash
93
+ ollama create ayncoding-gemma2 -f Modelfile
94
+ ```
95
+
96
+ 3. **Run Inference:**
97
+ ```bash
98
+ ollama run ayncoding-gemma2 "Write a thread-safe sliding window rate limiter in Python"
99
+ ```
100
+
101
+ ---
102
+
103
+ ## 💻 Python (`llama-cpp-python`) Usage
104
+
105
+ ```python
106
+ from llama_cpp import Llama
107
+
108
+ llm = Llama(
109
+ model_path="ayncoding-gemma2-2b.gguf",
110
+ n_ctx=8192,
111
+ n_threads=16 # NUMA optimization
112
+ )
113
+
114
+ output = llm.create_chat_completion(
115
+ messages=[
116
+ {"role": "user", "content": "Explain how Ghazalian logic eliminates circularity in software architecture."}
117
+ ],
118
+ temperature=0.2,
119
+ max_tokens=4096
120
+ )
121
+
122
+ print(output["choices"][0]["message"]["content"])
123
+ ```
124
+
125
+ ---
126
+
127
+ ## 🛠️ Included Tools in Repository
128
+
129
+ - `Modelfile`: Sovereign Ollama definition with the 5 Classical Arabic Pillars and hyperparameter tuning.
130
+ - `dataset/ayn_mantiq_epistemic_dataset_50.jsonl`: 50 AST-validated training samples across 10 classical domains with `<ayn_mantiq>` CoT reasoning.
131
+ - `tools/core/mantiq_engine.py`: Classical Logic fallacy detection engine (*Dawr*, *Tasalsul*, *Tanāquḍ*).
132
+ - `tools/core/mantiq_purifier.py`: Automated code sanitizer purging amorphous variables and silent bare `except:` clauses.
133
+ - `tools/bin/ayncode`: Sovereign CLI developer tool for code synthesis, auditing, and purification.
134
+
135
+ ---
136
+
137
+ ## 📜 Heritage & Citations
138
+
139
+ - Google DeepMind, *Gemma 2: Improving Open Language Models at a Practical Size*.
140
+ - Abū Ḥāmid al-Ghazālī, *Miʿyār al-ʿIlm fī Fann al-Manṭiq*.
141
+ - Al-Khalīl ibn Aḥmad al-Farāhīdī, *Kitāb al-ʿAyn*.
142
+ - Al-Rāghib al-Iṣfahānī, *Al-Mufradāt fī Gharīb al-Qurʾān*.
143
+ - Ibn Manẓūr, *Lisān al-ʿArab*.
144
+ - Sībawayh, *Al-Kitāb*.