GitHub - muellerberndt/cadence: A brain that learns from live experience. System 1 by default: perception, memory, plasticity and action. Optional System 2 for self-observation and slow corrections. · GitHub
Skip to content
muellerberndtPublic

About

A brain that learns from live experience. System 1 by default: perception, memory, plasticity and action. Optional System 2 for self-observation and slow corrections.

Topics

Resources

Contributing

Stars

452 stars

Watchers

3 watching

Forks

Repository files navigation

Cadence: a continuing brain with local state, memory and repair

Cadence

Website · Documentation · Application demos · Paper · PyPI

CI License: GPL v3

One continuing equilibrium brain: learn a world, act in it, repair what fails.

from cadence import Brain

brain = Brain.compose(inputs=4, actions=2, arousal=True)
action = brain.live([[1.0, 0.0, 0.0, 0.0]])

Execute the returned action, then pass its measured reward with the next observation: brain.live(next_observation, reward=reward). Tune named settings with compose or brain.retune(...); inspect them with brain.describe(). The composition guide explains the defaults and which learning rates each operation uses.

Cadence builds a simulated animal-like brain from simplified biological mechanisms. Its default System 1 is one continuing brain with perception, plastic connections, memory and action; optional System 2 adds observing cortical regions that feed back into the same neural graph. Biological names describe functional software roles.

One continuing equilibrium brain is the guide to this lifecycle and its boundaries. compose constructs the brain; live runs its life. Integrated learned world prediction, repair localized to what failed and cheap stable operation are work in progress. Cadence is alpha research software.

How a Cadence brain differs from a feed-forward network

Brain.compose(inputs=4, actions=2, modules=(64, 32, 16)) builds reciprocal regions whose activity settles together, so later regions shape earlier ones while an answer forms, and the action comes from the qualified neural state. The learner compares local activities in a free and a nudged phase, without a backward differentiation pass. The relevant comparison with a recurrent backprop network is acquired behavior and total work on the same task, which the orientation page sets out; other model families have their own learning contracts.

Why Cadence

The library puts continuing state, reciprocal interpretation, local plasticity and memory behind one small interface. A saved brain resumes an action that awaits its actual outcome, and private imagination inspects responses without rewriting live experience. These are mechanisms for testing acquisition, retention and recovery through a life.

The target includes full-sentence language and reusable world understanding; a small fixed-label task is a control.

Start with System 1

Python 3.11+ and NumPy are required. Install the published release, whose released documentation describes the APIs in that package:

python -m pip install cadence-net==0.84.3
import numpy as np
from cadence import Brain

brain = Brain.compose(inputs=4, actions=2, arousal=True)
observation = np.array([[1.0, 0.0, 0.0, 0.0]])
action = brain.live(observation)

# A tiny environment rewards action 0 and supplies the next observation.
reward = (action == 0).astype(float)
next_observation = np.array([[0.0, 1.0, 0.0, 0.0]])
action = brain.live(next_observation, reward=reward)
assert action.shape == (1,)

live takes the preceding action's measured reward, then chooses the next action for one continuing stream; supply one observation row per call. It needs arousal=True (the founder arousal settings). A calm brain acts greedily without learning; youth (the first 100 moments) or arousal enables exploration, learning and writes to the associative memory. There is no training/inference mode switch. The working trace advances at every accepted moment; with the opt-in recall memory (recall=True) its slots advance at every accepted moment too, or only at aroused moments with recall_write="aroused". Continuous interaction covers arousal, resets and saved continuation.

For explicit teaching, batched streams or learning from every outcome, use the lower-level step loop, which works with or without arousal=True; its teacher= labels the current observation. The continuing brain example runs that loop through changed conditions and saved continuation.

A teacher label changes graph parameters. The default associative memory ignores labels; the opt-in episodic memory (memory_choice=True) records them. Memory lists every memory of the composed brain and which one suits which task.

phases = brain.imagine([observation, next_observation])
assert phases  # Inspect phase.qualified before using an imagined response.

Imagination carries a private trace without changing live memory, random state or pending feedback. Learned consequences and action planning belong to the temporal model.

Each action solve reports its residual, qualification, sweeps and check counts in read-only brain.last_settlement, as the quickstart shows. An action whose settle exhausts its budget is refused without changing live state; qualification and refusal says when to retry live(observation) without resubmitting the reward.

To work from source, install the library repository root as an editable package:

python -m pip install -e .

Add optional System 2

recursive = Brain.compose(
    inputs=4, actions=2, modules=(16, 8), observers=(8,), seed=7,
    arousal=True,
)

Observer regions read and return influence to the base, motor regions and earlier observers. They join the same settlement and use the same interaction interface. Whether recursive feedback helps on a task is a question for experience and evaluation.

Go further

MANIFESTO.md states the design points, including the language goal of whole consistent sentences from the settled state. Build a brain for custom wiring, and the memory/planning example for a bounded demonstration with actual toy-body outcomes. Record patches provide event records and consolidation. The advanced population solver provides exact state-and-error readback under its own numerical contract. cadence-demos contains the application demos.

Documentation · API · Contributing · Changelog · Research tasks

Licensed under GPL-3.0.

Related projects and funding

Observer Patch Holography (OPH) is the related physics project. Its physics evidence is separate from Cadence's capability evidence. Pragma Research brings the projects together.

Cadence has an official memecoin on Solana, deployed by the Solana community. Its token address is 46doJPsSjEVMsNZm4b32UbbvbUXjFTM3TDPBWMM3pump (chart on Dexscreener). Its trading fees are routed to Bernhard Mueller to fund the project. Pragma Research holds none of the token. Cadence itself does not use it, and no integration into the core library is planned. We encourage the crypto community to build interesting projects that integrate it. Any other token using the Cadence name is unrelated to this project. Nothing here is financial advice.

About

A brain that learns from live experience. System 1 by default: perception, memory, plasticity and action. Optional System 2 for self-observation and slow corrections.

Topics

Resources

Contributing

Stars

452 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages