---
title: Conformal PID Control
url: https://www.emergentmind.com/topics/conformal-pid-control
type: topic
---

# Conformal PID Control

Conformal PID control encompasses two major, independently developed frameworks: (1) an adaptive online method for time-series prediction sets employing PID-like error regulation in conformal prediction [2307.16895], and (2) a conformal mapping-based approach for integer-order PID controller design that preserves key advantages of fractional-order (FO) PID while simplifying implementation [1202.5662]. Both exploit the "conformal" concept to interpolate or adaptively calibrate system parameters, either in the space of confidence thresholds (for uncertainty quantification) or controller zeros (for dominant pole placement).

## 1. Conformal PID in Online Time Series Prediction

The "Conformal PID control" algorithm for time-series prediction aims to provide distribution-free, formally valid prediction sets with online adaptivity under arbitrary nonstationary or adversarial data sequences. This methodology integrates conformal prediction's nonconformity scoring and classical proportional-integral-derivative (PID) error feedback to tune the quantile thresholds of prediction sets to maintain long-run nominal coverage, regardless of evolving statistical properties [2307.16895].

**Problem Setup:**  
- Let $(x_t, y_t)$ denote time-indexed covariate-response pairs, with no stationarity assumption.
- At each $t$, a forecasting rule $f_t$ (AR, Prophet, Transformer, ensemble, etc.) produces a point or distributional prediction for $y_t$.
- The goal is to output, for each $t$, a prediction set
  \[
  C_t = \{\,y: s_t(x_t, y) \le q_t\,\}
  \]
  where $s_t$ is a conformal score (e.g., $|y - f_t(x)|$), and $q_t$ is a dynamically updated threshold, so that the empirical miscoverage rate converges to the nominal $\alpha$:
  \[
  \frac{1}{T}\sum_{t=1}^T \mathbf{1}\{ y_t \notin C_t \} = \alpha + o(1),\quad T\rightarrow\infty.
  \]

**Error Signal and PID Law:**  
- With miscoverage indicator $err_t = \mathbf{1}\{y_t \notin C_t\}$, define the empirical coverage and error signal:
  \[
  \widehat{\mathrm{Cov}}_t = 1 - \frac{1}{t}\sum_{i=1}^t err_i, \qquad
  e_t = \widehat{\mathrm{Cov}}_t - (1-\alpha).
  \]
- The quantile threshold $u_t$ is updated via a PID-style recursion:
  \[
  u_t = u_{t-1} + K_P\,e_t + K_I\sum_{i=1}^t e_i + K_D(e_t - e_{t-1}),
  \]
  where $K_P$, $K_I$, and $K_D$ are the proportional, integral, and derivative gains.

**Theoretical Guarantee:**  
Under bounded score domains and integrator saturation, the long-run miscoverage error is upper-bounded by
\[
\left|\frac{1}{T}\sum_{t=1}^T (err_t - \alpha)\right| \le \frac{c\,h(T) + 1}{T}
\]
with $h(T)/T\to0$ for any sublinear function $h$, ensuring
\[
\frac{1}{T}\sum_{t=1}^T err_t = \alpha + o(1), \quad T\rightarrow\infty,
\]
independent of the data dynamics [2307.16895].

## 2. Algorithmic Workflow and Pseudocode

The method consists of an online routine:

```python
Input: α, gains (K_P, K_I, K_D), initial u0
Initialize: S ← 0, e_prev ← 0
for t = 1, 2, …:
    # 1. Use current threshold to define prediction set
    C_t = { y : s_t(x_t, y) ≤ u_{t-1} }
    # 2. Compute miscoverage
    err_t = 1 if y_t not in C_t else 0
    # 3. Compute empirical error
    coverage_t = 1 - ( (1/t) * ∑_{i=1}^t err_i )
    e_t = coverage_t - (1 - α)
    # 4. Update integrator
    S += e_t
    # 5. Compute derivative
    de = e_t - e_prev
    # 6. PID threshold update
    u_t = u_{t-1} + K_P*e_t + K_I*S + K_D*de
    # 7. Update previous error
    e_prev = e_t
```

## 3. Empirical Performance in Prediction Tasks

Applied across diverse real-world forecasting tasks, conformal PID control demonstrated robust regulation of empirical coverage while keeping prediction sets concise:

