Paying for Encryption with the Comfort Budget: Encrypted Predictive HVAC Control

Building climate controllers save the most energy when they let room temperatures drift to the edge of what occupants will tolerate. They do this by accepting a small, explicitly budgeted rate of comfort violations, say 5% of occupied hours. Running such a controller as a cloud service raises a privacy problem: the service sees temperature and occupancy traces, which reveal where people are. Homomorphic encryption avoids this by letting a server compute on data it cannot read. The price is a "cryptographic tax": slow arithmetic, large ciphertexts, and numerical error that grows with the precision and depth of the computation.

This note proposes treating that numerical error as one more source of prediction error that the controller's comfort-violation budget already has to absorb. It should not be treated as a disturbance to be cancelled exactly. If the controller's safety margins are calibrated on the errors it actually observes, including errors introduced by encryption, then lowering cryptographic precision should cost energy rather than comfort. That makes "how much encryption can we afford" a measurable point on an energy–comfort–cost surface.

Core Claim

The proposal starts from a recent data-driven building controller. Disturbance-Adaptive Data-Driven Predictive Control predicts future room temperatures directly from stored input–output histories, with no physical model. It tightens comfort bounds using conformal prediction, a distribution-free way to turn past prediction residuals into a safety margin. It then adjusts those margins online so the realized violation rate meets a target. With a 5% target, it saves 30.1%, 11.2% and 27.1% energy against default controllers on three BOPTEST cases and 20.5% in an occupied campus building.

We claim the same calibration loop can be run when the prediction and optimization steps execute over CKKS ciphertexts in an untrusted cloud. CKKS is an approximate homomorphic scheme that packs thousands of real numbers into one ciphertext. In this setting, the error that lower CKKS precision and cheap polynomial stand-ins for constraint handling introduce enters the conformal residuals and is priced in automatically. Concretely, the cloud never sees plaintext temperatures. The realized violation rate stays near target across a range of cryptographic parameters. The only thing that degrades as parameters shrink is energy savings, at a rate we can measure.

Three properties would be new together:

  • comfort constraints are enforced under encryption without per-iteration client round-trips;
  • encryption error is compensated with no physical plant model;
  • the cost of encryption is reported in kWh rather than as "matches plaintext / does not."

Relation to Prior Work

Two papers come closest, and each motivates part of the gap. Encrypted Data-driven Predictive Cloud Control with Disturbance Observer runs the same Hankel-matrix predictor over CKKS. It shows that heavy truncation destabilizes the loop unless an edge-side disturbance observer cancels the error. Its limits are that it drops all inequality constraints, tests only a second-order toy system, and requires a nominal physical model on the edge. That last requirement undercuts the reason for using model-free control in buildings. We keep the encrypted predictor. We replace the model-based observer with residual-calibrated margins and restore comfort constraints.

Cloud-Based MPC with Encrypted Data does enforce constraints. It uses additively homomorphic Paillier encryption, with projection steps done either by the client between iterations or by two non-colluding servers running a secure comparison protocol. The cost was about 91 s per step (client–server) and about 170 s (two-server) on a spacecraft toy model with 10 decision variables. We avoid secure comparison entirely by replacing exact projection with low-degree polynomial clipping and letting the conformal margin absorb the resulting inexactness.

On the encryption side, three papers supply the method:

  • SecureNets documents the degree-versus-depth trade-off for polynomial approximations: higher-degree polynomials are more accurate but consume more of the noise budget.
  • HEMET shows that multiplicative depth, not operation count, drives latency in leveled schemes. It also introduces coefficient merging, which we reuse to fuse the scaling and clipping polynomials.
  • Circa shows that accepting a 10% fault rate in non-linearities costs under 1% accuracy for a roughly 3× speedup. This is the closest analogue to our bet, transplanted from classification accuracy to closed-loop comfort.

CryptoNets supplies the packing idea: one ciphertext carries many values. We pack all thermal zones of a building, or of a portfolio, into the slots of one ciphertext.

Privacy-Enhanced Architecture for Occupancy-based HVAC Control motivates the threat model. Zone-level occupancy counts let an insider reconstruct individual trajectories with over 96% accuracy. It is also the main competitor, because it trades utility for privacy by adding noise to the data, whereas we trade utility for cryptographic cost.

Research Program

