Skip to main content

Coherence math primitives for CARL (Coherence-Aware Reinforcement Learning)

Project description

carl-core

Coherence math primitives for CARL — the foundational per-token field that every CARL metric derives from.

Install

pip install carl-core

Use

from carl_core import CoherenceTrace, compute_phi

# From logits:
trace = CoherenceTrace.from_logits(logits, token_ids=tokens, step=0)
print(trace.phi_mean, trace.cloud_quality, trace.carl_reward())

# Raw phi:
phi, probs, entropy = compute_phi(logits)

What's inside

  • CoherenceTrace — per-token coherence field (phi, entropy, selected_prob, delta_phi)
  • CoherenceProbe / CoherenceSnapshot — probe + snapshot for training-step metrics
  • CoherenceObserver — periodic Claude-backed training health assessment
  • FrameBuffer / FrameRecord — rolling temporal Phi buffer
  • compute_phi() — order parameter from logits: phi = 1 - H/log|V|
  • Constants: KAPPA = 64/3, SIGMA = 3/16, DEFECT_THRESHOLD, T_STAR(d)
  • InteractionChain / Step / ActionType — typed interaction trace

Depends on

numpy, pydantic.

Part of

Carl Studio — Coherence-Aware Reinforcement Learning. Full docs: https://github.com/wheattoast11/carl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carl_core-0.1.2.tar.gz (192.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carl_core-0.1.2-py3-none-any.whl (137.3 kB view details)

Uploaded Python 3

File details

Details for the file carl_core-0.1.2.tar.gz.

File metadata

  • Download URL: carl_core-0.1.2.tar.gz
  • Upload date:
  • Size: 192.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for carl_core-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0c3927e78c2df8c788796504887aaf5de76a481a448872ee3a4f50804f2340eb
MD5 4242bd1a00a8d9a6ef94c6b69c494fef
BLAKE2b-256 3ac4facb82a1d2e6abbbb93b488aa4747c2d0d14af2f693fcb8854b82860ca1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for carl_core-0.1.2.tar.gz:

Publisher: publish.yml on wheattoast11/carl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carl_core-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: carl_core-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 137.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for carl_core-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aca421211650d1ec119057a8e63ba6d697c540c965db069b52793aa37ee36beb
MD5 2600adea1d04e51b2cfb38eb5b00c05a
BLAKE2b-256 b8abdb84a1cd9413f3212896e2566ce6e2a6e9fcd0c74edd4de7d6f518e137db

See more details on using hashes here.

Provenance

The following attestation bundles were made for carl_core-0.1.2-py3-none-any.whl:

Publisher: publish.yml on wheattoast11/carl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page