CEREBRUM: Case-Enabled Reasoning Engine with Bayesian Representations for Unified Modeling
Actively maintained (v1.5.0). The offline unit suite runs and passes on a
uv pip install -e ".[dev]" checkout; pytest.ini deselects the opt-in live
network tests by default. The LEXICON and LLM subsystems additionally need
OPENROUTER_API_KEY and network access, so their live paths are not exercised by
the default run. Paper regeneration needs pandoc, XeLaTeX and Node with
mermaid-cli; it is not part of CI.
- Overview
- Project architecture
- Repository structure
- Implementation workflow
- Getting started
- PDF documentation
- Generative model specification
- Documentation index
- Citation
- License
- Contributing
- InstituteOS sidecar
GitHub Repository: https://github.com/ActiveInferenceInstitute/CEREBRUM
- Author: Daniel Ari Friedman
- Version: 1.5.0
- Date: April 16, 2025
- DOI: 10.5281/zenodo.15170907
- Zenodo Record: https://zenodo.org/records/15231156
- Institution: Active Inference Institute
CEREBRUM is a unified modeling framework that integrates case-based reasoning with Bayesian representations. It provides a comprehensive suite of tools for developing, testing, and deploying cognitive models that combine the strengths of case-based reasoning with probabilistic inference.
Key features include:
- Integration of symbolic case structures with Bayesian probabilistic representations
- Flexible transformation engine for model adaptation and learning
- Case-system mappings and implementation guidelines for 60+ natural and 35+ programming languages (see
docs/languages/) - Visualization tools for model inspection and analysis
- Extensive example library demonstrating applications across domains
Architecture diagram (Mermaid source): project_architecture.mermaid
The CEREBRUM repository is organized into the following structure:
| Directory/File | Description |
|---|---|
/src |
Source code for the CEREBRUM framework |
/src/core |
Core engine components including active inference module, neural networks, and model base classes |
/src/models |
Implementation of various model types and case definitions |
/src/utils |
Utility functions and helper classes |
/src/visualization |
Visualization tools and components |
/src/transformations |
Model transformation and adaptation algorithms |
/src/cases |
Case definition and management functionalities |
/src/examples |
Example implementations and demonstrations |
/models |
Generalized Notation Notation specifications for the generative models, with the loader/drift guard in src/core/gnn.py |
/docs |
Documentation including specifications, guides, and discussions |
/docs/examples |
Detailed documentation for example models |
/docs/languages |
Language-specific implementation guidelines |
/paper |
Academic paper source files and generation tools |
/paper/components |
Paper section components and figures |
/paper/output |
Generated paper outputs in various formats |
/scripts |
Setup, rendering, and maintenance orchestration scripts |
Workflow diagram (Mermaid source): implementation_workflow.mermaid
CEREBRUM can be used in multiple ways depending on your needs:
- Explore existing models: Check out the
/src/examplesdirectory - Create your own models: Follow the guides in
/docs/guides/getting_started.md - Extend the framework: See
/docs/contributing/contributing_technical.mdfor development setup
We use uv for fast, reliable Python dependency management.
# Clone the repository
git clone https://github.com/ActiveInferenceInstitute/CEREBRUM.git
cd CEREBRUM
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .
# For development (includes testing and linting tools)
uv pip install -e ".[dev]"
# For all optional dependencies
uv pip install -e ".[all]"All checks run through one entry point. ./run.sh lists the arms; each arm is
also what CI runs, so a local run and a CI run execute the same commands.
./run.sh setup # create .venv from uv.lock (dev + llm extras)
./run.sh lint # blocking static checks
./run.sh types # mypy on the annotated GNN loader surface
./run.sh docs # docs index freshness + relative link check
./run.sh test-fast # quick pass over the logic core
./run.sh test # full suite with coverage (what CI runs)
./run.sh gnn # pinned-upstream GNN conformance
./run.sh all # lint, types, docs, test, gnnMeasured per-arm wall times, test counts and coverage live in
docs/_generated/gate-metrics.md, which
./run.sh metrics regenerates from the run artifacts. See
docs/RUN_GUIDE.md for the arm definitions, the CI job
mapping and the current static-analysis debt.
Individual commands that the arms wrap are still fine for debugging:
# A single test file
uv run python -m pytest tests/core/test_model.py -v
# GNN specification drift guard, against a sibling GNN checkout
uv run python -m pytest tests/core/test_gnn_spec.py -v
# Run tests by marker
uv run python -m pytest -m unitThe full documentation for CEREBRUM is available as a PDF file in the paper/output/ directory, which is generated from the Markdown source files.
To regenerate the PDF documentation, you need:
- Python 3
- Node.js with Mermaid CLI (
@mermaid-js/mermaid-cli12.x, pinned inpackage.json; runnpm installat the repository root) - Pandoc
- XeLaTeX (for PDF generation)
To regenerate the PDF documentation, run:
python3 paper/assemble_paper.pyThis script will:
- Render all Mermaid diagrams from
docs/manuscript/components/figures/to PNG images - Assemble all markdown components in the correct order
- Generate an HTML version of the paper
- Create the final PDF file at
paper/output/assembled_paper.pdf
For more detailed information about the paper building process, please see paper/README.md.
Use-case mindmap (Mermaid source): use_cases_mindmap.mermaid
The framework's discrete generative model is specified in Generalized Notation
Notation (GNN) at
models/case_conditioned_active_inference.gnn.md.
models/README.md records the declared structure (one
hidden-state factor, one identity-likelihood modality, three controls, the
runtime A[state, observation] and B[previous_state, action, next_state]
storage orders, and the eight-case precision-focus contract), the loader in
src/core/gnn.py, and the pinned upstream revision (GNN v5.2.1, commit
c0becd6aa1bf55e5b865c2fb96ae121232f2c6ca, also in
.github/gnn-pin.json). tests/core/test_gnn_spec.py
checks the specification against the parameters and case configurations the
framework uses. ./run.sh gnn runs the shared gnn.importers reader against
the pin and pointer, then the pinned parser; the GNN pointer
records that adopted reader.
For new model work, start from the upstream framework integration guide and the downstream adoption guide.
Related Active Inference Institute repositories that already declare models this way:
- active_inference_language_model
β case-level specifications such as
gnn/models/L4_case.gnn.md, plus mutation variants that show how a declared model degrades. - ActiveBlockference β a control model validated against its own pinned GNN release.
- active_fractal_rabbit
β the reference layout this repository follows:
models/, a loader module, and.github/gnn-pin.json.
CEREBRUM is archived on Zenodo and citable via CITATION.cff (GitHub's "Cite this repository" button) or the BibTeX entry below.
If you use CEREBRUM in your research, please cite:
@misc{friedman2025cerebrum,
author = {Friedman, Daniel Ari},
title = {CEREBRUM: Case-Enabled Reasoning Engine with Bayesian Representations for Unified Modeling},
year = {2025},
month = {April},
version = {1.5.0},
doi = {10.5281/zenodo.15170907},
publisher = {Active Inference Institute},
url = {https://github.com/ActiveInferenceInstitute/CEREBRUM}
}This work builds upon the efforts and insights of many participants within the Active Inference Institute. Special thanks are extended to Dave Douglass for his contributions related to computational linguistics, archiving, Active Inference principles, upper ontologies, and translations, which have significantly informed aspects of this project.
We welcome contributions from researchers, developers, and enthusiasts across multiple domains:
- π¬ Research: Theoretical development, empirical testing, literature reviews
- π» Technical: Core development, language implementations, integrations, testing
- π Documentation: Educational content, API docs, use cases, tutorials
- π§© Examples: Model examples, domain applications, interactive demonstrations
- π Community: Organizing events, content creation, mentoring, user support
For detailed contribution guidelines, process information, and more specific ideas, please see our CONTRIBUTING.md document.
To report a security vulnerability, see SECURITY.md.
This repository carries a committed .aii/ sidecar with curated
InstituteOS metadata (aii-sidecar/v1): category, maturity, ecosystem relations,
key artifacts, provenance, and portable tasks. It is read by
InstituteOS tooling and
does not affect the project's build or runtime.