The system has three parties:

  • Edge gateway (trusted). It holds the secret key, measures zone temperatures and occupancy-driven comfort bounds, and applies actuator commands.
  • Cloud provider. It holds the Hankel data matrices and the solver, which may be proprietary.
  • Ciphertexts. Only ciphertexts cross the network.

Each control step, roughly 15 minutes for the thermal processes in BOPTEST, proceeds as follows. The edge encrypts the recent input–output window and the current comfort bounds, with all zones packed into slots. The cloud runs a fixed number $K$ of projected-gradient iterations on the data-driven predictive problem. In each iteration the box projection onto actuator and comfort bounds is replaced by a degree-$d$ polynomial approximation of clipping. The cloud returns the encrypted first control move and the encrypted predicted temperatures. The edge decrypts them, applies the move, and later records the residual between the predicted and realized temperature. Because the actuator always clips its own input physically, actuator limits are hard. Comfort limits on predicted states are the soft, budgeted part.

Margin calibration follows DAD-DPC, but the residual pool is formed from the encrypted pipeline's own predictions. For zone $i$ at prediction step $k$, the tightened lower bound is

$$\tilde T^{\min}_{i,k} = T^{\min}_{i,k} + \hat q_{1-\alpha_t}\big(\{e_{i,k}\}\big),$$

where $e_{i,k}$ are past residuals between encrypted-pipeline predictions and realized temperatures, and $\hat q_{1-\alpha_t}$ is their empirical $(1-\alpha_t)$ quantile. The level $\alpha_t$ is updated online from the observed violation rate toward the target $\varepsilon$. The same is done for the upper bound.

The residuals mix weather and occupancy disturbance, CKKS rescaling error, and the error from inexact polynomial projection with finite $K$. The margin therefore grows only as much as these errors require. That growth is what costs energy. The experiments will check whether the calibration's coverage guarantee holds under this mixed error, rather than assuming it.

The tunable cryptographic knobs are the CKKS scaling factor, the ring dimension, the clipping degree $d$, and the iteration count $K$. Together they set multiplicative depth, which is roughly $K(\lceil\log_2 d\rceil + 1)$, and hence whether bootstrapping is needed at all. The core deliverable is the measured surface relating energy, realized violation rate, per-step cloud latency, and bytes transferred. We expect the following:

  • Each extra CKKS precision bit buys less energy than the one before, because once encryption error falls below the weather and occupancy error, residual quantiles stop shrinking.
  • There is a "knee" parameter setting that fits in one ciphertext level budget without bootstrapping and costs a small energy premium over plaintext.

Baselines

The naive reference point is the default BOPTEST rule-based controller. Plaintext DAD-DPC's reported savings are measured against it, so every method's energy number is normalized to it.

The strongest competitor on control quality is plaintext DAD-DPC from Disturbance-Adaptive Data-Driven Predictive Control, run unencrypted with an exact quadratic-program solver. It reports 30.1%, 11.2% and 27.1% energy savings on BOPTEST cases 1–3 at a 5% violation target, solved in 6–11 ms per step. We reimplement it on the same three BOPTEST cases, with the same Hankel data length, horizon, violation target, test weather periods and conformal hyperparameters. First we reproduce its reported savings within a few points; if reproduction fails, that gap is reported, and comparisons use our reproduction. The encrypted system "wins" if two conditions hold together. Its realized violation rate stays within the same tolerance of the 5% target, and its energy savings stay within a small, pre-registered gap (we propose 3 percentage points) of plaintext. Beating plaintext on energy is not the goal. Matching it on comfort while hiding the data is.

The strongest existing encrypted approach is the CKKS controller with disturbance observer from Encrypted Data-driven Predictive Cloud Control with Disturbance Observer. It is unconstrained, so we give it the same comfort targets through post-hoc clipping at the edge. Its observer is supplied with a nominal model identified from the same historical data, which is a cost our method does not pay. No reported number on Lacuna exists for that paper's tracking error, and none for any encrypted controller on BOPTEST, so all numbers here are new measurements. For context on constraint-handling cost, the Paillier client–server protocol of Cloud-Based MPC with Encrypted Data reports about 91 s per step at 10 variables. We reimplement it at matched horizon and fixed-point precision to compare latency and bandwidth.

