Numerical Precision During Context Compression
By DX Research Group · · State and memory
Retain exact operational numbers and compress the surrounding explanation.
Context compression should preserve exact operational values when rounding can change the next action. We would compress descriptive text aggressively while keeping units, decimal strings, and threshold relationships available as typed fields. A human-friendly approximation can be unsuitable as a policy input.
Our state and memory framework gives each snapshot a source-bound identity. The trace feedback framework then allows us to locate whether a number changed during compression or later model reasoning. The distinction matters because the repairs belong to different stages.
A small rounding error crosses a limit
Take an illustrative available balance of 99.96 units and a proposed order requiring 99.98 units, with all costs already included in that requirement. The exact shortfall is 0.02. A compressed summary that rounds both amounts to 100 makes them appear equal. A model relying on that text may claim the order is affordable.
The deterministic check should use the exact source values regardless of the prose. But the model's decision record also benefits from retaining precision: repeated impossible proposals waste turns and make explanations harder to review. We would store 99.96 and 99.98 as exact decimal strings with their currency, then display a rounded version only where the display contract permits it.
Another fixture uses position size 0.0049 against a minimum actionable quantity of 0.0050. Rounding the position to 0.005 changes eligibility. Whether an order is valid depends on the venue's specified quantity rules; the example simply demonstrates how compression can erase a meaningful boundary.
Preserve relationships as well as digits
A summary can copy all digits and still misstate the relationship. “Available 99.96 after fees” differs from “available 99.96 before fees.” We would audit the qualifier, the unit, and the calculation dependency beside the numerical value. Scientific notation also needs testing when a tool and a renderer disagree about its accepted form.
The JSON Canonicalization Scheme describes deterministic serialization constraints for JSON. It is useful when comparing serialized records, but canonicalization does not create arbitrary-precision decimal arithmetic. An application needing exact decimals must declare its representation and calculations separately.
Our proposed round-trip fixture starts with typed source fields, produces a compressed context, extracts the relevant values, and compares them with the source. It reports absolute error and whether that error changes a declared decision boundary. A large error in an irrelevant display field and a tiny error at a minimum-order threshold should remain distinguishable.
We would run the same cases through repeated compression, because rounding can accumulate across summaries. The pass condition is exact preservation for required operational fields, with explicit approximation elsewhere. These examples are hypothetical arithmetic, rather than a result from DXAP. The useful ending artifact is the first boundary crossed by a lossy representation. It gives the builder a reason to retain a particular field at full precision instead of imposing a blanket rule that every number requires every digit.