fix(semif): 0.1.4 — object states ending in ) ; } no longer 422 (INV-7)

SemIf's shared scorer trims one token at the state boundary. When an object
state's last value ends in ')', ';' or '}', the JSON that follows re-merges two
tokens back, so score_shared refused the request with 422. The engine now wraps
semif_phase1.shared._state_prefix to keep only the tokens the full prompts
share. Each row scores the same token sequence; only the prefill/suffix split
moves.

Startup proves the fix is in effect, not just installed (heid bug hunt SKAL,
folded). It checks that the hook is callable and is what score_shared resolves,
that an ordinary state keeps upstream's whole prefix, and that a merge-prone
state scores through the shared path.

Real tokenizer: 154 states, 23 refused before and 0 after, with no ordinary or
authored144 prefix changed. Acceptance: 144/144 parity. Shared vs direct 71/72;
the miss is a bf16 tie that flipped across a plain restart (see README).
This commit is contained in:
vh
2026-09-27 10:23:14 -07:00
parent 7e11cf247b
commit 47cad33dd1
11 changed files with 384 additions and 20 deletions
@@ -0,0 +1,63 @@
{
"url": "http://10.251.50.54:8032",
"health": {
"status": "ok",
"semif_commit": "23cf1f39fc9534fe81437200959b6dfc7106e45a",
"model": {
"source": "Qwen/Qwen3.5-4B",
"revision": "851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a",
"dtype": "bfloat16",
"device": "cuda:0",
"torch_version": "2.10.0+cu128",
"transformers_version": "5.17.0",
"device_name": "NVIDIA RTX PRO 6000 Blackwell Max-Q Workstation Edition",
"allocated_gib": 7.84,
"reserved_gib": 8.12
},
"vram_cap_gib": 12.0,
"max_tokens": 4096,
"max_decisions": 64,
"workloads": []
},
"1_parity_vs_upstream": {
"rows": 144,
"top_choice_agree": 144,
"max_abs_prob_gap": 0.0595381559570336
},
"1_prompt_sha256_equal": 144,
"2_noise_floor_a_vs_b": {
"rows": 144,
"top_choice_agree": 144,
"max_abs_prob_gap": 0.0
},
"3_negative_rotated_options": {
"rows": 144,
"top_choice_agree": 14,
"max_abs_prob_gap": 0.9987391090270772
},
"4_shared_vs_direct": {
"groups": 36,
"rows": 72,
"top_choice_agree": 71,
"max_abs_prob_gap": 0.05927145076874801
},
"5_speed_21_binary": {
"prefix_tokens": 62,
"shared_s": {
"runs": [
0.13865972400526516,
0.1382300010009203,
0.13749008599552326
],
"median": 0.1382300010009203
},
"sequential_decide_s": {
"runs": [
0.9489945390087087,
0.9463060130074155,
0.9458249929884914
],
"median": 0.9463060130074155
}
}
}