Only the safe shall pass. A conformal verifier between autonomous bidders and the Nordic electricity balancing market
Language-model agents are starting to bid in electricity markets, and none of them can say how often they are wrong. We put a small conformal gate between the bidders and the market. The gate keeps every accepted bid above the operator's loss limit at the coverage the operator asked for, whether or not the model reasoned correctly.
Bachelor thesis in Software Engineering · University of Southern Denmark
Simulator·Dashboard ↗·Markdown version·Code ↗·Weights ↗·Cite this thesis

Point at any day after the rule change. Press a calibrator to hide or show it.
Figure 1. Each line is the share of the last 96 quarters (24 hours) whose realised DK1 imbalance price fell inside the calibrator's 90% interval, over the 5,568 quarters from 4 March to 30 April 2025. Split-CP was calibrated before the break. Small marks along the top are the 19 resets of the change-point detector. Stored per-quarter results of the thesis.
The balancing market is where the Nordic grid settles, every quarter hour, the gap between plan and reality. On 4 March 2025 its rules changed to 15-minute settlement, and two days later the DK1 imbalance price reached 36,013.90 DKK/MWh in a single quarter. We ask what it takes to let a language model bid into this market without putting the operator at risk.
First we wrap a zoo of ten probabilistic forecasters in conformal prediction and prove two theorems that carry coverage of the price over to coverage of realised profit. One is exact in finite samples when past and future are exchangeable. The other holds in the long run on any data stream.
Second we build a two-stage gate that checks physical feasibility and then the worst-case profit over the conformal interval. Through the rule change, online calibration keeps coverage near its 90% target, while a split interval calibrated before the break falls to 74%.
Finally we put three kinds of proposer behind the gate, a deterministic chooser, a single language model and a society of language-model personas. No accepted and filled bid lost money for any of them. The language model does not beat the deterministic chooser on profit. Its value lies in a rationale that can be checked against its own tool calls, and in behaviour that follows plain-language instructions.
On 6 March 2025, two days after the new rules went live, the DK1 imbalance price reached 36,013.90 DKK/MWh in the quarter from 15:00 UTC. That is more than 360 times the day-ahead price in the same hour. A 10 MWh bid placed against a point forecast of 100 DKK/MWh would have lost roughly 360,000 DKK, about 48,000 EUR, in fifteen minutes. A forecaster that had widened its band around that quarter would have told the gate to stand down.
Language models are now proposed as trading agents in exactly this kind of market. They read heterogeneous evidence and explain themselves in prose. They also hallucinate, and their stated confidence is not a calibrated probability. Danfoss, our industrial partner, runs power-to-heat units that turn surplus electricity into district heat and can sell that flexibility to the grid. An operator like Danfoss cannot put such a model on the bid path without a bound on what it can lose.1
In Norse myth Heimdall watches the bridge to Asgard and decides who may cross. Our gate plays that part. It never has to follow the model's reasoning. It checks the consequence of the bid, and that check carries a formal guarantee. The path of one bid through the system is drawn below.
Press a stage to read what happens there.
Figure 2. Solid arrows carry one bid from left to right. The dashed arrow returns the realised price to the calibrator after every quarter, which is what lets online calibration retune itself.
Three results would have refuted the thesis. The interval could have lost its coverage at the rule change, and a split interval calibrated before the break does lose it, while online calibration holds (Sheet 03). The gate could have let a losing bid through, and among 6,541 accepted and filled language-model bids and 882 deterministic ones, none lost money (Sheet 04). The gate could also have been safe only because it refused everything. On a stream of 1,000 aggressive buy bids it accepts all of them at a threshold of 100 EUR, 498 at 250 EUR and none at 500 EUR (Sheet 04). That stream is synthetic, which makes it the weakest of the three tests.2
Before the real results, here is the whole loop in miniature. A forecaster predicts the next quarter's price and a calibrator puts an interval around it. A bidder proposes a bid, and the gate checks the bid's profit at the worst end of the interval. Then the true price arrives and the calibrator learns from it. Press play and watch the quarters go by. Then change one setting at a time and see which part of the system is doing the work.
Everything in this box is simulated. The price stream is invented and only shaped like the Danish one, and the bidder is a simple rule standing in for a language model. The calibrators and the gate run the same rules as in the thesis. None of the numbers here are thesis results. Those start at Sheet 01.
Press play, or point at any quarter that has passed to read what happened in it.
Simulator. Simulated data, not a result. The first day only calibrates and places no bids. The top panel shows the price with the 1 − α interval around the forecast, and the dashed line is what the heat is worth to the asset. Prices above the panel are drawn as arrows. The middle lane marks each quarter's bid as accepted, rejected, or accepted and then below τ. The bottom panel adds up profit with the gate and without it, when every proposal is placed. Every accepted bid is settled at the realised price here, while the real market activates only some bids, and the physical first stage of the gate is left out.
Three things to notice. With the rule change switched on, the fixed split interval keeps the width it learned on the calm first day. Misses pile up, and accepted bids end below τ several times as often as under online calibration. ACI widens after each miss, and the gate grows more cautious on its own. The faster step size catches up within hours, and the slower one lags well behind it.
Second, compare the two counts of bids below τ. Without the gate a large share of all bids ends below the limit. With online calibration the share stays near or under α, which is what Theorem 1b promises in the long run. That safety costs profit. The gate turns down bids that would have paid, and over three days its profit line usually ends below the line without it.
Finally, switch the bidder's mistakes off and on. They cost much less with the gate in place, because the gate never asks why a bid was proposed. It only checks what the bid would earn at the worst price it has to plan for. That is why the thesis can put a language model behind it.
↑ Back to the top
The simulator above is a sketch. The dashboard we built for the thesis replays what really happened. It holds the curated runs that ship with the code, three full-day runs of the focal power-to-heat agent and 36 shorter runs from the matrix behind the appendix rationale examples.
It opens on a Danish demo day. The prices are the DK1 and DK2 imbalance and mFRR prices that Energinet published for 6 March 2025, the day of the spike. The fourteen trading agents and four information desks on top of them are simulated. They stand for the kinds of asset that bid in Denmark, from offshore wind and combined heat and power to electric boilers, heat pumps, batteries and EV fleets, and every bid passes the same gate. The dashboard marks this run as a demo, and the stored runs sit next to it in the run list.
Step through a run quarter by quarter. Open any agent to read its rationale, every tool call it made and what the gate said about each bid. It is an operator console and reads best on a wide screen.
Open the dashboard ↗A point forecast returns one price. An operator who commits money against it needs to know how far the price may stray, since the cost of being wrong runs mostly one way. So every model in the zoo returns three quantiles per horizon for 1 to 16 quarters ahead. These are the price the market should fall below one quarter in ten, the middle, and the price it should top one quarter in ten.
The zoo has ten entries. They run from a seasonal autoregressive baseline (F0) through gradient-boosted trees (F1), a Bayesian linear model (F2), a deep ensemble and a Monte Carlo dropout network built on patch Transformers (F3, F4), two conformal-wrapped patch Transformers (F7, F8), two zero-shot foundation models (F9, F10) and a domain-shaped surrogate (F11). It is a zoo on purpose. A claim that the conformal wrapper restores calibration for any base forecaster means little unless the bases differ.
Raw quantile heads do not keep their promise. On the validation window the raw band of F7 covers about 0.67 of prices against a nominal 0.80. After conformal wrapping, every entry sits within 0.003 of its target at α = 0.1, where α is the share of quarters the interval is allowed to miss.
Choose a target. Each dot is one model and one seed.
Figure 3. Horizontal position is empirical coverage on the validation window. The vertical rule is the target 1 − α. F12 is an explainable boosting surrogate that the thesis keeps outside the main leaderboard. Stored multi-level results of the thesis.
Accuracy and calibration are different races. Pinball loss scores a quantile by charging more for a miss on the side it promised to guard, and lower is better. On validation the five-seed deep ensemble F3 wins. On the held-out test year, scored once per configuration, the gradient-boosted F1 wins at 182.85 DKK/MWh, against 226.80 for the patch Transformers. F8 is neither, and it remains the focal default because its online calibration is the one that holds through the break.
Choose a window.
Figure 4. Values from the thesis leaderboards. On the test year F7, F8 and F11 share one patch Transformer base and so one point forecast, which is why they tie. Only these four entries have a test pinball in the thesis table.
A covered price is not yet a safe bid. The bridge between the two is monotonicity. Realised profit moves in one direction as the clearing price moves, so over an interval its worst value sits at one end. For a sell bid that is the lower end and for a buy bid the upper end. The gate computes this single number in closed form and compares it with the operator's threshold τ.4 Before that, it checks that the bid fits the asset's ramp, capacity, energy balance and the regulatory price cap.
Choose a side, then drag the interval or the threshold.
Figure 5. Illustration, not a result. The axes are unitless. The line is the profit of one bid as a function of the clearing price, rising for a sell bid and falling for a buy bid. Only the endpoint marked with a dot is checked against τ. In the thesis, a buy bid that would lose 240 EUR at the upper endpoint is rejected this way.
Two theorems carry the price guarantee over to profit. Each proof is short once the endpoint fact is in place.
If calibration and test prices are exchangeable, a split conformal interval contains the next price with probability at least 1 − α. Every bid the gate accepts then clears τ with probability at least 1 − α, jointly over the calibration draw and the price.
Under the online ACI update, with no assumption on the price stream, the long-run share of decision steps at which an accepted bid falls below τ is at most α, almost surely.
The two statements count different things, and a third rate is easy to confuse with both. Theorem 1a is a probability for one test point. Theorem 1b is a frequency over all decision steps, rejected ones included, since a rejected bid is never placed and cannot lose. The loss rate among the bids that were accepted carries the accepted count in its denominator. It is bounded only by α divided by the acceptance rate, so the thesis reports it as a measurement (Sheet 04) and never claims it at α.
On 4 March 2025 the mFRR Energy Activation Market went live across the Nordic zones, and settlement moved from hourly to 15 minutes. Exchangeability fails at such a break by construction. A price after the break could not have appeared before it, so the old calibration days stop standing in for the new ones. Theorem 1a no longer applies there, which is why the gate ships with online ACI.
The hero at the top of this page is the real break. A split interval calibrated before 4 March covers 0.739 of the next 5,568 quarters, and its 24-hour coverage dips as low as 0.385.3 Online ACI covers 0.892. BOCPD-ACI adds a Bayesian change-point detector that flushes the calibration buffer once it is confident the regime has moved, and it covers 0.896. The detector fired 19 times on this window, first on 6 March at 08:30 UTC. Whether BOCPD-ACI carries a formal guarantee of its own is still open.
A synthetic stress test points the same way. On an autoregressive price stream whose gas cost is multiplied by up to 20, split-CP slides from 0.8939 to 0.8826, while ACI stays between 0.8977 and 0.8985.
Choose a gas-cost multiplier.
Figure 6. The bars start at 0.87 so that the drift is visible. The gas cost enters a synthetic autoregressive price stream through the PyPSA-Eur-Sec technology cost stack. Stored stress-test results of the thesis.
The step size γ sets how hard each miss moves the calibrator. On the held-out year every setting we stored keeps all four calibrated forecasters within 0.002 of the target. The deployed γ = 0.05 sits a little lower, at 0.8981 for F8, and in exchange recovers fastest after a break.
Choose a step size. Each dot is one seed.
Figure 7. The axis spans 0.897 to 0.901 around the target, so the spread between seeds is visible. Stored test-year coverage results of the thesis.
We count the outcome where it matters, on bids that were accepted and then filled by the market. Across every scored run, language-model proposers made 33,597 proposals in 390 runs. The gate and the market let 6,541 of them through, and none realised a loss. On the deterministic side, 3,702 proposals in 43 runs led to 882 accepted and filled bids, and none of those lost either.
Press a proposer to read its counts.
Figure 8. Bar length is the number of proposals, the filled part is the accepted and filled bids, and the marker at the end of the filled part counts those that lost money. Values from the thesis table.
That zero is a measurement on a finite post-break window under a conservative threshold. It sits inside every version of the bound only because its numerator is zero. The theorems own a weaker and more general statement, a long-run breach frequency of at most α per decision step, whoever proposes.
A gate that rejects everything is also safe, so we check that this one discriminates. On a synthetic stream of 1,000 aggressive buy bids at α = 0.01, it accepts every bid up to τ = 100 EUR, 498 at 250 EUR, and none from 500 EUR on. The stream yields uniformly profitable forecasts at low thresholds, which is why the gate only starts to bite near 200 EUR.
Choose an operator threshold τ.
Figure 9. Each square is one bid. Filled squares were accepted, outlined squares were rejected on worst-case profit. The counts are stored results, and the order of the squares carries no meaning.
Behind the gate we put three kinds of proposer. A deterministic chooser takes the best-ranked candidate bid that the simulator and the gate accept. A single language model, Qwen3-32B served locally, sees the same candidates through narrow tools and picks one, or marks the quarter to watch, or abstains. A society runs six to twenty such agents with personas for a power-to-heat unit, wind, other renewables, a conventional generator, a retailer and an EV aggregator, joined in larger societies by information agents that only advise. Every tool call, rationale and verdict is written to a trace.

