Chaman1234 commited on
Commit
06b316f
Β·
verified Β·
1 Parent(s): 3f01d84

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +188 -28
README.md CHANGED
@@ -73,52 +73,212 @@ Comparison representing 100,000 tokens of corpus knowledge:
73
  - **Graph state memory**: **2.61 MB** (VLCM) βž” **19,134.6x memory compression**
74
  - **Generation FLOPs per query**: ~8.19 Trillion FLOPs vs. **~7.66 Million FLOPs** (1,000,000x savings)
75
 
76
- ### 4. Code Generation Test (CAT V3 + Qwen Coder 2.5 3B)
77
- We run an end-to-end autonomous coding test using the local `qwen2.5-coder:3b` model to evaluate the coding performance:
78
 
79
- * **User Query**: *"Write a Python function fibonacci(n) that returns the first n Fibonacci numbers. In the main block, call this function with n=10, print the result, and do not use any interactive input() calls."*
80
- * **CAT V3 GAT Routing**: Routes to **physics** and **mathematics** experts. Fused reasoning concept path: `force βž” acceleration βž” velocity βž” gravity`
81
- * **System 1 Generative Model**: Ollama `qwen2.5-coder:3b`
82
- * **Execution Sandbox**: Python 3 Subprocess Sandbox
83
- * **Execution Outcome**: **Success** (exited with code 0 on the first iteration)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
- #### Generated Python Code Example:
86
  ```python
 
 
87
  def fibonacci(n):
88
- # Initialize the first two Fibonacci numbers
89
- fib_sequence = [0, 1]
 
 
 
 
 
 
 
 
 
 
 
90
 
91
- # Generate the Fibonacci sequence up to n numbers
92
  for i in range(2, n):
93
  next_fib = fib_sequence[i-1] + fib_sequence[i-2]
94
  fib_sequence.append(next_fib)
95
 
96
  return fib_sequence
97
 
98
- # Main block: call the fibonacci function with n=10 and print the result
99
  if __name__ == "__main__":
100
  n = 10
101
- result = fibonacci(n)
102
- print(result)
 
 
 
103
  ```
 
 
 
 
 
 
104
 
105
- #### Execution Stdout:
106
- ```text
107
- [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
- ### 5. Large-Scale Stress Test (100,000 Concepts & 1.2M Edges)
111
- We stress-tested the memory footprint and traversal performance of the scaled symbolic reasoning engine using the newly generated 1 lakh concept coding graph:
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
- * **Graph Sizing**: **100,001 nodes** and **1,200,000 directed edges**
114
- * **Graph Load Time**: **14.69 seconds** (deserializing and building the memory structure)
115
- * **RAM Memory Footprint**: **1,255.68 MB** (approx. 1.25 GB in Python)
116
- * **Graph Traversal Latency (Beam Search)**: **133.61 ms** (average over 50 iterations for a 5-hop path search)
117
- * **System 1 Generation Latency (Qwen Coder 2.5 3B)**: **15.27 seconds**
118
- * **Sandbox Sandbox Run Latency**: **0.52 seconds**
119
-
120
- > [!TIP]
121
- > Traversal is highly optimized via pre-calculated activation mappings. Performing a 5-hop search on a graph of 100,000 nodes takes only **133 milliseconds**, proving that CAT V3's System 2 reasoning layer is extremely lightweight and ready for edge deployments.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  ---
124
 
 
73
  - **Graph state memory**: **2.61 MB** (VLCM) βž” **19,134.6x memory compression**
74
  - **Generation FLOPs per query**: ~8.19 Trillion FLOPs vs. **~7.66 Million FLOPs** (1,000,000x savings)
75
 
76
+ ### 4. End-to-End Stress Test: 100,000 Concepts & Actual Code Generation
 
77
 
78
+ We stress-tested the performance, memory footprint, and reliability of the scaled symbolic reasoning engine using a **100,001-node coding concept graph with 1.2 Million directed edges**, paired with the local **Qwen 2.5 Coder 3B** model (`qwen2.5-coder:3b`) and a multi-language subprocess execution sandbox.
79
+
80
+ #### πŸ“ˆ Stress Test Performance & Memory Metrics:
81
+ * **Graph Sizing**: **100,001 nodes** and **1,200,000 directed edges**
82
+ * **Graph Load Time**: **14.58 seconds** (deserializing and building the in-memory graph structure)
83
+ * **RAM Memory Footprint**: **1,501.59 MB** (approx. 1.50 GB)
84
+ * **Symbolic Traversal Latency (5-hop Beam Search)**: **121.81 ms** (average over 50 runs, highly optimized via pre-calculated activation mappings)
85
+ * **Average Code Generation Time**: **8.94 seconds** per task (System 1 inference)
86
+ * **Sandbox Code Execution Time**: **0.41 seconds** (System 2 sandbox execution)
87
+ * **Sandbox Compilation/Execution Success Rate**: **100.0%** (5 out of 5 tasks successfully compiled and passed on the first attempt)
88
+
89
+ ---
90
+
91
+ #### πŸ’» Multi-Language Code Generation & Sandbox Results
92
+
93
+ We ran 5 distinct coding tasks across Python and JavaScript, enforcing strict concept planning paths to test compliance, syntax validity, and execution outcomes.
94
+
95
+ ````carousel
96
+ ### 🐍 Task 1: Fibonacci Sequence (Python)
97
+ * **Prompt**: *"Write a Python function fibonacci(n) that returns the first n Fibonacci numbers. In the main block, call this function with n=10, print the result, and do not use any interactive input() calls."*
98
+ * **GNN Concept Path**: `Array Allocation in Python` βž” `Array Execution in Python` βž” `Array Optimization in Python`
99
+ * **Generation Time**: 10.99 seconds
100
+ * **Sandbox Output**: `The first 10 Fibonacci numbers are: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]`
101
 
 
102
  ```python
