From ab952b47e778dae4f19acfe04c0dd696e25b7824 Mon Sep 17 00:00:00 2001 From: Gahow Wang Date: Fri, 24 Jul 2026 00:11:48 +0800 Subject: [PATCH] Make synthetic trace block identities parent-sensitive --- runs/frontier-code-trace-v0/experiment-card.md | 5 +++++ runs/frontier-s3-real-v0/remap_hash_blocks.py | 15 +++++++++++---- .../test_remap_hash_blocks.py | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/runs/frontier-code-trace-v0/experiment-card.md b/runs/frontier-code-trace-v0/experiment-card.md index cb0047d..cac30cd 100644 --- a/runs/frontier-code-trace-v0/experiment-card.md +++ b/runs/frontier-code-trace-v0/experiment-card.md @@ -228,6 +228,11 @@ mode-specific: - source 无 Qwen-aligned prompt/token IDs。raw canonical prompt 使用 GLM token contract,不能同时保持 Qwen token content 与 trace ISL;本 campaign 采用 synthetic Qwen tokens 保持 length/hash/prefix shape,并降级内容 claim。 +- selected rho=0.0032 中有 1355 个可检查 parent links:tail rewrite + p50/p90/p95/p99/max=1/1/4/57/169 个 source blocks,说明 coder + `parent_chat_id` 不等价于 append-only prompt。source hash 序列作为 prefix + truth;synthetic content block 生成后再计算 parent-sensitive runtime + identities,避免“相同内容块出现在不同前缀后”造成 Frontier false hit。 - 远端 Qwen3-30B `config.json` 的原生 position limit 是 40960 (`rope_theta=1e6`,无 rope_scaling)。147456 profile smoke 在显式 `VLLM_ALLOW_LONG_MAX_MODEL_LEN=1` 下成功;该 override 只支持 diff --git a/runs/frontier-s3-real-v0/remap_hash_blocks.py b/runs/frontier-s3-real-v0/remap_hash_blocks.py index c07834d..83c7664 100644 --- a/runs/frontier-s3-real-v0/remap_hash_blocks.py +++ b/runs/frontier-s3-real-v0/remap_hash_blocks.py @@ -257,17 +257,22 @@ def materialize(args: argparse.Namespace, *, tokenizer: Any | None = None) -> di prompt_kind = "real_tokens" real_prompt_requests += 1 else: - block_ids = expand_hash_ids( + content_block_ids = expand_hash_ids( original_hashes, isl, source_block_size=source_block_size, ) request_prompt = synthetic_tokens( - block_ids, + content_block_ids, isl, vocab_size=args.vocab_size, token_offset=args.token_offset, ) + records = token_block_identity_records(request_prompt) + block_ids = [identity for identity, _ in records] + for runtime_id, witness in records: + previous = identity_to_witness.setdefault(runtime_id, witness) + identity_collisions += int(previous != witness) prompt_kind = "synthetic_missing_prompt_fallback" synthetic_fallback_requests += 1 parent = row.get("parent_chat_id") @@ -417,8 +422,9 @@ def materialize(args: argparse.Namespace, *, tokenizer: Any | None = None) -> di "workload_mode": workload_mode, "mapping": ( "real prompt tokens: BLAKE2b-128(parent runtime identity, exact 16-token block); " - "missing prompt fallback: expanded_id = zigzag(source_hash) * " - "subblocks_per_source + subblock_index" + "missing prompt fallback: source hashes first define deterministic 16-token " + "content blocks, then the same parent-sensitive BLAKE2b-128 runtime identity " + "contract is applied" ), "prompt_contract": { "real_prompt_requests": real_prompt_requests, @@ -455,6 +461,7 @@ def materialize(args: argparse.Namespace, *, tokenizer: Any | None = None) -> di "encoding": "injective base-(vocab_size-token_offset), 16 little-endian digits", "same_16_block_hash_same_tokens": True, "different_16_block_hash_different_tokens": True, + "runtime_identity_is_parent_sensitive": True, }, "parent_validation": { "enabled": args.validate_parents, diff --git a/runs/frontier-s3-real-v0/test_remap_hash_blocks.py b/runs/frontier-s3-real-v0/test_remap_hash_blocks.py index 03c48e3..cf484bc 100644 --- a/runs/frontier-s3-real-v0/test_remap_hash_blocks.py +++ b/runs/frontier-s3-real-v0/test_remap_hash_blocks.py @@ -59,6 +59,24 @@ class StrictRemapTest(unittest.TestCase): token_blocks_b = [tuple(token_block(value, vocab_size=151936)) for value in request_b] self.assertEqual(common_prefix_length(token_blocks_a, token_blocks_b), remapped_hits) self.assertEqual(len(set(token_blocks_a)), len(set(request_a))) + runtime_a = token_block_identities( + synthetic_tokens(request_a, 180, vocab_size=151936) + ) + runtime_b = token_block_identities( + synthetic_tokens(request_b, 190, vocab_size=151936) + ) + self.assertEqual(common_prefix_length(runtime_a, runtime_b), remapped_hits) + + def test_synthetic_runtime_identity_depends_on_parent_prefix(self) -> None: + left_content = expand_hash_ids([11, 22], 128) + right_content = expand_hash_ids([33, 22], 128) + left = token_block_identities( + synthetic_tokens(left_content, 128, vocab_size=151936) + ) + right = token_block_identities( + synthetic_tokens(right_content, 128, vocab_size=151936) + ) + self.assertNotEqual(left[4], right[4]) def test_mapping_rejects_non_strict_source_block_count(self) -> None: with self.assertRaisesRegex(ValueError, "strict 64-block contract"):