monitor · coherence field · cai
coherence field monitor
a practical set of signals that estimate when a model is stable, drifting, or collapsing under compression. wrap any inference loop and gate risky outputs with thresholds you control. this is the operational readout of the coherence field from compression aware intelligence (cai).
version 0.2.0 · coherence field monitor for compression aware intelligence
overview
what it is: a small metrics bundle, thresholds, and alerts that read how coherent your model is being when you compress, paraphrase, or perturb its inputs.
under cai, each bounded system sits in a coherence field: the way its outputs hang together when you squeeze them through compression, rephrasing, and small shocks. the monitor does not tell you if an answer is true. it tells you whether the system is acting like a single stable agent or wobbling between incompatible internal answers.
what it reads
- consistency across semantically equivalent prompts under compression
- token rhythm and logprob variance under tiny input edits
- agreement across agents, temperature seeds, or decoding paths
- waste heat signals like tokens and latency vs compression gain
what you get
- a single coherence field score between 0 and 1 per call
- bands, red line thresholds, and default actions wired to alerts
- a tiny monitor you can ship in a day on top of your existing stack
scope: this monitors bounded ai systems under their current training and deployment constraints. it does not estimate real world impact, intent, or truthfulness by itself. treat it as an engineering control layer that you pair with task level evals and domain checks.
quick start
- install and import
- wrap your inference call
- set thresholds and actions
# 1) install
# pip install cai-coherence-monitor # placeholder name, or copy the local module into your repo
# 2) import and wrap
from coherence_monitor import Monitor, default_thresholds
mon = Monitor(model, thresholds=default_thresholds())
# 3) call in your loop
result = mon.run(prompt)
print(result.score, result.alerts)
# 4) act on alerts
if "low_rhythm_stability" in result.alerts:
route_to_slow_path()
metrics
each metric is a surface readout of compression strain in the system: how much the coherence field bends before it snaps.
| name | what it reads | how | why it matters |
|---|---|---|---|
| prompt consistency | stability across compressed paraphrases | generate n paraphrases, embed answers, compute pairwise similarity | low values signal brittle reasoning when you hold meaning fixed but change wording |
| rhythm stability | token cadence under tiny compressed perturbations | apply small input edits, track per token logprob variance and spikes | spikes often precede off target drifts and local coherence field buckling |
| ensemble agreement | convergence across agents, seeds, or paths | run k samples, compute majority in n grams or embedding space | disagreement flags underspecified instructions or competing local minima inside the model |
| waste heat ratio | effort vs compression gain | tokens or latency divided by novelty or compression gain | high ratios suggest the system is burning compute without resolving underlying compression strain |
{
"score": 0.78,
"components": {
"consistency": 0.88,
"rhythm": 0.74,
"agreement": 0.81,
"waste_heat": 0.65
},
"alerts": ["low_rhythm_stability", "collapse_risk"],
"signals": {
"pairwise_sim_mean": 0.86,
"token_var_p95": 0.22,
"agreement_rate": 0.79,
"whr": 2.1
},
"context": {"model": "your-backend", "latency_ms": 420},
"version": "0.2.0"
}
score and thresholds
the monitor fuses component metrics into a single coherence field score using a simple weighted average. start with the defaults, then tune weights on your validation data and flows.
| band | score | what to do |
|---|---|---|
| good | 0.75 to 1.00 | allow fast path |
| watch | 0.50 to 0.74 | add self check, slower decode, or extra grounding |
| hold | below 0.50 | route to human, fetch more constraints, or deny action |
from coherence_monitor import Weights
weights = Weights(consistency=.35, rhythm=.25, agreement=.25, waste_heat=.15)
mon = Monitor(model, thresholds=default_thresholds(), weights=weights)
the coherence score is an internal stability signal, not a truth or safety label. 1.0 means the system is behaving like itself under compression. 0.0 means the coherence field is collapsing here. always pair the score with task level evals, safety layers, and domain constraints.
composite alerts like "collapse_risk" fire when multiple components drop at once,
for example low consistency plus high waste heat, or rhythm spikes plus ensemble disagreement.
example integration
def generate_safe(prompt: str) -> str:
r = mon.run(prompt)
if r.score < 0.5 or "collapse_risk" in r.alerts:
return slow_path_with_grounding(prompt)
return fast_path(prompt)
dashboards
emit results as json lines, send them to your logger, and plot them over time. this is enough for audits and for catching slow coherence drift across versions and days.
r = mon.run(prompt)
with open("coherence_events.jsonl", "a") as f:
f.write(r.to_json() + "\n")
faq
does this require training access
no. it runs at inference. logits, text, and timing are enough.
is the score calibrated
the default bands are reasonable starting points.
calibrate them using your validation percentiles, per domain and per flow.
will this slow my system
paraphrases and small ensembles add cost.
you can run the full monitor only on high risk flows and keep a cheaper subset on everything else.
does a high coherence score mean the answer is correct
no. the score reads stability under compression and perturbation.
you still need task level evals, safety rules, and domain checks for correctness and risk.
how is this different from generic evals
generic evals score outputs against labels.
the coherence field monitor scores how the system behaves when you compress, paraphrase, and perturb it.
it is a control layer that can sit next to any eval suite or safety pipeline.
references
- joseph, m. (2025). compression aware intelligence: coherence field monitor (v0.2.0).
- shannon, c. (1948). a mathematical theory of communication.
- tishby, n. (1999). the information bottleneck method.
last updated: