Risk Calculation in an AI World, Part 2: A Risk Engine Built Like an Inference Server
Part one ended with me making a not especially controversial claim: the constraint that shaped how the industry calculates risk was never compute, it was the cost of checking, agreeing and validating. Let’s test that.
After years of building trading and risk system. The product of all of this experience and the current engineering best practice is AMLACE a risk system not based on any of the prior models even those I have worked on myself. Starting from a completely novel place.
It is not an AI model. I will talk a lot about AI and AI engineering, but this is not an AI Model.
Nothing in the margin path learns at runtime or draws random samples. Every number it produces comes from deterministic classical numerics, and any of it can be replayed bit-for-bit from a logged decision record. What is new is where the architecture came from and how the correctness is established.
The engine is built the way large language models are served, and it is checked the way modern AI systems are checked: on the assumption that nothing, human or machine, gets trusted without an independent gate. AI required a whole new battery of engineering techniques to build. Applying that approach to risk get us here.
Risk is Geometry
Every risk system begins with a choice of representation, and the choice decides what you can see.
The scenario lineage represents a portfolio as its instruments and reprices them all under every scenario. ICE’s patent, quoted in part one, gives the reasoning: local sensitivity approaches “capture linear risk exposures only,” so reprice everything and pay the compute bill. Given the alternative on the table at the time, delta-normal with a Gaussian bolted on, that was the right call.
Our new design, AMLACE, represents a portfolio as its risk sensitivities, carried with their curvature: the same DV01s, vegas and gammas a desk already quotes, in the standardised CRIF format the uncleared margin world exchanges daily. The market’s risk factors form a space; portfolio value is a function on that space; the sensitivity vector is that function’s differential, its gradient at the point where the market currently stands. The margin formula the industry already uses, SIMM’s nested square roots, is precisely the length of that gradient measured under a correlation-weighted metric. Written that way, risk calculation stops being a statistics exercise and becomes geometry: a surface, a point standing on it, distances and curvatures around that point.
Two practical things fall out of this simple example of the geometry. First, netting is exact rather than statistical: a ten-year DV01 is a ten-year DV01 whatever instrument produced it, so offsetting exposures cancel in one calculation, across products, and the product silo stops being a mathematical necessity. Second, and less obvious: a geometric engine can state a property no scenario grid can even express, that the margin number should not change when you re-describe the same book in different risk-factor coordinates. Coordinate invariance becomes a checkable design test. When your representation is a curated list of scenarios, the question cannot even be asked.
The cost of the choice is the burden ICE named: you must show the local picture captures what full revaluation captures by brute force. That burden is real, it is registered in the engine’s own open-items log, and the most instructive place to watch it play out is a corner of the bond market that most risk systems quietly smear over.
The dormant dimension
The question of how to capture other sensitivities arises immediately, here a worked example gives the best view. A Treasury bond future is delivered from a basket: the short chooses which eligible bond to deliver, and the contract’s conversion factors are calibrated so that at a 6% yield the choice is a matter of indifference. Away from that region, one bond is decisively cheapest to deliver and the future behaves like that bond wearing a scaling factor. The delivery choice is a dimension of the problem that exists everywhere but does nothing almost everywhere. It is dormant.
When yields approach the switch region the dormant dimension appears to wakes up. The identity of the cheapest bond starts to flip, the future’s DV01 jumps discontinuously between the two candidates, and a risk direction that mattered nowhere else, the spread between two specific bonds, suddenly carries the book. The short futures holder owns this switch option; the long is short it, and the future’s price shows negative convexity that no single bond in the basket possesses (Grieves, Marcus and Woodhams, Review of Financial Economics, 2010). For years of low rates the option was so far from activating that it was worthless. Then came the hiking cycle. The Montreal Exchange published the arithmetic in February 2022: on the previous Canadian bond contract, flipping the cheapest-to-deliver would have taken an implausibly large 160 basis point selloff combined with 24 basis points of steepening; on the September 2022 contract, 0.8 basis points of steepening was enough, and a worked two-basis-point steepening flipped the deliverable and dropped the future 16 cents on the spot (Montreal Exchange, Futures Flash, February 2022). CME flagged the same switch as in play in the US bond contract as yields rose through 2023 (CME Group, Navigating Higher Yields: The Role of Treasury Futures in Today’s Market, 2023).
Now we ask how risk systems traditionally handle this. The academic literature prices the delivery option as a continuous option value, a tradition running from Margrabe in 1978 through Hemler’s Journal of Finance study in 1990 to the present. Practice mostly smears it: an add-on, a touch of extra volatility on the main sensitivities. And a sensitivity-based system that maps the future to its current cheapest-to-deliver is silently wrong the moment the identity flips, which is a version of ICE’s objection landing on our own representation.
The engine’s answer is to model the dormant dimension as what it is. Most of the time the delivery-choice coordinate is switched off and the future is one factor. Near the switch region, the local dimension of the problem grows by one, and the new direction, with its own curvature, enters the calculation explicitly. Activation is detectable, because the curvature term spikes as the boundary approaches; for known cases like delivery baskets it is also simply enumerable in advance. As far as literature searches could establish, nobody models cheapest-to-deliver identity as an explicit state like this; the field generally treats it as a pricing adjustment. We treat it as an extra local dimension, much like string theory. We think the geometric treatment is obviously right once you work through the mechanics, and it prices the risk where the risk actually lives: nothing charged for a dead option when the market is too far away, a sharp and honest margin increase as the extra dimension becomes reachable.
Which raises the question that word implies. Reachable within what?
Margin is a region, not a point
Margin was never supposed to be the risk at a point. It is the collateral that covers losses over a holding period, the days it takes to close out a defaulter. So the object that matters is not the loss surface at today’s state but the surface over the whole region of states the market can reach before close-out completes. Margin at a point is properly an average of what can happen in its neighbourhood, weighted by the likelihood of getting there.
The switch example above has a discontinuity in it, a genuine jump in the loss surface, and a naive system that margined the instantaneous risk would produce a margin cliff: a market level at which collateral demands leap. But integrate the same discontinuous surface over the reachable region and the cliff dissolves into a steep, smooth ramp whose width is set by volatility times the square root of the holding period.
As the state approaches the switch, the probability of touching it before close-out rises sharply and continuously, and the margin rises with it, before activation, on a path a member can compute in advance. The measurement stays sharp; the collateral demand never jumps. Part three comes back to why that matters for stability. Routes are always reversible.
It also explains, better than any speed argument, why the engine is built the way it is. Region-based margin converts one evaluation into many: the surface over a neighbourhood rather than a point, at fine resolution near every locus that can activate. Add the hypothetical evaluations a modern clearing service owes its members, pre-trade what-if answers in milliseconds, margin simulators that regulators now expect members to have. Add every member. Add continuous operation. An architecture that recomputes from scratch per evaluation pays for each of those multiplicities linearly, every batch, forever. An architecture that builds the surface once, offline, and answers every query by reading it, pays once.
That is the whole design.
Train: offline, decompose the loss surfaces and the co-movement structure of the market into compact precomputed objects, with the tails calibrated by extreme value theory rather than assumed away. Hold: keep those objects in memory, shared across all members, the way a model’s weights are shared across queries. Infer: project the arriving portfolio onto the handful of directions that carry its risk and evaluate the tail deterministically from the prebuilt structure, quadrature where the book is genuinely non-linear, a closed-form saddlepoint fast path with exact additive risk attribution where it is not, and a verifier that checks the fast answer against an independent one and routes on disagreement, a pattern lifted directly from how language models are served under the name speculative decoding, though its correctness logic is older than the name, classical a posteriori error control.
There is a precedent, and it is not ours. When the bilateral world needed margin evaluated at many future states, for margin valuation adjustment and dynamic initial margin, nested full revaluation blew up, and the published answer, across a decade of papers, was proxy surfaces trained offline and queried online. The industry’s own quants already proved the architecture; they proved it one layer away from the margin engine. The scenario engine also cannot see the fine structure even when it stumbles over it: historical scenarios sit wherever history walked, and a 0.8 basis-point boundary layer gets resolved by a lookback window only by accident. And why questions on gap risk show a lack of understanding amongst quants.
Error budgets all the way down
The polynomial representation of a loss surface is exact only up to its truncation, and its celebrated convergence holds only where the surface is smooth, which is why the switch regions are carved into their own strata rather than papered over. The low-rank structure that makes the precomputation affordable is a bet that the surface actually has low rank. The active-subspace projection is a bet that real cleared books load a handful of risk directions, single digits, and that bet is written into the design documents as a load-bearing assumption with the test harness built to falsify it on real portfolios. The error of the composed system, truth to scaffold to correction to surrogate, has a derived bound whose formal core is proven and whose empirical calibration is still open work, and the engine’s own decision log blocks any regulatory submission that cites it until the remaining pieces close.
Set that against the stack in part one, where the load-bearing assumption, that a distribution fitted to recent history describes the tail you have not seen, sat implicitly inside production VaR for a decade before a crisis made it visible. The new engine does not assume less; the difference is that every layer carries a measured error budget, every assumption is declared in a register with a test attached, and the composition of the layers is what gets certified. Assumptions stop being things a model quietly contains and become things a system explicitly declares and continuously checks.
The machinery that makes that affordable is the AI engineering, and it has nothing to do with models predicting markets. The current harness runs a validation matrix in which each core mathematical claim is gated by an independent oracle, a separate long-hand implementation computing the same quantity to fifty decimal places by a different method, two hundred and seventy-eight of them, beside a simulator suite of three hundred and seventy-two tests that generates synthetic markets, portfolios and clearing days including member defaults, a dual implementation reconciled continuously between the production code and a reference, and emulators of the incumbent methodologies from part one computed in parallel on the same portfolios, because the proof a regulator can use is demonstrated equivalence in data, not a mathematical argument. The full tree is over two thousand tests and the build is red until every one passes. Building broad testing with AI systems working alongside is exactly why the gates look like this. You do not trust the generator. You gate it tightly. Cheap generation is what makes gates this dense affordable, and dense gates are what make cheap generation usable in a system whose numbers move collateral.
Still working
Three debts, we are focussed on. The non-linearity proof against a genuinely path-dependent book is derived and only finished when the empirical error tables exist, the sensitivity-plus-surrogate representation remains a designed answer to ICE’s objection, not a proven one. The low-dimension bet has been tested at scale on real institutional portfolios but cannot be conclusive until every portfolio has not invalidated it. And Eurex’s discipline, that offsets should only be granted where positions could actually be liquidated together in a default, is the sharpest external challenge to any netting-led design; the engine’s exact additive attribution happens to give a good answer, because per-position contributions are natural bidding units in a default auction, but the default-management process around that answer is design work in progress.
Part three takes on the objection all of this invites: that sharper, faster, more responsive risk measurement is exactly how we got to liquidity crisis before. The objection is serious, the history behind it is real, and the answer requires taking the model apart into layers that the current stack has always conflated.
This first appeared on LinkedIn on 27 July 2026. If you want to comment or discuss, that’s the place.