Skip to main content

Cruxy Stability Engine - Adaptive optimization framework by Axiom Forge Systems

Project description

Axiom Forge Systems Logo

Train 1.5B parameter models on a 4GB GPU. No scheduler tuning required.
White paper available on request.

Cruxy Stability Engine SDK

License Python PyTorch Status

The Cruxy Stability Engine is an adaptive optimization framework for neural network training, implementing the algorithms described in the Axiom Forge Systems Ltd White Paper (v2.0 + Meta-Cruxy 3.0).

🚀 Verified Performance (4GB VRAM)

The following models have been verified to train on consumer hardware (GTX 1650, 4GB VRAM) using Cruxy Meta-Lion + LoRA.

Model Params Config Status Demo Script
TinyLlama 1.1B Float16 + LoRA ✅ Verified examples/demo_tinyllama_4gb.py
Qwen 2.5 1.5B Float16 + LoRA ✅ Verified examples/demo_qwen_4gb.py
Gemma 2B 4-bit + LoRA ⚠️ Untested examples/demo_gemma2b_4gb.py
Phi-2 2.7B 4-bit + LoRA ⚠️ Untested examples/demo_phi2_4gb.py

Note: 4-bit quantization requires bitsandbytes. Without it, models >1.5B may require CPU offloading.

🏆 Benchmark Results (Shakespeare GPT)

Verified on NVIDIA GPU (Dec 2025)

Optimizer Final Loss Time Memory Notes
Cruxy (Meta3) 1.6413 26s Standard Most Intelligent (Beat AdamW)
AdamW (Baseline) 1.6843 10s Standard Baseline
Cruxy (Meta-Lion) 1.6633 26s Low (1/3x) Best for 4GB Cards (Stable @ LR=1e-3)

Hero Chart

Note: Meta-Lion achieved near-parity with AdamW while using significantly less memory, enabling LLM training on consumer hardware.

Features

  • Dual-Window Variance Monitoring: Detects training phases (volatility vs convergence).
  • Curvature-Adaptive Momentum: Adjusts beta1 based on loss landscape geometry.
  • Meta-Optimization (Meta-Cruxy 3.0): Schedule-free training via hierarchical control of learning rate and momentum.
  • Predictive Gradient Clipping: Variance-informed clipping thresholds.
  • Safety Guards: Automatic NaN/Inf detection and hyperparameter clamping.
  • Cluster Ready (Experimental): Supports torch.compile for high-performance training (untested on clusters).

Installation

pip install cruxy

Usage

Basic Usage

Use CruxyOptimizer as a drop-in replacement for torch.optim.AdamW.

import torch
from cruxy import CruxyOptimizer

model = torch.nn.Linear(10, 1)
optimizer = CruxyOptimizer(
    model.parameters(), 
    mode="meta3", # Options: "stability_v1", "stability_v2", "meta3"
    lr=1e-3
)

# Training Loop
for batch in dataloader:
    inputs, targets = batch
    optimizer.zero_grad()
    outputs = model(inputs)
    loss = torch.nn.MSELoss()(outputs, targets)
    loss.backward()
    
    # Pass loss to step() for curvature estimation
    optimizer.step(loss=loss.item())

HuggingFace Trainer Integration

from transformers import Trainer, TrainingArguments
from cruxy import CruxyOptimizer

class CruxyTrainer(Trainer):
    def create_optimizer(self):
        self.optimizer = CruxyOptimizer(
            self.model.parameters(),
            mode="meta3",
            lr=self.args.learning_rate
        )
        return self.optimizer

trainer = CruxyTrainer(...)
trainer.train()

Modes

  1. stability_v1: Baseline dual-window variance monitoring with PD control.
  2. stability_v2: Adds curvature adaptation, gamma-norm variance, and predictive clipping.
  3. meta3: Adds meta-controller for schedule-free training (Recommended).
  4. Meta-Lion: Activate by setting mode="meta3" and use_lion=True. Combines the memory efficiency of Lion with the stability of the Meta3 controller.

Testing

Run the test suite:

pytest tests/

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

cruxy-2.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

cruxy-2.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file cruxy-2.1.0.tar.gz.

File metadata

  • Download URL: cruxy-2.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cruxy-2.1.0.tar.gz
Algorithm Hash digest
SHA256 6f30e2b79cbac6b60097cdbb19f0391af71cdc2ec474fa8d283001a9e9cfb2a0
MD5 0e65c68c28ab6d4454025d3bea1d01c3
BLAKE2b-256 b4d9c2430d22193068f369efc806a9664a64e57df318bf5ad4598aeec4204dc7

See more details on using hashes here.

File details

Details for the file cruxy-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: cruxy-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cruxy-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5187de7df5b85ac2ae17ebdf1eb0758c864ecd88c22272deabe95b71d765b8fe
MD5 38df928535b11aa743352564e8d82d8d
BLAKE2b-256 280c918d5eefa4b5aa0db71cc822a79b96010e18f86059f108dcb3fd31d8ec7c

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