103
+ # Fibonacci sequence generator in Python
104
+
105
  def fibonacci(n):
106
+ '''
107
+ Generate the first n Fibonacci numbers.
108
+
109
+ Parameters:
110
+ n (int): The number of Fibonacci numbers to generate.
111
+
112
+ Returns:
113
+ list: A list containing the first n Fibonacci numbers.
114
+ '''
115
+ if n <= 0:
116
+ return []
117
+ elif n == 1:
118
+ return [0]
119
 
120
+ fib_sequence = [0, 1]
121
  for i in range(2, n):
122
  next_fib = fib_sequence[i-1] + fib_sequence[i-2]
123
  fib_sequence.append(next_fib)
124
 
125
  return fib_sequence
126
 
127
+ # Main block to test the fibonacci function
128
  if __name__ == "__main__":
129
  n = 10
130
+ try:
131
+ result = fibonacci(n)
132
+ print(f"The first {n} Fibonacci numbers are: {result}")
133
+ except Exception as e:
134
+ print(f"An error occurred: {e}")
135
  ```
136
+ <!-- slide -->
137
+ ### 🐍 Task 2: Greatest Common Divisor (Python)
138
+ * **Prompt**: *"Write a Python function calculate_gcd(a, b) that computes the greatest common divisor using the Euclidean algorithm. Test it with inputs a=48 and b=18, print the result, and do not use interactive input() calls."*
139
+ * **GNN Concept Path**: `Variable Normalization in Python` βž” `Variable Execution in Python` βž” `Variable Optimization in Python`
140
+ * **Generation Time**: 6.26 seconds
141
+ * **Sandbox Output**: `The greatest common divisor of 48 and 18 is: 6`
142
 
143
+ ```python
144
+ # Function to calculate the greatest common divisor using the Euclidean algorithm
145
+ def calculate_gcd(a, b):
146
+ # Ensure both numbers are positive
147
+ a = abs(a)
148
+ b = abs(b)
149
+
150
+ # Use the Euclidean algorithm to find GCD
151
+ while b:
152
+ a, b = b, a % b
153
+
154
+ return a
155
+
156
+ # Main block with test data
157
+ if __name__ == "__main__":
158
+ a = 48
159
+ b = 18
160
+ try:
161
+ result = calculate_gcd(a, b)
162
+ print(f"The greatest common divisor of {a} and {b} is: {result}")
163
+ except Exception as e:
164
+ print(f"An error occurred: {e}")
165
  ```
166
+ <!-- slide -->
167
+ ### 🐍 Task 3: Matrix Transpose (Python)
168
+ * **Prompt**: *"Write a Python function transpose(matrix) that transposes a 2D list (matrix) of size 3x3. Test it with matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]], print the transposed matrix, and do not use interactive input() calls."*
169
+ * **GNN Concept Path**: `Matrix Normalization in Python` βž” `Matrix Execution in Python` βž” `Matrix Optimization in Python`
170
+ * **Generation Time**: 8.75 seconds
171
+ * **Sandbox Output**:
172
+ ```text
173
+ Original Matrix:
174
+ [1, 2, 3]
175
+ [4, 5, 6]
176
+ [7, 8, 9]
177
+
178
+ Transposed Matrix:
179
+ [1, 4, 7]
180
+ [2, 5, 8]
181
+ [3, 6, 9]
182
+ ```
183
 
184
+ ```python
185
+ import numpy as np
186
+
187
+ def transpose(matrix):
188
+ try:
189
+ if len(matrix) != 3 or any(len(row) != 3 for row in matrix):
190
+ raise ValueError("Input must be a 3x3 matrix.")
191
+
192
+ # Transpose using numpy's transpose function
193
+ transposed_matrix = np.array(matrix).T.tolist()
194
+ return transposed_matrix
195
+ except Exception as e:
196
+ print(f"An error occurred: {e}")
197
+ return None
198
 
