The Executable Mathematical Foundation for AI & Scientific Computing
Bridging symbolic rigor, real-time math transparency, and bare-metal C++ / CUDA GPU hardware acceleration.
Trusted by over 10,000+ researchers, educators, and engineers worldwide.
The Legacy • Why NeuroGebra? • Installation • Quick Start • Hardware Acceleration • Observatory • 20 GPU & Colab Projects • Documentation
The Legacy of NeuroGebra
"Modern machine learning has become extraordinarily powerful, but in the race for scale, it became an opaque black box. Practitioners call
loss.backward()without seeing the calculus, and students memorize API calls without understanding the algebraic derivations underneath."
NeuroGebra was founded to solve this divide.
Conceived as a union of symbolic mathematics (SymPy), numerical computing (NumPy), and real-time diagnostic observability, NeuroGebra began as a curated mathematical formula companion designed to make the mathematics of artificial intelligence tangible, searchable, and executable.
Over successive releases, NeuroGebra has evolved into an international open-source standard:
- 10,000+ Practitioners Worldwide: Adopted by university courses, researchers experimenting with novel architectures, and ML engineers auditing mathematical divergence.
- 100+ Curated Mathematical Expressions: Covering 10 domains from activation manifolds and non-convex loss functions to attention mechanisms, probability metrics, and optimization dynamics.
- The First Mathematical Training Observatory: Bringing live algebraic formulas, weight distribution telemetry, vanishing gradient alarms, and reproducible training fingerprints directly into your terminal.
- Native Hardware JIT Acceleration (v2.6+): Bridging the educational clarity of symbolic math with bare-metal C++ AVX2 SIMD and NVIDIA CUDA GPU execution, outperforming baseline NumPy by up to 4.76x.
NeuroGebra stands today not merely as a library, but as a commitment: that high-performance artificial intelligence should never require abandoning mathematical understanding.
Why NeuroGebra?
Most deep learning frameworks ask you to choose between interpretability and performance. NeuroGebra provides a unified paradigm where every expression is simultaneously:
- Symbolic: Render exact LaTeX formulas, compute analytical derivatives, and introspect algebraic structures via SymPy.
- Numerical: Evaluate vectors and tensors with high-speed NumPy vectorized pipelines.
- Hardware-Accelerated: Compile on-the-fly into native C++ SIMD or NVIDIA CUDA C kernels via NVRTC with zero external build configuration.
- Trainable: Bind learnable weights and optimize parameters with built-in Adam, SGD, and real backpropagation.
- Self-Explaining: Every formula, layer, and training warning features an embedded
.explain()method.
flowchart LR
A["MathForge / Expression<br/>(Symbolic LaTeX & Calculus)"] --> B["Compute & Execution Engine"]
B --> C["C-JIT Engine<br/>(Bare-Metal AVX2 SIMD)"]
B --> D["CUDA-JIT Engine<br/>(NVIDIA GPU NVRTC)"]
B --> E["Vectorized Autograd<br/>(Micrograd Engine)"]
C --> F["Training Observatory<br/>(Math Transparency & Diagnostics)"]
D --> F
E --> F
F --> G["Production Bridges<br/>(PyTorch / TF / JAX Export)"]
Framework Comparison
| Capability | NeuroGebra | PyTorch / TensorFlow | SymPy | Pure NumPy |
|---|---|---|---|---|
| Searchable ML Formula Repository | Yes (10 Domains) | No | No | No |
| Symbolic Math & Analytical Gradients | Yes | No | Yes | No |
| Live Formula Math Transparency in Training | Yes (Observatory) | No | No | No |
| Automated Health Warnings (Dead ReLU, Divergence) | Yes (Pro Rules) | No | No | No |
| Reproducibility Fingerprinting (Hardware/Dataset Hash) | Yes | Manual | No | No |
| On-the-Fly C-JIT & CUDA GPU Compilation | Yes | Pre-compiled | No | No |
| Export to Production (PyTorch, TF, JAX) | Yes | Native | No | No |
| Zero-Setup Educational Explainability | Yes (.explain()) |
No | Partial | No |
Installation
Install NeuroGebra in seconds from PyPI:
pip install neurogebra
Optional Extras for Advanced Workflows
pip install "neurogebra[viz]" # Interactive Visualization (Plotly, Seaborn)
pip install "neurogebra[frameworks]" # Framework Bridges (PyTorch, TensorFlow)
pip install "neurogebra[logging]" # TensorBoard & Weights & Biases telemetry
pip install "neurogebra[datasets]" # Real-world dataset integrations
pip install "neurogebra[all]" # Complete ecosystem bundle
System Requirements: Python 3.9+ | Linux, macOS (Intel & Apple Silicon), Windows | CUDA 11.0+ (optional for GPU).
Quick Start
1. Discover and Evaluate AI Formulas in 30 Seconds
from neurogebra import MathForge
forge = MathForge()
# Retrieve curated expressions across 10 domains
gelu = forge.get("gelu")
print(gelu.formula) # LaTeX: 0.5 \cdot x \cdot \left(1 + \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right)
print(gelu.explain()) # Comprehensive educational breakdown & practical guidelines
print(gelu.eval(x=1.5)) # Evaluated numerical result: 1.399...
# Compute exact analytical derivatives
gelu_derivative = gelu.gradient("x")
print(gelu_derivative.formula)
# Search the entire mathematical repository
classification_losses = forge.search("cross_entropy")
forge.compare(["relu", "gelu", "swish"])
2. High-Performance Hardware Acceleration (C++ & CUDA)
Compile mathematical graphs dynamically into bare-metal C++ SIMD or NVIDIA CUDA device kernels:
import numpy as np
from neurogebra import Expression, get_acceleration_info
# Inspect local machine capabilities
print(get_acceleration_info())
# {'c_jit_available': True, 'cuda_available': True, 'cuda_device': 'NVIDIA GeForce RTX 5070', ...}
# Define any symbolic mathematical expression
swish = Expression("swish", "x / (1.0 + exp(-x))")
data = np.linspace(-5, 5, 1_000_000)
# 1. Bare-metal C++ AVX2 SIMD (2.04x faster than NumPy)
swish.compile(backend="c")
result_cpu = swish.eval(x=data)
# 2. NVIDIA CUDA GPU Acceleration (4.76x faster than NumPy)
swish.compile(backend="cuda")
result_gpu = swish.eval(x=data)
Hardware Acceleration & Performance Benchmarks
NeuroGebra includes a native compiler engine (neurogebra.acceleration) that generates JIT-compiled C++ shared objects and raw CUDA C kernels compiled at runtime via NVRTC:
| Backend | Implementation | Latency (1M elements) | Speedup vs NumPy |
|---|---|---|---|
| NumPy (Baseline) | Vectorized CPython / OpenBLAS | 10.55 ms | 1.00x |
| NeuroGebra C-JIT | Clang++ / GCC -O3 AVX2 / OpenMP |
5.16 ms | 2.04x faster |
| NeuroGebra CUDA-JIT | Fused CUDA kernel on NVIDIA RTX 5070 | 2.22 ms | 4.76x faster |
Benchmarked on an Intel i7 / NVIDIA GeForce RTX 5070 (12GB VRAM) evaluating non-linear activation pipelines.
The Training Observatory & Observatory Pro
Stop guessing what happens inside your neural network. The Training Observatory turns black-box training loops into a mathematically transparent experience.
from neurogebra.builders.model_builder import ModelBuilder
from neurogebra.datasets.loaders import Datasets
# Load structured dataset
X, y = Datasets.load_moons(n_samples=1000, noise=0.2)
# Build architecture
builder = ModelBuilder()
model = builder.Sequential([
builder.Dense(64, activation="relu", input_shape=(2,)),
builder.Dense(32, activation="tanh"),
builder.Dense(1, activation="sigmoid"),
], name="deep_classifier")
# Activate math transparency with one flag
model.compile(
loss="binary_crossentropy",
optimizer="adam",
learning_rate=0.01,
log_level="expert", # Activates layer-by-layer symbolic transparency
)
model.fit(X, y, epochs=20, batch_size=32)
Live Terminal Telemetry
[INFO] Epoch 1/20
Forward: a1 = relu(W1 * x + b1) | shape: (32, 64) -> (32, 32)
Forward: a2 = tanh(W2 * a1 + b2) | shape: (32, 32) -> (32, 16)
Forward: y_hat = sigma(W3 * a2 + b3) | shape: (32, 16) -> (32, 1)
Backward: dL/dW3 = dL/dy_hat . sigma'(z3) * a2^T
Backward: dL/dW2 = dL/da2 . tanh'(z2) * a1^T
Backward: dL/dW1 = dL/da1 . relu'(z1) * x^T
[HEALTH WARNING] Possible dying ReLU in 'dense_0' (52.0% zero activations)
-> Recommendation: Switch to LeakyReLU or apply He initialisation.
Observatory Pro Capabilities
- ️ Automated Health Warnings: Real-time detection of 10+ training pathologies: NaN/Inf loss, vanishing gradients ($||\nabla|| < 10^{-7}$), exploding gradients, dying ReLUs, and loss divergence.
- Adaptive Logging: Quiet during stable epochs, automatically escalating to verbose telemetry the moment anomalies occur (reducing log clutter by 85%).
- Interactive HTML Dashboards: Single-file, self-contained interactive dashboards powered by Chart.js (loss curves, gradient distributions, layer activations).
- Training Fingerprint: Cryptographic capture of seeds, dataset SHA-256 hashes, library versions, and hardware configuration for verifiable scientific reproducibility.
Complete End-to-End Walkthrough
Click to expand the 7-Step Production Training & Diagnostic Pipeline
Step 1: Initialize Pipeline Components
import numpy as np
from neurogebra.builders.model_builder import ModelBuilder
from neurogebra.datasets.loaders import Datasets
from neurogebra.logging.logger import TrainingLogger, LogLevel
from neurogebra.logging.adaptive import AdaptiveLogger, AnomalyConfig
from neurogebra.logging.health_warnings import AutoHealthWarnings
from neurogebra.logging.epoch_summary import EpochSummarizer
from neurogebra.logging.tiered_storage import TieredStorage
from neurogebra.logging.dashboard import DashboardExporter
from neurogebra.logging.fingerprint import TrainingFingerprint
Step 2: Prepare Dataset
X, y = Datasets.load_moons(n_samples=1000, noise=0.2)
split = int(0.8 * len(X))
X_train, X_test = X[:split], X[split:]
y_train, y_test = y[:split], y[split:]
Step 3: Configure Observatory Diagnostics & Storage
logger = TrainingLogger(level=LogLevel.EXPERT)
adaptive = AdaptiveLogger(logger, config=AnomalyConfig(zeros_pct_threshold=50.0))
storage = TieredStorage(base_dir="./logs", write_debug=True)
logger.add_backend(storage)
dashboard = DashboardExporter(path="./logs/dashboard.html")
logger.add_backend(dashboard)
warnings = AutoHealthWarnings()
summarizer = EpochSummarizer()
Step 4: Cryptographic Fingerprinting
fp = TrainingFingerprint.capture(
model_info={"name": "classifier", "layers": 3},
hyperparameters={"lr": 0.01, "batch_size": 32, "epochs": 20},
dataset=X_train,
random_seed=42,
)
print(fp.format_text())
Step 5: Execute Training Loop
builder = ModelBuilder()
model = builder.Sequential([
builder.Dense(64, activation="relu", input_shape=(2,)),
builder.Dense(32, activation="tanh"),
builder.Dense(1, activation="sigmoid"),
])
model.compile(loss="binary_crossentropy", optimizer="adam", learning_rate=0.01)
# Training execution with live telemetry
for epoch in range(20):
loss = model.train_on_batch(X_train, y_train)
alerts = warnings.check_epoch(epoch=epoch, train_loss=loss)
for alert in alerts:
print(f"[{alert.severity.upper()}] {alert.message}")
Step 6: Export Reports & Close Handlers
storage.flush()
storage.close()
dashboard.save()
print("Artifacts generated in ./logs: dashboard.html, basic.log, health.log, debug.log")
20 Executed GPU & Colab Portfolio Projects
Explore 20 end-to-end, fully executed and verified reference projects representing every dimension of the NeuroGebra framework. Every notebook contains real stored outputs, loss curves, and diagnostic figures:
What's New in v2.8.0
NeuroGebra v2.8.0 introduces four core architectural expansions:
1. Physics-Informed Neural Networks (neurogebra.science.PINN)
Solve ordinary and partial differential equations (ODEs/PDEs) directly by minimizing physical conservation residuals:
from neurogebra.science import PINN
# Define network for 2D domain to 1D field
pinn = PINN(layer_sizes=[2, 32, 32, 1], activation="tanh")
# Enforce Burgers' PDE: du/dt + u*du/dx - nu*d^2u/dx^2 = 0
history = pinn.fit(
X_data=boundary_pts,
y_data=boundary_vals,
X_colloc=domain_pts,
residual_fn=pinn.burgers_residual,
epochs=100,
lr=0.01,
)
2. Dynamic Learning Rate Schedulers (neurogebra.optim)
Adjust learning rates dynamically during training with standard schedules or metric-based reductions:
from neurogebra.optim import StepLR, CosineAnnealingLR, ExponentialLR, ReduceLROnPlateau
scheduler = CosineAnnealingLR(model, T_max=50, eta_min=1e-5)
history = model.fit(X_train, y_train, epochs=50, lr_scheduler=scheduler)
3. Comprehensive Zero-Dependency Evaluation Metrics (neurogebra.metrics)
Production-grade classification and regression metrics without requiring third-party libraries:
from neurogebra.metrics import (
accuracy_score, confusion_matrix, classification_report,
r2_score, mean_squared_error, explained_variance_score,
)
print(classification_report(y_true, y_pred, target_names=["Cat", "Dog"]))
print(f"R^2 Score: {r2_score(y_true_reg, y_pred_reg):.4f}")
4. Advanced Modern Layers
builder.LayerNorm(): Feature-wise normalization across sample dimensionsbuilder.GlobalAveragePooling2D(): Spatial pooling for modern convolutional backbonesbuilder.ResidualDense(units=64): Skip-connection residual block for deep gradient flow
Framework Bridges (Export to Production)
Prototype and verify your mathematical logic inside NeuroGebra, then export your models directly to production frameworks in one line:
from neurogebra.bridges import to_pytorch, to_tensorflow, to_jax
# Export model with weights and layer definitions intact
pytorch_model = to_pytorch(model)
tf_model = to_tensorflow(model)
jax_forward = to_jax(model)
Curated Mathematical Repository (10 Domains)
| Domain | Representative Mathematical Formulas |
|---|---|
| Activations | ReLU, Sigmoid, Tanh, Swish, GELU, Mish, ELU, SELU, Softmax, LeakyReLU |
| Losses | MSE, MAE, Cross-Entropy, Focal Loss, Huber Loss, Hinge, Log-Cosh, Quantile Loss |
| Regularizers | L1, L2, Elastic Net, SCAD, MCP, Group Lasso, Tikhonov Regularization |
| Linear Algebra | Vector/Matrix Norms, Cosine Distance, Projections, Scaled Dot-Product Attention |
| Optimization | SGD, Momentum, Adam, AdamW, Nesterov, Cosine Annealing, Exponential Decay |
| Statistics | Gaussian PDF, Poisson, Bernoulli, Kullback-Leibler Divergence, Shannon Entropy |
| Calculus | Taylor Approximations, Fourier Terms, Numerical & Analytical Jacobians |
| Metrics | Precision, Recall, F1 Score, ROC-AUC, Matthews Correlation Coefficient, NDCG |
| Transforms | LayerNorm, BatchNorm, He/Xavier Initializers, MinMax Scaling, Standard Scaling |
| Algebra | Chebyshev Polynomials, Radial Basis Functions, Sigmoidal Kernels |
Architecture Overview
neurogebra/
├── acceleration/ # Bare-metal C-JIT (AVX2 SIMD) & CUDA GPU kernels
├── builders/ # ModelBuilder: Dense, Conv2D, MaxPool2D, Dropout
├── bridges/ # Seamless converters to PyTorch, TensorFlow, JAX
├── core/ # Expression, MathForge, Autograd (Value & Tensor), Trainer
├── datasets/ # Base and expanded synthetic & benchmark loaders
├── logging/ # Training Observatory, AdaptiveLogger, AutoHealthWarnings, Dashboard
├── repository/ # 10 curated symbolic & numerical mathematical domains
├── training/ # EducationalTrainer with real-time heuristic advice
└── tutorials/ # Step-by-step interactive CLI tutorials
Contributing & Development
We welcome contributions from mathematicians, researchers, and software engineers worldwide!
# Clone the repository
git clone https://github.com/fahiiim/NeuroGebra.git
cd NeuroGebra
# Set up local virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies and pre-commit test suite
pip install -e ".[all]"
pytest tests/ -v
Please review CONTRIBUTING.md for code styling guidelines, test coverage requirements, and PR workflows.
License & Citation
NeuroGebra is released under the permissive MIT License.
@software{sarker2026neurogebra,
author = {Fahim Sarker},
title = {NeuroGebra: The Executable Mathematical Foundation for AI and Scientific Computing},
year = {2026},
url = {https://github.com/fahiiim/NeuroGebra},
publisher = {PyPI}
}
Crafted with mathematical precision for the global AI community.
Maintained by Fahim Sarker • Connect on GitHub • Read on ReadTheDocs
Metadata
Release files for neurogebra 2.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| neurogebra-2.8.0.tar.gz | 1.6 MB | Without provenance | Details for neurogebra-2.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| neurogebra-2.8.0-py3-none-any.whl | Python 3 | none | any | Details for neurogebra-2.8.0-py3-none-any.whl |
Total release size: 1.8 MB
Release files / neurogebra-2.8.0.tar.gz
| Download URL | neurogebra-2.8.0.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc7e9c7cc39df995a10ab8d62eac4e209d41645ce577ef891ae9debf39a6f52a
|
|
BLAKE2b-256 checksum How to use checksums |
32ae016fd0f849a62dce93e81714554bc2ed18efc55b2848773cf02302d409dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / neurogebra-2.8.0-py3-none-any.whl
| Download URL | neurogebra-2.8.0-py3-none-any.whl |
|---|---|
| Size | 183.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6e2a69ca7bbf7014bd671936f746929d3e84ca8978d54e577c3ebb6fe73a0f3
|
|
BLAKE2b-256 checksum How to use checksums |
07936bd607628ef6e021480c260492169cffbba9fb78671dbe639d7004c53aed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for neurogebra 2.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.