The privacy-by-distortion competitor is the mutual-information-optimal noise injection of Privacy-Enhanced Architecture for Occupancy-based HVAC Control, applied to occupancy-driven comfort bounds. It feeds plaintext DAD-DPC, with the noise level tuned until the trajectory inference attack falls to the out-of-building base rate (about 77% in that paper). Our system beats it if it achieves lower energy at equal violation rate. Our system also leaks no plaintext to the cloud, which the noise approach cannot do at any setting.

Two ablations isolate the key ingredient. The first freezes the conformal margins at values calibrated on plaintext residuals, so that encryption error is not priced in. If this ablation also holds the violation target at low precision, the calibration loop is not doing the work we claim. The second replaces in-cloud polynomial clipping with "solve unconstrained in the cloud, clip at the edge." This isolates whether constraint handling under encryption matters at all.

Why not just…?

Why not just run the controller on the building's own edge computer? DAD-DPC solves in milliseconds, so for a single building with an in-house controller this is the right answer, and we will not pretend otherwise. The proposal targets a different situation: a provider serving many buildings with proprietary data matrices or solvers, where neither side wants to hand its assets to the other. The portfolio-packing experiment is where this regime is tested. If per-building cost does not fall with packing, the case for the cloud setting weakens, and we will report that.

Why not just use high-precision CKKS and ignore the comfort budget? This is the most serious threat. Thermal sampling intervals are minutes long, so a high-precision, bootstrapping-free encryption of a small linear predictor might already fit in the time budget, making the trade-off moot. We measure exactly this: latency and bandwidth at the precision where encrypted and plaintext predictions agree to sensor resolution. If that setting is cheap for single buildings, the contribution narrows to iterative constrained solving (which needs depth $K\lceil\log_2 d\rceil$ and does force bootstrapping) and to large packed portfolios. The note would be reframed around that.

Why not just decrypt the unconstrained solution and clip it at the edge? This handles actuator limits but not comfort limits on predicted temperatures. Clipping an unconstrained optimum is generally not the constrained optimum, so either energy or comfort suffers. The second ablation measures how large this loss is on BOPTEST. If it is negligible, the simpler design should be adopted and the polynomial-clipping machinery dropped.

Why not just add noise to the data, as in mutual-information distortion? Privacy-Enhanced Architecture for Occupancy-based HVAC Control shows this works against trajectory inference at a bounded utility cost. However, the cloud still sees perturbed temperatures, schedules and building responses, and the utility loss is permanent rather than tunable by spending compute. The head-to-head comparison at equal violation rate settles which costs less energy.

Why not use secret sharing or two-server protocols? The two-server Paillier design in Cloud-Based MPC with Encrypted Data was slower than client–server (about 170 s vs about 91 s) because of communication. A Systematic Comparison of Encrypted Machine Learning Solutions reports gigabytes of traffic for interactive protocols on deep networks. Both designs also require trusting that the two servers never collude. We include the Paillier reimplementation precisely so the bandwidth comparison on a building workload is measured, not asserted.

Proposed Experiments

All closed-loop experiments use BOPTEST cases 1–3: the residential heat pump, the single-zone school and the multi-zone office. They use the same test periods as DAD-DPC, CKKS via a standard library on commodity CPUs, and five random seeds over training-data windows.

The first experiment sweeps CKKS scaling bits, clipping degree $d$ and iteration count $K$. For each setting it records energy relative to the default controller, realized violation rate against the 5% and 2.5% targets, cloud latency per step, and bytes per step.

The decisive check is coverage. The full method should hold realized violations at target across the sweep. The frozen-margin ablation should exceed the target once precision drops below the point where encryption error rivals disturbance error. If both behave identically, the central claim fails.

The second check is the energy price of encryption. We plot savings lost against the plaintext reproduction as a function of multiplicative depth, and locate the cheapest bootstrapping-free setting within 3 points of plaintext savings.

The third experiment packs zones from case 3, then many replicated buildings, into ciphertext slots. It measures how amortized per-zone latency and bandwidth scale, and checks that coverage holds per zone and not only in aggregate.

Finally, we run the trajectory inference attack from Privacy-Enhanced Architecture for Occupancy-based HVAC Control against the cloud's view under each method. We use occupancy traces in the style of its Augsburg benchmark to drive comfort bounds. The attack documents that the encrypted pipeline leaks nothing beyond timing and size, whereas noise injection leaves perturbed but readable traces.