Skip to main content

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

Metadata

Release files for carl-core 0.3.0

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

Source distribution (sdist)

Source distribution for carl-core 0.3.0
File Size Uploaded
carl_core-0.3.0.tar.gz 209.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for carl-core 0.3.0
File Interpreter ABI Platform
carl_core-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 358.5 kB

Release files / carl_core-0.3.0.tar.gz

Download URL carl_core-0.3.0.tar.gz
Size 209.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ba8f80dbae0e2e0922c3f31a44f209059b267c06a59d77800aad22a09d02aa1d
BLAKE2b-256 checksum
How to use checksums
9446274856d1eb8d63c507d03e4fe8d15995c8edb56c9089655a30bba1639e46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 8, 2026.

Transparency log

Release files / carl_core-0.3.0-py3-none-any.whl

Download URL carl_core-0.3.0-py3-none-any.whl
Size 149.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bde6f2b54b74a7bcdb3a6f207afc1c37952d5345d4b251ddca851b39e8fda0b3
BLAKE2b-256 checksum
How to use checksums
b1b52ff76daa830a99aab25138765cec555e40928a47dafccd9924598927c78b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.1

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.2

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