Counterfactual Safe Thermal Control

Status: research direction derived from CFLight, not an implemented thermal-control system.

Core intuition: rare unsafe thermal episodes are most valuable as branch points. Rewind a calibrated digital twin to the warning state, replay alternative control-input plans under the same disturbances, reject unsafe or uncertain branches, and optimize efficiency only inside the remaining safe set.

Recoverability extension: Counterfactual PoNR Auditing suggests labeling the last snapshot from which an admissible emergency protocol can still preserve constraints. This separates current thermal safety from remaining recovery options and turns the feasible-but-irrecoverable interval into a direct target for offline audit and online monitor distillation.

Collaboration

If this direction resonates with you, I would be happy to discuss it, collaborate on research, or work on practical use cases.

Ideas are not the bottleneck. Hands are. Time-series modeling should be moving at least as fast as vision, audio, and robotics.

Why This Is Useful

Unsafe thermal events are rare, delayed, and expensive to explore on physical equipment. Ordinary logs are dominated by normal operation; simply oversampling the violation timestamp misses the earlier control decisions and accumulated heat that caused it. CFLight suggests a better data-generation protocol: treat the violation as a trigger, return to a pre-event state, and compare alternative actions under shared context.

The research target is broad:

  • HVAC and multi-zone building climate;
  • heat pumps, boilers, furnaces, ovens, and industrial heaters;
  • reactors and thermal-process control;
  • batteries, electronics, GPUs, and data-center thermal management;
  • district heating, thermal storage, and coupled energy networks;
  • manufacturing processes where temperature profile affects product quality.

Canonical Mapping

Traffic-signal controlThermal control
state before collisionmultivariate thermal history and estimated latent heat state before violation
phase actionheater level, valve position, flow, compressor/fan/pump command, supply temperature, duty cycle, or setpoint plan
collision-risk outcometemperature, pressure, ramp-rate, gradient, comfort, quality, or hardware-limit risk
delay / throughputenergy, price, peak power, time-to-target, comfort, process throughput, quality, and wear
exogenous noiseambient conditions, occupancy, workload, feedstock, weather, demand, and uncertain parameters
alternative traffic transitionreplayed/simulated thermal trajectory under an alternative control-input plan

Proposed Loop

flowchart LR
  O["sensors + event stream + context"] --> B["belief / latent thermal state"]
  V["violation or near-violation"] --> W["rewind to warning state"]
  B --> W
  W --> C["candidate control-input plans"]
  C --> T["calibrated digital twin / world model"]
  T --> Y["multi-horizon outcome distributions"]
  Y --> U["uncertainty and support gate"]
  U --> S["hard safety filter"]
  S --> P["Pareto set: energy, comfort, throughput, cost, wear"]
  P --> A["execute first control input"]
  A --> O

At time , use history

where is multivariate thermal/process state, is the control-input history, and is exogenous context. For a candidate plan , predict a distribution over the future trajectory and outcomes:

The horizon must cover the relevant thermal delay. A one-step branch is insufficient when stored heat, transport delay, sensor lag, or phase change determines later risk.

Safety Before Optimization

Hard feasibility should be separate from preference optimization. Example chance constraints include

Depending on the system, the safe set may also constrain:

  • lower and upper temperature;
  • pressure and flow;
  • and spatial thermal gradients;
  • cumulative time above a critical temperature;
  • actuator saturation, dwell time, and switching frequency;
  • emergency shutdown reachability;
  • comfort, product-quality, or material-integrity bounds.

Only feasible plans should enter the Pareto ranking over energy, price, peak demand, time-to-target, comfort, throughput, quality, and equipment wear. This avoids hiding a hard safety violation inside one scalar reward weight.

Data Contract For Branches

Measured, simulator-generated, and learned branches must not be silently mixed. Each branch group should record:

branch_group_id
snapshot_id
decision_timestamp
warning_horizon
factual_control_plan
counterfactual_control_plan
shared_disturbance_seed
initial_belief_state
ambient_and_process_context
branch_source: measured | physical_simulator | learned_model
simulator_version
world_model_version
support_score
prediction_uncertainty
hard_constraints
multi_horizon_outcomes

All branches from one snapshot must remain in one dataset split. Otherwise nearly identical histories leak across train and test.

1. Simulator-grounded branching

Start with a validated physical simulator or digital twin, not a learned SCM. Save restorable states, detect violations or near misses, rewind by a physically meaningful warning horizon, and execute alternative plans with the same initial state, disturbance profile, uncertain-parameter sample, and random seed.

