From 5eeac4df8814a2ca207bca6fb09e883235968476 Mon Sep 17 00:00:00 2001 From: Sonic Shih Date: Tue, 28 Jul 2026 15:18:08 +0800 Subject: [PATCH] fix(research): preserve checkpoint float identity --- .../research_missions/polymarket-btc-5m.example.json | 2 +- .../research_missions/polymarket-sol-5m.example.json | 2 +- .../prediction-markets/crates/ploy-research/Cargo.toml | 2 +- .../prediction-policy-dependencies.linux.sha256 | 2 +- .../prediction-policy-dependencies.linux.txt | 4 ++-- .../crates/ploy-research/src/prediction_mcts_run.rs | 10 ++++++++-- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json b/rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json index 8c2b6c2b6..507a061b1 100644 --- a/rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json +++ b/rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json @@ -15,7 +15,7 @@ "horizon": "5m", "time_cohort_boundary_ms": 0, "prompt_snapshot_id": "sha256:2b55ba0e724dfc9f5a040911e397058a09c6229e42064e4998739d617b368dcb", - "search_policy_snapshot_id": "sha256:76d4afe04854587a2883f06cdcf8a67563853f320630eafb700ef794b5ef9c33", + "search_policy_snapshot_id": "sha256:7f7843c1345dce4c722e1ca1a93e99b134ae15197a77de8c38a99ba22eacc5a5", "search_budget": { "max_candidates": 6, "max_llm_calls": 2, diff --git a/rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json b/rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json index 4e8f608d2..4ab02ff49 100644 --- a/rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json +++ b/rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json @@ -15,7 +15,7 @@ "horizon": "5m", "time_cohort_boundary_ms": 0, "prompt_snapshot_id": "sha256:0816ebccf4c75ee6bdcfe315b253c84ddf1808a38687ebe3b924b87bd72a52a9", - "search_policy_snapshot_id": "sha256:76d4afe04854587a2883f06cdcf8a67563853f320630eafb700ef794b5ef9c33", + "search_policy_snapshot_id": "sha256:7f7843c1345dce4c722e1ca1a93e99b134ae15197a77de8c38a99ba22eacc5a5", "search_budget": { "max_candidates": 6, "max_llm_calls": 2, diff --git a/rust_hft/prediction-markets/crates/ploy-research/Cargo.toml b/rust_hft/prediction-markets/crates/ploy-research/Cargo.toml index cb2b26283..d13eef2f2 100644 --- a/rust_hft/prediction-markets/crates/ploy-research/Cargo.toml +++ b/rust_hft/prediction-markets/crates/ploy-research/Cargo.toml @@ -32,7 +32,7 @@ ploy-strategy-bundles = { workspace = true, optional = true } ploy-trading = { workspace = true, optional = true } rust_decimal.workspace = true serde.workspace = true -serde_json.workspace = true +serde_json = { workspace = true, features = ["float_roundtrip"] } sha2.workspace = true sqlx = { workspace = true, optional = true } tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } diff --git a/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.sha256 b/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.sha256 index e26c31943..a5cf720e5 100644 --- a/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.sha256 +++ b/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.sha256 @@ -1 +1 @@ -sha256:718c9dc75ac117ae58698c04f3a39c004a0da5c6755f55cc7b2a2652b58cc6ce +sha256:3a34b6921bca1f258953c5c2690e3ecab4e13b9d0cf8956b9b0a71b07f9aff3a diff --git a/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.txt b/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.txt index 5714da8f9..06b1eb54d 100644 --- a/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.txt +++ b/rust_hft/prediction-markets/crates/ploy-research/prediction-policy-dependencies.linux.txt @@ -3,7 +3,7 @@ target=x86_64-unknown-linux-gnu profile=default,db input:Cargo.lock=sha256:c3346b8cd700b030d8f9a106ad7c3b6a8e776b8cdaf8d7aaa10f57b9d83b95ad input:Cargo.toml=sha256:fbcd5c33c246ade9700e461e9fd62c1f56f3af262ac67d8206a29b4d0bf626f9 -input:crates/ploy-research/Cargo.toml=sha256:0962c6b853e0929ab0fd0c009e03067d235526536559d279817dfa94ac6f4fe6 +input:crates/ploy-research/Cargo.toml=sha256:6ca7b4b9068c6eee63e2d766399b7d79b9b0d300391149eb43b0905c8adfa957 input:crates/ploy-feed-loaders/Cargo.toml=sha256:abf8f1b8adec93b1ad84a66294cb58eb65f9cbca33c701cc81c7635eb9b35e2c input:crates/ploy-market-contracts/Cargo.toml=sha256:e086ddc8f162ff0abcabe832b1b61549f0daf7e98a78ab96f5512c596c3dc7f0 input:crates/ploy-market-data/Cargo.toml=sha256:4f3c213c3d8283de4672b7c2de6f9c9c30d12db11bb8460495f5ebf09225b2bd @@ -135,7 +135,7 @@ package:ryu@1.0.23|source=registry+https://github.com/rust-lang/crates.io-index| package:scopeguard@1.2.0|source=registry+https://github.com/rust-lang/crates.io-index|checksum=94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49|features= package:serde@1.0.228|source=registry+https://github.com/rust-lang/crates.io-index|checksum=9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e|features=alloc,default,derive,rc,serde_derive,std package:serde_core@1.0.228|source=registry+https://github.com/rust-lang/crates.io-index|checksum=41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad|features=alloc,rc,result,std -package:serde_json@1.0.150|source=registry+https://github.com/rust-lang/crates.io-index|checksum=e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9|features=arbitrary_precision,default,raw_value,std +package:serde_json@1.0.150|source=registry+https://github.com/rust-lang/crates.io-index|checksum=e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9|features=arbitrary_precision,default,float_roundtrip,raw_value,std package:serde_urlencoded@0.7.1|source=registry+https://github.com/rust-lang/crates.io-index|checksum=d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd|features= package:sha1@0.10.7|source=registry+https://github.com/rust-lang/crates.io-index|checksum=a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8|features=default,std package:sha2@0.10.9|source=registry+https://github.com/rust-lang/crates.io-index|checksum=a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283|features=default,std diff --git a/rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts_run.rs b/rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts_run.rs index 30deabae6..c5684403c 100644 --- a/rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts_run.rs +++ b/rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts_run.rs @@ -983,8 +983,8 @@ mod tests { probability_blend_sha256: candidate.probability_blend_sha256.clone(), training_cohort_id: "train-before-boundary".to_string(), event_count: 12, - mean_brier_score: 0.2, - mean_log_loss: 0.3, + mean_brier_score: 0.5492666666666667, + mean_log_loss: 1.359634792578074, }, ), }) @@ -1551,6 +1551,12 @@ mod tests { #[test] fn selection_evidence_binds_the_current_checkpoint_and_selected_candidate() { + let checkpoint_reward: f64 = -(0.5492666666666667 + 1.359634792578074); + assert_eq!(checkpoint_reward, -1.9089014592447406); + let roundtripped: f64 = + serde_json::from_slice(&serde_json::to_vec(&checkpoint_reward).unwrap()).unwrap(); + assert_eq!(roundtripped.to_bits(), checkpoint_reward.to_bits()); + let output = temp_dir("selection-evidence-digests"); let configured = mission(1, 1); let identity = PredictionMctsIdentity::from_mission(&configured).unwrap();