Calibration Loop

intelligence

Calibration Loop

Definition

A Calibration Loop is a feedback mechanism that compares predicted confidence scores with observed real-world outcomes, computes the error delta, and uses that delta to adjust future predictions. In the Prismatic Decision Core, calibration operates via bucket-based correction with bounded adjustments.

Technical Deep Dive

How It Works

When a decision outcome is recorded, the system computes:

calibration_delta = observed_success - predicted_confidence
absolute_error = abs(calibration_delta)
bucket = confidence_bucket(predicted_confidence)  # e.g., "0.7-0.8"

A positive delta means the system was under-confident (reality was better than predicted). A negative delta means over-confident (reality was worse).

Bucket-Based Correction

Confidence scores are bucketed into 10 bins. Each bucket tracks the average delta across all historical events:

BucketEventsMean DeltaInterpretation
0.3-0.48+0.12Under-confident in this range
0.5-0.615-0.03Well-calibrated
0.7-0.812-0.15Over-confident in this range
0.8-0.95+0.05Slightly under-confident

When scoring future hypotheses, the system applies the bucket's mean delta as an adjustment, bounded to [-0.15, +0.15].

Health Monitoring

The Calibrator.health_check/1 function detects calibration drift:

  • High MAE (> 0.25) - predictions are unreliable
  • Systematic bias (|mean_delta| > 0.1) - consistent over/under-confidence
  • Sparse buckets (< 3 events) - insufficient data for reliable correction

Weight Recommendations

When systematic bias is detected, Calibrator.recommend_weight_adjustment/1 suggests concrete parameter changes to the scoring weights.

Implementation in Prismatic Platform

# Automatic calibration on outcome attachment
{:ok, %{outcome: outcome, calibration: cal}} =
  Decisions.attach_outcome(decision_id, %{
    outcome_label: "success",
    success_score: 0.85,
    measured_at: DateTime.utc_now()
  })

# Check calibration health
:healthy = Calibrator.health_check(events)

# Get weight recommendations
:no_change = Calibrator.recommend_weight_adjustment(events)

Connect & Contribute

Created by Tomas Korcak (korczis) | Open Source under GHL