V9 Palace Transformer — from-scratch LLM with block-diagonal palace-collated attention, per-palace LoRA K/V, cross-palace gating, and semantic palace routing
Project description
transformers-v9
V9 Palace Transformer — an independent from-scratch LLM architecture with block-diagonal palace-collated attention, per-palace LoRA K/V adapters, and cross-palace semantic gating. Not a base-model adapter — its own embedding/position/lm_head stack.
Part of the V∞ (SiliconLifeOS) paradigm: cognitive structure is architecture, not prompt engineering.
Architecture
| Component | Detail |
|---|---|
| Palace Attention | Block-diagonal mask: tokens attend only within same palace |
| LoRA K/V | Per-palace low-rank adapters (r=16, 48 palaces) |
| Cross-palace gate | Softmax MLP mix of palace embeddings |
| QKV low-rank | D→64→D bottleneck projections |
| Residuals | 6 layers, no FFN (sufficient for structured reasoning) |
| Default scale | ~1.5B params (hidden=2048, 6 layers, 48 palaces) |
Input → Embed/Pos → 6×PalaceAttentionLayer (residual) → LM Head → Output
Quick Start
import transformers_v9 # registers v9_palace with HF Auto Classes
from transformers import AutoConfig, AutoModelForCausalLM
config = AutoConfig.from_pretrained("v9_palace", vocab_size=32768, hidden_size=2048)
model = AutoModelForCausalLM.from_config(config)
Training
from transformers_v9 import V9PalaceTrainer
trainer = V9PalaceTrainer(model, train_dataset, eval_dataset)
trainer.train()
From-scratch training pipeline included (from transformers_v9.train import get_curriculum_dataset):
- SPC L1-L6 curriculum data
- CP fusion tasks
- Multi-domain reasoning
Router (Semantic Palace Routing)
from transformers_v9 import V9RouterConfig, V9Router
router = V9Router(V9RouterConfig())
palace = router.route("Discuss the attention mechanism in Transformers")
# → Palace ID for attention-related reasoning
4-level cascade: L0 domain hash → L1 keyword voting → L2 group Jaccard → L3 embedding (optional).
Install
pip install transformers-v9
Requirements
- Python 3.8+
- PyTorch 2.0+
- transformers 4.30+
- accelerate 0.20+
Status
Alpha prototype — structured reasoning validation complete. CPU training verified (500 samples, 20 epochs: ont_self 0.55→1.11, accuracy 96.5%). GPU training for full-scale (1.5B+) recommended.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file transformers_v9-0.2.0.tar.gz.
File metadata
- Download URL: transformers_v9-0.2.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b214b1fd92582b8d53347c67c2f2988433a32ed161a765aaac287d914a87b9fd
|
|
| MD5 |
730a1489bcf9f180a45f726153de3326
|
|
| BLAKE2b-256 |
bb89ea29f4fd94460ddd52116094661a8e8165089969942384faefa65c6f5bee
|
File details
Details for the file transformers_v9-0.2.0-py3-none-any.whl.
File metadata
- Download URL: transformers_v9-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ab4cb051f282146b106ffcc9a50c1a157001f02d2a639186fb0ba5b3aab6ca9
|
|
| MD5 |
b54aad14f0187d93ad10460101c3a1d5
|
|
| BLAKE2b-256 |
ba057c9c045bc2c53afc86dd5d568774ef782a235fd3335ec24f210bf9bc36ee
|