Foundational industrial AI model for real-time telemetry, IoT, and time-series
Project description
VULGARIS is an open-source foundational model designed for real-time telemetry, sensor fusion, and time-series intelligence across industrial environments. It is written entirely in NumPy with a custom reverse-mode automatic differentiation engine — no PyTorch, no TensorFlow, no CUDA dependency.
The architecture combines state-space recurrence, causal graph learning, hierarchical memory, and domain-adaptive hypernetworks into a single unified model that trains on a CPU and deploys on edge hardware.
Architecture
| Module | Role |
|---|---|
| ASE — Adaptive Signal Embedding | Morlet wavelet filterbank; converts raw channels to latent sequences |
| HTD — Hierarchical Timescale Decomposition | Four-level parallel SSM; captures dynamics from milliseconds to minutes |
| SSSR — Selective State-Space Recurrence | Diagonal ZOH state-space core; selective gating per timestep |
| DAH — Domain-Adaptive Hypernetwork | LoRA-style adapter generation; zero-shot domain switching at inference |
| CRG — Causal Routing Graph | NOTEARS-constrained DAG; learns causal structure from data online |
| HMB — Hierarchical Memory Bank | VAE-compressed episodic slots; retrieval-augmented state transitions |
| ESE — Explainability Engine | CART rule extraction from latent activations; human-readable decisions |
| Safety | Control Barrier Function head; certified safe action projection |
| SHCAL | EWC + Hebbian continual learning; prevents catastrophic forgetting |
| CMLA | InfoNCE cross-modal latent alignment; multi-sensor fusion |
Installation
pip install vulgaris
Optional extras:
pip install "vulgaris[serve]" # REST inference server (FastAPI + uvicorn)
pip install "vulgaris[train]" # Training utilities (tqdm, rich)
pip install "vulgaris[all]" # Everything
Requirements: Python ≥ 3.10, NumPy ≥ 1.26, SciPy ≥ 1.11, PyYAML ≥ 6.0
Quick Start
import numpy as np
from vulgaris import Vulgaris, ModelConfig, Tensor
config = ModelConfig(
input_dim=9, # input channels
n_classes=5, # classification targets (set 0 for regression)
output_dim=1,
)
model = Vulgaris(config)
# Batch inference: (batch, channels, timesteps)
x = Tensor(np.random.randn(8, 9, 64).astype(np.float32))
output, aux = model(x)
print(output.data.shape) # (8, 5)
Streaming Inference
VULGARIS processes one timestep at a time with stateful recurrence — suitable for hard real-time systems:
state = model.init_state(batch_size=1)
for t in range(sequence_length):
x_t = Tensor(sensor_reading[t].astype(np.float32)) # (1, 9)
output_t, state = model.step(x_t, state)
Training
from vulgaris import (
Vulgaris, ModelConfig,
TrainingPipeline, VulgarisLoss,
SpectralAdamW, CosineSchedule,
)
config = ModelConfig(input_dim=9, n_classes=5)
model = Vulgaris(config)
loss_fn = VulgarisLoss(config)
optimizer = SpectralAdamW(model.parameters(), lr=3e-4)
scheduler = CosineSchedule(optimizer, warmup_steps=1000,
max_steps=50_000, min_lr=1e-6)
pipeline = TrainingPipeline(model, config, loss_fn, optimizer, scheduler)
metrics = pipeline.train_step(x_np, y_np)
Save and Load
model.save("checkpoints/my_run")
model = Vulgaris.load("checkpoints/my_run")
Checkpoints store weights.npz, config.yaml, and metadata.json — no pickle, no binary blobs.
Configuration
All hyperparameters are dataclasses — composable and serialisable to YAML:
from vulgaris import ModelConfig
from vulgaris.config import SSSRConfig, DAHConfig
config = ModelConfig(
input_dim=16,
n_classes=10,
sssr=SSSRConfig(state_dim=512, n_heads=16),
dah=DAHConfig(n_domains=64, adapter_rank=32),
)
config.to_yaml("config.yaml")
Load from environment variables for containerised deployments:
# VULGARIS_INPUT_DIM=16 VULGARIS_N_CLASSES=10 VULGARIS_D_MODEL=256
config = ModelConfig.from_env()
Inference Server
export VULGARIS_INPUT_DIM=9
export VULGARIS_N_CLASSES=5
vulgaris-serve
Endpoints: POST /predict · GET /health · GET /metrics · GET /versions
Supports API key authentication (VULGARIS_API_KEYS), Prometheus metrics exposition, and three-level graceful degradation.
Docker
docker compose up
Brings up the inference server and a Prometheus sidecar. Memory limit: 2 GB.
Reproducibility
from vulgaris import set_seed
set_seed(42)
Self-Supervised Pretraining
from vulgaris.training import SelfSupervisedTrainer
trainer = SelfSupervisedTrainer(model, in_channels=9, d_model=64)
metrics = trainer.pretrain_step(x_np) # masked reconstruction + temporal InfoNCE
Drift Detection
from vulgaris import DriftDetector
detector = DriftDetector(window_size=200)
detector.set_reference(reference_data)
result = detector.update(new_batch)
if result["drift_detected"]:
print(f"KS={result['ks_stat']:.3f} MMD={result['mmd_stat']:.3f}")
Multi-Domain Adaptation
# Switch domain at inference time — no retraining
output, aux = model(x, domain_idx=3)
Repository Structure
vulgaris/
├── vulgaris/ public API and config
├── engine/ autograd engine: Tensor, Module, layers
├── modules/ ASE · HTD · SSSR · DAH · CRG · HMB · ESE · Safety · CMLA · SHCAL
├── model/ full Vulgaris model assembly
├── training/ loss · optimizer · pipeline · conformal · self-supervised
├── inference/ FastAPI server · streaming
├── serve/ auth · metrics · degradation · versioning
├── monitoring/ drift detection
├── federated/ federated continual learning with differential privacy
├── benchmarks/ baselines · ETT · NAB · EdgeTelemetry dataset loaders
└── tests/ unit tests with numerical gradient verification
Documentation
Full technical documentation: doc.md
Citation
@software{vulgaris2026,
title = {VULGARIS: Foundational Model for Streaming Industrial Intelligence},
author = {Khan, Jalaluddin},
year = {2026},
url = {https://github.com/jalaluddinkhan1/vulgaris},
license = {Apache-2.0},
}
License
Apache License 2.0. See LICENSE for details.
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 vulgaris-0.1.3.tar.gz.
File metadata
- Download URL: vulgaris-0.1.3.tar.gz
- Upload date:
- Size: 103.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c84e8bd58dc3576ba3e06f4fd19bd0426569041c876cf4939abebea5113d0d6a
|
|
| MD5 |
165ae14a587fa2dd31065cefc6d428b1
|
|
| BLAKE2b-256 |
e430996fa5b54c4a9d97a7216acbec1c95d141a745e8ddd28865655f87dcc84e
|
File details
Details for the file vulgaris-0.1.3-py3-none-any.whl.
File metadata
- Download URL: vulgaris-0.1.3-py3-none-any.whl
- Upload date:
- Size: 115.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9df607a1818cd91e2f1cf0c968d8ba9c6df6e868a8d1a3dc05e2930cf54b876
|
|
| MD5 |
fdd49357c141228a4d4e5600f3339ca8
|
|
| BLAKE2b-256 |
14e216ea4ae5dfb71076d2db6a239f11fd7b96e1f51d49ef819a32ebe897baab
|