Skip to main content

Cadence: self-reading cortical columns with local state, readback and repair

Cadence

Website · Examples · Paper · PyPI · Documentation

PyPI CI Python License: MIT

Deep Recursive Settlement Networks (DRSNs), built from cortical columns that continually update their world model from experience.

Cadence is a library for building persistent, self-reading learning systems. New experience changes the evidence held by local columns, disturbing their existing equilibrium. Local feedback repairs the affected message relationships until their beliefs settle again. The system retains what it has learned for the next interaction. Its world model is this retained evidence and the settled beliefs about the quantities an application asks it to model.

The central idea is recursive observation inside the same equilibrium. An observer reads a column's live uncertainty and sends feedback that changes it. Further observer stages read and regulate that activity in turn. The observers become part of the system they observe: all stages remain live and settle together. This is the recursive structure at the heart of a DRSN.

The building block is the cortical column: a bounded patch with local memory, typed observation ports, readback and repair. Inspired by mammalian cortical organization, Cadence's columns are mathematical abstractions, not biophysical simulations. A Cortex combines them into contextual predictors; an optional action-value interface supports learning from the consequences of actions. The current models learn scalar quantities and context-dependent outputs; useful depth and comparative performance are still being evaluated.

The library is pure Python and uses only the standard library.

The roadmap

The goal is continuing intelligence: learning from experience, retaining useful knowledge, imagining alternatives and solving problems across domains. The building block stays as simple as possible; every part answers through local settlement, and evolution across lives is preferred to hand-designed complexity.

We want to reach a point where we can effortlessly evolve a human-like brain, teach it first by imitation and then through its own life, and give it an experience identical to that of a human living in our world. Brains with capabilities far beyond ours are thinkable on the same path; human-level competence comes first, as a sensible milestone. The steps from the brains in this library to that milestone are tracked as issues in this repository, rung by rung, each with its task, its control and its falsifier.

Install

From a checkout, with Python 3.11 or later:

python -m pip install -e .

The optional games extra adds Gymnasium and ALE; neither is needed below.

Learn from a sensor

from cadence import CorticalColumn

column = CorticalColumn(height=3, decay=0.9)
for reading in (0.2, 0.4, 0.3):
    admitted = column.add(reading)
    assert admitted["accepted"]

belief = column.query()
assert belief["qualified"]
print(belief["answer"], belief["variance"])

height=3 adds two recursive rate-observer stages above the base belief–precision loop. All of them participate in the same settlement. Each add proposes new retained evidence and admits it after the solve qualifies; query reads the resulting belief without adding an observation. Use explicit ordered event IDs with observe when delivery may be retried.

Add context

from cadence import Cortex

model = Cortex.from_dimensions(
    n_inputs=2, n_outputs=1, bounds=(-1.0, 1.0), bins=8, depth=1, height=3,
)
context = (-0.5, 0.25)

before = model.predict(context)[0]
result = model.observe(context, -0.3)
assert result["accepted"]
after = model.predict(context)[0]
print(before, after)

saved = model.snapshot()
restored = Cortex.from_snapshot(saved)
assert restored.predict(context) == model.predict(context)

Here two normalized sensor values select a context, and the observed target teaches one scalar output. Built-in binning supplies the representation; Cadence learns the evidence within those contexts. height controls recursive observer stages inside each column; depth controls the context hierarchy. They are independent choices, alongside output count and context resolution.

Within a column, observer feedback is reciprocal. Between Cortex levels, coarser beliefs supply priors to finer ones; this directed hierarchy is a different structure. Each output's active context chain is solved and qualified separately. Additional levels or observer stages are choices to test, not a guaranteed improvement.

Start here What it covers
Quickstart Sensors, multiple outputs, retries, checkpoints and optional actions.
Reference Public classes, methods, parameters, defaults and errors.
Element Evidence, executed equations, residuals and qualification.
Variants Context depth, width, observer height and evidence limits.
Specification What the API guarantees and what the application supplies.

MIT license.

Metadata

Release files for cadence-net 0.20.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cadence-net 0.20.1
File Size Uploaded
cadence_net-0.20.1.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for cadence-net 0.20.1
File Interpreter ABI Platform
cadence_net-0.20.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / cadence_net-0.20.1.tar.gz

Download URL cadence_net-0.20.1.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
fca368af71f4a23dfb8a0b622741b1ff8ee265fcada1b1a46b227eea234c2fba
BLAKE2b-256 checksum
How to use checksums
5448316f392c3ca455aae6a1ce3a157f9fc1864ed2d2c4234a6546eb1a2d0532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / cadence_net-0.20.1-py3-none-any.whl

Download URL cadence_net-0.20.1-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
313e6400403d657740911919ff1b5e45430841c948d5db81f89d66f2f3e3637c
BLAKE2b-256 checksum
How to use checksums
d2c1e4779c42302c14eef88ef298549eb37859175b7f94d9aaada4e5865e642c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release history Release notifications | RSS feed

0.83.0

2 release files

0.82.0

2 release files

0.81.0

2 release files

0.50.0

2 release files

0.49.0

2 release files

0.48.0

2 release files

0.47.0

2 release files

0.46.0

2 release files

0.45.0

2 release files

0.44.0

2 release files

0.43.0

2 release files

0.42.0

2 release files

This release

0.20.1 This release

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page