File size: 4,063 Bytes
3a869aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---

license: mit
tags:
  - custom-architecture
  - gstack
  - voidnet
  - linear-attention
  - hybrid-architecture
  - python-code
  - character-level
  - from-scratch
library_name: pytorch
---


# `GStack v4.1` — Python Code (`VoidOSS/GStack-v4.1-PythonCode`)

> **Second Comeback Release from `VoidOSS`** — A **9,410,614-parameter (`9.41M`)** hybrid sequence architecture built from scratch on a single **8 GB consumer RTX 4060 Ti (`$0.00` cloud spend)** that achieves **`1.54×` higher data efficiency** than a modern `10.70M` **FlashAttention + RoPE + SwiGLU Transformer** on real unseen Python source code while cutting KV-cache memory by **67% (`1/3` the attention layers)**.

![GStack v4.1 vs FlashRoPE-TF Real Python Code](assets/gstack_v4_1_code.png)

---

## Architecture Highlights (`GStack v4.1`)

| Component | Normal Transformer | **`GStack v4.1`** |
| :--- | :--- | :--- |
| **Long-Range Memory (67% of layers)** | 100% quadratic `T × T` attention | **`Neural Context`:** 5 fixed power-of-2 `O(n)` linear memory horizons (`128, 256, 512, 1024, 2048`) |
| **Active Working Memory (67% of layers)** | None | **`Associative Neural Attention`:** 4 self-cleaning working-memory concept slots (`24 × 48` key-value state) with differentiable soft eviction |
| **Verbatim Recall (33% of layers)** | All 6/6 layers | **2× `UltraFlashAttention` Sniper Layers** (Layers 3 & 6) with **QK-RMSNorm + RoPE** (`1/3` KV cache!) |
| **Feed-Forward Weights** | Static frozen FFN matrices | **Per-Layer `Gweight` (Galaxyweights):** Dedicated BF16 SwiGLU Core + 4 low-rank specialist Orbits dynamically dialed per token by `Neural Attention` |
| **Input Stream** | Shift-invariant tokens | Shift-invariant raw Python characters + multi-scale causal char-glue (`k=3 + k=7`) |

---

## Verified Benchmarks (Strict Zero-Leakage Causality QA: `past_diff = 0.00e+00`)



Evaluated on **`2,584` train / `287` completely unseen validation `.py` files** (`39.80M` train chars / `5.28M` unseen val chars, strict file-level split):



| Model | Exact Params | KV Cache | Data Seen | Unseen `.py` `val_BPC` |
| :--- | :---: | :---: | :---: | :---: |
| `FlashRoPE-TF` (modern Transformer baseline, 2.0m) | `10.70M` | `100%` (6/6) | `14.8M` chars | `1.2796 BPC` |
| **`GStack v4.1` (3-Min Benchmark)** | **`9.41M` (`−1.29M`)** | **`33%` (2/6)** | **`14.4M` chars** | **`1.0802 BPC`** *(48b: `1.1107` — **`1.54×` higher data efficiency!**)* |
| **`GStack v4.1` (This 5.0-Min Published Release)** | **`9.41M`** | **`33%` (2/6)** | **`24.5M` chars (`1,494` steps)** | **`0.9602 BPC`** |

### Flat `O(n)` Long-Context Scaling Proof (`2K → 32K` on 8 GB VRAM)
![VoidNet-G O(n) Scaling](assets/voidnet_g_3min.png)

---

## Quick Start (`from_pretrained`)



```python

from huggingface_hub import hf_hub_download
import importlib.util

# Load standalone modeling_gstack.py directly from this repo

mod_path = hf_hub_download("VoidOSS/GStack-v4.1-PythonCode", "modeling_gstack.py")

spec = importlib.util.spec_from_file_location("modeling_gstack", mod_path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)



model = mod.GStackModel.from_pretrained("VoidOSS/GStack-v4.1-PythonCode")
print(model.generate("def parse_config(filepath, default_timeout=30):\n    ", max_chars=240))

```



### Sample Unseen Python Completion (This Release)

```python

def parse_config(filepath, default_timeout=30):

    """Load key-value settings from a config file."""

    if filepath is None:

        filepath = filepath.size() * size

    elif filepath is None:

        filepath = filepath.size()

        with warnings.catch_warnings(filepath, default_timeout=30):

            filepath = filepath.size()

            filepath = filep

```



---



## Training Details

- **Hardware:** Single NVIDIA GeForce RTX 4060 Ti (8 GB VRAM)

- **Cloud Cost:** `$0.00`

- **Training Time:** `5.02` minutes (`1,494` steps, `24.5M` chars, WSD cosine LR schedule)

- **Strict Causality QA:** Passed (`past_diff = 0.00e+00`)