Skip to main content

Bija — Artificial Brain Computation Kernel. A PyTorch-like framework for event-causal plastic graph simulation.

Project description

Bija (बीज) — Artificial Brain Computation Kernel

Bija (Sanskrit for "seed") is a PyTorch-like computation kernel for artificial brain simulation. It provides device-agnostic primitives, a composable module system, and CPU/CUDA backends for event-causal plastic graph computation.

Install

pip install bija-cpu          # CPU only (NumPy)
pip install bija-gpu          # GPU support (Numba CUDA)
pip install bija-tpu          # TPU support (JAX/XLA - coming soon)

Quick Start

import bija
from bija import nn

# 1. Choose device
dev = bija.device("cuda")  # or "cpu"

# 2. Build a brain model (user-level code)
brain = nn.Brain(
    neurons   = nn.AdExNeuron(10_000, branches=2),
    synapses  = [nn.PlasticSynapse(10_000, 10_000, 1_280_000)],
    regions   = nn.RegionMap(10_000, 8),
    stability = nn.HomeostasisController(target_rate=0.05),
    safety    = nn.Watchdog(),
).to(dev)

# 3. Run
for t in range(1000):
    result = brain.step(sensory=[...], body=bija.BodyContext(novelty_delta=0.1))
    print(f"t={t} spikes={result.spike_count}")

# 4. Save / Load
bija.save(brain, "my_brain.bija")
bija.load(brain, "my_brain.bija")

Architecture

User Model (10k brain, cortical column, custom architecture)
     |
bija.nn       Module system: Brain, AdExNeuron, PlasticSynapse, RegionMap
     |
bija.ops      Primitives: integrate, spike, trace, plasticity (auto-dispatch)
     |
bija.core     Data structures: Device, StateVector, SparseGraph
     |
Backend       CPU (NumPy) / CUDA (Numba)

Key Principles

  • No global loss. All plasticity is local (pre/post/neuromodulator).
  • Event-sparse. Cost per tick ~ O(active_neurons + spikes × fanout).
  • Device-agnostic. Same model code runs on CPU or GPU.
  • Composable. Build arbitrary brain architectures from modules.
  • Safe. External actions gated by an immutable Watchdog.

Examples

# Run 10k test model on CPU
python examples/model_10k.py

# Run on GPU
python examples/model_10k.py --cuda

License

MIT

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

bija_cpu-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

bija_cpu-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file bija_cpu-0.1.0.tar.gz.

File metadata

  • Download URL: bija_cpu-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for bija_cpu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c7a68ef7e3b9510867c0d3b95e80038678206c10ed78e395b0192755f9eeae3d
MD5 e860b2000db751dce0190afa849a620f
BLAKE2b-256 0b2e5eeb7ceeb0c02d1c49ea3dc28427e4ebd70aaf70ffb55315db351b48f784

See more details on using hashes here.

File details

Details for the file bija_cpu-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bija_cpu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for bija_cpu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90f311386773126e651b86194e9142d12b30cbc2ff3cf2c732c688e9924609e5
MD5 3083f35d1ee9c9a9fe497b54e4b639c5
BLAKE2b-256 869b9bce95814d2e6b6b9ddfb2588bee35a60a8b894a420c92f1db65af1a5455

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