code wiki / _hdl_build / nx_ge_research_h2h.nx

nx_ge_research_h2h.nx source

↩ module page · 166 lines · 9317 B

1// nx_ge_research_h2h.nx -- HONEST researcher head-to-head gate. Replaces the rigged 2// nx_research_exceed_test (which hardcoded the opponent's numbers from an unrelated past run, 3// cherry-picked count-axes, and scored our biggest weakness [no LLM = no semantic synthesis] as a 4// "win" via llm_calls-lower-better). THIS gate: 5// (1) carries QUALITY axes (coverage + SYNTHESIS) on which the mechanical extractor LOSES, so the 6// verdict can honestly say BEHIND; 7// (2) caps the verdict at EXCEEDS-OPS-ONLY when a quality axis is lost (no blanket "S-class exceed"); 8// (3) LIAR-KILLs the old failure mode by construction: a vector that sweeps every OPS axis but loses 9// SYNTHESIS can NEVER return EXCEEDS-FULL (negative control T3). 10// Numbers are filled from REAL runs (sovereign = measured this session; opponent = scored from a REAL 11// Claude deep-research run on the SAME pre-registered question, knowledge/research/ge_headtohead_prereg.md). 12// Axes i64[8]: [0]sources [1]coverage/10 [2]SYNTHESIS/10 [3]adversarial_refutes [4]sovereignty(1/0) 13// [5]reproducible(1/0) [6]llm_calls(LOWER better) [7]persistence(1/0) 14// license_tier: ORIGINAL expect_exit: 0 15import "nx_syscalls.nx" 16 17const H_BELOW: i64 = 0 18const H_PARITY: i64 = 1 19const H_OPS_ONLY: i64 = 2 20const H_FULL: i64 = 3 21 22func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 23func hn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } 24 25// THE HONEST RULE. EXCEEDS-FULL requires team >= opp on BOTH quality axes (coverage AND synthesis) 26// AND a strict win somewhere. A lost quality axis caps at OPS-ONLY. No quality axis can be faked. 27func h2h_verdict(team: *i64, opp: *i64) -> i64 { 28 var q_ge: i64 = 0 29 if team[1] >= opp[1] { if team[2] >= opp[2] { q_ge = 1 } } 30 var q_loss: i64 = 0 31 if team[1] < opp[1] { q_loss = 1 } 32 if team[2] < opp[2] { q_loss = 1 } 33 var wins: i64 = 0 34 var any_loss: i64 = 0 35 var i: i64 = 0 36 while i < 8 { 37 if i == 6 { 38 if team[6] < opp[6] { wins = wins + 1 } 39 if team[6] > opp[6] { any_loss = 1 } 40 } else { 41 if team[i] > opp[i] { wins = wins + 1 } 42 if team[i] < opp[i] { any_loss = 1 } 43 } 44 i = i + 1 45 } 46 var ops_wins: i64 = 0 47 if team[4] > opp[4] { ops_wins = ops_wins + 1 } 48 if team[5] > opp[5] { ops_wins = ops_wins + 1 } 49 if team[7] > opp[7] { ops_wins = ops_wins + 1 } 50 if team[6] < opp[6] { ops_wins = ops_wins + 1 } 51 if q_ge == 1 { if wins >= 1 { return H_FULL } } 52 if q_loss == 1 { if ops_wins >= 1 { return H_OPS_ONLY } } 53 if any_loss == 0 { return H_PARITY } 54 return H_BELOW 55} 56 57func h2h_vname(v: i64) -> i64 { 58 if v == H_FULL { hw("EXCEEDS-FULL (quality+ops)" as *u8) } 59 if v == H_OPS_ONLY{ hw("EXCEEDS-OPS-ONLY / BEHIND-ON-QUALITY" as *u8) } 60 if v == H_PARITY { hw("PARITY" as *u8) } 61 if v == H_BELOW { hw("BELOW" as *u8) } 62 return 0 63} 64 65func h2h_row(label: *u8, t: i64, o: i64) -> i64 { hw(" "); hw(label); hw(" team="); hn(t); hw(" claude="); hn(o); hw("\n"); return 0 } 66 67func h2h_board(team: *i64, opp: *i64) -> i64 { 68 hw("=== HONEST HEAD-TO-HEAD (Nishi sovereign researcher vs Claude deep-research, SAME question) ===\n") 69 h2h_row("sources_cited " as *u8, team[0], opp[0]) 70 h2h_row("rubric_coverage /10 " as *u8, team[1], opp[1]) 71 h2h_row("rubric_SYNTHESIS /10" as *u8, team[2], opp[2]) 72 h2h_row("adversarial_refutes " as *u8, team[3], opp[3]) 73 h2h_row("sovereignty (1/0) " as *u8, team[4], opp[4]) 74 h2h_row("reproducible (1/0) " as *u8, team[5], opp[5]) 75 h2h_row("llm_calls (LOWER+) " as *u8, team[6], opp[6]) 76 h2h_row("persistence (1/0) " as *u8, team[7], opp[7]) 77 hw(" VERDICT: "); h2h_vname(h2h_verdict(team, opp)); hw("\n") 78 return 0 79} 80 81func setv(v: *i64, a: i64, b: i64, c: i64, d: i64, e: i64, f: i64, g: i64, h: i64) -> i64 { 82 v[0]=a; v[1]=b; v[2]=c; v[3]=d; v[4]=e; v[5]=f; v[6]=g; v[7]=h; return 0 83} 84 85func main() -> i64 { 86 var pass: i64 = 0 87 var total: i64 = 0 88 89 // ---- RULE-HONESTY TESTS (independent of any real data; prove the verdict can't be gamed) ---- 90 let opp: *i64 = sys_mmap(64) as *i64 91 // representative strong opponent (deep-research): few-but-synthesized 92 setv(opp, 15, 9, 9, 3, 0, 0, 80, 0) 93 94 // T1: a team that matches/beats on quality AND wins an ops axis -> EXCEEDS-FULL (it CAN say exceed when earned) 95 total=total+1 96 let t1: *i64 = sys_mmap(64) as *i64 97 setv(t1, 20, 9, 9, 3, 1, 1, 0, 1) // quality tied, sweeps ops -> FULL 98 if h2h_verdict(t1, opp) == H_FULL { pass=pass+1 } else { hw("T1 FAIL want FULL got "); hn(h2h_verdict(t1,opp)); hw("\n") } 99 100 // T2: quality LOST (synthesis 0 < 9) but ops won -> OPS-ONLY (the honest split, NOT full) 101 total=total+1 102 let t2: *i64 = sys_mmap(64) as *i64 103 setv(t2, 33, 10, 0, 0, 1, 1, 0, 1) // our REALISTIC profile: high coverage, ZERO synthesis 104 if h2h_verdict(t2, opp) == H_OPS_ONLY { pass=pass+1 } else { hw("T2 FAIL want OPS-ONLY got "); hn(h2h_verdict(t2,opp)); hw("\n") } 105 106 // T3 (NEGATIVE CONTROL / LIAR-KILL): a vector engineered to sweep EVERY ops axis + sources but with 107 // SYNTHESIS=0 must be INCAPABLE of EXCEEDS-FULL. This is the exact rig the old gate fell for. 108 total=total+1 109 let t3: *i64 = sys_mmap(64) as *i64 110 setv(t3, 999, 0, 0, 0, 1, 1, 0, 1) // sweeps ops, sources huge, but quality floored 111 if h2h_verdict(t3, opp) != H_FULL { pass=pass+1 } else { hw("T3 FAIL liar-kill BREACHED (returned FULL on faked quality)\n") } 112 113 // T4: identical metrics -> PARITY (no win => no exceed) 114 total=total+1 115 let t4: *i64 = sys_mmap(64) as *i64 116 setv(t4, 15, 9, 9, 3, 0, 0, 80, 0) 117 if h2h_verdict(t4, opp) == H_PARITY { pass=pass+1 } else { hw("T4 FAIL want PARITY got "); hn(h2h_verdict(t4,opp)); hw("\n") } 118 119 // T5: strictly worse everywhere -> BELOW 120 total=total+1 121 let t5: *i64 = sys_mmap(64) as *i64 122 setv(t5, 5, 3, 1, 0, 0, 0, 90, 0) 123 if h2h_verdict(t5, opp) == H_BELOW { pass=pass+1 } else { hw("T5 FAIL want BELOW got "); hn(h2h_verdict(t5,opp)); hw("\n") } 124 125 hw("RULE-HONESTY "); hn(pass); hw("/"); hn(total); hw("\n") 126 127 // ---- LIVE SCOREBOARD ---- 128 // SOVEREIGN side = REAL, measured this session (verifiable): 33 fetched (~12 relevant to this Q), 129 // coverage 10/10 retrievable, SYNTHESIS 0 (mechanical extractor surfaces sentences not arguments), 130 // 0 adversarial refutes, sovereign(nx_cc->nxasm,own TLS)=1, reproducible(idempotent)=1, llm_calls=0, 131 // persisted to Library=1. 132 // UPDATED with REAL measured numbers from nx_ge_synth (sovereign extractive-synthesis organ over the 133 // 14-file rendering corpus): covered=9, corroborated=7, EXPLAINED(extractive synthesis)=5 (UP from 0), 134 // contested/adversarial=0 (corpus had NO contrarian sources to contradict; deep-research ran a dedicated 135 // contrarian angle -> 9 refutes). Honest: extractive 5 is still < reasoned 7; reasoning+caveats = LLM-bound. 136 // OPPONENT BASELINE: Claude deep-research, REAL run on the SAME pre-registered question (workflow 137 // wf_4da99785-aaf): sourcesFetched=24, agentCalls=107, 9 claims KILLED (adversarial). Rubric-scored 138 // from its report: coverage=8, SYNTHESIS=7, adversarial=9. sovereignty=0/reproducible=0 (3rd-party, 139 // stochastic), persistence=0 (web sources link-rot). NOT hardcoded recall -- this session's real run. 140 // coverage/synthesis/adversarial = INDEPENDENT JUDGE scores (referee, no self-grade): A=7/8/9. 141 let claude: *i64 = sys_mmap(64) as *i64 142 setv(claude, 24, 7, 8, 9, 0, 0, 107, 0) 143 144 // PROFILE 1 -- SOVEREIGN-ONLY (mechanical): measured by nx_ge_synth v2 over the rendering corpus 145 // (covered=8, EXPLAINED=4, CONTESTED=1). Pure sovereign (nx_cc->nxasm, 0 LLM). The honest ceiling. 146 let team_sov: *i64 = sys_mmap(64) as *i64 147 setv(team_sov, 18, 8, 4, 1, 1, 1, 0, 1) 148 hw("\n[PROFILE 1] SOVEREIGN-ONLY (mechanical extract + contradiction; 0 LLM):\n") 149 h2h_board(team_sov, claude) 150 151 // PROFILE 2 -- PARTNERSHIP (sovereign substrate + ONE LLM synth call, ~167k tok vs deep-research's 152 // 4.08M / 107 agents). coverage/SYNTHESIS/adversarial = filled from the INDEPENDENT JUDGE (referee, 153 // no self-grade). sovereignty=0 + reproducible=0 (synth step uses an LLM -> sovereign-LLM = the named 154 // destination), llm_calls=1, persistence=1 (corpus saved). Fill the 3 judged numbers then rerun. 155 // INDEPENDENT JUDGE scores B(partnership)=coverage 9 / synthesis 9 / adversarial 8. llm_calls=1 156 // (~167k tok) vs deep-research 107 agents (~4.08M tok). sovereignty/reproducible=0 (LLM synth step). 157 let team_pp: *i64 = sys_mmap(64) as *i64 158 setv(team_pp, 18, 9, 9, 8, 0, 0, 1, 1) 159 hw("\n[PROFILE 2] PARTNERSHIP (sovereign substrate + 1 LLM synth call):\n") 160 if team_pp[1] > 0 { h2h_board(team_pp, claude) } 161 else { hw(" pending INDEPENDENT JUDGE scores (coverage/synthesis/adversarial) -- fill + rerun\n") } 162 163 if pass == total { hw("GE-H2H RULE ALL-PASS\n"); sys_exit(0) } 164 sys_exit(1) 165 return 1 166}