Skip to main content

Decepticons

Decepticons

PyPI CI License: MIT Python Status

Website · Architecture · Kernel matrix · Examples · Related work

O(n) attention is deception. A backend-neutral kernel of predictive primitives — substrates, memory, gating, routing, readouts — that downstream systems combine into trained models without forking the kernel itself.

decepticons is the shared mechanism layer for predictive descendants: substrate dynamics, controller summaries, memory primitives, feature views, readouts, and runtime helpers extracted from a broader experiment family so downstream systems can specialize without forking the kernel.

Install

Requires Python ≥ 3.11. The kernel itself only needs numpy.

If you don't already have a Python virtual environment, make one first. Modern Linux distributions block pip from writing into the system Python (PEP 668), so a venv is the standard path:

python3 -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate

Then install from PyPI:

pip install decepticons

For the model backends:

pip install "decepticons[torch]"   # PyTorch CausalBankModel + routed readouts
pip install "decepticons[metal]"   # Apple MLX backend (Apple Silicon)

To leave the venv when you're done: deactivate.

For development from source (clone + editable install + run tests):

git clone https://github.com/asuramaya/decepticons
cd decepticons
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[test]"
pytest -v

Quickstart

from decepticons import ByteCodec, ByteLatentPredictiveCoder

text = "predictive coding likes repeated structure.\n" * 64
model = ByteLatentPredictiveCoder()
report = model.fit(text)

prompt = ByteCodec.encode_text("predictive ")
sample = model.generate(prompt, steps=40, greedy=True)

print(report.train_bits_per_byte)
print(ByteCodec.decode_text(sample))

CLI:

decepticons fit --input ./corpus.txt --prompt "predictive " --generate 80

A complete worked example lives in examples/quickstart.py. For descendant-shaped projects, see examples/projects/.

What's in the kernel

Area Highlights
Substrates recurrent, delay, linear-memory, oscillatory, mixed, hierarchical
Control controller summaries, pathway gates, summary routing, hormone modulation, predictive surprise
Memory exact-context, n-gram, statistical-backoff, online n-gram, cache views
Views byte-latent, hierarchical, linear-memory, sampled multiscale, bridge features, probability diagnostics
Readouts ridge, frozen-readout expert, sampled multiscale, GRU recurrent, routed squared-ReLU
Adapters causal predictive, oracle analysis, bridge export, noncausal reconstructive, paired teacher/export
Runtime traces, fit reports, rollout evaluation, transfer probes, train-mode checkpoints, artifact accounting
Causal-bank family metadata + deterministic substrate construction (frozen / learnable-decays / learnable-mixing / learned-recurrence / gated-retention)
Backends numpy-only kernel; PyTorch and MLX CausalBankModel implementations

Full capability matrix: docs/kernel_matrix.md.

Architecture

decepticons  ──→  chronohorn  ──→  heinrich
  kernel          runtime          forensics
 (this repo)   training · fleet   geometry · audit

Three layers inside this repo:

  1. Kernel — src/decepticons/. Public package. Reusable mechanisms only.
  2. Project descendants — examples/projects/. Pressure-tests the kernel boundary with concrete descendant shapes (causal · oracle · bridge · noncausal · byte-latent).
  3. Tooling — examples/tools/. Development and analysis scripts. Not part of the public package.

Code moves into src/ only when all three hold:

  1. It is a mechanism, not a project policy.
  2. At least two descendants want the same thing.
  3. The generalized API is simpler than keeping the duplication.

This rule is the main defense against turning the kernel into a renamed collection of branches. Full detail in docs/architecture.md and the boundary against the runtime in docs/chronohorn_boundary.md.

Causality is verified

All substrate modes are verified by tests/test_causality.py: it feeds two identical sequences up to position t, different after t. If logits at position t differ, causality is violated and CI fails. Modes verified: frozen, learnable_mixing, learnable_decays, selective scan augment (state_dim > 0), readout_bands, routed experts.

decepticons never imports its descendants — enforced by an AST scan in tests/test_dependency_firewall.py.

Docs

Scope

This is a research kernel and reference implementation. The current pressure from descendants is O(n) causal-bank architecture search — cheap ablation lanes to separate mechanisms before promotion, with scale and context survival checked in the descendant runtime.

It is not a frontier runtime, a production compression stack, or a benchmark claim. It exists to keep the shared mechanism layer reusable and legible.

Contributing

See CONTRIBUTING.md. Issues and pull requests welcome.

License

MIT — see LICENSE.

Metadata

Release files for decepticons 0.1.3

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

Source distribution (sdist)

Source distribution for decepticons 0.1.3
File Size Uploaded Provenance Actions
decepticons-0.1.3.tar.gz 187.6 kB With provenance Details for decepticons-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for decepticons 0.1.3
File Interpreter ABI Platform Actions
decepticons-0.1.3-py3-none-any.whl Python 3 none any Details for decepticons-0.1.3-py3-none-any.whl

Total release size: 345.0 kB

Release files / decepticons-0.1.3.tar.gz

Download URL decepticons-0.1.3.tar.gz
Size 187.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2036bf2acde55c270a9509b6e5c4d4bd1aa551354eb26f09dc7a4e552eaf7186
BLAKE2b-256 checksum
How to use checksums
bbbe439362e9a52257d7da341fdb9d662e413186ce13a502d6b8ccda781904ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 1, 2026.

Transparency log

Release files / decepticons-0.1.3-py3-none-any.whl

Download URL decepticons-0.1.3-py3-none-any.whl
Size 157.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d202f31540db407f54a21629a19c9d26c9ec68be185841c593242d03ca29201e
BLAKE2b-256 checksum
How to use checksums
b4f0eeee879c8c5aacec9a56d310178d7a71e50434a28c8e3e0a5b5d73b874d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 1, 2026.

Transparency log

Security for decepticons 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for decepticons-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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