Skip to content
ActiveInferenceInstitutePublic

About

CEREBRUM: Case-Enabled Reasoning Engine with Bayesian Representations for Unified Modeling

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

14 stars

Watchers

3 watching

Forks

Latest commit

Β 

History

218 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CEREBRUM

DOI CI

CEREBRUM: Case-Enabled Reasoning Engine with Bayesian Representations for Unified Modeling

Status

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.

Contents

Repository

GitHub Repository: https://github.com/ActiveInferenceInstitute/CEREBRUM

Publication Information

Overview

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

Project Architecture

Architecture diagram (Mermaid source): project_architecture.mermaid

Repository Structure

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

Implementation Workflow

Workflow diagram (Mermaid source): implementation_workflow.mermaid

Getting Started

CEREBRUM can be used in multiple ways depending on your needs:

  1. Explore existing models: Check out the /src/examples directory
  2. Create your own models: Follow the guides in /docs/guides/getting_started.md
  3. Extend the framework: See /docs/contributing/contributing_technical.md for development setup

Installation

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]"

Testing

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, gnn

Measured 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 unit

PDF Documentation

The full documentation for CEREBRUM is available as a PDF file in the paper/output/ directory, which is generated from the Markdown source files.

Requirements for PDF Generation

To regenerate the PDF documentation, you need:

  • Python 3
  • Node.js with Mermaid CLI (@mermaid-js/mermaid-cli 12.x, pinned in package.json; run npm install at the repository root)
  • Pandoc
  • XeLaTeX (for PDF generation)

Generating the PDF

To regenerate the PDF documentation, run:

python3 paper/assemble_paper.py

This script will:

  1. Render all Mermaid diagrams from docs/manuscript/components/figures/ to PNG images
  2. Assemble all markdown components in the correct order
  3. Generate an HTML version of the paper
  4. 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 Cases

Use-case mindmap (Mermaid source): use_cases_mindmap.mermaid

Generative model specification

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.

Citation

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}
}

License

CC BY 4.0

Acknowledgements

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.

Contributing

We welcome contributions from researchers, developers, and enthusiasts across multiple domains:

Ways to Contribute

  • πŸ”¬ 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.

InstituteOS sidecar

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.

Research manuscript

About

CEREBRUM: Case-Enabled Reasoning Engine with Bayesian Representations for Unified Modeling

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

14 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages