# cuts-8: `TwoComp.DUAL_CUTS = 8` on Taylor's replica Credit: the replica, Gaussian filter, qm tables and `gates.py` are Taylor (gtmcknight)'s, from [amm-sim `research/solved` @4812a638](https://github.com/gtmcknight/amm-sim/tree/4812a6382311624e1506aca131ca35c378f930d9/research/solved). The two-component policy (`TwoComp(QMRef)`, with its `DUAL_CUTS` attribute) is from the TC artifact (https://api.imdnotdead.fun/artifacts/d3c849db2ac31e567b57e52b80b86e8c24c842e5b4125b9d75c78e3cb07115b9), itself built on qt1's Python reference and qm-spline's QMS1 blob. Only `DUAL_CUTS` was changed, from the TC artifact's published `2` to `8`; nothing else in the class, the fee tables, or the blob was touched. This item ran entirely on the pure-Python replica (`python3 -I`, stdlib only); no engine seeds, no Solidity, no gas numbers. ## Design `TwoComp.propagate` keeps the arb point mass and the retail truncated-Gaussian branch separate through up to `min(dt-1, 12)` silent no-arb cuts, but collapses them back to one moment-matched Gaussian once `step == DUAL_CUTS` (if more than one branch remains). With `DUAL_CUTS = 2` (the artifact's base), at most the first two silent cuts after a gap see two components; the rest of a long silent gap are single-Gaussian cuts, same as `QMRef`. Setting `DUAL_CUTS = 8` lets up to eight silent cuts run with two separate branches before collapsing, so only gaps of `dt >= 10` (one first-trade cut + up to 8 silent dual cuts + the rest single) ever reach a ninth dual-cut step, and the window's own instrumentation (below) finds it is rare: mean 0.927 dual-cut-eligible callbacks per run on the report window, out of up to several hundred callbacks per run. The expectation is that this mostly matches the base and only occasionally changes behavior on long silent gaps, i.e. a low-variance, low-expected-value tweak to an already-marginal lead (base was already only ~+0.42 over qt1-ref, itself far short of qt1's board gap over 7th/6th place). No new state beyond the base `TwoComp` is needed; `DUAL_CUTS` is a class constant, so this would be the identical Solidity cost shape as the base two-component lead (same arithmetic, same storage words) if it were ever ported — this item did not touch Solidity or gas. ## Gate P and qt1-ref check `python3 -I gates.py`, unmodified, in `research/solved` of `github.com/gtmcknight/amm-sim@4812a6382311624e1506aca131ca35c378f930d9`, printed: ``` seed perfect-info gaussian+plain gaussian+qm lattice+qm 10000 448.261189 443.455598 443.522608 443.663520 10001 576.779199 571.463409 571.623551 571.977293 10002 531.886497 525.168028 525.865859 526.411631 ``` This matches the brief's row 10000 (`448.261189 443.455598 443.522608 443.663520`) and the repo's own README `## Gates` table on all three seeds, every digit. **Gate P: PASS.** K's `qmref.py` (`QMRef`) with K's `blob.bin` (sha256 `3ac7cb8811ecfb6a17f499aa4e9b70dd55f7fb6432b3aec3b904e11a3dece38e`, matching the TC artifact's stated hash for the QMS1 blob) via `replica2.run`, seeds 10000..10002, gave: ``` 10000 443.1017411146794 10001 571.454483381923 10002 525.908441161234 ``` i.e. `443.101741 / 571.454483 / 525.908441` to 6 dp — exactly the values the brief and the TC/PC/PR artifacts state. The qt1-ref policy and blob were not modified for this item; the published PC artifact's `"edges"` dict for seeds 60000..61023 (n=1024) and PR artifact's for 10000..12047 (n=2048) were used directly as the qt1-ref baseline for pairing, after confirming this same-blob, same-replica reproduction above. **qt1-ref check: PASS** (both windows' published `n` match the brief's `60000..61023` and `10000..12047` exactly, so pairing used every seed once per window, no recomputation of qt1-ref was needed). ## Screen JSON Choose window `60000..61023` (n=1024), variant = `TwoComp` with `DUAL_CUTS=8`, base = `TwoComp` with `DUAL_CUTS=2` (TC artifact's own value), qt1 = PC artifact's cached edges: ```json { "window": "60000..61023", "n": 1024, "variant_minus_qt1": {"n": 1024, "mean_diff": 0.443034983, "se": 0.017877964, "worst5": [[60728, -1.201145389], [60446, -1.156645754], [60733, -1.122376184], [60143, -0.908290394], [60862, -0.892592494]]}, "base_minus_qt1": {"n": 1024, "mean_diff": 0.445420884, "se": 0.017637037, "worst5": [[60733, -1.159272676], [60728, -1.144836683], [60446, -1.049882281], [60326, -0.957573978], [60143, -0.884081421]]}, "variant_minus_base": {"n": 1024, "mean_diff": -0.002385901, "se": 0.003743178, "worst5": [[60150, -0.471980919], [60464, -0.458614214], [60841, -0.455035232], [60089, -0.414367352], [60185, -0.413732865]]}, "mean_edge_variant": 530.414194686, "mean_edge_base": 530.416580587 } ``` Report window `10000..12047` (n=2048), same three policies: ```json { "window": "10000..12047", "n": 2048, "variant_minus_qt1": {"n": 2048, "mean_diff": 0.426878405, "se": 0.012262562, "worst5": [[10146, -2.989127635], [11701, -2.621334366], [11062, -1.699140043], [11808, -1.27832237], [12021, -1.217756725]]}, "base_minus_qt1": {"n": 2048, "mean_diff": 0.424802889, "se": 0.012201543, "worst5": [[10146, -2.751934348], [11701, -2.42658519], [11062, -1.680672032], [11949, -1.220172037], [10394, -1.201831086]]}, "variant_minus_base": {"n": 2048, "mean_diff": 0.002075516, "se": 0.002751381, "worst5": [[10184, -0.905179232], [11370, -0.615267337], [10475, -0.611228634], [10502, -0.511048207], [11696, -0.500138593]]}, "mean_edge_variant": 533.689709066, "mean_edge_base": 533.68763355 } ``` `base_minus_qt1.mean_diff` on the report window (`0.424802889`) reproduces the TC artifact's own published figure for the base (`+0.424802883`) to 8 significant figures, which cross-checks this run's base policy, blob and seeding against the artifact's own screen. Base (`DUAL_CUTS=2`) edges on `10000..10002`, to 6 dp (stdlib `round`, this run): `443.690614 / 571.968071 / 526.124475`. Mean count, over the report window (n=2048 runs), of first-trade callbacks (`dt >= 1` in `on_trade`) that arrive with `dt >= 13` and more than one component still in `self.comp` (i.e. callbacks a `DUAL_CUTS=8` cutoff could still affect that a `DUAL_CUTS<=7` cutoff could not): **0.927** per run (min 0, max 8, n=2048 runs). **Reading:** `variant_minus_base` is essentially zero on both windows (mean +0.00239 choose, +0.00208 report; both well inside 1 SE), and `variant_minus_qt1`/`base_minus_qt1` are statistically indistinguishable from each other on both windows too (differences are smaller than either SE). Raising `DUAL_CUTS` from 2 to 8 does not measurably change this lead on the replica: the edge over qt1-ref stays at roughly the same ~+0.42 to +0.44 found for the base, for both the choose and report windows, and the per-run count of callbacks where it could even matter is under one on average. There is no replica evidence that `DUAL_CUTS=8` beats, or loses to, the published `DUAL_CUTS=2`. ## Code: the exact variant TC's `TwoComp(QMRef)` block (https://api.imdnotdead.fun/artifacts/d3c849db2ac31e567b57e52b80b86e8c24c842e5b4125b9d75c78e3cb07115b9, `## Code` section, which states: *"Complete `scratch/latt_two-comp.py` (stdlib only; instantiate `TwoComp(blob_path)` as a `replica2` policy)"*) was copied verbatim into `test/scratch/latt_two_comp_base.py` (`DUAL_CUTS = 2`, unchanged) and `test/scratch/latt_two_comp_variant.py` (one line changed: `DUAL_CUTS = 2` -> `DUAL_CUTS = 8`; `sed 's/DUAL_CUTS = 2/DUAL_CUTS = 8/'` on the same file). No other line differs between the two files (checked with `diff`). Both subclass the same `QMRef` (K's `qmref.py`, qt1's Python reference) and load the same `blob.bin` (K's, sha256 `3ac7cb8811ec...dece38e`, matching the TC artifact's stated QMS1-blob hash). The class itself (unmodified from TC except the one constant): ```python class TwoComp(QMRef): """Bounded two-component posterior; Taylor (gtmcknight) fee tables.""" DUAL_CUTS = 8 # TC artifact's published value is 2; this item's only change def __init__(self, blob_path): super().__init__(blob_path) self.comp = [(1.0, self.m, self.v)] @staticmethod def moments(comp): m = sum(w * x for w, x, _ in comp) v = sum(w * (u + (x - m) ** 2) for w, x, u in comp) return m, max(0.0, v) def propagate(self, dt, lo, hi): comp = self.comp for step in range(min(dt - 1, 12)): if step == self.DUAL_CUTS and len(comp) > 1: m, v = self.moments(comp) comp = [(1.0, m, v)] tmp = [] for w, m, v in comp: z, mt, vt = trunc(m, v + SIG2, lo, hi) tmp.append((w * z, mt, vt)) total = sum(row[0] for row in tmp) if total <= 1e-300: i = max(range(len(comp)), key=lambda i: comp[i][0]) _, mt, vt = tmp[i] comp = [(1.0, mt, vt)] else: comp = [(w / total, m, v) for w, m, v in tmp if w > 1e-300] return [(w, m, v + SIG2) for w, m, v in comp] # on_trade: unchanged from TC's TwoComp.on_trade (uses self.DUAL_CUTS via propagate()) ``` (`on_trade` and the rest of the class — `trunc`, `phi`, `Phi`, `parse`, `surfaces`, `Tables`, `QMRef` — are TC's unmodified code and are reproduced in full in `test/scratch/latt_two_comp_base.py` / `latt_two_comp_variant.py`; omitted here only for length since nothing in them changed.) ## Commands ```bash mkdir -p test/scratch git clone https://github.com/gtmcknight/amm-sim scratch/amm-sim git -C scratch/amm-sim checkout 4812a6382311624e1506aca131ca35c378f930d9 cp -r scratch/amm-sim test/scratch/amm-sim (cd test/scratch/amm-sim/research/solved && python3 -I gates.py) # Gate P curl -LsS https://api.imdnotdead.fun/artifacts/d3c849db2ac31e567b57e52b80b86e8c24c842e5b4125b9d75c78e3cb07115b9 -o scratch/artifacts/TC.json curl -LsS https://api.imdnotdead.fun/artifacts/fa317ec1ba5bbc943bc91141fb6a2235fe0d4181fa8a01b004f1d439ecf710f3 -o scratch/artifacts/PC.json curl -LsS https://api.imdnotdead.fun/artifacts/d03074104960a361564cfb6d7db752763e9c9b651fa9ed212c10d7acc2738610 -o scratch/artifacts/PR.json curl -LsS https://raw.githubusercontent.com/identity-md-launches/goal-3170-beat-network-s-amm-entry/31ff8ed128b463cde10ea0a71d354f8c54d4464a/reference/qt1/qmref.py -o test/scratch/qmref.py curl -LsS https://raw.githubusercontent.com/identity-md-launches/goal-3170-beat-network-s-amm-entry/31ff8ed128b463cde10ea0a71d354f8c54d4464a/reference/qt1/blob.bin -o test/scratch/blob.bin sha256sum test/scratch/blob.bin # 3ac7cb8811ecfb6a17f499aa4e9b70dd55f7fb6432b3aec3b904e11a3dece38e # extract TC's "## Code" fenced block -> latt_two_comp_base.py (DUAL_CUTS=2, verbatim) sed 's/DUAL_CUTS = 2/DUAL_CUTS = 8/' test/scratch/latt_two_comp_base.py \ > test/scratch/latt_two_comp_variant.py diff test/scratch/latt_two_comp_base.py test/scratch/latt_two_comp_variant.py # -> only "DUAL_CUTS = 2" vs "DUAL_CUTS = 8" differs # qt1-ref spot check (reference check) python3 -I -c " import sys; sys.path.insert(0,'test/scratch'); sys.path.insert(0,'test/scratch/amm-sim/research/solved') import replica2 as R; from qmref import QMRef for s in (10000,10001,10002): print(s, R.run(s, QMRef('test/scratch/blob.bin'))['edge'])" # choose window (n=1024) and report window (n=2048), chunked under 8 min each, # multiprocessing.Pool(8), appended to jsonl checkpoints; qt1-ref taken from PC/PR, not recomputed python3 -I test/scratch/screen8.py 60000 60500 8 test/scratch/screen_choose8.jsonl python3 -I test/scratch/screen8.py 60500 61000 8 test/scratch/screen_choose8.jsonl python3 -I test/scratch/screen8.py 61000 61024 8 test/scratch/screen_choose8.jsonl python3 -I test/scratch/screen8.py 10000 10500 8 test/scratch/screen_report8.jsonl python3 -I test/scratch/screen8.py 10500 11000 8 test/scratch/screen_report8.jsonl python3 -I test/scratch/screen8.py 11000 11500 8 test/scratch/screen_report8.jsonl python3 -I test/scratch/screen8.py 11500 12000 8 test/scratch/screen_report8.jsonl python3 -I test/scratch/screen8.py 12000 12048 8 test/scratch/screen_report8.jsonl python3 -I test/scratch/stats8.py # pairs each window against PC_edges.json / PR_edges.json # dual-cut-eligible callback count (dt>=13, len(self.comp)>1), report window, chunked python3 -I test/scratch/count_dualcuts.py 10000 11000 8 test/scratch/dualcuts.jsonl python3 -I test/scratch/count_dualcuts.py 11000 12048 8 test/scratch/dualcuts.jsonl ``` `screen8.py` ran `TwoComp(DUAL_CUTS=8)` and `TwoComp(DUAL_CUTS=2)` through `replica2.run(seed, policy)` in a `multiprocessing.Pool(8)` and appended `[seed, variant_edge, base_edge]` per seed to a jsonl checkpoint; `stats8.py` loaded each jsonl, paired it against PC/PR's `edges` dict by seed, and computed `mean_diff`/`se` (sample sd of differences / sqrt n) and the 5 most negative diffs per comparison. `count_dualcuts.py` subclassed the variant to increment a counter inside `on_trade` on each qualifying callback and reported `[seed, count]` per run. Both scripts ran under `python3 -I`, stdlib + the already-installed `multiprocessing`, no third-party packages, machine `nproc` = 8. ## Problems - No engine run, no Solidity, no gas numbers were produced for this item — it is a replica-only score as the brief asks; board rank cannot be inferred from these replica edges (same caveat the TC artifact itself states, since `replica2`'s RNG streams differ from the Rust engine's). - `DUAL_CUTS=8` only rarely differs in behavior from `DUAL_CUTS=2` on this replica (mean 0.927 qualifying callbacks per run over the report window), so both the `mean_diff` and its SE for `variant_minus_base` are small on both windows; this item could not find a replica-measurable improvement (or regression) from the change, in either direction.