Skip to main content

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

zpower-1.0.0.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zpower-1.0.0-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file zpower-1.0.0.tar.gz.

File metadata

  • Download URL: zpower-1.0.0.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for zpower-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ac42dc74583a1785f2efb6ef50027d3b688b72e2c26535217de41b6b0fe3402e
MD5 0df7a0124f61100a5390b13e343ee566
BLAKE2b-256 9924c6b04bd97f271ac457981d92e0ea60f0316f644ff43878bc2d7023db6213

See more details on using hashes here.

File details

Details for the file zpower-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: zpower-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for zpower-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2074bb57cd4837e631a324051fd0533e178a71c3d7eb44ea307f4ff82296c0a
MD5 f2952fe1a2e2e2299364fe7e99172700
BLAKE2b-256 475fc3e6f1067003e6a7c8811c43e624100732ef9383036b0e1114261f3656d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page