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.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 carl-core 0.3.1
File Size Uploaded
carl_core-0.3.1.tar.gz 214.3 kB Details

Built distribution (wheel)

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

Total release size: 368.9 kB

Release files / carl_core-0.3.1.tar.gz

Download URL carl_core-0.3.1.tar.gz
Size 214.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3a1309d1be8c79feb40cb6049381dd23cba820235789faeca3283e6b6b012979
BLAKE2b-256 checksum
How to use checksums
4066cd02c9c37d2683ad7e465c20f3485d4e2ab3e729c8ec1a52c55336e8090e
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 13, 2026.

Transparency log

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

Download URL carl_core-0.3.1-py3-none-any.whl
Size 154.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdfc63699a12a334ae4cd2fed6ddcc5e59fc234b0d90ffd97c7d54af27d90c9c
BLAKE2b-256 checksum
How to use checksums
e112b7f64bac69afeb30b61069912669363997e4f25c016413bbe626da42a32c
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 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

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