MtnMCG commited on
Commit
6ec3ff4
·
verified ·
1 Parent(s): c1b9444

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +168 -0
README.md ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ tags:
6
+ - pcei
7
+ - bitnet
8
+ - ternary
9
+ - 1.58bit
10
+ - mamba
11
+ - ssm
12
+ - state-space-model
13
+ - fastkan
14
+ - linear-attention
15
+ - energy-efficient
16
+ - green-ai
17
+ pipeline_tag: text-generation
18
+ ---
19
+
20
+ # PCEI-Text: Physically Constrained Emergent Intelligence (100M BitNet Ternary Mamba)
21
+
22
+ [![GitHub Repository](https://img.shields.io/badge/GitHub-MtnMCG%2FPCEI-blue.svg)](https://github.com/MtnMCG/PCEI)
23
+ [![Sister Repo: PCEI-Robotics](https://img.shields.io/badge/🤗%20HuggingFace-PCEI--Robotics-blueviolet.svg)](https://huggingface.co/MtnMCG/PCEI-Robotics)
24
+ [![Architecture: Selective SSM + BitNet 1.58b](https://img.shields.io/badge/Architecture-Mamba%20SSM%20%2B%20BitNet%201.58b-red.svg)]()
25
+ [![Complexity: O(L) Linear](https://img.shields.io/badge/Inference%20Complexity-O(1)%20Memory%20%7C%20O(L)%20Compute-green.svg)]()
26
+ [![Quantization: 1.58-bit {-1, 0, +1}](https://img.shields.io/badge/Quantization-Strict%20BitNet%20b1.58-brightgreen.svg)]()
27
+
28
+ > **Full Codebase, Theoretical Compendium, and Replication Suite**: [https://github.com/MtnMCG/PCEI](https://github.com/MtnMCG/PCEI)
29
+
30
+ ---
31
+
32
+ ## 🏛️ Executive Summary
33
+
34
+ **PCEI-Text** is an open-weights linear-time sequence model that discards quadratic Transformer attention ($\mathcal{O}(L^2)$) and high-energy 16-bit floating-point multiplications in favor of:
35
+ 1. **Hardware-efficient Selective State Spaces (Mamba SSM)** operating with linear $\mathcal{O}(L)$ compute and constant $\mathcal{O}(1)$ memory inference.
36
+ 2. **Canonical Microsoft BitNet b1.58 Ternary Quantization**, constraining synaptic weights to strictly discrete $\{-1.0, 0.0, +1.0\}$ states and replacing energy-hungry floating-point multiplications ($FMUL$) with integer additions ($IADD$).
37
+ 3. **Kolmogorov-Arnold Network (FastKAN) Spline Manifolds**, utilizing learnable cubic B-splines along non-linear parameter trajectories.
38
+ 4. **Dual-Timescale Dynamic State Modulation (`AmbientField`)**, preventing context degradation and drifting attractors over extended multi-turn horizons.
39
+
40
+ This repository hosts foundation checkpoint `pcei_100m_bitnet_ternary.pt` (1.09 GB), trained continuously on diverse natural language, dialogue, reasoning, and synthetic curricula.
41
+
42
+ ---
43
+
44
+ ## 🔬 Empirical Audits & Verification
45
+
46
+ ### 1. Tiny LM Compute-Matched Bake-Off (Muse Autonomous Evaluation)
47
+ In an independent multi-seed compute-matched baseline bake-off conducted via the Muse evaluation agent against a compute-matched Transformer:
48
+
49
+ | Model | Architecture | Parameters | Val Loss (mean ± std) | Val Perplexity | Win Rate |
50
+ | :--- | :--- | :---: | :---: | :---: | :---: |
51
+ | **Transformer** | Vanilla Decoder (5L, 4H, FFN $2\times d$ GELU) | 398,688 | 4.6131 ± 0.0003 | 100.8 | Baseline |
52
+ | **Dense Mamba** | Repo `MambaBlock` (6L, FP32 dense weights) | 407,232 | 4.3881 ± 0.0009 | 80.5 | 0 / 2 vs PCEI |
53
+ | **PCEI-tiny** | **Strict 1.58-bit Ternary (`{-1, 0, +1}`) + FastKAN** | 411,912 | **4.3783 ± 0.0073** | **79.1** | **2 / 2 (Won all seeds)** |
54
+
55
+ * **Key Takeaway**: Despite linear projections constrained strictly to discrete $\{-1, 0, +1\}$ ternary states (zero floating-point multiplications), PCEI outperformed the dense FP32 Mamba baseline and beat the standard Transformer by **0.23 nats** (val perplexity 79.1 vs 100.8).
56
+
57
+ ### 2. Strict Microsoft BitNet b1.58 Migration
58
+ An external audit in October 2026 disclosed that early internal prototypes utilized an experimental 5-state quantizer. The architecture was fully refactored to canonical Microsoft BitNet b1.58:
59
+ - **Parameter Entropy Cut**: Reduced from 2.32b to strictly 1.58b ($\le \log_2(3)$ bits/param), cutting parameter entropy by **32%**.
60
+ - **Perplexity & Hallucinations**: Validation loss improved from 11.1696 to 11.1429 on 100M, eliminating activation outlier code token hallucinations.
61
+ - Full scientific post-mortem report: [`AUDIT_REPORT_TERNARY_QUANTIZATION_POSTMORTEM.md`](https://github.com/MtnMCG/PCEI/blob/main/pcei_framework/docs/AUDIT_REPORT_TERNARY_QUANTIZATION_POSTMORTEM.md).
62
+
63
+ ---
64
+
65
+ ## ⚙️ Model Specifications
66
+
67
+ | Architectural Dimension | Specification |
68
+ | :--- | :--- |
69
+ | **Base Architecture** | 12-Layer Selective State Space (Mamba SSM) |
70
+ | **Model Dimension ($d_{\text{model}}$)** | 768 |
71
+ | **Inner Expansion Dimension ($d_{\text{inner}}$)** | 512 |
72
+ | **State Dimension ($d_{\text{state}}$)** | 16 |
73
+ | **Convolution Kernel Size** | 4 |
74
+ | **Non-Linear Branch** | FastKAN (Learnable cubic B-splines, grid size = 5) |
75
+ | **Synaptic Quantization** | Strict BitNet b1.58 ($\{-1.0, 0.0, +1.0\}$) via STE |
76
+ | **Vocabulary Size** | 50,257 (OpenAI GPT-2 BPE tokenizer) |
77
+ | **Context Length ($L$)** | 128 / 512 / 2048 streaming tokens |
78
+ | **Inference Footprint** | $\approx 250\text{ MB}$ packed ternary integer weights |
79
+ | **Hardware Target** | Apple Silicon MPS, NVIDIA CUDA, or CPU edge devices |
80
+
81
+ ---
82
+
83
+ ## 🚀 Local Inference Quickstart
84
+
85
+ To run local text generation using the PCEI framework:
86
+
87
+ ```bash
88
+ # 1. Clone the master GitHub repository
89
+ git clone https://github.com/MtnMCG/PCEI.git
90
+ cd PCEI/pcei_framework
91
+
92
+ # 2. Set up virtual environment and install dependencies
93
+ python3 -m venv venv
94
+ source venv/bin/activate
95
+ pip install -r requirements.txt
96
+ pip install huggingface_hub
97
+
98
+ # 3. Download the model checkpoint directly from Hugging Face
99
+ python3 -c "
100
+ from huggingface_hub import hf_hub_download
101
+ hf_hub_download(repo_id='MtnMCG/PCEI-Text', filename='pcei_100m_bitnet_ternary.pt', local_dir='checkpoints')
102
+ "
103
+
104
+ # 4. Interactive generation with continuous state modulation
105
+ python3 tools/resonance_chat.py \
106
+ --checkpoint checkpoints/pcei_100m_bitnet_ternary.pt \
107
+ --device mps # Use --device cuda on NVIDIA GPUs
108
+ ```
109
+
110
+ ### Python API Usage
111
+
112
+ ```python
113
+ import torch
114
+ from src.pcei import PCEINexus
115
+ from src.config import PCEIConfig
116
+ from src.tokenizer import PCEITokenizer
117
+
118
+ device = torch.device("mps" if torch.backends.mps.is_available() else ("cuda" if torch.cuda.is_available() else "cpu"))
119
+
120
+ # Load checkpoint
121
+ checkpoint = torch.load("checkpoints/pcei_100m_bitnet_ternary.pt", map_location=device)
122
+ cfg_obj = checkpoint.get("config", None)
123
+ config = cfg_obj if isinstance(cfg_obj, PCEIConfig) else PCEIConfig.load()
124
+
125
+ # Initialize model
126
+ nexus = PCEINexus(config=config).to(device)
127
+ nexus.load_state_dict(checkpoint["model_state_dict"], strict=False)
128
+ nexus.eval()
129
+
130
+ # Tokenize prompt
131
+ tokenizer = PCEITokenizer(vocab_size=config.vocab_size)
132
+ prompt = "USER: Explain why ice floats on water.\nASSISTANT:"
133
+ input_ids = torch.tensor(tokenizer.encode_raw(prompt), dtype=torch.long).unsqueeze(0).to(device)
134
+
135
+ # Autoregressive generation
136
+ with torch.no_grad():
137
+ for _ in range(64):
138
+ outputs = nexus({"text": input_ids})
139
+ logits = outputs["logits"] if isinstance(outputs, dict) else outputs
140
+ next_token = torch.argmax(logits[:, -1, :], dim=-1, keepdim=True)
141
+ input_ids = torch.cat([input_ids, next_token], dim=-1)
142
+
143
+ print(tokenizer.decode(input_ids[0].tolist()))
144
+ ```
145
+
146
+ ---
147
+
148
+ ## 🤖 Sister Repositories & Embodied Intelligence
149
+
150
+ PCEI proves that physical constraints generalize across domains:
151
+ - 🏃 **[MtnMCG/PCEI-Robotics](https://huggingface.co/MtnMCG/PCEI-Robotics)**: Autonomous American Ninja Warrior 18-meter humanoid controller traversing 45° angled Quad Steps without attention or deep RL.
152
+ - 🏛️ **[PCEI Master GitHub Repository](https://github.com/MtnMCG/PCEI)**: Contains the 11 theoretical research papers, continuous training daemons, curriculum streaming pipelines, and full verification suite.
153
+
154
+ ---
155
+
156
+ ## 📜 Citation & License
157
+
158
+ This model and the PCEI codebase are released under the **MIT License**.
159
+
160
+ ```bibtex
161
+ @article{ramirez2026pcei,
162
+ title = {Physically Constrained Emergent Intelligence: Subverting Transformer Hyperscaling via Linear State Spaces, Ternary Synaptic Gating, and Latent Generative Replay},
163
+ author = {Ramirez, Emerson and Antigravity Assistant},
164
+ journal = {PCEI Theoretical Research Compendium},
165
+ year = {2026},
166
+ url = {https://github.com/MtnMCG/PCEI}
167
+ }
168
+ ```