- **COVID-19 Death Forecasting**: On CDC Forecast Hub data (80% nominal coverage), the method elevated coverage during local failures (~20% to 70% in the winter 2020–21 wave) and maintained long-run coverage at 80%, with only modest interval widening [2307.16895].
- **Electricity Demand**: For daily-retrained Transformer models, conformal PID (using a Theta-model scorecaster) consistently achieved 90% coverage while outputting tighter prediction sets than Adaptive Conformal Inference.
- **Financial Returns**: Across Amazon, Google, and Microsoft, PID-based quantile tracking suppressed coverage oscillations and avoided the unbounded sets produced by some alternatives.
- **Temperature Forecasting**: When nominal regimes shifted rapidly, conformal PID retained valid coverage and eschewed excess conservativeness, outperforming classical conformal and ACI methods.

## 4. Conformal Mapping and Sub-Optimal PID Tuning

A distinct development of "conformal PID" appears in the context of deterministic control design, exploiting conformal (power) maps to approximate fractional-order PID (FOPID) behavior with integer-order PID controllers, retaining the dominant-pole placement benefits of FO designs [1202.5662].

**Key Procedures:**
- Map the FO controller $C(s) = K_p + K_i s^{-q} + K_d s^{+q}$ via $w = s^q$, rendering the controller rational in $w$:
  \[
  C(w) = \frac{K_d w^2 + K_p w + K_i}{w}
  \]
- The zeros of $C(w)$, back-mapped to $s$, become $s_{1,2} = r^{1/q} e^{\pm j\varphi/q}$, guiding the placement of integer-PID zeros.
- By varying $q$, the locations of $s_{1,2}(q)$ trace an "M-curve," a trajectory in the left half-plane, allowing regulation of closed-loop damping.

**Two-Stage Algorithm:**
1. Use LQR-based dominant pole placement to fix canonical integer-PID gains.
2. Map these gains to nominal FOPID parameters; choose $q<1$ and recalculate integer-PID gains such that the closed-loop poles traverse the M-curve to the prescribed damping.

## 5. The "M-Curve" and Controller Effort Tradeoff

The "M-curve" phenomenon refers to the trajectory described by the zeros of the mapped controller numerator as $q$ varies. For $q>1$, zeros shift toward the imaginary axis (reducing damping); $q<1$ pushes zeros left (increasing damping), but excessive reduction jeopardizes stability. The conformal design enables control of closed-loop pole locations with strict equivalence to LQR step and disturbance timings but requires uniformly lower gain magnitudes, and, consequently, lower peak and RMS control effort, as evidenced through Riccati cost analysis [1202.5662].

## 6. Practical Considerations and Implementation

- **Gain selection:** For PID-based conformal prediction, $K_P$ is scaled to typical score deviations; $K_I$ to maximum score magnitude; $K_D$ is minimized for noise suppression. Initialization via brief burn-in using empirical quantiles, followed by steady online adaptation, is effective.
- **Computational cost:** $O(1)$ per timestep for threshold update in conformal prediction; scorecaster inference cost is model-dependent.
- **Extensibility:** Both frameworks support plug-and-play modularity—arbitrary forecasters (AR, Prophet, Transformer) or scorecasters, and in the control context, analog/digital PID realization with integer gains derived from conformal mapping.
- **Fractional order in control:** In the sub-optimal design, the fractional order $q$ serves as a tuning knob (offline), with all physical implementation remaining strictly integer-order.

## 7. Summary and Scope

Conformal PID control synthesizes conformal prediction with feedback strategies or uses conformal mappings to transfer the benefits of fractional-order design into integer-domain realizations. In online uncertainty quantification, it maintains long-run coverage guarantees for time-series predictions against arbitrary dynamics with minimal user intervention [2307.16895]. In deterministic controller design, it yields integer PID controllers with dominant-pole placement and reduced control effort, directly matching the closed-loop time response of optimal LQR tuning while lowering associated quadratic cost [1202.5662]. Both approaches demonstrate that conformal techniques, whether in parameter-space mappings or in online error dynamics calibration, afford principled, formally controllable adaptivity in both statistical learning and feedback control frameworks.

Source: https://www.emergentmind.com/topics/conformal-pid-control