compile_events · live
awaiting first compile…
Disasters · spreadsheet failures, examined architecturally

The London Whale
(2012)

A VaR calculation was rebuilt by hand in Excel.
The new formula divided by a sum instead of an average.
The model under-stated risk by roughly half.

JPMorgan's Chief Investment Office lost ~$6.2 billion on a credit derivatives position in the first half of 2012. The position grew so large the trader who built it became known industry-wide as “the London Whale.” A model that mis-stated the position's risk by roughly half is one of several failures the post-mortems converged on.

Sources · U.S. Senate Permanent Subcommittee on Investigations, “JPMorgan Chase Whale Trades” (2013) · JPMorgan task-force report, January 2013 · SEC enforcement actions 2013-2014 · Bloomberg, The Wall Street Journal, Reuters coverage 2012-2013.

Diagnostic · what actually happenedpublic record · cited
The model

The Chief Investment Office's synthetic credit portfolio used a Value-at-Risk (VaR) model to constrain how much capital the trading desk could deploy. The model was managed in part through a spreadsheet that aggregated risk metrics across the position. The VaR limit was a hard guardrail: when the metric crossed it, trading activity had to be reduced.

The change

In early 2012, the desk built a revised VaR model and rebuilt parts of it in a new spreadsheet. According to the Senate subcommittee's report, one calculation was supposed to divide a sum of variances by the count of observations: producing an average. The new spreadsheet implementation divided by the sum, not the count. Mathematically, this approximately halved the resulting VaR figure for that calculation.

The propagation

The under-stated VaR fed the guardrail check. The guardrail kept reading below the threshold even as the position grew large enough that the true VaR would have triggered the limit weeks earlier. The desk continued to add risk in good faith: the model said it was safe to do so. By the time the position blew up, the firm held a derivative book it could neither hedge nor unwind without moving the market.

The reveal

The position became too large to hide. Other market participants began identifying the trader, and JPMorgan disclosed a $2 billion loss in May 2012. The loss ultimately grew to roughly $6.2 billion. Investigations followed: SEC, OCC, FBI, Senate Permanent Subcommittee. The spreadsheet error is one of several failures the reports converge on (others include risk-policy violations, valuation disputes, and management oversight). The architectural failure of the model is the one most relevant to us here.

The cost

$6.2 billion in mark-to-market trading losses. ~$1 billion in regulatory penalties (SEC, OCC, FCA combined). Senior departures. Substantial reputational damage. The firm acknowledged in its own task-force report that the model had been “improperly implemented” in the workbook in question.

The architectural cause

The architectural cause is not that the modeler was careless or that JPMorgan didn't care about risk. The architectural cause is that a spreadsheet has no structural way to express the invariant “VaR_new must produce the same dimensional result as VaR_canonical.”A new formula was written; the substrate could not compare its output dimensions to the previous formula's. No type system flagged that the new calculation produced a quantity with the wrong units. No cross-validation assertion fired. The substrate accepted the new VaR as if it were the same kind of number as the old one. From the moment of the rewrite, the guardrail was checking a number that no longer meant what the guardrail thought it meant.

Specimen · the calculation, in two forms
CIO_VaR_v3.xlsx · the substrate of recordreconstructed from public reports · for illustration
Canonical (what the math says)
=SUMPRODUCT(variances) / COUNT(variances)
average over N observations
Output: real VaR figure
Implemented (what shipped)
=SUMPRODUCT(variances) / SUM(variances)
divided by a sum of the same set
Output: ~halved VaR figure
What the cell looked like
B23 · 67
Number in a cell. No type. No unit. No name.
What the guardrail compared against
if B23 > 95 then halt
95 is a hard number. B23 was wrong.
The figures above are reconstructed from the published Senate subcommittee report and JPMorgan's own task-force report. The specific cell references are illustrative; the architectural shape: a denominator that should have been a count but was a sum: is documented in the public record.
The same model, in typed IR

Dimensional inference would
have flagged it at compile.

In Flatland, variances is a typed Vector(Variance). The canonical VaR formula would have produced Variance(USD²) when divided by Count. The implemented formula: divided by Variance(USD²) instead: produces a dimensionless ratio, which the dimensional inference pass would warn on the moment the IR was compiled. The guardrail itself would be a typed assertion against Variance(USD²) specifically. The substitute number would refuse to land in it.

The point isn't that the JPMorgan team would have caught the error with a different tool. The point is that a spreadsheet substrate cannot express the constraint that the new formula must produce a quantity of the same dimensional kind as the old. A typed compilation substrate can. The model and the guardrail share a contract. When the contract breaks, the compiler refuses to run.

Try the substrate · sixty seconds

Compile a model with assertions
that have units behind them.

Three questions. A typed compile. The dimensional inference pass runs. The assertions check. When something's wrong, the compiler tells you which assumption broke: before it ships.

Flatland · index of everything
© 2026 Flatland · made for systems of record · live pulse · awaiting first compile