Intelligence layer for AI/ML — stabilization, selective memory, weight surgery
Project description
ZPower (zp) — v1
Intelligence layer for AI/ML systems.
Works with PyTorch and HuggingFace — not against them.
Stabilize training. Protect good weights. Detect anomalies. Reduce wasted compute.
Install
pip install zpower # numpy only (core features)
pip install zpower[torch] # + PyTorch support
pip install zpower[hf] # + HuggingFace Transformers
pip install zpower[full] # everything
Quick Start
Mode A — Pre-trained model (attach ZPower)
import zpower as zp
# Any PyTorch or HuggingFace model
zp_model = zp.attach(
my_model,
stabilize = True, # GradShield + StabilityCore
monitor = True, # NipGraph anomaly detection
weight_vault = True, # Record best weight checkpoints
)
# Forward pass — completely unchanged
output = zp_model(input_tensor)
# After loss + backward — ZPower hooks are active automatically
loss.backward()
Mode B — Training from scratch
import zpower as zp
trainer = zp.Trainer(
my_model,
stabilize = True,
weight_vault = True,
weight_guard = False, # enable after first good run
)
trainer.fit(train_loader, epochs=20, lr=1e-3)
print(trainer.weight_report())
# { layers_vaulted: 12, total_snapshots: 47, overall_vault_score: 0.84 }
trainer.render_monitor()
# NipGraph ASCII dashboard
Multi-model weight selection
from zpower.weights import WeightSurgeon
surgeon = WeightSurgeon(conflict_resolution="highest_performer")
surgeon.add_source("run_jan.pt", label="jan", perf_score=0.72)
surgeon.add_source("run_mar.pt", label="mar", perf_score=0.89)
surgeon.add_source("run_may.pt", label="may", perf_score=0.81)
best_weights = surgeon.select_best()
new_model.load_state_dict(best_weights)
print(surgeon.selection_report())
# { 'transformer.layer.0.attn': 'mar', 'transformer.layer.1.ffn': 'may', ... }
Module Overview
| Module | Purpose |
|---|---|
zp.memory.OtuxStore |
Selective context-aware memory — stores only important information |
zp.stabilize.GradShield |
Real-time gradient health: detects vanishing / exploding |
zp.stabilize.StabilityCore |
Loss EMA + plateau detection + LR signal |
zp.stabilize.ModelStabilizer |
Unified stabilization API |
zp.monitor.NipGraph |
Parity-aware training anomaly detection |
zp.weights.WeightVault |
Performance-gated weight snapshots |
zp.weights.WeightSurgeon |
Multi-model best weight selection (Fisher-guided) |
zp.weights.WeightGuard |
EWC-style catastrophic forgetting prevention |
zp.compute.safe_loss |
NaN-safe loss computation with rational fallback |
zp.compute.safe_divide |
Exact fraction arithmetic for recurring decimals |
zp.compat.ZPowerModel |
PyTorch model wrapper |
zp.compat.augment |
HuggingFace model augmentation |
How ZPower Reduces Load
| Problem | ZPower Solution | Effect |
|---|---|---|
| NaN crash mid-training | GradShield clips before NaN | No wasted restart |
| Plateau wastes epochs | StabilityCore signals LR reduction | Converges faster |
| Catastrophic forgetting | WeightGuard EWC penalty | Retains good knowledge |
| Starting training from scratch | WeightSurgeon merges best of past runs | Better initialization |
| Storing all context blindly | OTUX-S importance gate | 70%+ memory reduction |
| Anomaly found too late | NipGraph detects at first sign | Early intervention |
Research Origins
All core systems are original research by NNN Bhoi:
- OTUX-S — from PERATHINK research paper (selective 3D coordinate memory)
- NipGraph — from NipGraph research paper (parity-aware state tracking)
- GradShield + StabilityCore — from MUSAI vGPU engine (M2 + M4)
- WeightVault / Surgeon / Guard — original ZPower research
License
MIT — free to use in any project.
Project details
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 zpower-1.1.0.tar.gz.
File metadata
- Download URL: zpower-1.1.0.tar.gz
- Upload date:
- Size: 40.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
097821794eed30d9a2c764f596865e433e1b191ea009c64f58de456b954bbd31
|
|
| MD5 |
1da1d977f601566361963b0a46eff3a0
|
|
| BLAKE2b-256 |
ba61f25b12d42286166d987ab61aa6f3fe2c2fb895fa7a22625adc20c86da6ff
|
File details
Details for the file zpower-1.1.0-py3-none-any.whl.
File metadata
- Download URL: zpower-1.1.0-py3-none-any.whl
- Upload date:
- Size: 41.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e06c4454228d9c88f397b39a4afbdcc61063ccb3f188fdd7fa182df7ea06894
|
|
| MD5 |
6abdbd5a97b339928a8003472ac31470
|
|
| BLAKE2b-256 |
27bc90a73c16aa1b51b7640af7a538be2ea2a26fcc0e50358da4ad09de60d13f
|