Make synthetic trace block identities parent-sensitive

This commit is contained in:
2026-07-24 00:11:48 +08:00
parent 029c8991b6
commit ab952b47e7
3 changed files with 34 additions and 4 deletions

View File

@@ -228,6 +228,11 @@ mode-specific
- source 无 Qwen-aligned prompt/token IDs。raw canonical prompt 使用 GLM - source 无 Qwen-aligned prompt/token IDs。raw canonical prompt 使用 GLM
token contract不能同时保持 Qwen token content 与 trace ISL本 campaign token contract不能同时保持 Qwen token content 与 trace ISL本 campaign
采用 synthetic Qwen tokens 保持 length/hash/prefix shape并降级内容 claim。 采用 synthetic Qwen tokens 保持 length/hash/prefix shape并降级内容 claim。
- selected rho=0.0032 中有 1355 个可检查 parent linkstail rewrite
p50/p90/p95/p99/max=1/1/4/57/169 个 source blocks说明 coder
`parent_chat_id` 不等价于 append-only prompt。source hash 序列作为 prefix
truthsynthetic content block 生成后再计算 parent-sensitive runtime
identities避免“相同内容块出现在不同前缀后”造成 Frontier false hit。
- 远端 Qwen3-30B `config.json` 的原生 position limit 是 40960 - 远端 Qwen3-30B `config.json` 的原生 position limit 是 40960
(`rope_theta=1e6`,无 rope_scaling)。147456 profile smoke 在显式 (`rope_theta=1e6`,无 rope_scaling)。147456 profile smoke 在显式
`VLLM_ALLOW_LONG_MAX_MODEL_LEN=1` 下成功;该 override 只支持 `VLLM_ALLOW_LONG_MAX_MODEL_LEN=1` 下成功;该 override 只支持

View File

@@ -257,17 +257,22 @@ def materialize(args: argparse.Namespace, *, tokenizer: Any | None = None) -> di
prompt_kind = "real_tokens" prompt_kind = "real_tokens"
real_prompt_requests += 1 real_prompt_requests += 1
else: else:
block_ids = expand_hash_ids( content_block_ids = expand_hash_ids(
original_hashes, original_hashes,
isl, isl,
source_block_size=source_block_size, source_block_size=source_block_size,
) )
request_prompt = synthetic_tokens( request_prompt = synthetic_tokens(
block_ids, content_block_ids,
isl, isl,
vocab_size=args.vocab_size, vocab_size=args.vocab_size,
token_offset=args.token_offset, 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" prompt_kind = "synthetic_missing_prompt_fallback"
synthetic_fallback_requests += 1 synthetic_fallback_requests += 1
parent = row.get("parent_chat_id") parent = row.get("parent_chat_id")
@@ -417,8 +422,9 @@ def materialize(args: argparse.Namespace, *, tokenizer: Any | None = None) -> di
"workload_mode": workload_mode, "workload_mode": workload_mode,
"mapping": ( "mapping": (
"real prompt tokens: BLAKE2b-128(parent runtime identity, exact 16-token block); " "real prompt tokens: BLAKE2b-128(parent runtime identity, exact 16-token block); "
"missing prompt fallback: expanded_id = zigzag(source_hash) * " "missing prompt fallback: source hashes first define deterministic 16-token "
"subblocks_per_source + subblock_index" "content blocks, then the same parent-sensitive BLAKE2b-128 runtime identity "
"contract is applied"
), ),
"prompt_contract": { "prompt_contract": {
"real_prompt_requests": real_prompt_requests, "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", "encoding": "injective base-(vocab_size-token_offset), 16 little-endian digits",
"same_16_block_hash_same_tokens": True, "same_16_block_hash_same_tokens": True,
"different_16_block_hash_different_tokens": True, "different_16_block_hash_different_tokens": True,
"runtime_identity_is_parent_sensitive": True,
}, },
"parent_validation": { "parent_validation": {
"enabled": args.validate_parents, "enabled": args.validate_parents,

View File

@@ -59,6 +59,24 @@ class StrictRemapTest(unittest.TestCase):
token_blocks_b = [tuple(token_block(value, vocab_size=151936)) for value in request_b] 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(common_prefix_length(token_blocks_a, token_blocks_b), remapped_hits)
self.assertEqual(len(set(token_blocks_a)), len(set(request_a))) 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: def test_mapping_rejects_non_strict_source_block_count(self) -> None:
with self.assertRaisesRegex(ValueError, "strict 64-block contract"): with self.assertRaisesRegex(ValueError, "strict 64-block contract"):