This gives direct branch labels and a calibration target for later learned models.

2. Action-conditioned latent dynamics

Train a probabilistic state-space or recurrent latent model to predict temperature, pressure, flow, energy, constraint violations, and uncertainty. A physics-plus-residual model is preferable when trusted equations exist. Ensembles or Bayesian approximations should expose epistemic uncertainty.

The evaluation must include paired action effects:

not just unconditional forecast error. A model can have good average RMSE and still rank safety-critical actions incorrectly.

3. Conservative learned branching

Use learned branches only after testing:

  • multi-horizon calibration;
  • false-negative rate for every hard violation;
  • agreement with direct simulator branches;
  • out-of-distribution detection across ambient/process regimes;
  • sensitivity to sensor delay, missingness, actuator error, and parameter drift;
  • uncertainty-aware abstention and fallback behavior.

4. Receding-horizon control

Generate discrete plan templates for the MVP, then move to constrained MPC or trajectory optimization for continuous controls. Execute only the first control input, observe the new state, and replan. Keep an independent safety controller or emergency fallback outside the learned planner.

Domain-Specific Adaptations

DomainState/contextCandidate controlsCritical outcomes
HVAC / heat pumpzone temperatures, humidity, occupancy, weather, storage statesetpoints, compressor power, valves, fan/pump speedscomfort, energy, peak power, cycling, freeze/overheat risk
Furnace / oveninternal/surface temperature, material state, gas/air flowburner power, ramps, flow, dwell scheduleovershoot, gradient, product quality, throughput, emissions
Reactor / processtemperatures, pressure, concentration, flow, feedstockheating/cooling, valves, agitation, feed raterunaway, pressure, conversion, selectivity, safe shutdown
Battery / electronicscell/component temperatures, current, workload, cooling statecharge/current limit, cooling, DVFS, workload placementhot spots, thermal runaway, throttling, lifetime, performance
District heatingsupply/return temperatures, storage, network demand, weathergeneration, pumps, valves, storage dispatchcomfort, pressure/temperature bounds, peak demand, fuel cost

What Transfers Directly From CFLight

  • unsafe-event-triggered branch generation;
  • a common pre-event state for factual and alternative actions;
  • targeted replay around rare safety boundaries;
  • modular separation between alternative-outcome generation and downstream controller training;
  • explicit evaluation of the safety–efficiency frontier.

What Requires A Digital Twin

  • physically feasible future trajectories after changing a control input;
  • preservation of latent stored heat and delayed effects;
  • counterfactual labels where the physical system cannot be safely rewound;
  • systematic rare-failure exploration;
  • paired action-effect calibration.

What Is Speculative

  • that CFLight’s BiCoGAN is the right thermal architecture;
  • that one-step monotonic SCM inversion is valid under thermal partial observability;
  • that generated branches are causally identified from observational logs;
  • that reward shaping alone can guarantee safety;
  • that simulation gains transfer to equipment without system identification and prospective validation.

Evaluation Protocol

A credible benchmark should report:

  1. state and outcome RMSE/NLL over multiple horizons;
  2. paired action-effect error and action-ranking accuracy;
  3. violation false-negative rate and calibrated risk coverage;
  4. performance under ambient, occupancy, workload, and parameter shift;
  5. degradation under missing sensors, delay, saturation, and hysteresis;
  6. realized safety, energy, cost, comfort/quality, throughput, and wear in closed loop;
  7. simulator-call budget and world-model speedup;
  8. direct-simulator, learned-model, MPC, rule-controller, and no-branch ablations;
  9. emergency fallback usage and unsafe-abstention rate;
  10. group-safe splits by physical episode/snapshot.

Relation To Foundation TSFM Agenda

This is an idea page, so the verdicts describe the intended contribution if the system is implemented and validated.

Agenda slotVerdictEvidenceMissing pieces
Native multivariate encodingpartially closesProposes joint numeric sensor, actuator, event, and context histories with latent thermal state.Implemented encoder and high-channel/multi-zone benchmarks.
Control and counterfactualsclosesProposes common-state alternative control-plan trajectories, uncertainty gating, and receding-horizon action selection.Digital-twin implementation, paired branch corpus, baselines, and closed-loop tests.
Causal structurepartially closesPreserves shared initial state/disturbances and distinguishes direct simulator branches from learned predictions.Identification assumptions, controlled interventions, hidden-state analysis, and prospective validation.
Benchmarkspartially closesSpecifies safety, paired-action, uncertainty, shift, and Pareto evaluation.Public benchmark implementation and reproducible thermal environments.