{ "format": "BitState/HSDR correctness vectors v3 — direct 8-phase + histogram equivalence", "lns8": { "base_code": 74, "codes_per_octave": 8, "zero_code": 0, "magnitude_formula": "2^((code-74)/8)", "sign_encoding": "separate +/-1" }, "q9_6_rounding": "round half away from zero after multiplying by 64", "histogram_reconstruction": "R[p]=sum_o H[p][o]*2^o; S=scale*2^-9*sum_p R[p]*2^((p-2)/8)", "cases": [ { "name": "all_unity_positive", "K": 128, "scale": 1.0, "notes": "All activations are +1.0, all ternary weights +1. Expected sum 128.", "activation_codes": [ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74 ], "activation_signs": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "ternary_weights": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "expected_direct_fp64": 128.0, "expected_histogram_fp64": 128.0, "expected_abs_difference": 0.0, "expected_q9_6_raw_lround": 8192, "expected_q9_6_value_lround": 128.0, "phase_integer_reduction_R": [ 0, 0, 65536, 0, 0, 0, 0, 0 ], "state_domain_v2": { "nonzero_signed_state_buckets": 1, "balanced_global_tree_depth_upper_bound": 0, "population_buckets": [ { "code": 74, "phase": 2, "band": 9, "signed_count": 128, "sign": 1, "population_log_offset_code_units": 56.0, "fractional_lns_code": 130.0 } ], "phase_fractional_lns_reference": [ { "phase": 0, "sign": 0, "fractional_lns_code_unscaled": null }, { "phase": 1, "sign": 0, "fractional_lns_code_unscaled": null }, { "phase": 2, "sign": 1, "fractional_lns_code_unscaled": 130.0 }, { "phase": 3, "sign": 0, "fractional_lns_code_unscaled": null }, { "phase": 4, "sign": 0, "fractional_lns_code_unscaled": null }, { "phase": 5, "sign": 0, "fractional_lns_code_unscaled": null }, { "phase": 6, "sign": 0, "fractional_lns_code_unscaled": null }, { "phase": 7, "sign": 0, "fractional_lns_code_unscaled": null } ], "expected_final_sign": 1, "expected_final_fractional_lns_code": 130.0, "expected_nearest_lns8_magnitude_code": 127, "note": "fractional_lns_code fields are correctness references from exact math; runtime candidate uses count-log and kappa LUTs without linear materialization" }, "expected_direct_8phase_accumulators": [ 0, 0, 65536, 0, 0, 0, 0, 0 ], "direct_8phase_note": "Same 8 integers as histogram sum_o H[phase][o]< dyadic integer shift/add -> wide fixed/Q9.6 optional", "pure_lns_path": "signed state histogram -> count-to-log fold -> fractional-LNS balanced add/sub -> scale log offset -> LNS8", "population_fold": "lambda_bucket = code + 8*log2(abs(signed_count)); sign = sign(signed_count)", "same_sign_add": "out=max(a,b)+8*log2(1+2^(-abs(a-b)/8))", "opposite_sign_add": "out=max(a,b)+8*log2(1-2^(-abs(a-b)/8)); equal magnitudes cancel to zero", "anchor_identity": "code = (120 + phase) + 8*(band - 15); code122 is exact 64", "final_phase_tree": "8 -> 4 -> 2 -> 1 balanced reduction" }, "direct_8phase_reduction": { "excel_reference": "LNS8_base74_8step_zone8_popcount_demo_JA_v0.8_bitslice128_validation.xlsx", "product_layout": "S1|E4|L3", "formula": "A[L3] += sign * (1 << E4)", "final_formula": "S=scale*2^-9*sum_p A[p]*2^((p-2)/8)", "correctness_invariant": "direct decoded sum == direct A[0..7] reconstruction == histogram-derived A[0..7] reconstruction", "note": "phase masks are intermediate routing selectors; POPCOUNT is optional for the direct dyadic path" } }