Figure 10. Figure 1 of the thesis. The operator dashboard replays one DK1 trading day of the gated society. Nodes are agents coloured by archetype, edges are the links along which they exchange candidate bids, and every accepted and rejected bid can be opened from this one surface. The dashboard section above opens it in the browser.
On profit the deterministic chooser wins every window. The reason is structural, and the thesis calls it the selector trap. Candidates arrive ranked by profit and filtered by the gate, so the best any selector can do is take the top entry, which the deterministic rule always does. Any other pick costs money. On the two stress windows the language model matched the chooser's focal power-to-heat profit to the euro and earned less in total. Averaged over three seeds, the retrieval-augmented society lands within 1 to 3% of the chooser.
Choose a stress window.
Figure 11. Total is the realised profit of the whole society, focal is the power-to-heat agent alone. The two adaptive rows are language-model choosers given more freedom over the menu. Values from the thesis table.
The language model adds two things the chooser lacks. Its rationales can be checked claim by claim against its own tool traces. Grounded in its tools, it cited unfounded evidence in none of them, and ungrounded in all of them. It also follows plain-language policy. Told to mind delivery risk, it cut 28 of 30 variable bids from 2.0 to 1.0 MWh and halved the worst-case delivery tail, a volume control that the price-only gate does not have. The pairs below are verbatim decisions from the same window, agent and step, made once by each chooser.
Choose a pair, or step through them with Previous and Next.
It also fails where one would expect. Its self-reported confidence does not rank realised outcomes, with an AUC below 0.5, while the deterministic control ranks them correctly. Letting it retry rejected bids did not recover profit, and disagreement between agents did not flag wrong-side risk. Safety has to rest on the gate.
Filter by verdict.
Figure 13. Each claim is tested against the deterministic or matched control that could refute it. Positive and negative verdicts are reported alike. Values from the thesis scorecard.
The first step is a one-week shadow pilot on a single district-heating installation, with the gate in advisory mode and a human operator approving every bid. After that come the faster aFRR and intraday products, where the calibrator has to update within a tighter latency budget, and a formal coverage statement for the change-point variant.
The code is an Apache-2.0 workspace with nine services and seven shared packages, released with the forecaster checkpoints and a data bundle under CC-BY-4.0 that rebuilds from public sources. The test set sits behind a ledger that refuses a second evaluation of any configuration.
Konrad, P. M. and Adam, T. L., 2026. Heimdall: Only the Safe Shall Pass. A Conformal Verifier Between Autonomous Bidders and the Nordic Electricity Balancing Market. Bachelor's thesis, University of Southern Denmark.
@thesis{konrad2026heimdall,
title = {Heimdall: Only the Safe Shall Pass. A Conformal Verifier
Between Autonomous Bidders and the Nordic Electricity
Balancing Market},
author = {Konrad, Phongsakon Mark and Adam, Tim Lukas},
type = {Bachelor's thesis},
school = {University of Southern Denmark},
address = {S{\o}nderborg, Denmark},
year = {2026},
url = {https://phomarkon.github.io/heimdall-page/}
}