199
+ if __name__ == "__main__":
200
+ matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
201
+ transposed_matrix = transpose(matrix)
202
+ if transposed_matrix is not None:
203
+ print("Original Matrix:")
204
+ for row in matrix:
205
+ print(row)
206
+ print("
207
+ Transposed Matrix:")
208
+ for row in transposed_matrix:
209
+ print(row)
210
+ ```
211
+ <!-- slide -->
212
+ ### 🟨 Task 4: Run-length Encoding (JavaScript)
213
+ * **Prompt**: *"Write a JavaScript function rle(input) that performs run-length encoding on a string. For example, 'AABBBCCCC' should return 'A2B3C4'. Call it with 'AABBBCCCC' in the main block and print the result using console.log. Do not use interactive prompt() calls."*
214
+ * **GNN Concept Path**: `String Parsing in JavaScript` βž” `String Execution in JavaScript` βž” `String Validation in JavaScript`
215
+ * **Generation Time**: 9.93 seconds
216
+ * **Sandbox Output**: `A2B3C4`
217
+
218
+ ```javascript
219
+ // Function to perform run-length encoding on a string
220
+ function rle(input) {
221
+ if (typeof input !== 'string') {
222
+ throw new Error('Input must be a string');
223
+ }
224
+
225
+ let encoded = '';
226
+ let count = 1;
227
+
228
+ for (let i = 1; i < input.length; i++) {
229
+ if (input[i] === input[i - 1]) {
230
+ count++;
231
+ } else {
232
+ encoded += input[i - 1] + count;
233
+ count = 1;
234
+ }
235
+ }
236
+
237
+ // Add the last character and its count
238
+ encoded += input[input.length - 1] + count;
239
+ return encoded;
240
+ }
241
+
242
+ // Main block to test the rle function
243
+ try {
244
+ const inputString = 'AABBBCCCC';
245
+ const result = rle(inputString);
246
+ console.log(result); // Output: A2B3C4
247
+ } catch (error) {
248
+ console.error('Error:', error.message);
249
+ }
250
+ ```
251
+ <!-- slide -->
252
+ ### 🐍 Task 5: Bubble Sort (Python)
253
+ * **Prompt**: *"Write a Python function bubble_sort(arr) that sorts an array of integers in ascending order. Test it with inputs arr=[64, 34, 25, 12, 22, 11, 90], print the sorted array, and do not use interactive input() calls."*
254
+ * **GNN Concept Path**: `Array Optimization in Python` βž” `Array Parsing in Python` βž” `Array Execution in Python`
255
+ * **Generation Time**: 8.75 seconds
256
+ * **Sandbox Output**:
257
+ ```text
258
+ Original array: [64, 34, 25, 12, 22, 11, 90]
259
+ Sorted array: [11, 12, 22, 25, 34, 64, 90]
260
+ ```
261
+
262
+ ```python
263
+ # Bubble Sort Function in Python
264
+
265
+ def bubble_sort(arr):
266
+ n = len(arr)
267
+ for i in range(n):
268
+ for j in range(0, n-i-1):
269
+ if arr[j] > arr[j+1]:
270
+ arr[j], arr[j+1] = arr[j+1], arr[j]
271
+
272
+ if __name__ == "__main__":
273
+ arr = [64, 34, 25, 12, 22, 11, 90]
274
+ try:
275
+ print("Original array:", arr)
276
+ bubble_sort(arr)
277
+ print("Sorted array:", arr)
278
+ except Exception as e:
279
+ print(f"An error occurred: {e}")
280
+ ```
281
+ ````
282
 
283
  ---
284