← Notes

Pessimistic wasn't good enough

In August we argued that a simulation should only ever err on the pessimistic side. Three months later we replaced that rule. A pessimistic simulation distorts what a model learns, and the only safe target is the wallet itself.

In August we wrote that a simulation is only allowed to be pessimistic. Every simulated trade fills at a price that never happened, so we corrected each result downwards against real fills and never upwards. If the simulation had to be wrong, it should be wrong in the direction that costs an untried idea rather than real money.

That rule was right about the danger and wrong about the fix. This note is about why we replaced it.

Pessimism is not a constant

If a pessimistic correction lowered every result by the same amount, its cost would be easy to name. The model would rank trades exactly as before; only its probabilities would come out low, which makes it take fewer trades and bet less on each (Calibrated beats accurate is about why that still matters). That cost is caution, and it is the price the August rule accepted on purpose.

That is not what happened. When we finally measured our old correction against what real wallets received on the same trades, it was low on average by about three points of return. It also invented losses: about one in six of the severe losses it recorded never happened to the real trade. And the error was far from even. Against the replay described below, trades that were stopped out were understated by roughly the average, while trades that rode a move and exited on a trailing stop were understated by two to four times as much.

An uneven bias costs more than caution. It doesn’t just shift the numbers, it reorders them, and so it changes what the model prefers. When we relabelled the same history without the bias, the order of outcomes changed enough that the model had to be retrained. For months it had been learning a version of the market in which one style of trade looked worse than it was, and in which the worst outcomes were more common than they were.

The decision must not change the label

There is a second, quieter problem. A live system learns from two kinds of examples. The trades it took are labelled by what the wallet received. The candidates it skipped are labelled by a simulation, because only the simulation can say what a skipped trade would have done. We record those skipped candidates for exactly that reason: you can’t learn only from the trades you took.

If the two labelling methods disagree, the label of a trade depends on the decision the model made about it, and that creates a loop.

Suppose simulated results are too optimistic for some group of candidates. They look good as simulations, so the model starts taking them. As real trades they do worse, the model learns that and drops them, and as simulations they look good again. The system cycles, and every pass through the cycle costs real money.

Now suppose the simulation is too pessimistic, which is what our rule demanded. Skipped candidates look worse than they really were. The model learns that the kind of trade it skips is bad, keeps skipping it, and never collects the real results that would prove it wrong. The bias stops looking like an error. It looks like a finding.

We haven’t measured either loop in our own data; this is a structural argument, not a finding. But both are built into any system whose two labelling methods disagree, and the only way out of both is for a trade’s label to be the same whichever way the decision went. That means the simulation has to match the wallet as closely as possible, in both directions.

Simulating the fill instead of correcting a price

The old method took the price at the moment of decision and adjusted it afterwards. The new one simulates the fill itself, the way a real transaction would experience it:

  • Delay. Each simulated buy and sell lands after a delay drawn from our own recent live transactions, not after a single average delay. Fast markets punish the slow tail of that distribution, and an average hides it.
  • Price. The fill is priced from the recorded market state at the moment it lands, including the price movement our own order would have caused.
  • Fees. Protocol and venue fees are computed with the same arithmetic the chain uses, per asset, to the last unit.

We left one thing out on purpose. Per-transaction costs, such as the fees for getting included quickly, are roughly flat per trade and change with network congestion, not with the trade. They are tracked separately, so the label measures the trade and not the state of the network that day.

Checking it against the wallet

The test was to take more than a thousand real trades and run each one again as if it had been simulated, with the same decisions, then compare the simulated result with what the wallet actually received.

Given the real delay each trade experienced, the simulation matched the wallet to within a few hundredths of a point on average, with a typical error on a single trade of about a third of a point, and it reproduced every severe loss in the sample.

A real simulation can’t know the delay in advance, so it has to draw one from the live distribution. With drawn delays the average error was about a quarter of a point, leaning slightly low. It missed about one in twenty of the severe losses, and on those trades it rated the losses about two points milder than the wallet did. The old pessimistic correction, on the same trades, was off by about three points.

We then relabelled recent simulated trades the same way: the stretch of history whose recorded data allows an exact replay. Each one keeps its original decisions; only what those decisions would have earned is recomputed. Most of the model’s training history is older than that and keeps its old labels, so for now the model still learns mostly from the biased version, and the share of honest labels grows as the older rows age out of its training window.

Why August’s test said otherwise

The August note mentioned that we had tried a correction that could also raise results, and that it lost on every measure we tracked. That test had two weaknesses we didn’t see at the time. The correction it tried adjusted a single price at a single fixed delay, which mostly added noise. And, as far as we can reconstruct, each version was scored against its own labels, so the pessimistic version was partly grading itself. When we later scored candidate labels against common referees, the result was more mixed than a clean reversal. Judged by what real wallets received, a label that drew its delays from real sells ranked real outcomes better than the pessimistic one, on most days of the test. Judged by a simulated referee, the two tied. Judged by the pessimistic label itself, the pessimistic label won, which is the August result again. It narrowly missed the bar we had set for it in advance. What decided the switch was the direct check against the wallet above, not that ranking test.

What we have shown is that the new labels match the wallet. What we haven’t shown yet is that a model trained on them trades better: the first models with a meaningful share of them are only days old.

What a simulation still can’t see

Matching the wallet on trades that filled isn’t the same as matching the market. Some effects exist only because we were really in a trade: other participants reacting to our order, or several sellers racing for the same exit. A simulated order can model its own price impact, but nobody else ever sees it. The check also covers only trades that went through; a simulation of a transaction that would have failed still books a result.

These effects grow with position size, so we keep comparing simulated and real results on trades the model scored alike, and we treat a widening gap as a signal that the simulation has fallen behind the way we trade.

What survived from August

The instinct behind the old rule still holds. An optimistic simulation is worse than none, and the uncorrected decision price is still sitting in the database, waiting to be reached for. That rule, never to use the raw simulated value, is unchanged.

What we gave up is the idea that a deliberate bias is a safe place to stand. A simulation that is wrong on the cautious side still teaches the model something false, and the model has no way to know which of its beliefs came from the market and which came from our caution. The target is not pessimism. It is the wallet, measured on real trades and checked again whenever the way we trade changes.