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.2.0.tar.gz (209.2 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.2.0-py3-none-any.whl (149.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: carl_core-0.2.0.tar.gz
  • Upload date:
  • Size: 209.2 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.2.0.tar.gz
Algorithm Hash digest
SHA256 aa04a0758c5685207ffddca62036343d93788a5f8aa071b105287bc241688fbb
MD5 8994dab624790ce56442113ad9efd3e1
BLAKE2b-256 e5f79ec291cc90a24ebd4f6af2d1b624761f9776131e61960451466cce5f90cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for carl_core-0.2.0.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: carl_core-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 149.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8b18e0f586370dd021b2b54aad68abad0c7b8b2d54e43cf6c7a29caae32b986
MD5 e46d281171b2f2aabc50f77f88f34192
BLAKE2b-256 6bc1529a6ce98e2846f84d8fcdf1874574d3b8dd66c2910f9ee8f0403258eef9

See more details on using hashes here.

Provenance

The following attestation bundles were made for carl_core-0.2.0-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